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.
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.
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.
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.
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.