Git Product home page Git Product logo

cuckclean's Introduction

cuckclean

Command line utility to either get or delete a Cuckoo SandBox analysis from a MongoDB instance.

Additionally provides a prune command that is used to delete old analysis results in bulk, by specifying how many to keep. Defaults to keeping the newest 100 000 analysis documents.

The clean command looks for gridfs files that are not referenced in any anaylsis result and deletes them.

For the delete operations to work fast enough, a prerequisite is to create indexes on several fields

Example Mongo shell commands for this:

db.analysis.createIndex({"info.id": 1})
db.analysis.createIndex({"dropped.object_id": 1})
db.analysis.createIndex({"target.file_id": 1})
db.analysis.createIndex({"network.pcap_id": 1})
db.analysis.createIndex({"network.sorted_pcap_id": 1})
db.analysis.createIndex({"network.mitmproxy_id": 1})
db.analysis.createIndex({"shots.original": 1})
db.fs.createIndex({"chunks.files_id:": 1})
db.fs.createIndex({"files.sha256:": 1})

Install

Installation is done via pip, as follows:

pip install git+https://github.com/haam3r/cuckclean.git

Usage

Use cuckclean --help to get info on available commands. All commands need a host parameter, provided via -h or --host. e.g. cuckclean prune -h mongo.ip.addr --keep 100000

Release space from MongoDB

After DB entries were removed you need to shrink the size of the collections to release space from the database to the operating system, read more at https://docs.mongodb.com/manual/reference/command/compact. Original Cuckoo database has the following collections: analysis, fs.chunks, fs.files

Check how much space can be released from each collection:

db.<collection name>.stats().wiredTiger['block-manager']['file bytes available for reuse']

WiredTiger is a default storage engine in MongoDB 3.2 and higher.

To release available space:

db.runCommand({compact: <collection name> })

Depending on how much space can be released, the command execution can take from minutes to hours.

Pull requests and issues welcome

cuckclean's People

Contributors

haam3r avatar midav7 avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

primmus midav7

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.