brad-sp / cuckoo-modified

Modified edition of cuckoo
271 stars 98 forks source link

mongodb.py SintaxError #202

Closed cjmateos closed 9 years ago

cjmateos commented 9 years ago

Hi team,

In the first execution of cuckoo modified I get the following error:

cuckoo-modified]# ./cuckoo.py --debug --test

  _____________________________________/\/\_______________________________
  ___/\/\/\/\__/\/\__/\/\____/\/\/\/\__/\/\__/\/\____/\/\/\______/\/\/\___
  _/\/\________/\/\__/\/\__/\/\________/\/\/\/\____/\/\__/\/\__/\/\__/\/\_
  _/\/\________/\/\__/\/\__/\/\________/\/\/\/\____/\/\__/\/\__/\/\__/\/\_
  ___/\/\/\/\____/\/\/\/\____/\/\/\/\__/\/\__/\/\____/\/\/\______/\/\/\___
  ________________________________________________________________________

 Cuckoo Sandbox 1.3-Optiv
 www.cuckoosandbox.org
 Copyright (c) 2010-2015

 Checking for updates...
 Good! You have the latest version available.

2015-09-17 10:34:07,416 [root] DEBUG: Importing modules...
Traceback (most recent call last):
  File "./cuckoo.py", line 102, in <module>
    test=args.test)
  File "./cuckoo.py", line 60, in cuckoo_init
    init_modules()
  File "/cuckoo-modified/lib/cuckoo/core/startup.py", line 224, in init_modules
    import_package(modules.reporting)
  File "/cuckoo-modified/lib/cuckoo/core/plugins.py", line 49, in import_package
    import_plugin(name)
  File "/cuckoo-modified/lib/cuckoo/core/plugins.py", line 36, in import_plugin
    module = __import__(name, globals(), locals(), ["dummy"], -1)
  File "/cuckoo-modified/modules/reporting/mongodb.py", line 76
    totals = {k: 0 for k in dct.keys()}
                     ^
SyntaxError: invalid syntax

If I replace mongodb.py file with the original cuckoo release the error disapears.

Thanks in advance

KillerInstinct commented 9 years ago

Odd, I'm not getting this error and have been running that code for a long time. That code is used to diagnose large dict keys which would prevent mongodb from saving reports. The reason it works if you use upstream's mongodb.py is because their doesn't have this check and will just fail to save the report.

What version of python?

cjmateos commented 9 years ago

Thanks for your response. I use python 2.6.6

KillerInstinct commented 9 years ago

Use python 2.7... alternatively you could change line 76 to:

totals = dict((k: 0 for k in dct.keys()))
jbremer commented 9 years ago

Or like, dict((k, 0) for k in dct).