Scapy Module Installation
Yum Install tcpdump Graphviz ImageMagick
Open https://pypi.org/project/scapy/2.3.3/#files
Download scapy-2.3.3.tar.gz
wget https://files.pythonhosted.org/packages/ac/14/c792a14b9f8bc4bb9c74c0594c167a2da36e31964098d9e27202142cbd7d /scapy-2.3.3.tgz
Tar zxf scapy-2.3.3.tar.gz
CD scapy-2.3.3
Python setup.py Install
Explore Baidu's route map
#!/usr/bin/env python#-*-coding:utf-8-*-import os,sys,time,subprocessimport warnings, Loggingwarnings.filterwarnings ("Ignore", category=deprecationwarning) #logging. GetLogger ("Scapy.runtime"). SetLevel (logging. ERROR) from scapy.all import traceroutedomains = raw_input (' Please input one or more ip/domain: ') target = Domains.split (' ') Dport = [80]if len (target) >= 1 and target[0]!= ': Res,unans = traceroute (target,dport=dport,retry=-2) Res.gra ph (target= "> Test.svg") time.sleep (1) subprocess. Popen ("/usr/bin/convert test.svg test.png", shell=true) Else:print "ip/domain Number of Errors,exit"
Execute Python png.py
Generate Test.png
[email protected] home]# python simple.py
Please input one or more ip/domain:www.baidu.com
Begin emission:
*finished to send packets.
Begin emission:
Finished to send 5 packets.
Begin emission:
Finished to send 5 packets.
Received packets, got answers, remaining 5 packets
14.215.177.38:tcp80
1 192.168.1.1 11
2 100.64.0.1 11
3 59.38.106.57 11
5 113.96.4.14 11
Ten 14.215.177.38 SA
14.215.177.38 SA
14.215.177.38 SA
14.215.177.38 SA
14.215.177.38 SA
14.215.177.38 SA
14.215.177.38 SA
14.215.177.38 SA
14.215.177.38 SA
14.215.177.38 SA
14.215.177.38 SA
14.215.177.38 SA
14.215.177.38 SA
14.215.177.38 SA
14.215.177.38 SA
14.215.177.38 SA
14.215.177.38 SA
14.215.177.38 SA
14.215.177.38 SA
14.215.177.38 SA
14.215.177.38 SA
Note Scapy version 2.4 will error
With the 2.3.3 version is exactly
Python uses scapy to produce dynamic route maps