Hacker News new | past | comments | ask | show | jobs | submit login
Wi-Fi SSID Sniffer in 10 Lines of Python (securitytube.net)
71 points by infoseckid on April 1, 2013 | hide | past | favorite | 24 comments



He's using the incorrect datatype for ap_list. This is apprently the collection of AP's already seen, and used with this pattern:

  ap_list = []
  if AP not in ap_list:
      ap_list.append(AP)
      print AP
It works, but does a linear scan every time. It's better to use a set() in such a case:

  ap_seen = set()
  if AP not in ap_seen:
      ap_seen.add(AP)
      print AP
For looking up things, a set (essentially a dict without values) is much quicker than a list. Is this premature optimisation? Perhaps, but using a list for this purpose is also a code smell.


Nice catch! This may be required as we are comparing against every beacon frame and one could have a large number of them over the air at any time.


> Is this premature optimisation?

In this case, I feel that it is not. It's just using the right data set for the job. This is exactly the sort of thing that sets are for.


> A 10 Line Wi-Fi SSID Sniffer

> from scapy.all import *

Yeah.


Missing the point. That line doesn't do anything by itself.

Obviously we're not going to have Wireshark innards built with 10 lines of python (or whatever other language). However, the fact that such an easy to use, high level library available for packet inspection allowing one to build a quick AP scanner is completely relevant.


My point is that the title is not really useful. Something along the lines of 'Using the Scapy library for wireless packet inspection' would be more reasonable. All this 'whatever with N lines' articles when you are using a 200MB tool stack really makes no sense. This is not a 1k demo where character count matters at all.


It makes total sense when you want to actually sit down and write something like this. The point is that this is an easy, quick-to-hack-together thing, not a big project.


> My point is that the title is not really useful.

For a developer, knowing how many lines are needed to get something done with a given API can be a good indicator of how generally nice it is to work with -- compare Python's URLLib vs the Requests library, for example.


This is why his grievance wasn't with the text but the title.


Good grief! Do you want this team to build the computer from discrete components, then custom code their OS using dip switches too?


As long as they used less than 10 dip switches


Of course not, that's an absurd exaggeration.


adplz, I can do wifi ssid sniffing using 0 lines of code and only using my mouse. Oh yeah, and Wireshark. But that is irrelevant according to lloeki.


Finally, one person on HN who gets it :) Pleased to meet you another sane person on HN! :)


  > A 10 Line Wi-Fi SSID Sniffer
  > #!/usr/bin/env python
Yeah.

I bet it's even being run on an OS that they didn't write themselves.


There is a point where it is reasonable, there is a point where it is not. Look, a complete X graphical environment with one bash line!

    $ startx


I kind of agree with @adlpz on this. It's like saying, "Serve a website with 1 line of code!" and then running `sudo service apache start`.

Technically correct, but highly misleading. Either way, I hope you realize I'm not being snarky here - just wanted to share my point of view on this. OP's article was great, that's a ridiculously powerful library.


Meh. Strictly speaking you are correct, but deconstructing it, it means that we can never say anything is easy (N lines of codes for small N's being synonymous with 'easy'). Yes, it's actually bloody easy to serve a website, and that's a good thing, and if someone didn't know it was possible, it's been helpful to write that 'tutorial'.

All members of the "Do X in N lines or M minutes" meme are examples of stringing together one or more powerful libraries.


> Technically correct, but highly misleading.

Who exactly would be mislead by this? It's April 1st, but was anyone really tricked into thinking a full packet sniffer was written in 10 lines?


For me, getting the first working example running is often the biggest step. Up until then, you don't know whether what you are doing will work at all. After that, you can start fiddling with it and changing bits and pieces.

Saying "Serve a website with 1 line of code!" and then starting apache with that 1 line is useful, because I can then go from there to changing configurations. Fewer lines for the rough draft => fewer places to mess up in unknown ways.


Yeah, this totally sucks. Show me the assembly and tell me that's 10 lines. 10 x86 instructions, that's my total attention span. :)


Unless you smelt your own silicon for the transistors and ICs, it's cheating!


Should be WiFi SSID Sniffer in 10 lines of Scapy.

Let's give Philippe (Scapy's author) the credit he deserves.


Is there a problem/drawback with "iw phy phy0 interface add mon0 type monitor" besides using the airmon tool to create a monitor interface? It works nicely with the iw command.




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: