-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathandrozoo_download.py
108 lines (99 loc) · 3.32 KB
/
androzoo_download.py
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# coding:utf-8
import requests
import urllib.request
import threading
import argparse
#
# import time
base_url = 'https://androzoo.uni.lu/api/download?apikey=your key =%s'
global c
global count
def download(sha256, year, type):
global c
global count
url = base_url % sha256
# start = time.time()
r = requests.get(url=url)
# print("request")
# end = time.time()
# print(end-start)
if r.status_code == 200:
urllib.request.urlretrieve(url,
'/home/lhd/apk/androzoo/' + year + '/' + type + '/%s.apk' % sha256)
c += 1
print("**********下载个数:%d, 下载进度:%f %%**********" % (c, 100 * round(c / 284, 3)))
print('downloaded', sha256)
# print("download count:", count)
count -= 1
if __name__ == "__main__":
year = '2017'
type = 'benign'
count = 0
c = 0
with open('/home/lhd/apk/androzoo/sha256/' + year + '_' + type + '.txt',
'r') as tf:
for line in tf:
sha256 = line.rstrip('\n')
# print(sha256)
while (count >= 20):
continue
# print('count', count)
count += 1
t = threading.Thread(target=download, args=(sha256,year,type,))
t.setDaemon(False)
t.start()
if c % 50 == 0:
print("**********下载个数:%d, 下载进度:%f**********" % (c, c / 20))
type = 'malware'
count = 0
c = 0
with open('/home/lhd/apk/androzoo/sha256/' + year + '_' + type + '.txt',
'r') as tf:
for line in tf:
sha256 = line.rstrip('\n')
# print(sha256)
while (count >= 20):
continue
# print('count', count)
count += 1
t = threading.Thread(target=download, args=(sha256,year,type,))
t.setDaemon(False)
t.start()
if c % 50 == 0:
print("**********下载个数:%d, 下载进度:%f**********" % (c, c / 20))
year = '2018'
type = 'malware'
count = 0
c = 0
with open('/home/lhd/apk/androzoo/sha256/' + year + '_' + type + '.txt',
'r') as tf:
for line in tf:
sha256 = line.rstrip('\n')
# print(sha256)
while (count >= 20):
continue
# print('count', count)
count += 1
t = threading.Thread(target=download, args=(sha256,year,type,))
t.setDaemon(False)
t.start()
if c % 50 == 0:
print("**********下载个数:%d, 下载进度:%f**********" % (c, c / 20))
year = '2019'
type = 'malware'
count = 0
c = 0
with open('/home/lhd/apk/androzoo/sha256/' + year + '_' + type + '.txt',
'r') as tf:
for line in tf:
sha256 = line.rstrip('\n')
# print(sha256)
while (count >= 20):
continue
# print('count', count)
count += 1
t = threading.Thread(target=download, args=(sha256,year,type,))
t.setDaemon(False)
t.start()
if c % 50 == 0:
print("**********下载个数:%d, 下载进度:%f**********" % (c, c / 20))