added some files at home
commands are a few command notes fritzshark2?.sh are scripts to dump fritzbox traffic to wireshark mount_container is my crypsetup automount skript
This commit is contained in:
9
commands
Executable file
9
commands
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/cat
|
||||||
|
#uniq without sorting:
|
||||||
|
awk '{a[$0]+=1; if (a[$0]<2)print}'
|
||||||
|
#send my mic to remote
|
||||||
|
arecord -f cd -t raw | oggenc - -r | ssh <remote> mplayer -
|
||||||
|
#and reverse
|
||||||
|
ssh <user>@<remotehost> 'arecord -f cd -t raw | oggenc - -r' | mplayer -
|
||||||
|
|
||||||
|
|
||||||
32
fritzshark.sh
Executable file
32
fritzshark.sh
Executable file
@@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Stolen from Hippie2000 and modified by Jackfritt ;)
|
||||||
|
# Stolen from Jackfritt and modified by Chaosmaster :-P
|
||||||
|
ipddr="fritz.box"
|
||||||
|
unset dumpfile
|
||||||
|
unset passwd
|
||||||
|
if [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ ! $1 ]; then
|
||||||
|
echo "Usage: $0 <PASSWORD> [<DUMPFILE>] [<IP>]"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ $1 ] && passwd=$1
|
||||||
|
[ $2 ] && dumpfile="-w $2"
|
||||||
|
[ $3 ] && ipaddr=$3
|
||||||
|
|
||||||
|
# Challenge abholen
|
||||||
|
ChallengeXML=`wget -O - "http://$ipddr/cgi-bin/webcm?getpage=../html/login_sid.xml" 2>/dev/null| grep Challenge`
|
||||||
|
Challenge=`echo $ChallengeXML | awk '{match($0,/>[^<>]+</); print substr($0,RSTART+1,RLENGTH-2)}'`
|
||||||
|
|
||||||
|
# login aufbauen und hashen
|
||||||
|
CPSTR="$Challenge-$passwd"
|
||||||
|
MD5=`echo -n $CPSTR | iconv -f ISO8859-1 -t UTF-16LE | md5sum -b | awk '{print substr($0,1,32)}'`
|
||||||
|
RESPONSE="$Challenge-$MD5"
|
||||||
|
POSTDATA="login:command/response=$RESPONSE&getpage=../html/de/menus/menu2.html"
|
||||||
|
|
||||||
|
# login senden und SID herausfischen
|
||||||
|
SID=`wget -O - --post-data="$POSTDATA" "http://$ipddr/cgi-bin/webcm" 2>/dev/null| grep "name=\"sid\"" | head -1 | awk '{match($0,/value="[^"]+"/); print substr($0,RSTART+7,RLENGTH-8)}'`
|
||||||
|
|
||||||
|
# Internet Capture
|
||||||
|
wget -O - "http://$ipddr/cgi-bin/capture_notimeout?ifaceorminor=3-17 \
|
||||||
|
&snaplen=1600&capture=Start&sid=$SID" 2>/dev/null | \
|
||||||
|
wireshark -k $dumpfile -i -
|
||||||
30
fritzshark2.sh
Executable file
30
fritzshark2.sh
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
IP="fritz.box"
|
||||||
|
echo -n Password:
|
||||||
|
read -s Passwd
|
||||||
|
|
||||||
|
# Challenge abholen
|
||||||
|
Challenge=`wget -O - "http://$IP/login_sid.lua" 2>/dev/null | sed 's/.*<Challenge>\(.*\)<\/Challenge>.*/\1/'`
|
||||||
|
|
||||||
|
# login aufbauen und hashen
|
||||||
|
CPSTR="$Challenge-$Passwd"
|
||||||
|
MD5=`echo -n $CPSTR | iconv -f ISO8859-1 -t UTF-16LE | md5sum -b | awk '{print substr($0,1,32)}'`
|
||||||
|
RESPONSE="$Challenge-$MD5"
|
||||||
|
POSTDATA="?username=&response=$RESPONSE"
|
||||||
|
|
||||||
|
# login senden und SID herausfischen
|
||||||
|
SID=`wget -O - --post-data="$POSTDATA" "http://$IP/login_sid.lua" 2>/dev/null | sed 's/.*<SID>\(.*\)<\/SID>.*/\1/'`
|
||||||
|
|
||||||
|
# Internet Capture
|
||||||
|
#Schnittstelle 1(Internet)=3-17
|
||||||
|
#wget -O - "http://$IP/cgi-bin/capture_notimeout?ifaceorminor=3-17 \
|
||||||
|
#alle Schnittstellen =3-0
|
||||||
|
#wget -O - "http://$IP/cgi-bin/capture_notimeout?ifaceorminor=3-0 \
|
||||||
|
#&snaplen=1600&capture=Start&sid=$SID" 2>/dev/null | \
|
||||||
|
#tshark -i - -S -l -N nmtC
|
||||||
|
#wget -O - "http://$IP/cgi-bin/capture_notimeout?ifaceorminor=3-0 \
|
||||||
|
#Externe Schnittstelle
|
||||||
|
#wget -O - "http://$IP/cgi-bin/capture_notimeout?ifaceorminor=3-17 \
|
||||||
|
#Lokal LAN
|
||||||
|
#wget -O - "http://$IP/cgi-bin/capture_notimeout?ifaceorminor=1-eth0&snaplen=1600&capture=Start&sid=$SID" 2>/dev/null | tshark -i - -S -l -N nmtC
|
||||||
|
wget -O - "http://$IP/cgi-bin/capture_notimeout?ifaceorminor=1-eth0&snaplen=1600&capture=Start&sid=$SID" 2>/dev/null | tcpdump -r - -w /tmp/trace -W 48 -G 1800 -C 100 -K -n
|
||||||
143
mount_container
Executable file
143
mount_container
Executable file
@@ -0,0 +1,143 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
## Functions
|
||||||
|
#find containers
|
||||||
|
containers=""
|
||||||
|
commands=""
|
||||||
|
|
||||||
|
function read_containers(){
|
||||||
|
containers=$(
|
||||||
|
[ -e ~/.containers ] && cat ~/.containers 2>/dev/null
|
||||||
|
find /media/${USER} -maxdepth 2 -iname ".containers" | while read line ; do
|
||||||
|
cat $line | awk -F';' -v path="$(dirname $line)" '{OFS=";" ; print $1,path"/"$2}'
|
||||||
|
done)
|
||||||
|
}
|
||||||
|
|
||||||
|
function mount_container(){
|
||||||
|
container_line=$*
|
||||||
|
name=$(echo $container_line | cut -f1 -d';')
|
||||||
|
path=$(echo $container_line | cut -f2 -d';')
|
||||||
|
mount_point="/mnt/${name}"
|
||||||
|
|
||||||
|
#mount only if containerfile is valid
|
||||||
|
if [ -e ${path} ] && cryptsetup isLuks "${path}" ; then
|
||||||
|
#if mountpoint is not there create it
|
||||||
|
[ ! -e ${mount_point} ] && sudo mkdir -p "${mount_point}" && sudo chmod 777 "${mount_point}"
|
||||||
|
#open luks Container
|
||||||
|
sudo cryptsetup luksOpen "${path}" "${name}"
|
||||||
|
#mount Container
|
||||||
|
sudo mount "/dev/mapper/${name}" "${mount_point}"
|
||||||
|
else
|
||||||
|
echo "Container ${path} not found" && continue
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function unmount_container(){
|
||||||
|
container_line=$*
|
||||||
|
name=$(echo $container_line | cut -f1 -d';')
|
||||||
|
path=$(echo $container_line | cut -f2 -d';')
|
||||||
|
mount_point="/mnt/${name}"
|
||||||
|
|
||||||
|
#unmount only if mounted
|
||||||
|
if ( mount | grep -q "${mount_point}" ) ; then
|
||||||
|
#if still in use
|
||||||
|
if [[ $( lsof "${mount_point}" | wc -l ) -gt 0 ]] ; then
|
||||||
|
echo "Mountpoint ${mount_point} is still in use:"
|
||||||
|
lsof "${mount_point}"
|
||||||
|
continue
|
||||||
|
else
|
||||||
|
sudo umount -l "${mount_point}"
|
||||||
|
sudo rmdir "${mount_point}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
sudo cryptsetup luksClose "${name}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function is_open(){
|
||||||
|
container_path="${1}"
|
||||||
|
ls -b /dev/mapper/ | xargs -n1 sudo cryptsetup status | grep loop: | grep -q "${container_path}"
|
||||||
|
return $?
|
||||||
|
}
|
||||||
|
|
||||||
|
function is_mounted(){
|
||||||
|
mount_point="${1}"
|
||||||
|
mount | grep -q "${mount_point}"
|
||||||
|
return $?
|
||||||
|
}
|
||||||
|
|
||||||
|
function is_used(){
|
||||||
|
mount_point="${1}"
|
||||||
|
lsof ${mount_point} 2>/dev/null 1>&2
|
||||||
|
return $?
|
||||||
|
}
|
||||||
|
|
||||||
|
function is_mounted_container(){
|
||||||
|
container_line=$*
|
||||||
|
name=$(echo $container_line | cut -f1 -d';')
|
||||||
|
path=$(echo $container_line | cut -f2 -d';')
|
||||||
|
mount_point="/mnt/${name}"
|
||||||
|
result=0
|
||||||
|
mount | grep -q "${mount_point}" && (( result+=1 ))
|
||||||
|
sudo cryptsetup status ${name} | grep -q "${path}" && (( result+=2 ))
|
||||||
|
echo $result
|
||||||
|
return $result
|
||||||
|
}
|
||||||
|
|
||||||
|
#mount all containers
|
||||||
|
function mount_all(){
|
||||||
|
read_containers
|
||||||
|
for line in $containers ; do
|
||||||
|
mount_container $line
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
#unmount all containers
|
||||||
|
function unmount_all(){
|
||||||
|
read_containers
|
||||||
|
for line in $containers ; do
|
||||||
|
unmount_container $line
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
#print status
|
||||||
|
function print_status(){
|
||||||
|
container_line=$*
|
||||||
|
name=$(echo $container_line | cut -f1 -d';')
|
||||||
|
path=$(echo $container_line | cut -f2 -d';')
|
||||||
|
mount_point="/mnt/${name}"
|
||||||
|
echo "Stats for $name : $path"
|
||||||
|
is_open ${path} && echo "IS OPENED"
|
||||||
|
is_mounted ${mount_point} && echo "IS MOUNTED"
|
||||||
|
is_used ${mount_point} && echo "IS IN USE"
|
||||||
|
}
|
||||||
|
|
||||||
|
#print status
|
||||||
|
function print_status_all(){
|
||||||
|
read_containers
|
||||||
|
for line in $containers ; do
|
||||||
|
print_status $line
|
||||||
|
done
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
##main
|
||||||
|
|
||||||
|
command="show"
|
||||||
|
[[ $# -eq 1 ]] && command="${1}"
|
||||||
|
echo "Command: ${command}"
|
||||||
|
|
||||||
|
case $command in
|
||||||
|
mount)
|
||||||
|
mount_all
|
||||||
|
;;
|
||||||
|
unmount)
|
||||||
|
unmount_all
|
||||||
|
;;
|
||||||
|
list)
|
||||||
|
print_status_all
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
read_containers
|
||||||
|
echo $containers
|
||||||
|
;;
|
||||||
|
esac
|
||||||
Reference in New Issue
Block a user