0

I want to create a python3 script which uses a wireless active connection (the bssid which the interface is attached at the moment) to send a 100% custom layer 2 payload (or in other words, a 100% custom layer 3 or 2.5 protocol).

I have tried a lot of ways with scapy, with scripts like the following:

from scapy.all import *
import os

interfaces = os.listdir('/sys/class/net')
interface = interfaces[1] # which is the wireless interface

send(Dot11(addr1 = 'aa:aa:aa:aa:aa:aa'), iface = str(interface)) # I pretend here to send an empty frame to addr1 destination, using the wireless card and the existing bssid on which i'm currently connected

Always I get the destination MAC address as broadcast. And of course I don't understand the proper way to do what I want.

Any suggestion or clarification is welcome.

Thanks in advance.

1 Answer 1

0

The answer, the key is use sendp instead send, for example a IEEE1905 Ethertype:

import os
from scapy.all import *

dest_MAC = aa:aa:aa:aa:aa:aa # the mac address you want to send it

interfaces = os.listdir('/sys/class/net') interface = interfaces[3] #select one interface from the array, it could be Ethernet or an existing Wireless STA connection

p = Ether(type=0x893a, dst = dest_MAC)/b"\x00\x00\x00" #we send just three "zero" bytes

sendp(p, iface=interface) #using sendp instead send, which is layer2 abstracted

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.