Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Wifi sniffer capability; often asked for, never delivered?

    Scheduled Pinned Locked Moved Comments & Feedback
    2 Posts 2 Posters 85 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D Offline
      drgdhorler
      last edited by

      Hello!

      Covid -19 has given me time to ressurect my embedded experiments!

      I've noted that there are a number of esp32 solutions to "promiscuous" wifi sniffing (mostly in "C"), indeed Zerynth provide a "compiled python solution" that can be targeted to the pycom modules. Over the years there have been requests for this facility in Pycom; so my question is, "Does WIFI sniffing exist, will it ever exist? If it does where is the documentation, examples etc. For sure a "work round" solution can be created that uses a slave esp32 running alongside a Pycom module, but this is not very elegant.

      I'm keen to have an answer, please.

      Many thanks in advance.

      X 1 Reply Last reply Reply Quote 0
      • X Offline
        Xykon administrators @drgdhorler
        last edited by

        @drgdhorler We added experimental support for this. Below is some example code to capture MAC addresses.

        from network import WLAN
        import ubinascii
        
        
        
        def pack_cb(pack):
            mac = bytearray(6)
            pk = wlan.wifi_packet()
            control = pk.data[0]
            subtype = (0xF0 & control) >> 4
            type = 0x0C & control
            #print("Control:{}, subtype:{}, type:{}".format(control, subtype, type))
            if subtype == 4:
                for i in range (0,6):
                    mac[i] = pk.data[10 + i]
                print ("Wifi Node with MAC: {}".format(ubinascii.hexlify(mac)))
        
        wlan = WLAN(mode=WLAN.STA, antenna=WLAN.EXT_ANT)
        wlan.callback(trigger=WLAN.EVENT_PKT_MGMT, handler=pack_cb)
        wlan.promiscuous(True)

        Christian Ehlers

        1 Reply Last reply Reply Quote 7

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • 1 / 1
        • First post
          Last post

        Pycom on Twitter

        Pycom