mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
init
This commit is contained in:
+103
-2
@@ -23,6 +23,17 @@ TEST_URL = "http://t1.cn/"
|
||||
# TEST_URL = "https://www.zzzvps.com/"
|
||||
|
||||
|
||||
def writeFile(filename, str):
|
||||
# 写文件内容
|
||||
try:
|
||||
fp = open(filename, 'w+')
|
||||
fp.write(str)
|
||||
fp.close()
|
||||
return True
|
||||
except Exception as e:
|
||||
return False
|
||||
|
||||
|
||||
def httpGet(url, timeout=10):
|
||||
import urllib.request
|
||||
|
||||
@@ -35,6 +46,61 @@ def httpGet(url, timeout=10):
|
||||
return str(e)
|
||||
|
||||
|
||||
def httpGet__Header(url, headers, timeout=10):
|
||||
import urllib.request
|
||||
try:
|
||||
req = urllib.request.Request(url, headers=headers)
|
||||
response = urllib.request.urlopen(req)
|
||||
result = response.read().decode('utf-8')
|
||||
return result
|
||||
|
||||
except Exception as e:
|
||||
return str(e)
|
||||
|
||||
|
||||
def httpUpload(url, timeout=10):
|
||||
try:
|
||||
import requests
|
||||
|
||||
files = {
|
||||
'file': open('/Users/midoks/Desktop/mwdev/server/op_waf/version.pl', 'rb')
|
||||
}
|
||||
res = requests.post(url=url, files=files)
|
||||
return res
|
||||
except Exception as e:
|
||||
return "http.upload:" + str(e)
|
||||
|
||||
|
||||
def httpUploadPhp(url, timeout=10):
|
||||
try:
|
||||
import requests
|
||||
|
||||
writeFile("/tmp/tmp.php", "")
|
||||
|
||||
files = {
|
||||
'file': open('/tmp/tmp.php', 'rb')
|
||||
}
|
||||
res = requests.post(url=url, files=files)
|
||||
return res
|
||||
except Exception as e:
|
||||
return "http.upload:" + str(e)
|
||||
|
||||
|
||||
def httpUploadPhpData(url, timeout=10):
|
||||
try:
|
||||
import requests
|
||||
|
||||
writeFile("/tmp/tmp.py", "<?php echo '123123';?>")
|
||||
|
||||
files = {
|
||||
'file': open('/tmp/tmp.py', 'rb')
|
||||
}
|
||||
res = requests.post(url=url, files=files)
|
||||
return res
|
||||
except Exception as e:
|
||||
return "http.upload:" + str(e)
|
||||
|
||||
|
||||
def httpGet__UA(url, ua, timeout=10):
|
||||
import urllib.request
|
||||
headers = {'user-agent': ua}
|
||||
@@ -107,7 +173,7 @@ def test_Dir():
|
||||
url = TEST_URL + '?t=../etc/passwd'
|
||||
print("args test start")
|
||||
url_val = httpGet(url, 10)
|
||||
# print(url_val)
|
||||
print(url_val)
|
||||
print("args test end")
|
||||
|
||||
|
||||
@@ -122,6 +188,17 @@ def test_UA():
|
||||
print("user-agent test end")
|
||||
|
||||
|
||||
def test_Header():
|
||||
'''
|
||||
user-agent 过滤
|
||||
'''
|
||||
url = TEST_URL
|
||||
print("user-agent test start")
|
||||
url_val = httpGet__Header(url, {'X-forwarded-For': '../etc/passwd'})
|
||||
print(url_val)
|
||||
print("user-agent test end")
|
||||
|
||||
|
||||
def test_UA_for(num):
|
||||
'''
|
||||
user-agent 过滤
|
||||
@@ -208,16 +285,40 @@ def test_OK():
|
||||
print("ok test end")
|
||||
|
||||
|
||||
def test_Upload():
|
||||
'''
|
||||
上传文件
|
||||
'''
|
||||
url = TEST_URL
|
||||
print("upload test start")
|
||||
url_val = httpUpload(url, 10)
|
||||
print(url_val)
|
||||
|
||||
print("upload test end")
|
||||
|
||||
print("upload php test start")
|
||||
url_val = httpUploadPhp(url, 10)
|
||||
print(url_val)
|
||||
print("upload php test start")
|
||||
|
||||
print("upload php data test start")
|
||||
url_val = httpUploadPhpData(url, 10)
|
||||
print(url_val)
|
||||
print("upload php data test start")
|
||||
|
||||
|
||||
def test_start():
|
||||
# test_OK()
|
||||
# test_Dir()
|
||||
# test_UA()
|
||||
# test_Header()
|
||||
# test_UA_for(1000)
|
||||
# test_POST()
|
||||
test_scan()
|
||||
# test_scan()
|
||||
# test_CC()
|
||||
# test_url_ext()
|
||||
# test_cdn()
|
||||
test_Upload()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -10,4 +10,13 @@ export PATH
|
||||
# ab -c 10 -n 1000 http://t1.cn/wp-admin/index.php
|
||||
# ab -c 1000 -n 1000000 http://dev156.cachecha.com/
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
|
||||
if [ -f ${rootPath}/bin/activate ];then
|
||||
source ${rootPath}/bin/activate
|
||||
fi
|
||||
|
||||
python3 index.py
|
||||
|
||||
Reference in New Issue
Block a user