Quantcast
Viewing all articles
Browse latest Browse all 25

Automagically create a /etc/hosts file based on your DHCP list (only works on Linksys WRT54G router)

$ curl -s -u $username:$password http://192.168.1.1/DHCPTable.htm | grep '<td>.* </td>' | sed 's|\t<td>\(.*\) </td>\r|\1|' | tr '\n' ';' | sed 's/\([^;]*\);\([^;]*\);/\2\t\1\n/g'

Will create a sample etc host file based on your router's dhcp list.

Now I know this won't work on most routers, so please don't downvote it just because it doesn't work for you.

Image may be NSFW.
Clik here to view.
commandlinefu.com

Diff your entire server config at ScriptRock.com


Viewing all articles
Browse latest Browse all 25

Trending Articles