Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need correct syntax find /home -name viewtopic.php -exec (xargs 2

Status
Not open for further replies.

linuxMaestro

Instructor
Jan 12, 2004
183
US
need correct syntax
find /home -name viewtopic.php -exec (xargs cat $i | grephtmlspecialchars\(urldecode) > sites_running_exploitable_phpBB.txt

I want to find all files named viewtopic.php, check to see if it has the exploitable code and if it does enter it into a txt file, what is the correct syntax?
 
see if it has the exploitable code and if it does enter it into a txt file
How you do that for ONE file ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I know you want the syntax for many files.
I asked you how you do that for one file in order to show you how to do the same for many files.
Anyway, man find.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Can I suggest something like:
Code:
#!/bin/ksh
for filename in `find /home -name "viewtopic.php" -print`
do
   echo ${filename} >> sites_running_exploitable_phpBB.txt
   grep "htmlchars" ${filename} >> sites_running_exploitable_phpBB.txt
done
Perhaps a bit simplistic in that the output file will contain a list of all files named "viewtopic.php" including their path, plus the lines of the files that contain the string "htmlchars".

I hope that helps (at least as a start point).

Mike
 
Same exact idea as Mike042, except only those files containing the desired (or undesired?) string are listed:

str="htmlspecialchars"
find . -name "viewtopic.php" >flist
for i in `cat flist`
do
found=`grep "$str" $i`
if [ "$found" != "" ]
then
echo $i >>outfile
echo $found >>outfile
echo "================================" >>outfile
fi
done
rm flist
more outfile
 
find /home -name viewtopic.php | xargs grep 'SearchPattern' > sites_running_exploitable_phpBB.txt

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top