美文网首页
scapy抓包1

scapy抓包1

作者: sexy_cyber | 来源:发表于2022-07-10 01:31 被阅读0次
from scapy.all import *


def capture(x):
    if b'HTTP/' in x.lastlayer().original and x.lastlayer().original[0:4] != b'HTTP':
        print('dst ip:', x.payload.dst)
        try:
            request_body = x.lastlayer().original
            request_body = request_body.decode('utf-8')
        except:
            request_body = str(x.lastlayer().original)
        if 'allall01.baidupcs.com' in request_body:
            return
        if 'netdisk' in request_body:
            return
        if 'baidu' in request_body:
            return
        print('request body:', request_body)


def main():
    sniff(filter="tcp", prn=lambda x: capture(x))


if __name__ == '__main__':
    main()

相关文章

网友评论

      本文标题:scapy抓包1

      本文链接:https://www.haomeiwen.com/subject/creibrtx.html