"Bad programming? Use good programming. It’s so simple! How could we not have seen it!" -Ptacek
Read this post.
Friday, April 18, 2008
Friday, April 11, 2008
Evil Friday
(YMMV.)
Take one DHCP server that allows you to set your hostname in DNS. Add a whole mess of workstations which are configured with the same search suffix as the DNS domainname. Then call yourself google. Set up a web server and catch all the people who are just typing "google" into their browsers. (I used a Python script to log the request, then 302 the user to google.com.)
Optional part II: clobber the DNS entry for a legitimate host on the network and have REAL fun. (Yes, this works, at least in my environment.)
Take one DHCP server that allows you to set your hostname in DNS. Add a whole mess of workstations which are configured with the same search suffix as the DNS domainname. Then call yourself google. Set up a web server and catch all the people who are just typing "google" into their browsers. (I used a Python script to log the request, then 302 the user to google.com.)
host1.domain.edu - - [11/Apr/2008 14:38:27] "GET / HTTP/1.1" 302 -Optional: go phishing.
host2.domain.edu - - [11/Apr/2008 14:46:38] "GET / HTTP/1.1" 302 -
host3.domain.edu - - [11/Apr/2008 14:49:34] "GET / HTTP/1.1" 302 -
host4.domain.edu - - [11/Apr/2008 14:55:21] "GET / HTTP/1.1" 302 -
host5.domain.edu - - [11/Apr/2008 15:03:45] "GET / HTTP/1.1" 302 -
host6.domain.edu - - [11/Apr/2008 15:07:58] "GET / HTTP/1.1" 302 -
host7.domain.edu - - [11/Apr/2008 15:09:45] "GET / HTTP/1.1" 302 -
host8.domain.edu - - [11/Apr/2008 15:10:17] "GET / HTTP/1.1" 302 -
host9.domain.edu - - [11/Apr/2008 15:17:01] "GET / HTTP/1.1" 302 -
host10.domain.edu - - [11/Apr/2008 15:17:37] "GET / HTTP/1.1" 302 -
Optional part II: clobber the DNS entry for a legitimate host on the network and have REAL fun. (Yes, this works, at least in my environment.)
Tuesday, April 8, 2008
Bash Brace Expansion
I have to give a little shout out to Bash brace expansion. This is one of the neat little toys that I rarely see mentioned. The really quick summary reads like this:
And of course, something like this this comes in really handy:
$ echo test_{foo,bar,baz}which is useful enough, but where it really shines is in sequence expansion. The idiomatic Bash For loop I've often seen is something like:
test_foo test_bar test_baz
$ for i in `seq 1 10`; do echo $i; donewhich is just nasty. Compare to:
$ for i in {1..10}; do echo $i; donewhich is nicer, but even more nice is:
$ echo {1..10} | tr ' ' '\n'(IMHO.)
And of course, something like this this comes in really handy:
$ wget www.somewhere.com/{a,b}{1..9}.jpgNot sure what I would use that for... ;)
Subscribe to:
Posts (Atom)