Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: Simple Script to search Hackers file or Malicious Script with Particular pattern  (Read 3266 times)

0 Members and 1 Guest are viewing this topic.

mohitht

  • Guest
This is a simple script to search files contains the patterns that mainly used by hackers. We can include as many as patterns in this script and delete those files to protect server from hacking.

Create a file

# vi search.sh


Insert the following lines to the file .





#!/bin/bash

PATTERNS=r57sh c99sh h00ly 0wn3d rst.void.ru
PATTERNS_FINAL=$(echo $PATTERNS | sed 's/  /|/g')
find /home/*/public_html/ -type f -exec grep -Eil "$PATTERNS_FINAL" {} ; >> /root/result.txt





Save the file.



Give execute permission for the file  that is created.


chmod +x searchscript.sh


execute by

./search.sh 


You can see the result under


  # cat /root/result.txt



Thanks