python实现路由追踪,并生成追踪图片


#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os,sys,time,subprocess
import warnings,logging


warnings.filterwarnings("ignore",category=DeprecationWarning)
logging.getLogger("scapy.runtine").setLevel(logging.ERROR)

from scapy.all import traceroute

domains = raw_input('please input the domain what you want: ')
target =  domains.split(' ')
dport = [80]

if len(target) >= 1 and target[0] != '':
        res,unans = traceroute(target,dport=dport,retry=-2)
        res.graph(target="> test.svg")
        time.sleep(1)
        subprocess.Popen("/usr/bin/convert test.svg test.png",shell=True)
else:
        print('domain error!')

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM