Comments (7)
I see the XML did not get included. I can send that to you if you need.
from python-libnmap.
yes you can send it over to [email protected]. thanks for bug post
from python-libnmap.
Quick fix, i need to get further with this (parsing tags) but here is the result:
(see commit 1cd054c)
In [1]: from libnmap.parser import NmapParser
In [2]: p = NmapParser.parse_fromfile("/vagrant/smb-os-test.xml")
In [3]: h[0].scripts_results
Out[3]:
[{'id': 'smb-os-discovery',
'output': '\n OS: Windows 2000 (Windows 2000 LAN Manager)\n OS CPE: cpe:/o:microsoft:windows_2000::-\n Computer name: oracle\n NetBIOS computer name: ORACLE\n Domain name: acme.local\n FQDN: oracle.acme.local\n NetBIOS domain name: ACME\n System time: 2014-03-03T16:41:35+02:00\n'}]
from python-libnmap.
ok... way better now...
Check change log: you now have
NmapHost.scripts_results (it's a property) and will produce the below output for your specific XML.
you also have NmapService.scripts_results (again a property, it was formerly a method) and will produce similar output but for service specific nse scripts output.
See example with your xml:
In [1]: from libnmap.parser import NmapParser
In [2]: p = NmapParser.parse_fromfile("/vagrant/smb-os-test.xml")
In [3]: h = p.hosts.pop()
In [4]: h.scripts_results
Out[4]:
[{'elements': {'cpe': 'cpe:/o:microsoft:windows_2000::-',
'date': '2014-03-03T16:41:35+02:00',
'domain': 'ACME',
'domain_dns': 'acme.local',
'fqdn': 'oracle.acme.local',
'lanmanager': 'Windows 2000 LAN Manager',
'os': 'Windows 5.0',
'server': 'ORACLE' } ,
'id': 'smb-os-discovery','output': '\n OS: Windows 2000 (Windows 2000 LAN Manager)\n OS CPE: cpe:/o:microsoft:windows_2000::-\n Computer name: oracle\n NetBIOS computer name: ORACLE\n Domain name: acme.local\n FQDN: oracle.acme.local\n NetBIOS domain name: ACME\n System time: 2014-03-03T16:41:35+02:00\n' } ]
Any feedback and more tests cases are most welcome.
from python-libnmap.
@trashgordon did you tested this?
from python-libnmap.
Yes, and it works great now. Thank you! And thank you for your great library!
from python-libnmap.
I've downloaded straight from github as opposed to PIP install, and still have issue of dict showing {} when printing it out. I print out nmap_report = NmapParser.parse(nmap_proc.stdout), and see values in the XML.
What am I doing wrong :?
[edit]
got it figured out.
here is a gist of: nmap_report = NmapParser.parse(nmap_proc.stdout) that shows how to cycle through everything.
https://gist.github.com/brizzbane/637dfed0032d6f00e191
from python-libnmap.
Related Issues (20)
- Issue parsing NSE output from xml HOT 3
- parsing hostnames should return the type of the hostname detected i.e user or PTR HOT 2
- Project still alive? Wrong XML structure: cannot parse data HOT 7
- CC-BY Licence is not recommended for code - should move to an equivalent OSS licence HOT 2
- parser detect if xml is incomplete
- Install fails on windows 10 due to characer encoding issue in README.rst HOT 1
- Script results may contain "None" dict keys HOT 2
- handle the <hosthint> xml tag
- Running with sudo without passwordless setup hangs
- Release of 0.7.3 HOT 4
- Any plan to fix CVE-2022-30284 [Critical] - python-libnmap 0.7.2 ? HOT 3
- Does python-libnmap library require "nmap" binary to be installed? HOT 2
- Syntax for printing the vulnerblities
- Python 2 compatibility
- Future maintenance of this project HOT 1
- XML Injection DoS attack HOT 5
- Multiprocess nmap problem. HOT 2
- Basic indentation/syntax errors in 3.6? HOT 4
- Require overriding of nmap arguments
- process.py returns 'Object has no attribute Format' HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-libnmap.