Linux > Server Security & Hardening

Simple Script to search Hackers file or Malicious Script with Particular pattern

(1/1)

mohitht:
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








Navigation

[0] Message Index

Go to full version