Internal changes

This commit is contained in:
clamsawd 2015-11-01 12:56:13 +01:00
parent 0b53361e61
commit a9c9018635
3 changed files with 29 additions and 47 deletions

View File

@ -5,7 +5,7 @@
# ip2e (IP to email) - Create the configuration file. | # ip2e (IP to email) - Create the configuration file. |
# Created by clamsawd (clamsawd@openmailbox.org) | # Created by clamsawd (clamsawd@openmailbox.org) |
# Licensed by GPL v.3 | # Licensed by GPL v.3 |
# Last update: 31-10-2015 | # Last update: 01-11-2015 |
# | # |
# Compatible with Python 3.x | # Compatible with Python 3.x |
# -------------------------------------------------------------- # --------------------------------------------------------------
@ -47,6 +47,7 @@ if not os.path.exists(".ip2e"):
if os.path.exists(".ip2e"): if os.path.exists(".ip2e"):
os.chdir(".ip2e") os.chdir(".ip2e")
#Set variables of 'ip2e-conf.py'
ClearScreen() ClearScreen()
print ("") print ("")
print ("ip2e-config v"+version+" - Create config.file") print ("ip2e-config v"+version+" - Create config.file")
@ -58,23 +59,18 @@ SmtpFromEmail=input("Type the server STMP of email sender: ")
ToEmail=input("Type the email receiver: ") ToEmail=input("Type the email receiver: ")
#Create 'ip2e-conf.py' #Create 'ip2e-conf.py'
def createip2ecf():
ip2ecf=open('ip2e-conf.py','w')
ip2ecf.close()
def writeip2ecf():
ip2ecf=open('ip2e-conf.py','a')
ip2ecf.write('# sample configuration file of ip2e\n')
ip2ecf.write('\n')
ip2ecf.write('FromEmail="'+FromEmail+'"\n')
ip2ecf.write('FromEmailUser="'+FromEmailUser+'"\n')
ip2ecf.write('FromEmailPass="'+FromEmailPass+'"\n')
ip2ecf.write('SmtpFromEmail="'+SmtpFromEmail+'"\n')
ip2ecf.write('ToEmail="'+ToEmail+'"\n')
ip2ecf.close()
os.remove("ip2e-conf.py") os.remove("ip2e-conf.py")
createip2ecf() ip2ecf=open('ip2e-conf.py','w')
writeip2ecf() ip2ecf.close()
ip2ecf=open('ip2e-conf.py','a')
ip2ecf.write('# sample configuration file of ip2e\n')
ip2ecf.write('\n')
ip2ecf.write('FromEmail="'+FromEmail+'"\n')
ip2ecf.write('FromEmailUser="'+FromEmailUser+'"\n')
ip2ecf.write('FromEmailPass="'+FromEmailPass+'"\n')
ip2ecf.write('SmtpFromEmail="'+SmtpFromEmail+'"\n')
ip2ecf.write('ToEmail="'+ToEmail+'"\n')
ip2ecf.close()
#Show the configuration #Show the configuration
ClearScreen() ClearScreen()

View File

@ -5,7 +5,7 @@
# ip2e (IP to email) - Run ip2e daemon. | # ip2e (IP to email) - Run ip2e daemon. |
# Created by clamsawd (clamsawd@openmailbox.org) | # Created by clamsawd (clamsawd@openmailbox.org) |
# Licensed by GPL v.3 | # Licensed by GPL v.3 |
# Last update: 31-10-2015 | # Last update: 01-11-2015 |
# | # |
# Compatible with Python 3.x | # Compatible with Python 3.x |
# -------------------------------------------------------------- # --------------------------------------------------------------
@ -52,10 +52,12 @@ if os.path.exists(".ip2e"):
os.chdir(".ip2e") os.chdir(".ip2e")
#Check if exists 'ip2e-conf.py' #Check if exists 'ip2e-conf.py'
def createip2ecf(): if os.path.isfile("ip2e-conf.py"):
print ("ip2e-conf.py exists")
else:
print ("ip2e-conf.py created")
ip2ecf=open('ip2e-conf.py','w') ip2ecf=open('ip2e-conf.py','w')
ip2ecf.close() ip2ecf.close()
def writeip2ecf():
ip2ecf=open('ip2e-conf.py','a') ip2ecf=open('ip2e-conf.py','a')
ip2ecf.write('# sample configuration file of ip2e\n') ip2ecf.write('# sample configuration file of ip2e\n')
ip2ecf.write('\n') ip2ecf.write('\n')
@ -66,28 +68,16 @@ def writeip2ecf():
ip2ecf.write('ToEmail="unknown@email.com"\n') ip2ecf.write('ToEmail="unknown@email.com"\n')
ip2ecf.close() ip2ecf.close()
if os.path.isfile("ip2e-conf.py"):
print ("ip2e-conf.py exists")
else:
print ("ip2e-conf.py created")
createip2ecf()
writeip2ecf()
#Check if exists 'current-ip.py' #Check if exists 'current-ip.py'
def createip2eIPcf():
ip2eIPcf=open('current-ip.py','w')
ip2eIPcf.close()
def writeip2eIPcf():
ip2eIPcf=open('current-ip.py','a')
ip2eIPcf.write('CurrentIP="0.0.0.0"\n')
ip2eIPcf.close()
if os.path.isfile("current-ip.py"): if os.path.isfile("current-ip.py"):
print ("current-ip.py exists") print ("current-ip.py exists")
else: else:
print ("current-ip.py created") print ("current-ip.py created")
createip2eIPcf() ip2eIPcf=open('current-ip.py','w')
writeip2eIPcf() ip2eIPcf.close()
ip2eIPcf=open('current-ip.py','a')
ip2eIPcf.write('CurrentIP="0.0.0.0"\n')
ip2eIPcf.close()
#Import variables from ip2e-conf.py #Import variables from ip2e-conf.py
exec(open("ip2e-conf.py").read()) exec(open("ip2e-conf.py").read())
@ -114,6 +104,7 @@ try:
os.system("color 6") os.system("color 6")
except: except:
print ("Error importing native color scheme") print ("Error importing native color scheme")
exit(1)
#Check if exists a previous log.file. #Check if exists a previous log.file.
if os.path.isfile("ip2e.log"): if os.path.isfile("ip2e.log"):

View File

@ -5,7 +5,7 @@
# ip2e (IP to email) - See the log file. | # ip2e (IP to email) - See the log file. |
# Created by clamsawd (clamsawd@openmailbox.org) | # Created by clamsawd (clamsawd@openmailbox.org) |
# Licensed by GPL v.3 | # Licensed by GPL v.3 |
# Last update: 31-10-2015 | # Last update: 01-11-2015 |
# | # |
# Compatible with Python 3.x | # Compatible with Python 3.x |
# -------------------------------------------------------------- # --------------------------------------------------------------
@ -48,10 +48,12 @@ if os.path.exists(".ip2e"):
os.chdir(".ip2e") os.chdir(".ip2e")
#Check if exists 'ip2e-conf.py' #Check if exists 'ip2e-conf.py'
def createip2ecf(): if os.path.isfile("ip2e-conf.py"):
print ("ip2e-conf.py exists")
else:
print ("ip2e-conf.py created")
ip2ecf=open('ip2e-conf.py','w') ip2ecf=open('ip2e-conf.py','w')
ip2ecf.close() ip2ecf.close()
def writeip2ecf():
ip2ecf=open('ip2e-conf.py','a') ip2ecf=open('ip2e-conf.py','a')
ip2ecf.write('# sample configuration file of ip2e\n') ip2ecf.write('# sample configuration file of ip2e\n')
ip2ecf.write('\n') ip2ecf.write('\n')
@ -62,13 +64,6 @@ def writeip2ecf():
ip2ecf.write('ToEmail="unknown@email.com"\n') ip2ecf.write('ToEmail="unknown@email.com"\n')
ip2ecf.close() ip2ecf.close()
if os.path.isfile("ip2e-conf.py"):
print ("ip2e-conf.py exists")
else:
print ("ip2e-conf.py created")
createip2ecf()
writeip2ecf()
#See the log file #See the log file
if os.path.isfile("ip2e.log"): if os.path.isfile("ip2e.log"):
print ("ip2e.log exists") print ("ip2e.log exists")