Created
June 18, 2019 18:18
-
-
Save brianpow/519f6713327873f530b8a128ef1f4639 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IP=192.168.10.239 | |
BUSYBOX=busybox-armv6l | |
TAR=tar | |
PS1='$(pwd)#' | |
download_ftp(){ | |
ftpget $IP $1 | |
} | |
download_nc(){ | |
nc $IP 12344 >$1 | |
} | |
download_wget(){ | |
wget "http://${IP}/$1" | |
} | |
download_tftp(){ | |
tftp -g -r $1 $IP | |
} | |
download_(){ | |
echo "Download error!" | |
return 1 | |
} | |
check_download_tools(){ | |
for i in ftpget wget tftp nc; do | |
[ busybox $i ] && return $i | |
done | |
return "" | |
} | |
download_tools() | |
{ | |
GET=$(check_download_tools) | |
download_$GET $BUSYBOX | |
download_$GET $TAR | |
} | |
upload_ftp(){ | |
./$BUSYBOX ftpput $IP $1 | |
} | |
upload_nc(){ | |
echo $1| ./$BUSYBOX nc $IP 12345 | |
cat $1| ./$BUSYBOX nc $IP 12345 | |
} | |
upload_tftp(){ | |
./$BUSYBOX tftp -p -l $1 $IP | |
} | |
dump_info_upload_nc(){ | |
cp /proc/cpuinfo cpuinfo.txt | |
cp /proc/meminfo meminfo.txt | |
cp /proc/mtd mtd.txt | |
cp /proc/version version.txt | |
uname -a >uname.txt | |
mount >mount.txt | |
lsmod >lsmod.txt | |
ifconfig >ifconfig.txt | |
ps > ps.txt | |
dmesg > dmesg.txt | |
df > df.txt | |
netstat -ap >netstat.txt | |
echo info.tar.gz| nc $IP 12345 | |
tar zc *.txt|nc $IP 12345 | |
} | |
dump_info(){ | |
# FILES=(/proc/cpuinfo /proc/meminfo /proc/mtd /proc/version) | |
# for i in FILES ; do | |
# cat $i | |
# done | |
cp /proc/cpuinfo cpuinfo.txt | |
cp /proc/meminfo meminfo.txt | |
cp /proc/mtd mtd.txt | |
cp /proc/version version.txt | |
uname -a >uname.txt | |
mount >mount.txt | |
lsmod >lsmod.txt | |
ifconfig >ifconfig.txt | |
ps > ps.txt | |
dmesg > dmesg.txt | |
df > df.txt | |
netstat -ap >netstat.txt | |
tar zc *.txt>info.tar.gz | |
} | |
dump_mtd(){ | |
for i in 0 1 2 3 4 5 6 7 8 9; do | |
[ -e /dev/mtd$i -a ! -e mtd$i.bin.gz ] && cat /dev/mtd$i | gzip > mtd$i.bin.gz; | |
done | |
} | |
dump_root(){ | |
[ ! -f ./$TAR ]./$BUSYBOX tar --exclude=tmp --exclude=sys --exclude=proc --exclude=dev --exclude=mnt/mmc01 --exclude="$(pwd)" -zcvf root.tar.gz / | |
[ -f ./$TAR ] && ./$TAR --ignore-failed-read --exclude=tmp --exclude=dev --exclude=mnt/mtd/ipc/tmpfs/sd --exclude="$(pwd)" -zcvf root.tar.gz / | |
} | |
dump_root_upload_nc(){ | |
echo root.tar.gz| nc $IP 12345 | |
[ ! -f ./$TAR ]./$BUSYBOX tar --exclude=tmp --exclude=sys --exclude=proc --exclude=dev --exclude=mnt/mmc01 --exclude="$(pwd)" -zc / | nc $IP 12345 | |
[ -f ./$TAR ] && ./$TAR --ignore-failed-read --exclude=tmp --exclude=dev --exclude=mnt/mtd/ipc/tmpfs/sd --exclude="$(pwd)" -zc / | nc $IP 12345 | |
} | |
dump_mtd_upload_nc(){ | |
for i in 0 1 2 3 4 5 6 7 8 9; do | |
echo $i.tar.gz|nc $IP 12345; | |
[ -e /dev/mtd$i -a ! -e mtd$i.bin.gz ] && cat /dev/mtd$i | gzip | nc $IP 12345 ; done | |
} | |
upload_ftp_all(){ | |
for i in *.gz; do [ -f $i ] && upload_ftp $i ; done | |
} | |
server_side_nc(){ | |
for i in busybox tar; do cat $i > nc -l 12344; done | |
for ((;;)); do echo "Waiting for next name..." ; NAME=$(nc -l 12345|sed -e 's/[^A-Za-z0-9._-]/_/g'); echo "Saving $NAME..."; nc -l 12345 > $NAME ; done | |
} | |
download_tools | |
dump_mtd_upload_nc | |
dump_root_upload_nc | |
dump_info_upload_nc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment