Update nmap.py

I have changed the if-else statement in the menuSelector() function to a switch statement, using a python dictionary.
The switch statement checks if the menuChoice variable exists as a key in the dictionary and returns the corresponding value,
This commit is contained in:
Greg Hendrickson
2023-01-24 05:55:43 -08:00
committed by GitHub
parent ccbf4a351a
commit 9c6675329f

14
nmap.py
View File

@@ -37,12 +37,14 @@ Anything else to exit.
def menuSelector(): def menuSelector():
menuChoice = input("Choose from above") menuChoice = input("Choose from above")
if menuChoice == "0": print("0.Selected Host Discoverer...") switch = {
elif menuChoice == "1": print("1.Selected Full Scan...") "0": "0.Selected Host Discoverer...",
elif menuChoice == "2": print("2.Selected TCP Connect...") "1": "1.Selected Full Scan...",
elif menuChoice == "3": print("3.Selected TCP Violation...") "2": "2.Selected TCP Connect...",
elif menuChoice == "4": print("4.Selected Masscan...") "3": "3.Selected TCP Violation...",
else: print("Exiting...") "4": "4.Selected Masscan..."
}
print(switch.get(menuChoice, "Exiting..."))
return menuChoice return menuChoice
def cmdList(): def cmdList():