[Pkg-netmeasure-discuss] Bug#850570: python-scapy: inet traceroute method world_trace() import wrong module

Petter Reinholdtsen pere at hungry.com
Sat Jan 7 22:22:58 UTC 2017


Package: python-scapy
Version: 2.2.0-1

The execution fail when trying to call TracerouteResult.world_trace() on
a traceroute result.  Here is how to reproduce the problem:

% cat x.py 
from scapy.all import *
host = "8.8.8.8"
res,unans = traceroute(host, dport=[80,443], maxttl=30, retry=-2)
res.world_trace()
% sudo python x.py 
WARNING: No route found for IPv6 destination :: (no default route?)
Begin emission:
.*****************************Finished to send 60 packets.
*******...Begin emission:
Finished to send 24 packets.
..Begin emission:
Finished to send 24 packets.
..
Received 44 packets, got 36 answers, remaining 24 packets
   8.8.8.8:tcp443     8.8.8.8:tcp80      
1  192.168.1.1     11 192.168.1.1     11 
2  10.231.128.1    11 10.231.128.1    11 
3  84.208.41.50    11 84.208.41.50    11 
4  80.232.88.45    11 80.232.88.45    11 
5  80.232.88.44    11 80.232.88.44    11 
6  62.95.54.122    11 62.95.54.122    11 
7  88.131.152.10   11 -                  
8  209.85.142.85   11 -                  
9  74.125.37.129   11 -                  
10 8.8.8.8         SA -                  
11 8.8.8.8         SA -                  
12 8.8.8.8         SA -                  
13 8.8.8.8         SA -                  
14 8.8.8.8         SA -                  
15 8.8.8.8         SA -                  
16 8.8.8.8         SA -                  
17 8.8.8.8         SA -                  
18 8.8.8.8         SA -                  
19 8.8.8.8         SA -                  
20 8.8.8.8         SA -                  
21 8.8.8.8         SA -                  
22 8.8.8.8         SA -                  
23 8.8.8.8         SA -                  
24 8.8.8.8         SA -                  
25 8.8.8.8         SA -                  
26 8.8.8.8         SA -                  
27 8.8.8.8         SA -                  
28 8.8.8.8         SA -                  
29 8.8.8.8         SA -                  
30 8.8.8.8         SA -                  
Traceback (most recent call last):
  File "x.py", line 4, in <module>
    res.world_trace()
  File "/usr/lib/python2.7/dist-packages/scapy/layers/inet.py", line 1072, in world_trace
    from modules.geo import locate_ip
ImportError: No module named modules.geo
%

The code look like this:

    def world_trace(self):
        from modules.geo import locate_ip

I suspect 'modules.geo' should read 'modules.geoip', as the geoip.py
file have a locate_ip() method.

Note, the locate_ip() method do not seem to work either.  Using it fail
like this:

% cat y.py 
from scapy.all import *
from scapy.modules.geoip import locate_ip
host = "8.8.8.8"
print locate_ip(host)
% python y.py 
WARNING: No route found for IPv6 destination :: (no default route?)
Traceback (most recent call last):
  File "y.py", line 4, in <module>
    print locate_ip(host)
  File "/usr/lib/python2.7/dist-packages/scapy/modules/geoip.py", line 59, in locate_ip
    cloc = country_loc_kdb.get_base()
NameError: global name 'country_loc_kdb' is not defined
%

-- 
Happy hacking
Petter Reinholdtsen



More information about the Pkg-netmeasure-discuss mailing list