Warning

 

Close
Confirm Action

Are you sure you wish to do this?

Cancel Confirm
AR15.COM
10/4/2013 5:32:16 AM EDT
OK, I have an impossible task that I've been handed and I need some help.

I need to search for all 10.4.0.0/16 addresses that are hardcoded into configuration files or binaries across my organization. Here's what I'm thinking:

Loop over all files in the filesystem.
Run each file through strings to get printable text.
Run output of strings through a regex looking for 10.4.0.0 through 10.4.255.255
Output any matching file names

The catch is that I'll need to do this for RHEL, Win 7, and Win XP.

Does this sound reasonable?
10/4/2013 5:38:29 AM EDT
[#1]
reasonably crazy!
how about zip files? zcat?



i assume the next step is going to be to replace the subnet portion in them with a new one.
i hate messing with cmdline grep/sed stuff on windows machines. With cygwin and cygputty it's manageable
I dont' envy you, please report back at the end of the day with your feelings on the task then!
edit make that puttycyg and I also think the newest cywin terminal is based on putty itself and works more like I prefer
 
10/4/2013 5:47:54 AM EDT
[#2]
My plan isn't to do any replacing for now. Step 1 is find. Step 2 is fix.
10/4/2013 6:10:31 AM EDT
[#3]
Looks like the plan i would come up with, good luck!


10/4/2013 8:29:39 AM EDT
[#4]
Quoted:
Run output of strings through a regex looking for 10.4.0.0 through 10.4.255.255
Output any matching file names

The catch is that I'll need to do this for RHEL, Win 7, and Win XP.

Does this sound reasonable?
View Quote


Why regex?  Chances are awfully good that just searching for "10.0.4." will work just fine, and save you some time.

Grep will work for RHEL.  For Windows... good luck.  You may want to just install and use a version of grep *for* Windows.
10/4/2013 9:17:12 AM EDT
[#5]
I would write a python script.  Runs on all your platforms.  Lots of examples on the web
10/4/2013 10:51:14 AM EDT
[#6]
Quote History
Quoted:


Why regex?  Chances are awfully good that just searching for "10.0.4." will work just fine, and save you some time.

Grep will work for RHEL.  For Windows... good luck.  You may want to just install and use a version of grep *for* Windows.
View Quote View All Quotes
View All Quotes
Quote History
Quoted:
Quoted:
Run output of strings through a regex looking for 10.4.0.0 through 10.4.255.255
Output any matching file names

The catch is that I'll need to do this for RHEL, Win 7, and Win XP.

Does this sound reasonable?


Why regex?  Chances are awfully good that just searching for "10.0.4." will work just fine, and save you some time.

Grep will work for RHEL.  For Windows... good luck.  You may want to just install and use a version of grep *for* Windows.


He would have to search for the string literal of "10.4." and searching binary files would just about guarantee false positives with that string.

I would use something like : 10\.4\.([0-5]{1,3})\.([0-5]{1,3})
10/4/2013 12:11:33 PM EDT
[#7]
Quote History
Quoted:
I would write a python script.  Runs on all your platforms.  Lots of examples on the web
View Quote

Problem is I would have to install python on 8,000 computers. I'd rather just do it without having to install anything.
10/4/2013 1:02:42 PM EDT
[#8]
Be careful with the ASCII vs Unicode text files.  Some of the Windows search utilities do not handle Unicode files like you think they would.
10/4/2013 9:31:30 PM EDT
[#9]
Quote History
Quoted:


He would have to search for the string literal of "10.4." and searching binary files would just about guarantee false positives with that string.

I would use something like : 10\.4\.([0-5]{1,3})\.([0-5]{1,3})
View Quote View All Quotes
View All Quotes
Quote History
Quoted:
Quoted:
Quoted:
Run output of strings through a regex looking for 10.4.0.0 through 10.4.255.255
Output any matching file names

The catch is that I'll need to do this for RHEL, Win 7, and Win XP.

Does this sound reasonable?


Why regex?  Chances are awfully good that just searching for "10.0.4." will work just fine, and save you some time.

Grep will work for RHEL.  For Windows... good luck.  You may want to just install and use a version of grep *for* Windows.


He would have to search for the string literal of "10.4." and searching binary files would just about guarantee false positives with that string.

I would use something like : 10\.4\.([0-5]{1,3})\.([0-5]{1,3})


Yeah, I was boneheaded and missed the /16.  I was thinking 10.0.4, not 10.4.