{"id":13642360,"url":"https://github.com/CERT-Polska/karton","last_synced_at":"2025-04-20T16:31:55.937Z","repository":{"id":37443879,"uuid":"267095189","full_name":"CERT-Polska/karton","owner":"CERT-Polska","description":"Distributed malware processing framework based on Python, Redis and S3.","archived":false,"fork":false,"pushed_at":"2024-10-18T13:53:40.000Z","size":717,"stargazers_count":389,"open_issues_count":12,"forks_count":45,"subscribers_count":24,"default_branch":"master","last_synced_at":"2024-10-18T16:22:18.091Z","etag":null,"topics":["cert","csirt","cybersecurity","karton","malware-analysis","malware-research","pipeline"],"latest_commit_sha":null,"homepage":"https://karton-core.readthedocs.io/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CERT-Polska.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-26T16:29:58.000Z","updated_at":"2024-10-18T14:22:32.000Z","dependencies_parsed_at":"2024-01-17T12:39:43.896Z","dependency_job_id":"6750d869-775b-44a0-a74b-4c4972d7b0b7","html_url":"https://github.com/CERT-Polska/karton","commit_stats":{"total_commits":161,"total_committers":23,"mean_commits":7.0,"dds":0.6086956521739131,"last_synced_commit":"46e39efbee8f2f2e702dd76e8a6705bf2f8a7d5e"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CERT-Polska%2Fkarton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CERT-Polska%2Fkarton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CERT-Polska%2Fkarton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CERT-Polska%2Fkarton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CERT-Polska","download_url":"https://codeload.github.com/CERT-Polska/karton/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223832979,"owners_count":17210758,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cert","csirt","cybersecurity","karton","malware-analysis","malware-research","pipeline"],"created_at":"2024-08-02T01:01:30.421Z","updated_at":"2025-04-20T16:31:55.928Z","avatar_url":"https://github.com/CERT-Polska.png","language":"Python","funding_links":[],"categories":["Python","Cybersecurity"],"sub_categories":[],"readme":"# Karton \u003cimg src=\"img/logo.svg\" width=\"64\"\u003e\n\nDistributed malware processing framework based on Python, Redis and S3.\n\n## The idea\n\nKarton is a robust framework for creating **flexible** and **lightweight** malware analysis backends.\nIt can be used to connect malware* analysis systems into a robust pipeline with very little effort.\n\nWe've been in the automation business for a long time. We're dealing with more and more threats, and we have to automate everything to keep up with incidents. Because of this, we often end up with many scripts stuck together with ~~duck~~ duct tape and WD-40. These scripts are written by analysts in the heat of the moment, fragile and ugly - but they work, and produce intel that must be stored, processed further, sent to other systems or shared with other organisations.\n\nWe needed a way to take our PoC scripts and easily insert them into our analysis pipeline. We also wanted to monitor their execution, centralise logging, improve robustness, reduce development inertia... For this exact purpose, we created **Karton**.\n\n\n*\\* while Karton was designed with malware analysis in mind, it works nicely in every microservice-oriented project.*\n\n\n## Installation\n\nInstallation is as easy as a single `pip install` command:\n\n```\npip3 install karton-core\n```\n\nIn order to setup the whole backend environment you will also need S3-compatible storage and Redis, see the [docs](https://karton-core.readthedocs.io/en/latest/getting_started.html#installation) for details.\n\n## Example usage\nTo use karton you have to provide class that inherits from Karton.\n\n\n```python\nfrom karton.core import Karton, Task, Resource\n\nclass GenericUnpacker(Karton):\n    \"\"\"\n    Performs sample unpacking\n    \"\"\"\n    identity = \"karton.generic-unpacker\"\n    filters = [\n        {\n            \"type\": \"sample\",\n            \"kind\": \"runnable\",\n            \"platform\": \"win32\"\n        }\n    ]\n\n    def process(self, task: Task) -\u003e None:\n        # Get sample object\n        packed_sample = task.get_resource('sample')\n        # Log with self.log\n        self.log.info(f\"Hi {packed_sample.name}, let me analyze you!\")\n        ...\n        # Send our results for further processing or reporting\n        task = Task(\n            {\n               \"type\": \"sample\",\n               \"kind\": \"raw\"\n            }, payload = {\n               \"parent\": packed_sample,\n               \"sample\": Resource(filename, unpacked)\n            })\n        self.send_task(task)\n\nif __name__ == \"__main__\":\n    GenericUnpacker.main()\n```\n\n## Karton systems\n\nSome Karton systems are universal and useful to everyone. We decided to share them with the community.\n\n#### [karton](https://github.com/CERT-Polska/karton)\nThis repository. It contains the `karton.system` service - main service, responsible for dispatching tasks within the system. It also contains the `karton.core` module, that is used as a library by other systems.\n\n#### [karton-dashboard](https://github.com/CERT-Polska/karton-dashboard)\nA small Flask dashboard for task and queue management and monitoring.\n\n#### [karton-classifier](https://github.com/CERT-Polska/karton-classifier)\nThe \"router\". It recognises samples/files and produces various task types depending on the file format. Thanks to this, other systems may only listen for tasks with a specific format (for example, only `zip` archives).\n\n#### [karton-archive-extractor](https://github.com/CERT-Polska/karton-archive-extractor)\nGeneric archive unpacker. Archives uploaded into the system will be extracted, and every file will be processed individually.\n\n#### [karton-config-extractor](https://github.com/CERT-Polska/karton-config-extractor)\nMalware extractor. It uses Yara rules and Python modules to extract static configuration from malware samples and analyses. It's a fishing rod, not a fish - we don't share the modules themselves. But it's easy to write your own!\n\n#### [karton-mwdb-reporter](https://github.com/CERT-Polska/karton-mwdb-reporter)\nA very important part of the pipeline. Reporter submits all files, tags, comments and other intel produced during the analysis to [MWDB](https://github.com/CERT-Polska/mwdb-core). If you don't use MWDB yet or just prefer other backends, it's easy to write your own reporter.\n\n#### [karton-yaramatcher](https://github.com/CERT-Polska/karton-yaramatcher)\nAutomatically runs Yara rules on all files in the pipeline, and tags samples appropriately. Rules not included ;).\n\n#### [karton-asciimagic](https://github.com/CERT-Polska/karton-asciimagic)\nKarton system that decodes files encoded with common methods, like `hex`, `base64`, etc. (You wouldn't believe how common it is).\n\n#### [karton-autoit-ripper](https://github.com/CERT-Polska/karton-autoit-ripper)\nA small wrapper around [AutoIt-Ripper](https://github.com/nazywam/AutoIt-Ripper) that extracts embedded AutoIt scripts and resources from compiled AutoIt executables.\n\n#### [DRAKVUF Sandbox](https://github.com/CERT-Polska/drakvuf-sandbox)\nAutomated black-box malware analysis system with DRAKVUF engine under the hood, which does not require an agent on guest OS.\n\n---\n\nThis is how these systems can be used to form a basic malware analysis pipeline:\n[![](img/karton-systems.svg)](img/karton-systems.svg?raw=true)\n\n\n## Community projects that incorporate the Karton framework\n\n#### [c3rb3ru5d3d53c/karton-unpacker](https://github.com/c3rb3ru5d3d53c/karton-unpacker)\nA modular Karton Framework service that unpacks common packers like UPX and others using the Qiling Framework.\n\n#### [c3rb3ru5d3d53c/mwcfg](https://github.com/c3rb3ru5d3d53c/mwcfg) / [c3rb3ru5d3d53c/mwcfg-modules](https://github.com/c3rb3ru5d3d53c/mwcfg-modules)\nA Feature Rich Modular Malware Configuration Extraction Utility for MalDuck\n\n#### [raw-data/karton-die-classifier](https://github.com/raw-data/karton-die-classifier)\nDetect-It-Easy classifier for the Karton framework\n\n#### [raw-data/karton-retdec-unpacker](https://github.com/raw-data/karton-retdec-unpacker)\nRetDec unpacker module for the Karton framework\n\n#### [W3ndige/aurora](https://github.com/W3ndige/aurora) / [W3ndige/karton-similarity](https://github.com/W3ndige/karton-similarity)\nMalware similarity platform with modularity in mind.\n\n![Co-financed by the Connecting Europe Facility by of the European Union](https://www.cert.pl/uploads/2019/02/en_horizontal_cef_logo-e1550495232540.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCERT-Polska%2Fkarton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCERT-Polska%2Fkarton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCERT-Polska%2Fkarton/lists"}