-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbatch_submit.py
More file actions
36 lines (27 loc) · 794 Bytes
/
batch_submit.py
File metadata and controls
36 lines (27 loc) · 794 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/python
# coding=utf-8
import os
from time import sleep
import os
import json
import time
import signal
from multiprocessing import cpu_count, Pool
pefile_dir = '/data/root/pe_classify/2017game_test_1'
CPU_COUNT = cpu_count()
def init_worker():
signal.signal(signal.SIGINT, signal.SIG_IGN)
def submit(i):
pefile_path = os.path.join(pefile_dir, i)
os.system('cuckoo --cwd /data/root/cuckoo submit {}'.format(pefile_path))
sleep(0.1)
def multi_submit():
start = time.time()
pool = Pool(processes=2, initializer=init_worker, maxtasksperchild=400)
for i in os.listdir(pefile_dir):
pool.apply_async(submit, (i,))
pool.close()
pool.join()
end = time.time()
print("multi_submit cost %.2f seconds." % (end - start))
multi_submit()