-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnt_query.py
More file actions
36 lines (30 loc) · 898 Bytes
/
Copy pathnt_query.py
File metadata and controls
36 lines (30 loc) · 898 Bytes
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
30
31
32
33
34
35
36
# !/usr/bin/env python
# -*- coding:utf-8 -*-
import urllib2
import json
import sys
class NetworkTotal(object):
def __init__(self):
self.url = 'https://networktotal.com/search.php?q='
def query(self, md5sum):
url = '{}{}&json=1'.format(self.url, md5sum)
try:
req = urllib2.Request(url)
rsp = urllib2.urlopen(req)
js = json.load(rsp)
for key in js:
print key
if type(js[key]) is list:
for value in js[key]:
print '\t{}'.format(value)
else:
print '\t{}'.format(js[key])
except Exception as e:
print str(e)
def main():
md5sum = sys.argv[1]
print 'Query {} on NetworkTotal.com'.format(md5sum)
nt = NetworkTotal()
nt.query(md5sum)
if __name__ == '__main__':
main()