1 Star 0 Fork 46

O_nly/qytang_Python

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
2016.04.22 计算初始化序列号增长规律 1.82 KB
一键复制 编辑 原始数据 按行查看 历史
现任明教教主-乾颐堂 提交于 2016-04-22 16:04 . new file
#!/usr/bin/python3.4
# -*- coding=utf-8 -*-
#本脚由亁颐堂现任明教教主编写,用于乾颐盾Python课程!
#教主QQ:605658506
#亁颐堂官网www.qytang.com
#乾颐盾是由亁颐堂现任明教教主开发的综合性安全课程
#包括传统网络安全(防火墙,IPS...)与Python语言和黑客渗透课程!
import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)#清除报错
from scapy.all import *
import time
def calTSN(tgt):
seqNum = 0
preNum = 0
diffSeq = 0
seqList = []
for x in range(1,10):
if preNum != 0:
preNum = seqNum
pkt = IP(dst = tgt)/TCP()
ans = sr1(pkt, verbose = 0)
seqNum = ans.getlayer(TCP).seq
diffSeq = seqNum - preNum
if x > 1:
seqList.append(diffSeq)
print(seqList)
avNum = sum(seqList)/len(seqList)
print('平均值为:' + str(avNum))
if __name__ == '__main__':
calTSN('202.100.1.102')
================================================================================
已经很难预测了误差很大!!!
[root@Fedora hacker]# ./计算序列号.py
[436964180, 437011174, 437086216, 437111414, 437159804, 437178256, 437206230, 437254251]
平均值为:437121440.625
[root@Fedora hacker]# ./计算序列号.py
[437644346, 437672637, 437719140, 437749861, 437804395, 437824092, 437850174, 437896779]
平均值为:437770178.0
[root@Fedora hacker]# ./计算序列号.py
[438348470, 438369485, 438430033, 438446863, 438465962, 438511938, 438536963, 438585857]
平均值为:438461946.375
[root@Fedora hacker]# ./计算序列号.py
[439026415, 439050493, 439081583, 439141626, 439160206, 439215714, 439241897, 439259593]
平均值为:439147190.875
[root@Fedora hacker]# ./计算序列号.py
[439679993, 439710602, 439731882, 439780385, 439801296, 439848148, 439877346, 439907270]
平均值为:439792115.25
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/scj0531/qytang_Python.git
git@gitee.com:scj0531/qytang_Python.git
scj0531
qytang_Python
qytang_Python
master

搜索帮助