-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path5-url-assigner.py
More file actions
150 lines (120 loc) · 4.23 KB
/
5-url-assigner.py
File metadata and controls
150 lines (120 loc) · 4.23 KB
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
from minimalware import miniassigner as ma
import pandas as pd
import json
def post_process(alldata):
# print(alldata)
# if alldata['isapphit']:
# return alldata
# else:
# return {}
return alldata
result_file_path="scannedoverallres.csv"
scanned_appid_path="scannedallminiapps.csv"
all_package_path_list="index.list"
appidlist=[]
allminiappfile=open(all_package_path_list,'r')
# with open('template_id.csv','r') as f:
# for line in f:
# appidlist.append(line.split(",")[0])
readcnt=0
# with open('/storage/miniapp/wechat/index.list','r') as f:
with open('data/4-all-miniapp-multikeywords/scannedoverallres.csv') as f:
for line in f:
# appid=line.split('/')[-1].split('.')[0]
data=json.loads(line)
appidlist.append(data['appid'])
readcnt+=1
if readcnt%10000 ==0:
print(readcnt)
# print(appid)
# break
# with open('../data/1-hit-anyone.csv') as f:
# for lin in f:
# data=json.loads(lin)
# appidlist.append(data['appid'])
print(len(appidlist))
flag=False
# appidlist=[]
cnt=0
# for appid in templatelist:
# print(cnt,4585587)
# cnt+=1
# appid=line.split('/')[7][:-1].split('.wxapkg')[0]
# if appid in templatelist:
# appidlist.append(appid)
ma.main(appidlist, result_file_path, scanned_appid_path, post_process)
# def writeres(res):
# f=open(scanned_appid_path,"a")
# f.write(json.dumps(res)+"\r\n")
# index = 0
# def loadscanned():
# res=set()
# finalres=open(scanned_appid_path,"r")
# lastone=''
# for l in finalres:
# appid=json.loads(l)['appid']
# res.add(appid)
# lastone=json.loads(l)['appid']
# # if not name in res:
# # res.add(name.strip())
# print("scanned",len(res))
# return res,lastone
# def loadTemplateMiniapps():
# # fr=open("template_id.csv")
# # data=pd.read_csv("template_id.csv",index_col=1, skiprows=1).T.to_dict()
# #wxid,template_id
# # allids=pd.DataFrame(['wx65e149bfea342554','wxdeadbeefdeadbeef'],columns =['wxid'])
# # print(data['wx65e149bfea342554'])
# # print(df.loc[df['wxid'] == allids['wxid']])
# # exit()
# df=pd.read_csv('template_id.csv')
# return list(df['wxid']), df
# if __name__ == '__main__':
# task_queue = queue.Queue()
# result_queue = queue.Queue()
# class QueueManager(BaseManager):
# pass
# QueueManager.register('get_task_queue', callable=lambda: task_queue)
# QueueManager.register('get_result_queue', callable=lambda: result_queue)
# manager = QueueManager(address=('', 8989), authkey=b'abc')
# manager.start()
# task = manager.get_task_queue()
# result = manager.get_result_queue()
# print("App analyzer Master is running")
# scanned=set()
# scanned,lastone=loadscanned()
# templatelist,df=loadTemplateMiniapps()
# file=open(all_package_path_list,'r')
# count = 0
# total=0
# scancnt=0
# flag=False
# for line in file:
# # if '_1' in line:
# # continue
# # print(line.split('/')[7][:-1].split('.wxapkg')[0])
# appid=line.split('/')[7][:-1].split('.wxapkg')[0]
# # print("loading...(scanned) {} ".format(scancnt))
# # if appid==lastone:
# # flag=True
# if flag and appid not in scanned and appid in templatelist:
# scancnt+=1
# print("loading... {} ".format(total), end="\r", flush=True)
# task.put(appid)
# total+=1
# print('hmm',total)
# while(count < total):
# alldata = result.get(timeout=20000)
# alldata=json.loads(alldata)
# print(alldata)
# count += 1;
# # print("loading... {} ".format(total), end="\r", flush=True)
# print("{}/{}: {}".format(count, total, alldata['appid']), end="\r", flush=True)
# print(alldata)
# output=open(result_file_path, "a")
# if alldata['similarityhit']:
# print("FOUND!")
# output.write("{}/{}: {}".format(count, total, alldata['appid'])+"\r\n")
# output.close()
# writeres(alldata)
# manager.shutdown()