Website hacked, how to remove malicious code with SED / GREP

前端 未结 3 878
夕颜
夕颜 2020-12-11 21:55

a website of mine is hacked. In every php file a line of code is added. I wont post the complete code here, but it starts with:



        
相关标签:
3条回答
  • 2020-12-11 22:09

    You can try this : https://github.com/daniyalahmadk/RMCI

    Just need to put that code in box and hit submit, it will search code from files and remove them all once.

    0 讨论(0)
  • 2020-12-11 22:10

    You need to add s/ at the start.

    sed 's/<?php if(\!isset.*gzagexgpdc-1; ?>//g' *.php
    

    OR

    sed -r 's/<\?php if\(!isset.*gzagexgpdc-1; \?>//g' *.php
    

    Add -i parameter to save the changes made.

    0 讨论(0)
  • 2020-12-11 22:20

    This should work.

    find . -name "*.php" -print0 | xargs -0 sed -ri '1s/^<\?php if\(!isset\(\$GLOBALS\[.*-1; \?>//' *.php
    
    0 讨论(0)
提交回复
热议问题