Commit feb1cce5 by devttys0

Added comments/docs to core code files

parent 0424af6d
...@@ -119,6 +119,7 @@ class Library(object): ...@@ -119,6 +119,7 @@ class Library(object):
lib_path = ctypes.util.find_library(library) lib_path = ctypes.util.find_library(library)
# If ctypes failed to find the library, check the common paths listed in system_paths
if not lib_path: if not lib_path:
for path in system_paths[sys.platform]: for path in system_paths[sys.platform]:
if os.path.exists(path): if os.path.exists(path):
......
# Code to handle displaying and logging of results.
# Anything in binwalk that prints results to screen should use this class.
import sys import sys
import csv as pycsv import csv as pycsv
import datetime import datetime
......
# Code for filtering of results (e.g., removing invalid results)
import re import re
import binwalk.core.common as common import binwalk.core.common as common
from binwalk.core.smart import Signature from binwalk.core.smart import Signature
...@@ -34,7 +36,6 @@ class FilterExclude(FilterType): ...@@ -34,7 +36,6 @@ class FilterExclude(FilterType):
class Filter(object): class Filter(object):
''' '''
Class to filter results based on include/exclude rules and false positive detection. Class to filter results based on include/exclude rules and false positive detection.
An instance of this class is available via the Binwalk.filter object.
Note that all filter strings should be in lower case. Note that all filter strings should be in lower case.
''' '''
......
# Python wrapper for the libmagic library.
# Although libmagic comes with its own wrapper, there are compatibility issues with older libmagic versions
# as well as unofficial libmagic Python wrappers, so it's easier to just have our own wrapper.
import binwalk.core.C import binwalk.core.C
import binwalk.core.common import binwalk.core.common
from binwalk.core.compat import * from binwalk.core.compat import *
......
# Core code relating to binwalk modules and supporting classes.
# In particular, the Module class (base class for all binwalk modules)
# and the Modules class (main class for managing and executing binwalk modules)
# are most critical.
import io import io
import os import os
import sys import sys
......
# Code for performing minimal parsing of libmagic-compatible signature files.
# This allows for building a single signature file from multiple other signature files,
# and for parsing out the initial magic signature bytes for each signature (used for
# pre-processing of data to limit the number of actual calls into libmagic).
#
# Also performs splitting/formatting of libmagic result text.
import io import io
import re import re
import os.path import os.path
......
# Core code for supporting and managing plugins.
import os import os
import sys import sys
import imp import imp
...@@ -140,17 +142,17 @@ class Plugins(object): ...@@ -140,17 +142,17 @@ class Plugins(object):
Returns a dictionary of: Returns a dictionary of:
{ {
'user' : { 'user' : {
'modules' : [list, of, module, names], 'modules' : [list, of, module, names],
'descriptions' : {'module_name' : 'module pydoc string'}, 'descriptions' : {'module_name' : 'module pydoc string'},
'enabled' : {'module_name' : True}, 'enabled' : {'module_name' : True},
'path' : "path/to/module/plugin/directory" 'path' : "path/to/module/plugin/directory"
}, },
'system' : { 'system' : {
'modules' : [list, of, module, names], 'modules' : [list, of, module, names],
'descriptions' : {'module_name' : 'module pydoc string'}, 'descriptions' : {'module_name' : 'module pydoc string'},
'enabled' : {'module_name' : True}, 'enabled' : {'module_name' : True},
'path' : "path/to/module/plugin/directory" 'path' : "path/to/module/plugin/directory"
} }
} }
''' '''
......
# Code for loading and accessing binwalk settings (extraction rules, signature files, etc).
import os import os
import binwalk.core.common as common import binwalk.core.common as common
from binwalk.core.compat import * from binwalk.core.compat import *
......
# "Smart" parser for handling libmagic signature results. Specifically, this implements
# support for binwalk's custom libmagic signature extensions (keyword tags, string processing,
# false positive detection, etc).
import re import re
import binwalk.core.module import binwalk.core.module
from binwalk.core.compat import * from binwalk.core.compat import *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment