Generate a list of target hosts to nmap scan
Legg følgende inn i fila iplist.sh #!/bin/bash # filename: iplist.sh # usage: ./iplist.sh 192.168.1.0/24 > iplist.txt nmap -sL $1 –randomize_hosts | grep ‘^Host’ | cut -d ‘(‘ -f 2 | cut -d ‘)’ -f 1
A chronological documentation test project, nothing serious, really!
Legg følgende inn i fila iplist.sh #!/bin/bash # filename: iplist.sh # usage: ./iplist.sh 192.168.1.0/24 > iplist.txt nmap -sL $1 –randomize_hosts | grep ‘^Host’ | cut -d ‘(‘ -f 2 | cut -d ‘)’ -f 1
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/bashNETWORKTARGET=$1PORT=$2FN=”port”# Scan Network Input File for active hosts saving IPS to $FNips.txtnmap -sS -p $PORT -n -iL $NETWORKTARGET -oG – | grep open | awk ‘/[1-9].[1-9]/ {print $2}’ > ${FN}ips.txt# use […]
I periodically receive files that are somewhat cryptically named, and I like to rename them to something more understandable.
#!/bin/bash for dir in /home/* do cp /path/to/file “$dir” done
Kode for å lage en mappestruktur på år og måneder #!/bin/bash for y in 2000 2001 2002 2003 2004 2005 2006 2007 do mkdir $y ; cd $y ; mkdir 01_Jannuary 02_February 03_March 04_April ; mkdir 05_May 06_June 07_July 08_August ; mkdir 09_September 10_October 11_November 12_December ; cd .. done