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():
menuChoice = input("Choose from above")
if menuChoice == "0": print("0.Selected Host Discoverer...")
elif menuChoice == "1": print("1.Selected Full Scan...")
elif menuChoice == "2": print("2.Selected TCP Connect...")
elif menuChoice == "3": print("3.Selected TCP Violation...")
elif menuChoice == "4": print("4.Selected Masscan...")
else: print("Exiting...")
switch = {
"0": "0.Selected Host Discoverer...",
"1": "1.Selected Full Scan...",
"2": "2.Selected TCP Connect...",
"3": "3.Selected TCP Violation...",
"4": "4.Selected Masscan..."
}
print(switch.get(menuChoice, "Exiting..."))
return menuChoice
def cmdList():