通过traceroute追踪并打印成图片
发布日期:2021-05-08 23:26:09 浏览次数:16 分类:博客文章

本文共 784 字,大约阅读时间需要 2 分钟。

#!/usr/bin/evn python#-*-coding:utf-8 -*-import timeimport logging,warningsimport subprocessimport socket# eclipse的pydev提示unresolve,但运行正常#import traceroute  # @UnresolvedImportwarnings.filterwarnings("ignore",category=DeprecationWarning) logging.getLogger("scapy.runtime").setLevel(logging.ERROR) domains = raw_input('Please input domains or IPs: ')# 利用socket 解析域名的方法# try:#     ip = socket.gethostbyname(domains)# except socket.error,e:#     print "you should run by root"'''try:    domain = domains.split(' ')      res,unans = traceroute(domains,dport=[80,443],retry=-2)    res.graph(target=">test.svg")    time.sleep(1)    #输出转换为png为可选,chrome,ie等可以打开.svg文件    subprocess.Popen("/usr/bin/convert test.svg test.png",shell=True)except:    print "you shoud run by root or domain error"

 

上一篇:ubuntu网桥设置
下一篇:6 个 Linux 运维典型问题

发表评论

最新留言

逛到本站,mark一下
[***.202.152.39]2025年04月29日 12时11分07秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章

CSDN----Markdown编辑器 2025-03-28
Docker部署postgresql-11以及主从配置 2025-03-28
EnvironmentNotWritableError: The current user does not have write permissions to the target environm 2025-03-28
Hyper-V系列:微软官方文章 2025-03-28
kali安装docker(亲测有效) 2025-03-28
Linux系列:Linux目录分析:[/] + [/usr] + [/usr/local] + [/usr/local/app-name]、Linux最全环境配置 + 动态库/静态库配置 2025-03-28
mysql系列:远程连接MySQL错误“plugin caching_sha2_password could not be loaded”的解决办法 2025-03-28
Nmap端口服务 之 CentOS7 关于启动Apache(httpd)服务、telnet服务、smtp服务、ftp服务、sftp服务、snmp服务 2025-03-28
PHP系列:PHP 基础编程 2(时间函数、数组---实现登录&注册&修改) 2025-03-28
PHP系列:使用PHP实现登录注册功能的完整指南 2025-03-28
Python&aconda系列:cmd/powershell/anaconda prompt提示“系统找不到指定的路径”(亲测有效) 2025-03-28
Python&aconda系列:(W&L)Conda使用faiss-gpu报错及解决办法、安装numpy的坑、cmd执行Python脚本找不到第三方库、安装tensorflow-gpu时遇到的from 2025-03-28
python&anconda 系列:Pycharm在debug问题的N种解决方案(一般程序、web方向、人工智能方向) 2025-03-28
python&anconda系列(亲测有效):tensorflow AttributeError: ‘str’ object has no attribute ‘decode’ 2025-03-28
python&anconda系列:tf.keras.backend.get_session()和keras.backend.get_会话()返回不同的会话对象(待解答) 2025-03-28
"WARNING: Increasing RAM size to 1GB" and "Cannot set up guest memory 'xxx.ram': Invalid argument". 2025-03-28
#if 0 #elif 1 #else #endif 用法 2025-03-28
(反射+内省机制的运用)处理jdbc的结果集 2025-03-28
(反射+内省机制的运用)简单模拟spring IoC容器的操作 2025-03-28
(转)tomcat7.0 manager app和host manager web管理 2025-03-28