Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
YMMV, but this should export a PNG of a zenmap topology from a Nmap XML file
#!/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])
from zenmapGUI.TopologyPage import *
except ImportError:
import sys
from zenmapGUI.TopologyPage import *
t = TopologyPage(NetworkInventory(sys.argv[1]))
pix = int(sys.argv[3])

This comment has been minimized.

Copy link

1990113602 commented Jan 24, 2014

this is a pretty useful script that i used to look for,i tired to integrate it with my java application,but it doesn't works ok,even though upgrade my Ubuntu(12.04).

apt-get update
apt-get upgrade

root@bt:/tmp#whereis zenmap
zenmap: /usr/bin/zenmap /usr/bin/X11/zenmap /usr/local/bin/zenmap /usr/share/zenmap /usr/share/man/man1/zenmap.1.gz

root@bt:/tmp# python /tmp/1.xml /tmp/2.png 256
/usr/lib/pymodules/python2.6/gtk-2.0/gtk/ GtkWarning: could not open display
warnings.warn(str(e), _gtk.Warning)
Traceback (most recent call last):
File "", line 17, in
t = TopologyPage(NetworkInventory(sys.argv[1]))
File "/usr/local/lib/python2.6/dist-packages/zenmapCore/", line 114, in init
File "/usr/local/lib/python2.6/dist-packages/zenmapCore/", line 284, in open_from_file
parsed = NmapParser(path)
TypeError: nmap_parser_sax() takes no arguments (1 given)

i'm a java programmer,not python,forgive my poor python skills

how can i slove this problem?
thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.