{"id":23419439,"url":"https://github.com/bannsec/extractor","last_synced_at":"2025-08-08T16:17:28.730Z","repository":{"id":82123905,"uuid":"81921969","full_name":"bannsec/extractor","owner":"bannsec","description":"Universal extraction tool","archived":false,"fork":false,"pushed_at":"2017-02-21T02:24:33.000Z","size":32,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-21T07:42:42.469Z","etag":null,"topics":["python","unarchive"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bannsec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2017-02-14T08:18:19.000Z","updated_at":"2024-10-25T08:24:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"d13484b2-fafa-4e0e-b9c0-82e6b54900de","html_url":"https://github.com/bannsec/extractor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bannsec/extractor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bannsec%2Fextractor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bannsec%2Fextractor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bannsec%2Fextractor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bannsec%2Fextractor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bannsec","download_url":"https://codeload.github.com/bannsec/extractor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bannsec%2Fextractor/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269450751,"owners_count":24419342,"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","status":"online","status_checked_at":"2025-08-08T02:00:09.200Z","response_time":72,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["python","unarchive"],"created_at":"2024-12-23T01:18:00.685Z","updated_at":"2025-08-08T16:17:28.721Z","avatar_url":"https://github.com/bannsec.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Install\nJust `pip install .`\n\n# Use\nMake sure you're in the python environment you installed it to. Then:\n\n```bash\n$ extract -h\nusage: extract [-h] [-rm] file\n\nUniversal Extractor\n\npositional arguments:\n  file        The file to extract\n\noptional arguments:\n  -h, --help  show this help message and exit\n  -rm         Should we remove the source file after extract? (defualt: False)\n```\n\n# Extending\nFound something that isn't handled? Adding a handler is easy. When extractor fails, it will tell you what the mime type was that it didn't know how to handle:\n\n```bash\n$ extract carry.c.lzma \nERROR:extract:No handler available for type LZMA compressed data, streamed (application/x-lzma)\n```\n\nTo write a handler, create a module using the mime type. In this case, the mime type is `application/x-lzma`. So, we will create a handler `extract/handlers/application/x_lzma/__init__.py`. This file must define a class named `handle` that extends `handleBaseClass` and exposes an `extract` method. The extract method must call the super class at the end of execution.\n\nExample:\n\n```python\nfrom extract.handlers import handleBaseClass\n\nclass handle(handleBaseClass):\n\n    def extract(self):\n        config = self.config\n\n        # Open it up\n        l = lzma.LZMAFile(config['fileName'])\n\n        # Find the base directory of the file\n        directory = os.path.dirname(os.path.abspath(config['fileName']))\n\n        # Do the actual extraction\n        with open(config['fileName'] + \"_extracted\",\"wb\") as f:\n            f.write(l.read())\n\n        # Call parent handler\n        handleBaseClass.extract(self)\n        \n\nimport lzma\nimport logging\nimport os\n\nlogger = logging.getLogger('extract.handlers.application.x_lzma')\n```\n\nThat's it. The handler will now be automatically discovered and called.\n\nFor an example of calling multiple options in sequence, check out [x-compress](extract/handlers/application/x_compress/__init__.py)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbannsec%2Fextractor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbannsec%2Fextractor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbannsec%2Fextractor/lists"}