|
| 1 | +# ThreatIngestor |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | +An extendable tool to extract and aggregate [IOCs](https://en.wikipedia.org/wiki/Indicator_of_compromise) from threat feeds. |
| 10 | + |
| 11 | +Integrates out-of-the-box with [ThreatKB](https://github.com/InQuest/ThreatKB) and [MISP](https://www.misp-project.org/), and can fit seamlessly into any existing workflow with [SQS](https://aws.amazon.com/sqs/), [Beanstalk](https://beanstalkd.github.io/), and [custom plugins](https://inquest.readthedocs.io/projects/threatingestor/en/latest/developing.html). |
| 12 | + |
| 13 | +Currently used by InQuest Labs IOC-DB: https://labs.inquest.net/iocdb |
| 14 | + |
| 15 | +## Overview |
| 16 | + |
| 17 | +ThreatIngestor can be configured to watch Twitter, RSS feeds, sitemap (XML) feeds, or other sources, extract meaningful information such as malicious IPs/domains and YARA signatures, and send that information to another system for analysis. |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | +Try it out now with this [quick walkthrough](https://inquest.readthedocs.io/projects/threatingestor/en/latest/welcome.html#try-it-out), read more [ThreatIngestor walkthroughs](https://inquest.net/taxonomy/term/42) on the InQuest blog, and check out [labs.inquest.net/iocdb](https://labs.inquest.net/iocdb), an IOC aggregation and querying tool powered by ThreatIngestor. |
| 22 | + |
| 23 | +## Installation |
| 24 | + |
| 25 | +ThreatIngestor requires Python 3.6+, with development headers. |
| 26 | + |
| 27 | +Install ThreatIngestor from PyPI: |
| 28 | + |
| 29 | +```bash |
| 30 | +pip install threatingestor |
| 31 | +``` |
| 32 | + |
| 33 | +Install optional dependencies for using some plugins, as needed: |
| 34 | + |
| 35 | +```bash |
| 36 | +pip install threatingestor[all] |
| 37 | +``` |
| 38 | + |
| 39 | +View the [full installation instructions](https://inquest.readthedocs.io/projects/threatingestor/en/latest/installation.html) for more information. |
| 40 | + |
| 41 | +## Usage |
| 42 | + |
| 43 | +Create a new ``config.yml`` file, and configure each source and operator module you want to use. (See ``config.example.yml`` for layout.) Then run the script: |
| 44 | + |
| 45 | +```bash |
| 46 | +threatingestor config.yml |
| 47 | +``` |
| 48 | + |
| 49 | +By default, it will run forever, polling each configured source every 15 minutes. |
| 50 | + |
| 51 | +If you'd like to run the image extraction source, or include the image extraction functionality for other sources, you will need to be running Python 3.7 >= due to the dependencies: |
| 52 | + |
| 53 | +```bash |
| 54 | +pip install opencv-python pytesseract numpy |
| 55 | +``` |
| 56 | + |
| 57 | +View the [full ThreatIngestor documentation](https://inquest.readthedocs.io/projects/threatingestor/) for more information. |
| 58 | + |
| 59 | +## Plugins |
| 60 | + |
| 61 | +ThreatIngestor uses a plugin architecture with "source" (input) and "operator" (output) plugins. The currently supported integrations are: |
| 62 | + |
| 63 | +### Sources |
| 64 | + |
| 65 | +- [Git repositories](https://inquest.readthedocs.io/projects/threatingestor/en/latest/sources/git.html) |
| 66 | +- [GitHub repository search](https://inquest.readthedocs.io/projects/threatingestor/en/latest/sources/github.html) |
| 67 | +- [Gists by username](https://inquest.readthedocs.io/projects/threatingestor/en/latest/sources/github_gist.html) |
| 68 | +- [RSS feeds](https://inquest.readthedocs.io/projects/threatingestor/en/latest/sources/rss.html) |
| 69 | +- [Sitemap feeds](https://inquest.readthedocs.io/projects/threatingestor/en/latest/sources/sitemap.html) |
| 70 | +- [Image extraction](https://inquest.readthedocs.io/projects/threatingestor/en/latest/sources/image.html) |
| 71 | +- [Amazon SQS queues](https://inquest.readthedocs.io/projects/threatingestor/en/latest/sources/sqs.html) |
| 72 | +- [Twitter](https://inquest.readthedocs.io/projects/threatingestor/en/latest/sources/twitter.html) |
| 73 | +- [Generic web pages](https://inquest.readthedocs.io/projects/threatingestor/en/latest/sources/web.html) |
| 74 | + |
| 75 | +### Operators |
| 76 | + |
| 77 | +- [CSV files](https://inquest.readthedocs.io/projects/threatingestor/en/latest/operators/csv.html) |
| 78 | +- [MISP](https://inquest.readthedocs.io/projects/threatingestor/en/latest/operators/misp.html) |
| 79 | +- [MySQL table](https://inquest.readthedocs.io/projects/threatingestor/en/latest/operators/mysql.html) |
| 80 | +- [SQLite database](https://inquest.readthedocs.io/projects/threatingestor/en/latest/operators/sqlite.html) |
| 81 | +- [Amazon SQS queues](https://inquest.readthedocs.io/projects/threatingestor/en/latest/operators/sqs.html) |
| 82 | +- [ThreatKB](https://inquest.readthedocs.io/projects/threatingestor/en/latest/operators/threatkb.html) |
| 83 | +- [Twitter](https://inquest.readthedocs.io/projects/threatingestor/en/latest/operators/twitter.html) |
| 84 | + |
| 85 | +View the [full ThreatIngestor documentation](https://inquest.readthedocs.io/projects/threatingestor/) for more information on included plugins, and how to create your own. |
| 86 | + |
| 87 | +## Threat Intel Sources |
| 88 | + |
| 89 | +Looking for some threat intel sources to get started? InQuest has a Twitter List with several accounts that post C2 domains and IPs: https://twitter.com/InQuest/lists/ioc-feed. Note that you will need to apply for a Twitter developer account to use the ThreatIngestor Twitter Source. Take a look at ``config.example.yml`` to see how to set this list up as a source. |
| 90 | + |
| 91 | +For quicker setup, RSS feeds can be a great source of intelligence. Check out this example [RSS config file](https://github.com/InQuest/ThreatIngestor/blob/master/rss.example.yml) for a few pre-configured security blogs. |
| 92 | + |
| 93 | +## Support |
| 94 | + |
| 95 | +If you need help getting set up, or run into any issues, feel free to open an [issue](https://github.com/InQuest/ThreatIngestor/issues). You can also reach out to [@InQuest](https://twitter.com/InQuest) on Twitter or read more about us on the web at https://www.inquest.net. |
| 96 | + |
| 97 | +We'd love to hear any feedback you have on ThreatIngestor, its documentation, or how you're putting it to work for you! |
| 98 | + |
| 99 | +## Contributing |
| 100 | + |
| 101 | +Issues and pull requests are welcomed. Please keep Python code PEP8 compliant. By submitting a pull request you agree to release your submissions under the terms of the [LICENSE](https://github.com/InQuest/ThreatIngestor/blob/master/LICENSE). |
| 102 | + |
| 103 | +## Docker |
| 104 | + |
| 105 | + |
| 106 | +### Production |
| 107 | + |
| 108 | +A `Dockerfile` is available for running ThreatIngestor within a Docker container. |
| 109 | + |
| 110 | +First, you'll need to build the container: |
| 111 | + |
| 112 | +```bash |
| 113 | +docker build . -t threatingestor |
| 114 | +``` |
| 115 | + |
| 116 | +After that, you can mount the container by using this command: |
| 117 | + |
| 118 | +```bash |
| 119 | +docker run -it --mount type=bind,source=/,target=/dock threatingestor /bin/bash |
| 120 | +``` |
| 121 | + |
| 122 | +After you've mounted the container and you're inside the `/bin/bash` shell, you can run ThreatIngestor like normal: |
| 123 | + |
| 124 | +```bash |
| 125 | +threatingestor config.yml |
| 126 | +``` |
| 127 | + |
| 128 | +### Development |
| 129 | + |
| 130 | +There is also a Dockerfile.dev for building a development version of ThreatIngestor. All you need is an available .whl file, which can be generated with the following command: |
| 131 | + |
| 132 | +```bash |
| 133 | +python3 -m build |
| 134 | +``` |
| 135 | + |
| 136 | +After you've built the project, you can build the container: |
| 137 | + |
| 138 | +```bash |
| 139 | +docker build . -t threatingestor -f Dockerfile.dev |
| 140 | +``` |
| 141 | + |
| 142 | +NOTE: If you run into any issues while building the development environment or running ThreatIngestor within the container, you may need to comment out the following lines in `Dockerfile.dev` to work properly: |
| 143 | + |
| 144 | +``` |
| 145 | +FROM ubuntu:18.04 |
| 146 | +... |
| 147 | +# RUN apt-get install tesseract-ocr -y |
| 148 | +... |
| 149 | +# RUN pip3 install opencv-python pytesseract numpy |
| 150 | +... |
| 151 | +``` |
0 commit comments