EvilZone
Programming and Scripting => Scripting Languages => : frog May 24, 2012, 09:11:47 PM
-
This line alone will cat every file that the user has permission to read.
for item in $(find /* -name "*"); do cat $item; done
Now we add another loop inside of this mechanism along with a grep and some other things to find what we want.
for item in $(find /* -name "*")
do
for filtered in `cat $item | grep x`
do
echo "Filename: "; echo $item; echo ""; echo "Data:"; echo $filtered; echo ""; echo ""
done
done
Change the parameters of grep inside the second 'for' loop to modify the search.
This script takes forever to run depending on the performance of your system. It also makes your terminal program shit its pants when you run it. It's just for fun, and I was thinking you could use `hexdump -C | grep x` to find certain patterns of bytes in any given file.
-
$ grep -rn findme /
or using find/grep:
$ find / -exec grep -Hn findme {} \;
-
Nice to see you and your one-liners again, xzid :D
-
That's much cleaner. I guess that's what I get for not using the man pages.