Jump to content

Scapy scan clients of an AP


fFoska

Recommended Posts

I'm writing a deauth attacker python script to kick everyone from an AP but my own devices (pretty much reverse engineered DanMcInerney's wifi jammer). It works fine so far, but every time scapy captures client macs it also captures devices that are connected to another AP or not connected at all. I tried fixing the mon0 channel with sudo airmon-ng start  mon0 11 but it's not working...

here's the code that gets the mac addresses:

def sniffmgmt(p):
    stamgmtstypes = (0, 2, 4)
    if p.haslayer(Dot11):
        if p.type == 0 and p.subtype in stamgmtstypes:
            if p.addr2 not in CliList:
                print p.addr2
                CliList.append(p.addr2)

sniff(iface=moniface, prn=sniffmgmt, timeout = scantime)

 

I could't find a proper documentation for scapy and I'm new to networking... so any help is apreciated.

Thanks in advance !

Link to comment
Share on other sites

Update: So I found out that could get the captured packet's channel by reading the Radio Tap header, however I can't find the information in the header about channel, signal strenght etc. Is that because I messed up something setting up the monitor iface or is it hidden in some other way?

Link to comment
Share on other sites

Never mind, I think I figured it out... I was capturing the wrong type of packets. I'm not sure what kind of packets are these but they are sent to the AP from the connected devices so they contain the AP's mac as a destination.

here's the code:

def cb(p):
    if p.haslayer(Dot11):
        if p.addr1 and p.addr2:                                            # if "from" and "to" mac addr. exists
            p.addr1 = p.addr1.lower()                                    # convert both macs to all lower case     
            p.addr2 = p.addr2.lower()         
            if APmac.lower() == p.addr1.lower():                    # AP's mac address = packt destination mac !
                if p.type in [1, 2]:                                               # the type I'm looking for
                    if p.addr2 not in CliList and p.addr2 != '':

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...