-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest1.py
70 lines (66 loc) · 1.47 KB
/
test1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
"""
@file : test1.py
@author : fxkxb.com
@date : 2021/3/15 23:52
@description :
"""
# re_data = {'{': '%7B', '}': '%7D', '[': '%5B', ']': '%5D', '"': '%22', "'": '%27', ',': '%2C', ':': '%3A'}
# tem = {}
# for i in re_data:
# tem[re_data[i]]=i
# print(re_data)
# print(tem)
#
# for i in range(1,61):
# print(i)
#
# import wmi as wmi
#
# s=wmi.WMI()
#
#
# for i in s.Win32_NetworkAdapterConfiguration():
# print(i)
from scapy.all import *
# import re
# #
# #
# def get_netdev():
# ethList = []
# t = get_ips()
# for i in t:
# eth = re.search('\[(.*)\]', str(i)).group(0)
# ethList.append(eth[1:-1])
# return ethList
#
#
# devs = get_netdev()
# for index, v in enumerate(devs):
# print(str(index + 1) + ":" + v)
#
# devopt = int(input())
# #
# dev_name = devs[devopt - 1]
# from scapy.all import *
#
# # while True:
# dpkt = sniff(filter='', iface='Qualcomm Atheros AR8171/8175 PCI-E Gigabit Ethernet Controller (NDIS 6.30)',count=100)
# for i in dpkt:
# i.show()
#
from scapy.all import *
#
#
# # 定义回调函数,嗅探一次返回执行一次
def pack_callback(pack):
try:
for i in pack:
i.show()
except Exception as e:
print(e)
dpkt = sniff(iface="Qualcomm Atheros AR8171/8175 PCI-E Gigabit Ethernet Controller (NDIS 6.30)", prn = pack_callback)
# dpkt = sniff(iface="Apple Mobile Device Ethernet", count=100)
# for i in dpkt:
# i.show()