Didier Stevens

Tuesday 10 June 2008

Quickpost: WiFi Channel Hopping with an AirPcap Adapter

Filed under: My Software,Quickpost,WiFi — Didier Stevens @ 9:26

Here is a Python program to do WiFi channel hopping with an AirPcap adapter.

The program (apc-channel.py) takes 3 options:

  • –interval sec to set the interval between hops (default is 0.5 sec)
  • –step increment to specify the size of the channel hop (default is 5)
  • –quit to prevent the program from displaying each channel hop

The program also serves as an example on how to use the AirPcap dll from a Python program.

I’ve a couple of other AirPcap programs written in Python (like one to monitor probe requests). If there’s enough interest, I’ll clean up the code and publish it. Be aware that you need an AirPcap adapter for all these programs.


Quickpost info


9 Comments »

  1. There is interest…

    Comment by JJ — Wednesday 11 June 2008 @ 15:15

  2. […] Filed under: My Software, Quickpost, WiFi — Didier Stevens @ 9:10 As promised in my previous post, here is another Python program for the AirPcap […]

    Pingback by Quickpost: WiFi Probe Request Logging with an AirPcap Adapter « Didier Stevens — Tuesday 24 June 2008 @ 9:11

  3. Thanks for this…I’d like to see what else you have….

    Comment by Nels — Tuesday 24 June 2008 @ 14:03

  4. […] made a modification to my Python program to do channel hopping with the AirPcap adapter. Now you can specify a sequence of channels with option […]

    Pingback by AirPcap Channel Hopping With Python | Didier Stevens — Monday 2 February 2015 @ 0:01

  5. Hello,

    I am trying to use your script to change the channel of airpcap. I don’t understand the line of code where the dll for airpcap is loaded. Can you tell what exact dll is this and will it be available in the standard wireshark installation on WIndows?

    Regards,
    Sharath

    Comment by Sharath Chandra — Friday 8 April 2016 @ 6:57

  6. @Sharath Can you give me the line number?

    Comment by Didier Stevens — Friday 8 April 2016 @ 8:03

  7. Wow! That was a very quick reply!

    I continued my experimentation and figured out that on my Windows laptop, the airpcap.dll was the one required to be used.
    I have a problem in line number 71 while using the AirpcapOpen function from the DLL.

    I tried both the cdll and WinDLL methods to load the library. The loading of the library has been successful with the WinDLL method. The current problem I have is with passing the first argument to the AirpcapOpen function. I see in your code that the create_string_buffer has been done for the adapter name. When I try the same, I get the following error:
    adapter = create_string_buffer(” \\\\.\\airpcap00″)
    File “C:\Python34\lib\ctypes\__init__.py”, line 63, in create_string_buffer
    raise TypeError(init)
    TypeError: \\.\airpcap00

    I tried an experiment of sending that string as a buffer like this:
    adapter = create_string_buffer(b” \\\\.\\airpcap00″)

    With this, the hAPC variable gets the value 0.

    Can you please help me out with this?

    Comment by Sharath — Friday 8 April 2016 @ 8:31

  8. Sorry, but I don’t follow you anymore. Do you have a problem with my script? Or are you writing your own script and is that causing problems?

    Comment by Didier Stevens — Friday 8 April 2016 @ 12:09

  9. Hi Steven,

    I was referring to yours and writing another one similar to it. I wasn’t sure how the cdll works and tried asking you the doubts. I then resolved the issue in my script that I was facing. Referring to your code was of immense help! Thanks a lot for uploading your code!

    Cheers,
    Sharath

    Comment by Sharath — Friday 8 April 2016 @ 12:20


RSS feed for comments on this post. TrackBack URI

Leave a Reply (comments are moderated)

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 451 other followers

%d bloggers like this: