Skip to main content

Making security analysis simpler by applying AI to binary artefacts of firmware

Project description

fw2ai

This is a tool for analysing binaries from extracted firmware images. It has the capabilities to convert relevant artefacts from binary files that can used with AI to simplify firmware analysis.

Getting started

Configuration

Configuration file defines following parameters that can be customized.

default config file name (resides in current directory): ./config.ini

Section Parameter Default Description
general config_path ./config.ini Path to configuration file
general firmwares_dir ./firmwares Directory containing firmwares
general output_dir ./output Directory where output will be generated
log log_path ./log.txt Path to log file
log log_level INFO Log level

Default configuration

[general]
config_path=./config.ini
firmwares_dir=./firmwares
output_dir=./output

[log]
log_level=INFO
log_path=./log.txt

Logging

Logging levels supported are:

  1. CRITICAL
  2. ERROR
  3. WARNING
  4. INFO
  5. DEBUG

Usage

fw2ai --help

fw2ai [-f | --fw-dir] /path/to/dir/with/all/firmware

fw2ai [-o | --output-dir ] /path/to/output/dir

fw2ai [-c | --config ] /path/to/config/file

Developer Notes

CLI architecture

There are three parameter types:

  1. Arguments: Mandatory

     pip install requests
    
  2. Options: Optional eg.

     pip install requests --proxy http://10.11.22.33
    
  3. Flags: Optional (for enabling or disabling features)

    ls -al
    ls --help
    

PyPi Lifecycle

Authenticaion

File name: ~/.pypirc

[pypi]
  username = __token__
  password = <PUT THE TOKEN HERE>

Generate source and binary distribution

python setup.py sdist bdist_wheel

Test locally

Install locally

pip install -e .

Uploading to PyPi

Upload to PyPi:

python -m twine upload dist/* --verbose

Git push

git push -u origin main

Git Configuration

There are 3 levels of git config; project, global and system. Ref

  1. project: Project configs are only available for the current project and stored in .git/config in the project's directory.
  2. global: Global configs are available for all projects for the current user and stored in ~/.gitconfig.
  3. system: System configs are available for all the users/projects and stored in /etc/gitconfig. Create a project specific config, you have to execute this under the project's directory:
$ git config user.name "Mahesh Patil"
$ git config user.email "cpuinfo10@gmail.com"

Create a global config:

$ git config --global user.name "Mahesh Patil"
$ git config --global user.email "cpuinfo10@gmail.com"

Create a system config:

$ git config --system user.name "Mahesh Patil"
$ git config --system user.email "cpuinfo10@gmail.com

Design Notes

Handling CLI arguments, options and flags

Three popular options Ref for handling CLI arguments, options and flags are:

  1. sys.argv
  2. argparse
  3. click

Check Video:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fw2ai-0.1.1.tar.gz (3.6 kB view hashes)

Uploaded Source

Built Distribution

fw2ai-0.1.1-py3-none-any.whl (4.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page