In Progress

Search/replace Perl or Bash script

Hi All,

Here is the logic that I need:

I'm not a perl or bash script expert, so my syntax is not correct.

We have a server that has been hacked and was injected with lines like:

<iframe frameborderMODIFIED="0" onlMODIFIEDoad="if (![url removed, login to view]){ this.src='[url removed, login to view]'; this.height='0'; this.width='0';}"

>mpjekrjkyxsjdivcdgobvmcrmdsqfoy</iframe>

(I injected the word MODIFIED so that no harm will be caused to anyone surfing here).

Running: grep -lr ":8080" * > [url removed, login to view]

Captures the list of all the infected files.

To MANUALLY clean each file I use the following [url removed, login to view] file:

for example:

./[url removed, login to view] [url removed, login to view]

server #less [url removed, login to view]

#!/usr/bin/perl -i

undef $/;

$_ = <>;

s/<iframe frameborder.*?iframe>//msg ;

print "$_";

Now, this is doing the work for a Single file.

However, I have hundreds of files that need to be sanitized, so I want to run the [url removed, login to view] on every file that is in the [url removed, login to view]

I tried to run the following logic, but I'm not a good bash/perl developer, so this is where I need your assistance in creating the right loop that will run correctly:

#!/usr/bin/perl -i

grep -lr ":8080" * > [url removed, login to view]

open (FILE, "<listofbadfiles.txt>") or die "Can't open file!";

while (<FILE>)

{

undef $/;

$_ = <>;

s/<iframe frameborder.*?iframe>//msg ;

print "$_";

}

This is a short script/project, probably a 5 minutes script.

When you bid,. please make sure you know Perl and Bash scripting.

I want to be able to run:

./[url removed, login to view]

and have the script grep recursivly all the files in the directory and below, and then process them accordingly.

Very simple,. very short.

Good luck and Happy bidding.

Skills: C Programming, Java, Linux, Perl, Python

See more: this is a search, search here, recursivly, perl search script, developer search, developer perl, bash directory script, bash script directory, bash file, bash 0, search http, word script, short script, search file, scripting word, msg, make loop, http search, height bid project, creating script, bash script, php script open file, perl msg, script src, open project script

About the Employer:
( 36 reviews ) New York, United States

Project ID: #539247

Awarded to:

trezorg

Hi. I can do it. Details is in PM.

$30 USD in 1 day
(27 Reviews)
4.9

4 freelancers are bidding on average $30 for this job

aterekhov

Hello, I've already solved that problem and I have the required script. Please see pmb for details.

$30 USD in 0 days
(5 Reviews)
4.2
ruimaxwell

Hi. Please check PMB. Thanks

$30 USD in 1 day
(8 Reviews)
4.0
mabin

I can do this project in 1 day I am linux webserver admin from the past 4 years and have encountered this same problem in our servers and fixed it. You can contact me on my business email

$30 USD in 1 day
(0 Reviews)
0.0