#!/usr/bin/python3
from scapy.all import *
TARGET = '8.8.8.8'
MAX_TTL = 14
TIMEOUT = 1.5
ip = IP()
icmp = ICMP()
ip.dst = TARGET
ip.ttl = (1,MAX_TTL)
p = ip/icmp
ans, uans= sr(p, timeout=TIMEOUT)
for snd, rcv in ans:
result = str(snd.ttl) + '\t' + rcv.src
if rcv.src == TARGET:
result += ' \t <== TARGET!'
print(result)
break
print(result)
sniff and spoof
#!/usr/bin/python3
from scapy.all import *
TARGET = '192.168.41.140'
spoof_ip = '8.8.8.8'
def spoof(pkt):
pkt.show()
ip = IP()
ip.src = spoof_ip
ip.dst = TARGET
icmp = ICMP()
icmp.type = 'echo-reply'
icmp.id = pkt[2].id
icmp.seq = pkt[2].seq
p = ip/icmp/pkt[3]
send(p)
pkt = sniff(filter='icmp[icmptype] == icmp-echo', prn=spoof)
'Computer Science% > Network' 카테고리의 다른 글
ufw 사용법 (0) | 2020.06.24 |
---|---|
sniff and spoof whth C (0) | 2020.05.09 |
네트워크 공부 (0) | 2018.07.15 |
가상 사설 네트워크 망 만들기 (feat. vm router 만들기) (1) | 2018.07.12 |
WPA2 무선랜 해킹 (6) | 2018.05.24 |