Skip to content
Snippets Groups Projects
Commit 58baae8d authored by Pierre LALET's avatar Pierre LALET
Browse files

Python 3: fix Nmap module tests

parent c5e1b99e
No related branches found
No related tags found
No related merge requests found
...@@ -10,8 +10,13 @@ ...@@ -10,8 +10,13 @@
load_module('nmap') load_module('nmap')
= Fetch database = Fetch database
import urllib from __future__ import print_function
open('nmap-os-fingerprints', 'wb').write(urllib.urlopen('https://raw.githubusercontent.com/nmap/nmap/9efe1892/nmap-os-fingerprints').read()) try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
open('nmap-os-fingerprints', 'wb').write(urlopen('https://raw.githubusercontent.com/nmap/nmap/9efe1892/nmap-os-fingerprints').read())
conf.nmap_base = 'nmap-os-fingerprints' conf.nmap_base = 'nmap-os-fingerprints'
= Database loading = Database loading
...@@ -20,14 +25,14 @@ assert len(nmap_kdb.get_base()) > 100 ...@@ -20,14 +25,14 @@ assert len(nmap_kdb.get_base()) > 100
= fingerprint test: www.secdev.org = fingerprint test: www.secdev.org
~ netaccess ~ netaccess
score, fprint = nmap_fp('www.secdev.org') score, fprint = nmap_fp('www.secdev.org')
print score, fprint print(score, fprint)
assert score > 0.5 assert score > 0.5
assert fprint assert fprint
= fingerprint test: gateway = fingerprint test: gateway
~ netaccess ~ netaccess
score, fprint = nmap_fp(conf.route.route('0.0.0.0')[2]) score, fprint = nmap_fp(conf.route.route('0.0.0.0')[2])
print score, fprint print(score, fprint)
assert score > 0.5 assert score > 0.5
assert fprint assert fprint
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment