This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from scapy.all import sniff, ICMP | |
def process_packet(packet): | |
if packet.haslayer(ICMP) and packet[ICMP].type == 0: | |
data = packet[ICMP].load[-8:] | |
try: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scapy.all import * | |
def get_mac_address(ip): | |
arp_broadcast = Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(op=1, pdst=ip) # Cria o pacote falso de ARP Request | |
ans, uns = srp(arp_broadcast, timeout=2, verbose=0) # Envia o pacote e espera uma resposta | |
return ans[0][1][1].hwsrc | |
def poison_arp(dest_ip, dest_mac, src_ip): | |
arp_spoof = ARP(op=2, psrc=src_ip, pdst=dest_ip, hwdst=dest_mac) # Cria o pacote falso |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scapy.all as scapy | |
def mac(ipadd): | |
arp_request = scapy.ARP(pdst=ipadd) | |
br = scapy.Ether(dst="ff:ff:ff:ff:ff:ff") | |
arp_req_br = br / arp_request | |
list_1 = scapy.srp(arp_req_br, timeout=5, verbose=False)[0] | |
return list_1[0][1].hwsrc | |
def sniff(interface): |