In [6]:
import pymongo
import numpy as np
username = 'populator'
password = 'malware_challenge'
cm = pymongo.MongoClient('afruizc-office.cs.unm.edu')
cm.malware.authenticate(username, password)
data = [(x['id'], x['asm_info']['seq'])
for x in cm.malware.test_samples.find({
"id": {"$exists": True}, # The id field exists
"asm_info.seq": {"$ne": []}}) if x.get('asm_info', '') \
and x['asm_info'].get('seq', '')]
final = [(f[0], len(f[1]), ','.join(f[1])) for f in data]
with open('time_series_test.txt', 'w') as f:
f.writelines([','.join(map(str, x)) for x in final])
In [25]:
Out[25]:
In [45]:
pwd
Out[45]:
In [ ]: