图片
- 图片以二进制流的形式为
xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x01\x00\x01\x00\x01\x00\x00\xff\xdb\x00C\x00\x06
- 但使用burpsuit直接输出的时候却是乱码格式,然后使用python来输出的时候也为乱码格式(其实为UTF-8),也就是传输的时候为UTF-8的格式传输的。这个时候查看字符串的格式为 "str"。
这个时候使用字符串转字节流的方式进行输出,输出了和代码中相同的字符串。这说明以二进制读取图片的时候读取的流为字节流。但是转换的时候会有错误,只要使用下面的代码忽略错误就行
burp0_data.decode('utf-8','ignore')
贴一下代码
import requests with open('image.png','rb')as f: img=f.read() burp0_url = "https://" burp0_cookies = {"Q_UDID": "", ""} burp0_headers = {"User-Agent": "\"I am your mother\"", "Content-Type": "multipart/form-data; boundary=----WebKitFormBoun", "Accept": "*/*", "Origin": "https://src.360.net", "Sec-Fetch-Site": "same-origin", "Sec-Fetch-Mode": "cors"} burp0_data = b'------WebKitFormBoundaryT4EDabPQX1udNKUR\r\nContent-Disposition: form-data; name=\"qh_img\"; filename=\"777.jpg\"\r\nContent-Type: image/jpeg\r\n\r\n'+img+b'\r\n------WebKitFormBoundaryT4EDabPQX1udNKUR--\r\n' print(burp0_data.decode('utf-8','ignore')) r=requests.post(burp0_url, headers=burp0_headers, cookies=burp0_cookies, data=burp0_data) print(r) print(r.text)
评论 (1)