My site got hacked and at every first line of php file i have line:
<?php $knitglx = '<%G]y6d]281Ld]245]K2 ... $knitglx=$fmfqhx-1; ?><?php (it is very long). Since i am using wordpress there are millions of files and it is impossible to open 1 by 1 and delete this line. Is there a way to delete them all at once?
I read something about some sed functions but i do not know how to use it and after some discussion i know that will not solve my problem so now i am looking a way how to scan and remove viruse from my files. Any help would be okay.
If your site got hacked you REALLY should not try to clean the source code they injected!. It is very likely that you will forget something and you may spread malware or whatever to the visitors of your WordPress site. Also try to figure out why you got hacked and fix the hole.
Make sure to delete all files from the server and change all your passwords (FTP, WordPress, etc. etc.).
Here is what you can do:
1) Contact your provider and ask them to setup the latest clean backup
2) Setup your own latest clean backup
3) If you really have no backup (which is very bad) do the following:
Simple deleting the first line of each file is most probably not enough. However there are solutions to this:
Batch file to delete first 3 lines of a text file
Delete certain lines in a txt file via a batch file
Note: With an IDE like Netbeans or IntelliJ you can do a search / replace on a huge number of PHP files. This might also help if step three is the only option.
The third possibility is not good because it means a lot of work ... good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With