Skip to content

Instantly share code, notes, and snippets.

@rushipkar90
rushipkar90 / findextensions.sh
Created September 25, 2015 16:34
findextensions.sh
#!/bin/sh
# Directory to store log files in
DST=/root/logs
# Any logs older than this will be deleted first
KEEPDAYS=14
# Create DST if it doesn't exist
if [ ! -d "$DST" ]; then
@rushipkar90
rushipkar90 / find_malicious_symlinks.sh
Created September 25, 2015 16:34
find_malicious_symlinks.sh
@rushipkar90
rushipkar90 / forcepwchange.sh
Created September 25, 2015 16:35
forcepwchange.sh
#!/bin/sh
if [ $# -lt 1 ]; then
echo "No arguments supplied"
echo "usage: sh $0 <username>"
exit 1
fi
if [ ! -d /home/$1 ]; then
echo "User doesn't exist"
echo "usage: sh $0 <username>"
@rushipkar90
rushipkar90 / ftplogcheck.pl
Created September 25, 2015 16:36
ftplogcheck.pl
#!/usr/bin/perl
use warnings;
use strict;
use Getopt::Long;
use Data::Dumper;
my $file = '';
my $csv = 0;
my $all = 0;
GetOptions(
@rushipkar90
rushipkar90 / generate_client_list.sh
Created September 25, 2015 16:37
generate_client_list.sh
#!/bin/bash
# Directory to store log files in
DST=/root/logs
# Any logs older than this will be deleted first
KEEPDAYS=5
# Create DST if it doesn't exist
@rushipkar90
rushipkar90 / getBPS-rx.sh
Created September 25, 2015 16:37
getBPS-rx.sh
#!/bin/bash
for i in 1 2; do X=$Y; sleep 1; Y=$(/sbin/ifconfig eth0|grep RX\ bytes|awk '{ print $2 }'|cut -d : -f 2); echo "$(( Y-X ))"; done | tail -1
@rushipkar90
rushipkar90 / getBPS-tx.sh
Created September 25, 2015 16:38
getBPS-tx.sh
#!/bin/bash
for i in 1 2; do X=$Y; sleep 1; Y=$(/sbin/ifconfig eth0|grep TX\ bytes|awk '{ print $6 }'|cut -d : -f 2); echo "$(( Y-X ))"; done | tail -1
@rushipkar90
rushipkar90 / geteth0.sh
Created September 25, 2015 16:38
geteth0.sh
#!/bin/bash
/sbin/ifconfig eth0 |grep bytes|cut -d":" -f2|cut -d" " -f1
/sbin/ifconfig eth0 |grep bytes|cut -d":" -f3|cut -d" " -f1
@rushipkar90
rushipkar90 / killallproc.sh
Created September 25, 2015 16:39
killallproc.sh
#!/bin/bash
ps aux | grep $1 | grep -v root | awk '{print $2}' | xargs kill -9
@rushipkar90
rushipkar90 / linkspam.sh
Created September 25, 2015 16:39
linkspam.sh
#!/bin/sh
for i in `cat /etc/userdomains| cut -d":" -f1 | grep -v \*`; do grep $i.zip /var/log/messages; done