5 ms·
Wi-Fi SSID Sniffer in 10 Lines of Python
- adlpz 14y ago> A 10 Line Wi-Fi SSID Sniffer > from scapy.all import * Yeah.
- lloeki 14y agoMissing 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.
- infoseckid 14y agoFinally, one person on HN who gets it :) Pleased to meet you another sane person on HN! :)
- adlpz 14y agoMy 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.
- dwb 14y agoIt 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.
- xradionut 14y agoGood grief! Do you want this team to build the computer from discrete components, then custom code their OS using dip switches too?
- Shish2k 14y ago> 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.
- toki5 14y agoThis is why his grievance wasn't with the text but the title.
- deleted 14y ago[deleted]
- cthackers 14y agoadplz, 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.
- switch007 14y ago> 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.
- bjornsing 14y agoYeah, this totally sucks. Show me the assembly and tell me that's 10 lines. 10 x86 instructions, that's my total attention span. :)
- adlpz 14y agoThere 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
- gngeal 14y agoUnless you smelt your own silicon for the transistors and ICs, it's cheating!
- sergiotapia 14y agoI 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.
- mseebach 14y agoMeh. 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.
- darkarmani 14y ago
- Luyt 14y agoHe'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.
- infoseckid 14y agoNice 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.
- arantius 14y ago> 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.
- h43z 14y agoIs 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.
- tzury 14y agoShould be WiFi SSID Sniffer in 10 lines of Scapy. Let's give Philippe (Scapy's author) the credit he deserves.