diff --git a/ip2e-config.py b/ip2e-config.py index e5afa47..dd2ab2e 100755 --- a/ip2e-config.py +++ b/ip2e-config.py @@ -5,7 +5,7 @@ # ip2e (IP to email) - Create the configuration file. | # Created by clamsawd (clamsawd@openmailbox.org) | # Licensed by GPL v.3 | -# Last update: 31-10-2015 | +# Last update: 01-11-2015 | # | # Compatible with Python 3.x | # -------------------------------------------------------------- @@ -47,6 +47,7 @@ if not os.path.exists(".ip2e"): if os.path.exists(".ip2e"): os.chdir(".ip2e") +#Set variables of 'ip2e-conf.py' ClearScreen() print ("") 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: ") #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") -createip2ecf() -writeip2ecf() +ip2ecf=open('ip2e-conf.py','w') +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 ClearScreen() diff --git a/ip2e-daemon.py b/ip2e-daemon.py index 96a0466..8b302a8 100755 --- a/ip2e-daemon.py +++ b/ip2e-daemon.py @@ -5,7 +5,7 @@ # ip2e (IP to email) - Run ip2e daemon. | # Created by clamsawd (clamsawd@openmailbox.org) | # Licensed by GPL v.3 | -# Last update: 31-10-2015 | +# Last update: 01-11-2015 | # | # Compatible with Python 3.x | # -------------------------------------------------------------- @@ -52,10 +52,12 @@ if os.path.exists(".ip2e"): os.chdir(".ip2e") #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.close() -def writeip2ecf(): ip2ecf=open('ip2e-conf.py','a') ip2ecf.write('# sample configuration file of ip2e\n') ip2ecf.write('\n') @@ -66,28 +68,16 @@ def writeip2ecf(): ip2ecf.write('ToEmail="unknown@email.com"\n') 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' -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"): print ("current-ip.py exists") else: print ("current-ip.py created") - createip2eIPcf() - writeip2eIPcf() + ip2eIPcf=open('current-ip.py','w') + ip2eIPcf.close() + ip2eIPcf=open('current-ip.py','a') + ip2eIPcf.write('CurrentIP="0.0.0.0"\n') + ip2eIPcf.close() #Import variables from ip2e-conf.py exec(open("ip2e-conf.py").read()) @@ -114,6 +104,7 @@ try: os.system("color 6") except: print ("Error importing native color scheme") + exit(1) #Check if exists a previous log.file. if os.path.isfile("ip2e.log"): diff --git a/ip2e-log.py b/ip2e-log.py index b4e459a..0636323 100755 --- a/ip2e-log.py +++ b/ip2e-log.py @@ -5,7 +5,7 @@ # ip2e (IP to email) - See the log file. | # Created by clamsawd (clamsawd@openmailbox.org) | # Licensed by GPL v.3 | -# Last update: 31-10-2015 | +# Last update: 01-11-2015 | # | # Compatible with Python 3.x | # -------------------------------------------------------------- @@ -48,10 +48,12 @@ if os.path.exists(".ip2e"): os.chdir(".ip2e") #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.close() -def writeip2ecf(): ip2ecf=open('ip2e-conf.py','a') ip2ecf.write('# sample configuration file of ip2e\n') ip2ecf.write('\n') @@ -62,13 +64,6 @@ def writeip2ecf(): ip2ecf.write('ToEmail="unknown@email.com"\n') 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 if os.path.isfile("ip2e.log"): print ("ip2e.log exists")