Cleaned up main loop and moved some code to external functions
This commit is contained in:
parent
bd7ad4838d
commit
da362e94fa
47
HTTPy.py
47
HTTPy.py
@ -13,11 +13,37 @@ phrases = ["ping", "whois", "quit", "clear", "help"]
|
||||
def printHelp():
|
||||
print "========================================================"
|
||||
print "= help - This screen ="
|
||||
print " clear - Clears the screen ="
|
||||
print " ping - Enables/Disables pinging the IP Address ="
|
||||
print "= clear - Clears the screen ="
|
||||
print "= ping - Enables/Disables pinging the IP Address ="
|
||||
print "========================================================"
|
||||
print "========================================================"
|
||||
|
||||
def checkPhrase(inputs):
|
||||
for word in phrases:
|
||||
if inputs == word:
|
||||
options(inputs)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
def options(inputs):
|
||||
global whoOn
|
||||
global pingOn
|
||||
|
||||
if inputs == "ping":
|
||||
if pingOn == "P":
|
||||
pingOn = "p"
|
||||
else:
|
||||
pingOn = "P"
|
||||
if inputs == "whois":
|
||||
if whoOn == "W":
|
||||
whoOn = "w"
|
||||
else:
|
||||
whoOn = "W"
|
||||
if inputs == "clear":
|
||||
subprocess.call("clear")
|
||||
if inputs == "help":
|
||||
printHelp()
|
||||
|
||||
def iterate(inArray, pre):
|
||||
count = 0
|
||||
while count != len(inArray) - 1:
|
||||
@ -57,7 +83,6 @@ def getInput():
|
||||
global inInput
|
||||
global partDomain
|
||||
global running
|
||||
global pingOn
|
||||
inInput = raw_input("["+ pingOn +"][" + whoOn + "] Please enter a domain/IP: ")
|
||||
partDomain = inInput.split(".")
|
||||
if inInput == "quit":
|
||||
@ -66,21 +91,7 @@ def getInput():
|
||||
#Main Loop
|
||||
while running == 1:
|
||||
getInput()
|
||||
if inInput == "ping":
|
||||
if pingOn == "P":
|
||||
pingOn = "p"
|
||||
else:
|
||||
pingOn = "P"
|
||||
if inInput == "whois":
|
||||
if whoOn == "W":
|
||||
whoOn = "w"
|
||||
else:
|
||||
whoOn = "W"
|
||||
if inInput == "clear":
|
||||
subprocess.call("clear")
|
||||
if inInput == "help":
|
||||
printHelp()
|
||||
if inInput == "" or inInput == "ping" or inInput == "whois" or inInput == "clear" or inInput == "help":
|
||||
if checkPhrase(inInput) == 1 or len(partDomain) == 1:
|
||||
pass
|
||||
else:
|
||||
if running == 0:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user