Bash

Bash Scripting - Recursive MD5sum On Files In Directory

Blog tags: 

Recently, I wanted to get the MD5sums of all of the files with a specific extension in the current directory and create a hash sum file for each. This was achieved using the following Bash script.

#!/bin/sh

# Get a list of files in a directory without the .md5 extension
# Note the ticks
LIST=`find . -name "*.txt" -a ! -name '.md5'`

Remote Logging Using Syslog And Logging Shell Commands Remotely

Blog tags: 

While trying to come up with a simple keylogging solution that provides remote logging, I came across a pretty good solution of using the audit package and altering bash.

One of the problems I came across was that many of the keyloggers could not log any commands sent through a SSH connection - this does on Fedora anyways.

Edit /etc/rsyslog.conf and uncoment this line:

vi /etc/rsyslog.conf

*.* @192.168.18.1:514>/code>

<b>Note: this is where the remote server is.</b>

Install and run the following:

<code>yum install -y audispd-plugins pasacct

SSH Password Attacks - Block IP Script

Blog tags: 

Running SSH and some script kiddy or attacker is running a username/password dictionary against it?  This script might help:

#!/bin/sh
# ----------------------------------
# IPTABLES / SSHD ATTACK BLOCKING SCRIPT
#
# Author: Ron Brash
# March 1st, 2011
#
# Purpose:
# Add offending IP from failed SSH connections
# to the iptables (firewall) rules.
#
# ------------------------------------

## Explaination

Subscribe to RSS - Bash