我需要帮助自动将zenmap网络拓扑图导出到PNG文件,而无需打开zenmap并手动执行。
我找到了a script on github,但它显示了一个错误:
#!/usr/bin/env python
import sys
if len(sys.argv) != 4:
print """{0} - Output a PNG from Nmap XML
Usage: {0} <scan.xml> <out.png> <width_in_pixels>""".format(sys.argv[0])
sys.exit(1)
try:
from zenmapGUI.TopologyPage import *
except ImportError:
import sys
sys.path.insert(0,"/usr/bin/zenmap")
from zenmapGUI.TopologyPage import *
t = TopologyPage(NetworkInventory(sys.argv[1]))
pix = int(sys.argv[3])
t.radialnet.set_allocation((0,0,pix,pix))
t.update_radialnet()
t.radialnet.save_drawing_to_file(sys.argv[2])
pradeep@ubuntu:~/Desktop$ python nmaptopng.py /home/pradeep/Desktop/topology.xml /home/pradeep/Desktop/xxx.png 500
Traceback (most recent call last):
File "nmaptopng.py", line 17, in <module>
t = TopologyPage(NetworkInventory(sys.argv[1]))
File "/usr/lib/python2.7/dist-packages/zenmapCore/NetworkInventory.py", line 145, in __init__
self.open_from_file(filename)
File "/usr/lib/python2.7/dist-packages/zenmapCore/NetworkInventory.py", line 315, in open_from_file
parsed = NmapParser(path)
TypeError: nmap_parser_sax() takes no arguments (1 given)
我尝试在zenmap中查找NetworkInventory.py
文件但未能理解该问题!任何人都可以帮我这个吗?