Giter VIP home page Giter VIP logo

smokeyjab's Introduction

SmokeyJab

SmokeyJab is a framework that simulates post-exploitation IOC's in an auditable and repeatable way, to exercise detection capabilities and strategies.

Getting the code

Latest version of SmokeyJab is available on github:

git clone https://github.com/klustic/SmokeyJab

Building a SmokeyJab payload for deployment

The provision.py script is used to generate a runnable SmokeyJab payload. It does the following:

  • Load each module and check it for basic syntax and required components
  • Perform any necessary module-level configuration
  • Generate a configuration template (optional) to fill in for repeatability

If not generating a module-level configuration template, the provisioning script requires a Splunk HEC host/token and a project name, at the minimum, so have those ready up front.

Example: Generating module-level configuration template

This command creates a template with all the configuration details for every module:

$ python provision.py -g --config new-template.json
WARNING:root:Skipping loading configuration file ([Errno 2] No such file or directory: 'new-template.json')
WARNING:root:Wrote module configuration template to new-template.json

If you want to force an option to be configured manually at provision time, simply remove it from the JSON file.

WARNING: Do not leave items blank (e.g. "") in the configuration file!! This will cause the item to not be configured in its corresponding module, and will lead to undefined behavior.

Example: Building the payload from a template

Once completing a module configuration template, as generated above, you can use that template to automate payload provisioning:

$ python provision.py --config new-template.json -u hec.mydomain.com -t hec-token-looks-like-uuid -p TESTPROJECT
WARNING:root:Minimum engagement time: 86400 seconds (1d 0h 0m 0s)
WARNING:root:Recommended engagement time: 432000 seconds (5d 0h 0m 0s)
How long (seconds) do you want this engagement to run? 432000
WARNING:root:Engagement is expected to last 432000 seconds (5d 0h 0m 0s)
CRITICAL:root:Provision successful! Written to "interrogatingly_tailzie.py"

Example: Building with manual configuration

If you prefer to manually enter your configuration, just enter the same command above without the --config option.

Note: You can provide a configuration with only some items specified. If you do this, the missing items will be prompted for during provisioning.

Deploying SmokeyJab to target

SmokeyJab was tested on Ubuntu 16.04LTS (Python 2.7.12), CentOS 6.7 (Python 2.7.8 and Python 2.6.6), and CentOS 7.2 (Python 2.7.5).

Write the file to disk. Use the name generated by the provisioning script, as it will be overwritten in the process list with the name provided at provision time. Execute in the background as root, and exit the terminal.

[root]# python interrogatingly_tailzie.py &
[1] 3124
[root]# exit

WARNING: On CentOS the hiding functionality fails. You should name your file something inconspicuous, and comment out the hide() call in the script before executing it! Once it's running, manually delete the script from disk to cover your tracks.

Creating a new module

The SmokeyJab framework allows you to create new content and plug it in with minimal effort. All modules should subclass ModuleBase, which takes care of some setup and basic testing.

Required

Each module, at a minimum, should provide:

  • absolute_duration: (integer) The expected runtime in seconds of the module
  • relative_delay: (integer) The delay, 0 <= x < 100, indicates the percentage of time through the total exercise that the module should execute (e.g. for a 2 day test, a module with a relative_delay of 50 will execute after 1 day has passed).
  • run(): The function called by the framework

Optional

  • needs_root: (bool) Tells the framework whether the module requires root permissions

Useful members of ModuleBase

  • hec_logger(): A function used to send messages/events to Splunk
  • util_childproc(): A function used to create a new orphaned process that executes a Python function (in memory) or any file (on disk)
  • util_netconnect(): A function that creates a network connection associated with an orphaned process, and provides a socket interface
  • util_orphanwait(): A function that waits for a PID returned by util_childproc() to exit, with an optional timeout that will cause the process to be killed if the timeout expires.

Conventions

Module file

Each module file should contain one module and should try to import ModuleBase from the framework. This ensures that the checks work properly at provision time and IDE's function properly.

run() Conventions

Each module should call self.start() when it begins (i.e. at the beginning of run()) and should call self.finish() when it has completed its action (e.g. at the end of run()). This sends start/finish logs to Splunk and contributes to auditing later.

Use orphan processes

If a module is going to create a measurable signature on the system (e.g. network connections, file handles, processes, etc.) it should run from an orphaned process to make it more difficult to trace the activity back to the SmokeyJab core.

For more information see Useful members of ModuleBase above.

Example module

Recommend looking at the BindPort module for a simple example of how a module works.

smokeyjab's People

Contributors

klustic avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.