Skip to content

Failing to add new samples to model #17

@enzok

Description

@enzok

Using the following to initialize and add new samples to the default model:

from mmbot import MaliciousMacroBot

opts = {'benign_path': 'benign',
        'malicious_path': 'malicious',
        'model_path': 'model'}

mmb = MaliciousMacroBot(retain_sample_contents=True)
mmb.set_model_paths(opts["benign_path"],
                    opts["malicious_path"],
                    opts["model_path"])
mmb.mmb_init_model(modelRebuild=True)

Get the following error:

Traceback (most recent call last):
  File "./build2.py", line 17, in <module>
    initresult = mmb.mmb_init_model(modelRebuild=True)
  File "/usr/local/lib/python2.7/dist-packages/mmbot/mmbot.py", line 712, in mmb_init_model
    newdoc_cnt = self.load_model_data(exclude)
  File "/usr/local/lib/python2.7/dist-packages/mmbot/mmbot.py", line 346, in load_model_data
    newdocs = temp[temp['extracted_vba'].isnull()].copy()
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 2139, in __getitem__
    return self._getitem_column(key)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 2146, in _getitem_column
    return self._get_item_cache(key)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/generic.py", line 1842, in _get_item_cache
    values = self._data.get(item)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/internals.py", line 3843, in get
    loc = self.items.get_loc(item)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/indexes/base.py", line 2527, in get_loc
    return self._engine.get_loc(self._maybe_cast_indexer(key))
  File "pandas/_libs/index.pyx", line 117, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 139, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 1265, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 1273, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: u'extracted_vba'

The model builds fine if it doesn't already exist.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions