Small changes in the command-line interface

This commit is contained in:
clamsawd 2015-12-01 19:06:02 +01:00
parent 9b61599699
commit c490ce0888
3 changed files with 35 additions and 32 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: 22-11-2015 | # Last update: 01-12-2015 |
# | # |
# Compatible with Python 3.x | # Compatible with Python 3.x |
# -------------------------------------------------------------- # --------------------------------------------------------------
@ -50,15 +50,15 @@ if os.path.exists(".ip2e"):
if os.path.isfile("ip2e.conf"): if os.path.isfile("ip2e.conf"):
ClearScreen() ClearScreen()
print ("") print ("")
print ("ip2e-config v"+version) print ("** ip2e-config v"+version+" **")
print ("") print ("")
print ("Detected a previous configuration file") print (" - Detected a previous configuration file.")
print ("Do you want to overwrite or check the current configuration?") print (" - Do you want to overwrite or check the current configuration?")
print ("") print ("")
print ("(o) - overwrite (create new configuration)") print (" * (o) - overwrite (create new configuration)")
print ("(c) - check and test the current configuration") print (" * (c) - check and test the current configuration")
print ("") print ("")
OverWriteOrCheck=input("[Default: check and test] Choose an option; ") OverWriteOrCheck=input("- [Default: check and test] Choose an option; ")
if OverWriteOrCheck == "o" or OverWriteOrCheck == "O": if OverWriteOrCheck == "o" or OverWriteOrCheck == "O":
print ("Create new configuration") print ("Create new configuration")
else: else:
@ -73,26 +73,26 @@ if os.path.isfile("ip2e.conf"):
server.login(FromEmailUser,FromEmailPass) server.login(FromEmailUser,FromEmailPass)
server.quit() server.quit()
print ("") print ("")
print ("Test OK") print ("* Test OK")
print ("") print ("")
PauseExit=input("Press ENTER to exit ") PauseExit=input("+ Press ENTER to exit ")
except: except:
print ("") print ("")
print ("Failed to connect ("+SmtpFromEmail+")") print ("* Failed to connect ("+SmtpFromEmail+")")
print ("") print ("")
PauseExit=input("Press ENTER to exit ") PauseExit=input("+ Press ENTER to exit ")
exit() exit()
#Set variables of 'ip2e.conf' #Set variables of 'ip2e.conf'
ClearScreen() ClearScreen()
print ("") print ("")
print ("ip2e-config v"+version+" - Create config.file") print ("** ip2e-config v"+version+" - Create config.file **")
print ("") print ("")
FromEmail=input("Type the email sender: ") FromEmail=input("- Type the email sender: ")
FromEmailUser=input("Type the user of email sender: ") FromEmailUser=input("- Type the user of email sender: ")
FromEmailPass=input("Type the pass of email sender: ") FromEmailPass=input("- Type the pass of email sender: ")
SmtpFromEmail=input("Type the server STMP of email sender: ") SmtpFromEmail=input("- Type the server STMP of email sender: ")
ToEmail=input("Type the email receiver: ") ToEmail=input("- Type the email receiver: ")
#Create 'ip2e.conf' #Create 'ip2e.conf'
if os.path.isfile("ip2e.conf"): if os.path.isfile("ip2e.conf"):
@ -112,7 +112,7 @@ ip2ecf.close()
#Show the configuration #Show the configuration
ClearScreen() ClearScreen()
print ("") print ("")
print ("ip2e-config v"+version+" - Current config.file") print ("** ip2e-config v"+version+" - Current config.file **")
print ("") print ("")
readfile=open('ip2e.conf', 'r') readfile=open('ip2e.conf', 'r')
print(readfile.read()) print(readfile.read())
@ -120,7 +120,7 @@ readfile.close()
#Test connection with your configuration #Test connection with your configuration
print ("") print ("")
TestConnection=input("[Default: y] Test connection with your configuration (y/n): ") TestConnection=input("- [Default: y] Test connection with your configuration (y/n): ")
if TestConnection == "n": if TestConnection == "n":
print ("Exiting...") print ("Exiting...")
exit() exit()
@ -136,11 +136,11 @@ else:
server.login(FromEmailUser,FromEmailPass) server.login(FromEmailUser,FromEmailPass)
server.quit() server.quit()
print ("") print ("")
print ("Test OK") print ("* Test OK")
print ("") print ("")
PauseExit=input("Press ENTER to exit ") PauseExit=input("+ Press ENTER to exit ")
except: except:
print ("") print ("")
print ("Failed to connect ("+SmtpFromEmail+")") print ("* Failed to connect ("+SmtpFromEmail+")")
print ("") print ("")
PauseExit=input("Press ENTER to exit ") PauseExit=input("+ Press ENTER to exit ")

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: 22-11-2015 | # Last update: 01-12-2015 |
# | # |
# Compatible with Python 3.x | # Compatible with Python 3.x |
# -------------------------------------------------------------- # --------------------------------------------------------------
@ -62,11 +62,11 @@ if os.path.isfile("ip2e.conf"):
else: else:
ClearScreen() ClearScreen()
print ("") print ("")
print ("The configuration file doesn't exist") print ("* The configuration file doesn't exist")
print ("") print ("")
print ("You can create it if you run 'ip2e-config.py'") print ("* You can create it if you run 'ip2e-config.py'")
print ("") print ("")
PauseExit=input("Press ENTER to exit ") PauseExit=input("+ Press ENTER to exit ")
exit() exit()
#Check if exists 'IP.log' #Check if exists 'IP.log'
@ -104,7 +104,10 @@ try:
elif os.name == "nt": elif os.name == "nt":
os.system("color 6") os.system("color 6")
except: except:
print ("Error importing native color scheme") print ("")
print ("* Error importing native color scheme")
print ("")
PauseExit=input("+ Press ENTER to exit ")
exit() exit()
#Check if ip2e-daemon is running. #Check if ip2e-daemon is running.
@ -121,9 +124,9 @@ if os.path.isfile("ip2e.lock"):
if LockN != LockN2: if LockN != LockN2:
ClearScreen() ClearScreen()
print ("") print ("")
print ("ip2e-daemon is already running.") print ("* ip2e-daemon is already running.")
print ("") print ("")
PauseExit=input("Press ENTER to exit ") PauseExit=input("+ Press ENTER to exit ")
exit() exit()
if not os.path.isfile("ip2e.lock"): if not os.path.isfile("ip2e.lock"):
createLock=open('ip2e.lock','w') createLock=open('ip2e.lock','w')

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: 22-11-2015 | # Last update: 01-12-2015 |
# | # |
# Compatible with Python 3.x | # Compatible with Python 3.x |
# -------------------------------------------------------------- # --------------------------------------------------------------
@ -57,5 +57,5 @@ if os.path.isfile("ip2e.log"):
else: else:
ClearScreen() ClearScreen()
print ("") print ("")
print ("ip2e.log doesn't exist.") print ("* ip2e.log doesn't exist.")
print ("") print ("")