windows - Error Logs from Python .exe -
i new programming on windows , python (mainly macos / ruby). writing program scans ip addresses, finds networked devices, logs them, , upgrades firmware. wrote python script , used tkinter gui. when run script in python, works expected. however, having issues when run script after create .exe pyinstaller.
when try "map network" , export output xml using python-nmap think it's throwing error. have scan_network() function on thread , check see if running, , when done popup saying "xml generated". when input ips gui tells me xml generated, alas no xml.
i assuming there problem nmap not being bundled exe, or something, not sure. there way can add way check logs?
here function button "scan network" calls. how can add logs this?
import nmap def scan_network(ips): nm = nmap.portscanner() nm.scan(hosts=ips, arguments='-v -a') open('xml/pyscan.xml', 'w') xml_file: xml_file.write(nm.get_nmap_last_output())
did more research.
this works!
import nmap import traceback utils import xml_parser def scan_network(ips): try: nm = nmap.portscanner() nm.scan(hosts=ips, arguments='-v -a') open('xml/pyscan.xml', 'w') xml_file: xml_file.write(nm.get_nmap_last_output()) xml_parser.parse_xml('xml/pyscan.xml') except: f = open('nmap.log', 'w') e = traceback.format_exc() f.write(str(e)) f.close()
Comments
Post a Comment