msgbartop
A cronological documentation test project, nothing serious, really!
msgbarbottom

08 May 2007 Rule-based DoS attacks prevention shell script

Dette scriptet er ikke testet samt DoS bør hindres på kernel nivå!

A simple rule-based DoS attack-prevention shell script. However, the proposed shell script is not a perfect tool for preventing DoS attacks, but a powerful tool for alleviating DoS attacks overheads of the Linux servers significantly.
(more…)

Tags: , , , , ,

Posted by

07 May 2007 Monitoring /var/log/secure for break-in attempts

date >> ssh-intruders.log ; cat /var/log/secure | grep -i "sshd.*authentication failure" | sort | awk '{FS="rhost="; print $2}' | awk '{FS="user="; print $1}' | grep ".*\..*\." | grep -v "knownhost.com" | grep -v "knownhost2.com" | sort | uniq | while read i; do counter=`grep -i "$i" /var/log/secure | wc -l` ; echo "$counter attempts by $i"; done >> ssh-intruders.log ; cat ssh-intruders.log

Tags: , , ,

Posted by

07 May 2007 Find duplicate usernames in /etc/passwd

# cat /etc/passwd | awk -F: '{print $1}' | sort | uniq -c | grep -v 1
# cat /etc/shadow | awk -F: '{print $1}' | sort | uniq -c | grep -v 1
# awk -F: '{ print $1, $5}' /etc/passwd

Tags: , ,

Posted by

18 Apr 2007 nmap/nbtscan scan for å finne pc med åpen port

Dette scriptet scanner IP-er fra ei fil og finner ut hvem som har en spesiell port åpen.

Lim inn følgende script kode i fila portLookup.sh

#!/bin/bash
NETWORKTARGET=$1
PORT=$2
FN="port"

# Scan Network Input File for active hosts saving IPS to $FNips.txt
nmap -sS -p $PORT -n -iL $NETWORKTARGET -oG - | grep open | awk '/[1-9].[1-9]/ {print $2}' > ${FN}ips.txt

# use nbtscan to find hostnames and generate the ip to name $FNlookup file
nbtscan -f ${FN}ips.txt | awk '/[1-9].[1-9]/ {print $1 " " $2}' > ${FN}lookup.txt

echo "Scan Complete"
echo "Port Scanned: "$PORT
NUMIPS=`cat ${FN}ips.txt | wc -l`
NUMHOSTS=`cat ${FN}lookup.txt | wc -l`
echo "Number of IPs Found: "$NUMIPS " See file ${FN}ips.txt"
echo "Number of Netbios Names Found: "$NUMHOSTS " See file ${FN}lookup.txt"

Scriptet henter data/IP-adresser fra ei tekstfil og du angir hvilken port som skal scannes på følgende måte:

portLookup.sh tekstfil portnr
portLookup.sh hosts.txt 80

Eksemplet ovenfor henter ut IP-adresser fra fila hosts.txt og scanner etter PCer med port 80 åpen.

En enkel måte å generere ei slik fil kan leses på generate a list of target hosts to nmap scan/

Resultatet legges i filene portips.txt og portlookup.txt

Tags: , , , ,

Posted by

09 Feb 2007 nmap result as comma separated list, csv

grep "^[0-9*]" nmap.out|awk '{print $1 "," $2 "," $3 "," $4 "," $5}'

Tags: , , ,

Posted by