From 58baae8d324265f899222fb3fcc62237094327e5 Mon Sep 17 00:00:00 2001
From: Pierre LALET <pierre.lalet@cea.fr>
Date: Sat, 30 Sep 2017 01:45:45 +0200
Subject: [PATCH] Python 3: fix Nmap module tests

---
 test/nmap.uts | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/test/nmap.uts b/test/nmap.uts
index d2522885..20003f7e 100644
--- a/test/nmap.uts
+++ b/test/nmap.uts
@@ -10,8 +10,13 @@
 load_module('nmap')
 
 = Fetch database
-import urllib
-open('nmap-os-fingerprints', 'wb').write(urllib.urlopen('https://raw.githubusercontent.com/nmap/nmap/9efe1892/nmap-os-fingerprints').read())
+from __future__ import print_function
+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'
 
 = Database loading
@@ -20,14 +25,14 @@ assert len(nmap_kdb.get_base()) > 100
 = fingerprint test: www.secdev.org
 ~ netaccess
 score, fprint = nmap_fp('www.secdev.org')
-print score, fprint
+print(score, fprint)
 assert score > 0.5
 assert fprint
 
 = fingerprint test: gateway
 ~ netaccess
 score, fprint = nmap_fp(conf.route.route('0.0.0.0')[2])
-print score, fprint
+print(score, fprint)
 assert score > 0.5
 assert fprint
 
-- 
GitLab