packing-box / docker-packing-box

Docker image gathering packers and tools for making datasets of packed executables and training machine learning models for packing detection
GNU General Public License v3.0
49 stars 10 forks source link

Error using 'dataset convert ... ' (with a proposed fix) #84

Closed jramhani closed 11 months ago

jramhani commented 11 months ago

Following those steps in the Doc. Qucikstart :

Steps to reproduce

  1. dataset make test-pe-upx -n 100 --format PE --packer upx
  2. dataset show test-pe-upx
  3. dataset convert test-pe-upx

Error traceback

At this 3rd command , I got this error :

Traceback (most recent call last):
  File "/home/user/.opt/tools/dataset", line 236, in <module>
    getattr(ds, args.command)(**vars(args))
  File "/home/user/.local/lib/python3.11/site-packages/pbox/core/dataset/__init__.py", line 23, in _wrapper
    return f(s, *a, **kw)
           ^^^^^^^^^^^^^^
  File "/home/user/.local/lib/python3.11/site-packages/pbox/core/dataset/__init__.py", line 367, in convert
    self._compute_all_features()
  File "/home/user/.local/lib/python3.11/site-packages/pbox/core/dataset/__init__.py", line 180, in _compute_all_features
    d = self._compute_features(exe)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/.local/lib/python3.11/site-packages/pbox/core/dataset/__init__.py", line 188, in _compute_features
    d.update(exe.data)        # be sure to include the features
             ^^^^^^^^
  File "/usr/lib/python3.11/functools.py", line 1001, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "/home/user/.local/lib/python3.11/site-packages/pbox/core/executable/__init__.py", line 166, in data
    return Features(self)
           ^^^^^^^^^^^^^^
  File "/home/user/.local/lib/python3.11/site-packages/pbox/core/executable/features.py", line 102, in __init__
    from .extractors import Extractors
  File "/home/user/.local/lib/python3.11/site-packages/pbox/core/executable/extractors/__init__.py", line 3, in <module>
    from .macho import *
AttributeError: module 'pbox.core.executable.extractors.macho' has no attribute 'MOFEATS'. Did you mean: '_MOFEATS'?

Proposed Fix :

Fixed the first line of macho.py by adding a _ :

# -*- coding: UTF-8 -*-
__all__ = ["mofeats", "_MOFEATS"] # FIX => "_MOFEATS" instead of "MOFEATS"

_MOFEATS = {}  #TODO

def mofeats(executable):  #TODO
    return {}
dhondta commented 11 months ago

@jramhani This was fixed in 90c50df three weeks ago. Did you git pull first ?

jramhani commented 11 months ago

@jramhani This was fixed in 90c50df three weeks ago. Did you git pull first ?

Correct, My bad!