Home

May 6th, 2009

Feature creep?

WARNING: Technobabble! You may not understand a lot of this! (If you do, though, so much the better)

Recently I had need of a script or tool that would reverse DNS a bunch of IPs, and then do a forward lookup on the results of the rDNS to ensure that the hostnames given would, indeed, point back to the IPs originally looked up to begin with. Something like this would, of course, be done to verify proper DNS operation of a host; essentially to make sure everything is pointing to the right place.

Take a look at the output and capabilities of it thus far: double-lookup output behind the cut )

I use a chunk of the Googlebot subnet as it's publicly available and I don't think Google would mind me hammering their rDNS too much in the name of getting things working. They probably deal with worse on a daily basis. I don't get into changing the second octet, because I don't really have forever to wait for my script to go through 65,535+ hosts, and that would almost certainly get me into trouble -- but the capability is there (or so I hope) in case someone really wants to play with it.

This thing is pretty good; you can pass it a single IP or a range (x.x.x.x-y.y.y.y) and it will cycle through the IP addresses in the range given, getting their hostnames and getting the IP address attached to the hostname (not always the same as the IP given to it!). But see, here's the thing: this is where my ambition grows and threatens to take over and deny me sleep tonight.

Because I want to add more.

I want to make the IPs you can pass to it capable of being comma-delimited; that is, you can pass a range and three individual IPs, or you can pass four ranges, an individual IP, and then another range. Basically I want to make this versatile as hell, so you only have to use it once from the command line and get all the information you want with regards to what it is.

Technically, it's as simple as throwing a split() function in there and iterating through the resultant array of that; applying my regex and routines to each member of that array, which results in the ability to query for a bunch of different machines at once, rather than just one range or just one machine.

The problem, of course, is that it's 1:50 AM (again... I planned on sleeping earlier but I'm a perfectionist), and I quite honestly don't have the time to pursue this further. Besides, it's complete enough for what I need to use it for, and that's the important bit, because now it's like, ten times easier to do the task I have to do. But that comes tomorrow. :)

However, for anyone who's interested in my ugly-ass Perl code, it's all behind the cut.

double-lookup.pl )

Caveat: the column formatting used in this script is fairly atrocious (although to be fair, the script itself ain't exactly aesthetic... or commented). The output won't be pretty, but it should be separated enough so that you can see all three columns distinctly and it won't be too hard transcribing it into something else, if need be.

Oh, it's also not commented and fairly messy. Watch your step.

So as Stan Lee might have used to say, farewell for now, true believers!

Choice tidbits of the Auto-Meme

Nicked from [info]takhisis -- the Auto-Meme is a script that randomly puts together a bunch of memes for often hilarious combinations.

Here are some of the excerpts I have:

- IPOD IS THE BOX OF RAPE OF THE PENGUINS
- CEILING TORRENT IS WATCHING YOU GET LAID
- THESE ARE NOT THE WHALES YOU'RE LOOKING FOR
- BLOGGER'S CLOSED DUE TO STEVE BALLMER
- I'M A BUTTON! I'M A BUTTON! SUCK MY DIIIIIICK! I'M A BUTTON!
- JESUS CHRIST IT'S A TROLL GET IN THE TRAP (that's terrible)
- MAXIMUM TECHCRUNCH RUMOURS YIELDS MAXIMUM LAWYERS
- PROTIP: TO DEFEAT THE MORON, SHOOT AT IT UNTIL IT DIES.
- I REALLY DO HOPE YOU'RE GETTING LAID AND NOT ACTUALLY THAT FUCKING ILLEGAL.
- NOOOO THEY BE GOOGLING MY DONG
- I AM ELVIS, HEAR ME GET LOW
- I WILL NOT TEABAG THIS PIG — IT IS DIZZY.
- I REALLY DO HOPE YOU'RE SHOOPIN AND NOT ACTUALLY THAT FUCKING RETARDED.
- THIS IS BUTTHURT. I CAN TELL BY THE DICTIONARIES, AND FROM HAVING SEEN A LOT OF GUYS IN MY DAY.
- 2GIRLS1CUP? IN MY ICE CREAM? (anyone who has actually seen this will understand; anyone who has not -- don't)

I can't seem to get it to output any gold like others, though.

Feature creep: an addendum

I actually added a feature or two to it today: an option that makes the third column (the IP of the hostname acquired by the reverse lookup of a given IP or one of the IPs in the given range) simply read out "match" if it matches the IP in the reverse lookup. Plus, the way I implemented it sets it up so that I can easily add more command-line options later.

November 2009

S M T W T F S
1234567
891011121314
15161718192021
22232425262728
2930     

Advertisement

Powered by LiveJournal.com