Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

python programming help, im trying to save the scan into a file which allows the user to choose the file name?

hi this is my code i want to save the file after the scan is finish into a txt file, can anyone help please

#!/usr/bin/python

#Color For Terminal

r = '\033[31m' #red

b = '\033[34m' #blue

g = '\033[32m' #green

print g + "hello there"

print ""

print b+ "##################################################"

print "# quicksnap - A Customized Nmap Automatic Scanner#"

print "##################################################"

print ""

print r+ "Scanning Options"

print "[1] Intense Scan"

print "[2] Intense Scan + UDP"

print "[3] Intense Scan - all TCP ports"

print "[4] Intense Scan w/out ping"

print "[5] Ping Scan"

print "[6] Quickie Scan"

print "[7] Quick Traceroute"

print "[8] Normal Scan"

print "[9] Send Bad Checksums"

print "[10] Generate Randon Mac Adress Spoofing for Evasion"

print "[11] Fragment Packets"

print "[12] Check for Possible Vulnerabilities"

option = raw_input("Choose your Scanning Option:")

print g+ ""

if option == '1':

ip = raw_input("Input IP Address / Hostname:")

os.system("nmap -T4 -A -v "+ip)

elif option == '2':

ip = raw_input("Input IP Address / Hostname:")

os.system("nmap -sS -sU -T4 -A -v "+ip)

elif option == '3':

ip = raw_input("Input IP Address / Hostname:")

os.system("nmap -p 1-65535 -T4 -A -v "+ip)

elif option == '4':

ip = raw_input("Input IP Address / Hostname:")

os.system("nmap -T4 -A -v -Pn "+ip)

elif option == '5':

ip = raw_input("Input IP Address / Hostname:")

os.system("nmap -sn "+ip)

elif option == '6':

ip = raw_input("Input IP Address / Hostname:")

os.system("nmap -T4 -F "+ip)

elif option == '7':

ip = raw_input("Input IP Address / Hostname:")

os.system("nmap -sn --traceroute "+ip)

elif option == '8':

ip = raw_input("Input IP Address / Hostname:")

elif option == '9':

ip = raw_input("Input IP Address / Hostname:")

os.system("nmap --badsum "+ip)

elif option == '10':

ip = raw_input("Input IP Address / Hostname:")

os.system("nmap -sT -Pn --spoofmac 0 "+ip)

elif option == '11':

ip = raw_input("Input IP Address / Hostname:")

os.system("nmap -f "+ip)

elif option == '12':

ip = raw_input("Input IP Address / Hostname:")

os.system("nmap --script vuln "+ip)

else:

print b+ "Your Choice is Invalid"

print "Goodbye"

name_of_file = raw_input("write file name: ")

completeName = name_of_file + ".txt"

3 Answers

Relevance
  • 8 years ago
    Favorite Answer

    The easiest way is to just use the file dialog that comes with whatever windows GUI handler you have chosen (TkInter, wxPython, whatever).

    One thing I am curious about - why are you naming a scan ".txt"? Surely it should be TIF or PNG or JPG or whatver your scanner gives you?

  • Anonymous
    4 years ago

    you may attempt the Pavtube DVD Ripper.it is expert besides as undemanding to apply DVD ripping application. it is sensible with out failing to accomplish in an superb way. it is versatile application and clientele can use it the two to backup DVD to no longer undemanding disk or to transform DVD video clips to AVI, WMV, MPG, MP4, MOV, and 3GP, AAC, MP3, W4A, WMA, WAV and AC3 etc. besides, it may convert DVD to iPod, iPhone, Zune, imaginitive Zen, iRiver, PSP, Xbox360, Pocket pc and Apple television etc. Pavtube DVD Ripper rips quickly and exports excellence in effortless terms.

  • 8 years ago

    Try holding on the "ctrl" key & press the "s" key

Still have questions? Get your answers by asking now.