그냥저냥

VirusTotal 조회 자동화 (Used API) 본문

Dev./Python

VirusTotal 조회 자동화 (Used API)

ex3llo 2016. 12. 28. 01:35

예전에 업무상 잠깐 만들어서 썼었던 바이러스 토탈 조회용 코드이며, 바이러스토탈 회원가입 후 API 키를 따로 받아야함

(참고로 조회 속도가 너무 빠르면 에러(?)가 발생한다고 해서 일부러 Sleep 함수를 추가함)


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import simplejson
import urllib
import urllib2
import time
 
vtkey = "" # API Key
md5str = ""
url = "https://www.virustotal.com/vtapi/v2/file/report"
 
txtf = open("list.txt""r"# 파일로 저장
 
while True:
    line = txtf.readline()
    md5str = line.strip('\n')
    if not md5str: break
    parameters = {"resource": md5str,"apikey": vtkey}
    data = urllib.urlencode(parameters)
    req = urllib2.Request(url, data)
    response = urllib2.urlopen(req)
    json = response.read()
    print (json)
    f = open(md5str+".txt","w")
    f.write(json)
    f.close()
    time.sleep(20)
    
txtf.close()
print ("Clear!!!")
 
cs


'Dev. > Python' 카테고리의 다른 글

외부 프로그램 실행 + 파라미터 전달  (0) 2017.01.10
Win32 라이브러리 API 주소  (0) 2017.01.04
HTTP 웹 Request 코드 (임시)  (0) 2016.12.28
Socket 통신 예제 (Server / Client)  (0) 2016.07.31
MD5 Hash  (0) 2016.07.31
Comments