Posted: 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? |
|
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 |
|
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. |
|
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. 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}) |
|
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}) 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. |