恶意样本下载

import requests
import json
#GET /file/81b69bf08aa50ff8896c11bb289f3656ac1df8ba3bba7a5444fa1ef97c9d14b5.7z HTTP/1.1
headers = {
"Host": "www.virusign.com",
"Connection": "keep-alive",
"Cache-Control": "max-age=0",
"Authorization": "Basic aW5mZWN0ZWQ6aW5mZWN0ZWQ=",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "zh-CN,zh;q=0.9",
"Cookie": "PHPSESSID=ocbgt2mt7f38q1aovbrj4h8ih4"
}


doc1 = open('docurl.json','r')
s = json.load(doc1)

mal = s["malicious"]
clean = s["clean"]

for i in mal:
	link1 = "http://www.virusign.com"+i
	file = i.split("/")[-1]
	path = 'doc/malicious/'+file
	r = requests.get(link1,headers=headers)
	with open(path,"wb") as code:
		code.write(r.content)
	print(path)
print("doc malicious done")

for i in clean:
	link1 = "http://www.virusign.com"+i
	file = i.split("/")[-1]
	path = 'doc/clean/'+file
	r = requests.get(link1,headers=headers)
	with open(path,"wb") as code:
		code.write(r.content)
	print(path)
print("doc clean done")

'''
r = requests.get("http://www.virusign.com/file/81b69bf08aa50ff8896c11bb289f3656ac1df8ba3bba7a5444fa1ef97c9d14b5.7z",headers=headers)
with open("test.7z","wb") as code:
	code.write(r.content)
'''
'''
infected
infected
infected
'''

你可能感兴趣的:(python)