Once, a vulnerability was revealed on one of the file hosting services through which an attacker could upload files to a PHP server and execute it, the vulnerability was fixed and just in case, I wrote a script that would send an email if a PHP file was found in the specified directory:
Continue reading “Script for email notifications when detecting prohibited files”Category Archives: Scripts
Script to check the free space on the HDD
Usually I use Zabbix to monitor free space on the disk system, which also notifies when it is running out, but Zabbix is not used on some servers, so I wrote a small script that performs this check and sends an email notification, for example, if there is less than 12Gb of free memory:
Continue reading “Script to check the free space on the HDD”IPTables quick setup script
Sometimes it is necessary, for example, to delete all IPTables rules and to add only the necessary, so for convenience, you can specify them in the script, and then execute it.
Continue reading “IPTables quick setup script”ClamAV script for automatic scanning and email notifications
I will give an example of a script for scanning and email notifications when infected files are detected.
Continue reading “ClamAV script for automatic scanning and email notifications”Simple Watchdog script
I will give an example of a simple script for restarting services if they are not running and sending a notification by email:
Continue reading “Simple Watchdog script”Backup script example
I will write below a simple example of backing up mysql databases using mysqldump.
Continue reading “Backup script example”The script against DDOS attacks
I will give an example of a simple script against DDOS attacks for NAT servers.
The script is executed when the total number of “conntrack” connections is more than 500000, it saves to the text file the IP address which has the most “conntrack” connections, who has more than 10,000 – adds to the ipset list.
File Transfer Script over SFTP in Windows
I will give an example of a file transfer script via SFTP in Windows.
Continue reading “File Transfer Script over SFTP in Windows”PPS Viewer Script (Packets Per Second)
The script every second displays the number of incoming and outgoing packets per second on the specified network interface.
Place the contents of the script into a file, for example, pps.sh and execute by specifying the name of the network interface (you can stop the execution of the script with CTRL+C):
Script to send SMS via Goip4 gateway for ABillS
I will give an example of a PHP script to which I send SMS messages through the GoIP4 gateway.
First, we choose tariffs with only monthly charges:
Continue reading “Script to send SMS via Goip4 gateway for ABillS”