Wi-Fi SSID Sniffer in 10 Lines of Python
hackoftheday.securitytube.net
hackoftheday.securitytube.net
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.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.
> from scapy.all import *
Yeah.
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.
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.
> 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.
$ startxTechnically 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.
All members of the "Do X in N lines or M minutes" meme are examples of stringing together one or more powerful libraries.
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?
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.
Let's give Philippe (Scapy's author) the credit he deserves.