diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..a029dc8 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +--- +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: monthly \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b23803c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,80 @@ +--- +name: Release +'on': + pull_request: + push: + branches: + - main + schedule: + - cron: "0 7 * * 0" + +env: + IMAGE_NAME: silk_analysis + +jobs: + + # Test the image builds and works correctly. + test: + name: Test + runs-on: ubuntu-latest + + steps: + - name: Check out the codebase. + uses: actions/checkout@v4 + + - name: Set up Python 3. + uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Install test dependencies. + run: pip3 install pytest-testinfra + + - name: Build image. + run: docker build -t cmusei/${{ env.IMAGE_NAME }} . + + - name: Run the built image. + run: docker run --name=${{ env.IMAGE_NAME }} -td cmusei/${{ env.IMAGE_NAME }} + + - name: Test the built image. + run: py.test --hosts='docker://${{ env.IMAGE_NAME }}' + + # If on main branch, build and release image. + release: + name: Release + runs-on: ubuntu-latest + needs: test + if: github.ref == 'refs/heads/main' + + steps: + - uses: actions/checkout@v4 + - uses: docker/setup-qemu-action@v3 + - uses: docker/setup-buildx-action@v3 + + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push image. + uses: docker/build-push-action@v6 + with: + context: ./ + file: Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: | + cmusei/${{ env.IMAGE_NAME }}:latest + cmusei/${{ env.IMAGE_NAME }}:3 + cmusei/${{ env.IMAGE_NAME }}:3.23.1 + ghcr.io/cmu-sei/${{ env.IMAGE_NAME }}:latest + ghcr.io/cmu-sei/${{ env.IMAGE_NAME }}:3 + ghcr.io/cmu-sei/${{ env.IMAGE_NAME }}:3.23.1 \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9f84ff9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +__pycache__/ +inventory +pytest_junit.xml \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fef2f25 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,52 @@ +FROM cmusei/fixbuf:2 AS build +LABEL maintainer="maheckathorn@cert.org" + +ARG SILK_VERSION=3.23.1 + +# Pre-reqs: +# curl for downloading +# build-essentials for build tools +# ca-certs to download https +# +RUN apt-get update && apt-get install -y --no-install-recommends \ + curl \ + build-essential \ + pkg-config \ + ca-certificates \ + libglib2.0-dev \ + libssl-dev \ + liblzo2-dev \ + libpcap-dev \ + libsnappy-dev \ + && apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /netsa + +RUN curl https://tools.netsa.cert.org/releases/silk-$SILK_VERSION.tar.gz | \ + tar -xz && cd silk-* && \ + ./configure --prefix=/netsa \ + --enable-data-rootdir=/data/ \ + --enable-ipv6 \ + --with-libfixbuf=/netsa/lib/pkgconfig \ + --disable-packing-tools && \ + make && \ + make install && \ + cd ../ && rm -rf silk-$SILK_VERSION + +FROM debian:11-slim +LABEL maintainer="maheckathorn@cert.org" + +RUN apt-get update && apt-get install -y --no-install-recommends \ + liblzo2-2 \ + libsnappy1v5 \ + libpcap0.8 \ + zlib1g \ + libgnutls30 \ + python3 \ + libglib2.0-0 && apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +ENV PATH=$PATH:/netsa/bin + +COPY --from=build /netsa/ /netsa/ \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b60cf1a --- /dev/null +++ b/LICENSE @@ -0,0 +1,135 @@ +docker-silk-analysis + +Copyright 2024 Carnegie Mellon University. + +Licensed under an MIT (SEI)-style license, please see license.txt or contact permission@sei.cmu.edu for full terms. + +MIT (SEI) + +docker-silk-analysis includes and/or can make use of certain third party software ("Third Party Software"). The Third Party Software that is used by docker-silk-analysis is dependent upon your system configuration, but typically includes the software identified in this license.txt file, and/or described in the documentation and/or read me file. By using docker-silk-analysis, you agree to comply with any and all relevant Third Party Software terms and conditions contained in any such Third Party Software or separate license file distributed with such Third Party Software. The parties who own the Third Party Software ("Third Party Licensors") are intended third party beneficiaries to this License with respect to the terms applicable to their Third Party Software. Third Party Software licenses only apply to the Third Party Software and not any other portion of docker-silk-analysis or docker-silk-analysis as a whole. + +This material is based upon work funded and supported by the Department of Homeland Security under Contract No. FA8702-15-D-0002 with Carnegie Mellon University for the operation of the Software Engineering Institute, a federally funded research and development center sponsored by the United States Department of Defense. + +The view, opinions, and/or findings contained in this material are those of the author(s) and should not be construed as an official Government position, policy, or decision, unless designated by other documentation. + +NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. + +[DISTRIBUTION STATEMENT A] This material has been approved for public release and unlimited distribution. Please see Copyright notice for non-US Government use and distribution. + +CERT® is registered in the U.S. Patent and Trademark Office by Carnegie Mellon University. + +This Software includes and/or makes use of Third-Party Software each subject to its own license, including but not limited to the following: + + 1. docker (https://github.com/moby/moby/blob/master/LICENSE) Copyright 2018 Docker, Inc.. + +Apache License + +Version 2.0, January 2004 + +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: +a.You must give any other recipients of the Work or Derivative Works a copy of this License; and +b.You must cause any modified files to carry prominent notices stating that You changed the files; and +c.You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and +d.If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + + You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + + 2. testinfra (https://github.com/philpep/testinfra/blob/master/LICENSE) Copyright 2024 Philippe Pepiot. + +Apache License + +Version 2.0, January 2004 + +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: +a.You must give any other recipients of the Work or Derivative Works a copy of this License; and +b.You must cause any modified files to carry prominent notices stating that You changed the files; and +c.You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and +d.If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + + You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +DM24-1333 \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2839bad --- /dev/null +++ b/Makefile @@ -0,0 +1,22 @@ +# source: https://jmkhael.io/makefiles-for-your-dockerfiles/ +# Run in parallel via make -j2 see: https://stackoverflow.com/a/9220818 + +NS = docker.cc.cert.org/netsa-tools +export SOFTWARE_NAME = silk_analysis + +export IMAGE_NAME += $(NS)/$(SOFTWARE_NAME) + +export WORK_DIR = . + +.PHONY: build test + +build: + docker build --build-arg http_proxy --build-arg https_proxy --build-arg no_proxy -t $(IMAGE_NAME):latest -f Dockerfile . + +test: + docker rm -f $(SOFTWARE_NAME) + docker run --name=$(SOFTWARE_NAME) -td $(IMAGE_NAME) + py.test --hosts='docker://$(SOFTWARE_NAME)' + docker rm -f $(SOFTWARE_NAME) + +default: build diff --git a/README.md b/README.md new file mode 100644 index 0000000..2a16a45 --- /dev/null +++ b/README.md @@ -0,0 +1,148 @@ +[![Software Engineering Institute](https://avatars.githubusercontent.com/u/12465755?s=200&v=4)](https://www.sei.cmu.edu/) + +[![Blog](https://img.shields.io/static/v1.svg?color=468f8b&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=SEI&message=Blog)](https://insights.sei.cmu.edu/blog/ "blog posts from our experts in Software Engineering.") +[![Youtube](https://img.shields.io/static/v1.svg?color=468f8b&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=SEI&message=Youtube&logo=youtube)](https://www.youtube.com/@TheSEICMU/ "vidoes from our experts in Software Engineering.") +[![Podcasts](https://img.shields.io/static/v1.svg?color=468f8b&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=SEI&message=Podcasts&logo=applepodcasts)](https://insights.sei.cmu.edu/podcasts/ "podcasts from our experts in Software Engineering.") +[![GitHub](https://img.shields.io/static/v1.svg?color=468f8b&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=SEI&message=GitHub&logo=github)](https://github.com/cmu-sei "view the source for all of our repositories.") +[![Flow Tools](https://img.shields.io/static/v1.svg?color=468f8b&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=SEI&message=Flow%20Tools)](https://tools.netsa.cert.org/ "documentation and source for all our flow collection and analysis tools.") + + +At the [SEI](https://www.sei.cmu.edu/), we research software engineering, cybersecurity, and AI engineering problems; create innovative technologies; and put solutions into practice. + +Find us at: + +* [Blog](https://insights.sei.cmu.edu/blog/) - blog posts from our experts in Software Engineering. +* [Youtube](https://www.youtube.com/@TheSEICMU/) - vidoes from our experts in Software Engineering. +* [Podcasts](https://insights.sei.cmu.edu/podcasts/) - podcasts from our experts in Software Engineering. +* [GitHub](https://github.com/cmu-sei) - view the source for all of our repositories. +* [Flow Tools](https://tools.netsa.cert.org/) - documentation and source for all our flow collection and analysis tools. + +# [certcc/silk](https://tools.netsa.cert.org/silk/docs.html) + +[![CI](https://img.shields.io/github/actions/workflow/status/cmu-sei/docker-silk_analysis/release.yml?style=for-the-badge&logo=github)](https://github.com/cmu-sei/docker-silk_analysis/actions?query=workflow%3ARelease) [![Docker pulls](https://img.shields.io/docker/pulls/cmusei/silk_analysis?color=468f8b&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=pulls&logo=docker)](https://hub.docker.com/r/cmusei/silk_analysis/) + +SiLK, the System for Internet-Level Knowledge, is a collection of traffic analysis tools developed by the [CERT Network Situational Awareness Team](www.cert.org/netsa) (CERT NetSA) to facilitate security analysis of large networks. The SiLK tool suite supports the efficient collection, storage, and analysis of network flow data, enabling network security analysts to rapidly query large historical traffic data sets. SiLK is ideally suited for analyzing traffic on the backbone or border of a large, distributed enterprise or mid-sized ISP. + +A SiLK installation consists of two categories of applications: the packing system and the analysis suite. The packing system collects IPFIX, NetFlow v9, or NetFlow v5 and converts the data into a more space efficient format, recording the packed records into service-specific binary flat files. The analysis suite consists of tools which read these flat files and perform various query operations, ranging from per-record filtering to statistical analysis of groups of records. The analysis tools interoperate using pipes, allowing a user to develop a relatively sophisticated query from a simple beginning. This image contains **only** the analysis suite tools. + +The vast majority of the current code-base is implemented in C, Perl, or Python. This code has been tested on Linux, Solaris, OpenBSD, Mac OS X, and Cygwin, but should be usable with little or no change on other Unix platforms. + +The SiLK software components are released under [the GNU General Public License V2](https://tools.netsa.cert.org/silk/license.html). + +## Documentation + +More information [here](https://tools.netsa.cert.org/silk/docs.html). + +## Usage + +The intention of this container image is to allow for usage of the SiLK analysis collection of command-line tools for processing SiLK Flow records created by the [SiLK packing system](https://tools.netsa.cert.org/silk/docs.html#packing). Here are some example snippets to help get you started. + +### FCCX-15 Reference Data + +Example reference data for SiLK can be found [here](http://tools.netsa.cert.org/silk/referencedata.html). Download and unpack the data set with: + +```bash +curl https://tools.netsa.cert.org/silk/refdata/FCCX-silk.tar.gz | tar -xz - +``` + +To print information about the network sensors and the earliest and latest date for files in the data set, run: +```bash +docker run --rm -it -v $PWD/FCCX-silk:/data:ro \ + cmusei/silk_analysis:latest \ + rwsiteinfo \ + --fields=sensor,describe-sensor,repo-start-date,repo-end-date +``` +``` +Sensor|Sensor-Description| Start-Date| End-Date| + S0| Div0Ext|2015/06/16T12:00:00|2015/06/18T18:00:00| + S1| Div1Ext|2015/06/16T12:00:00|2015/06/18T18:00:00| + S2| Div0Int|2015/06/16T12:00:00|2015/06/18T18:00:00| + S3| Div1Int1|2015/06/16T12:00:00|2015/06/17T18:00:00| + S4| Div1Int2|2015/06/16T12:00:00|2015/06/17T18:00:00| + S5| Div1log1|2015/06/02T13:00:00|2015/06/17T19:00:00| + S6| Div1log2|2015/06/02T13:00:00|2015/06/17T19:00:00| + S7| Div1log3|2015/06/02T13:00:00|2015/06/17T19:00:00| + S8| Div1log4|2015/06/02T13:00:00|2015/06/17T18:00:00| + S9| Div1ops1|2015/06/02T13:00:00|2015/06/18T17:00:00| + S10| Div1ops2|2015/06/02T13:00:00|2015/06/18T17:00:00| + S11| Div1ops3|2015/06/02T13:00:00|2015/06/18T17:00:00| + S12| Div1svc|2015/06/02T13:00:00|2015/06/18T17:00:00| + S13| Div1dhq|2015/06/02T13:00:00|2015/06/17T18:00:00| + S14| Div1dmz|2015/06/02T13:00:00|2015/06/18T14:00:00| + S15| Div1mar|2015/06/02T13:00:00|2015/06/18T16:00:00| + S16| Div1med|2015/06/02T13:00:00|2015/06/17T18:00:00| + S17| Div1nusr|2015/06/02T13:00:00|2015/06/18T17:00:00| + S18| Div1mgt|2015/06/17T14:00:00|2015/06/18T17:00:00| + S19| Div1intel1|2015/06/02T13:00:00|2015/06/17T19:00:00| + S20| Div1intel2|2015/06/02T13:00:00|2015/06/17T19:00:00| + S21| Div1intel3|2015/06/02T13:00:00|2015/06/17T18:00:00| +``` + +Pull records of interest from the data set and store them in ``flows.rw`` on the docker host: +```bash +docker run --rm -it -v $PWD/FCCX-silk:/data:ro -v $PWD/output:/tmp \ + cmusei/silk_analysis:latest \ + rwfilter \ + --start=2015/06/17T14 \ + --end=2015/06/17T14 \ + --sensor=S1 \ + --type=all \ + --any-address=192.168.70.10 \ + --pass=/tmp/flows.rw +``` + +View the flow records from the previous ``rwfilter`` command with ``rwcut``: +```bash +docker run --rm -it -v $PWD/FCCX-silk:/data:ro -v $PWD/output:/tmp \ + cmusei/silk_analysis:latest \ + rwcut \ + --fields=sip,dip,sport,dport,protocol,stime \ + --num-recs=10 \ + /tmp/flows.rw +``` +``` + sIP| dIP|sPort|dPort|pro| sTime| + 10.0.40.83| 192.168.70.10|53981| 8082| 6|2015/06/17T14:00:02.631| + 10.0.40.20| 192.168.70.10| 53|58887| 17|2015/06/17T14:00:04.619| + 10.0.40.20| 192.168.70.10| 53|55004| 17|2015/06/17T14:00:04.621| + 10.0.40.83| 192.168.70.10|53982| 8082| 6|2015/06/17T14:00:12.673| + 10.0.40.20| 192.168.70.10| 53|64408| 17|2015/06/17T14:00:14.685| + 10.0.40.20| 192.168.70.10| 53|57734| 17|2015/06/17T14:00:14.689| + 10.0.40.83| 192.168.70.10|53983| 8082| 6|2015/06/17T14:00:22.709| + 10.0.40.20| 192.168.70.10| 53|63770| 17|2015/06/17T14:00:24.753| + 10.0.40.20| 192.168.70.10| 53|53374| 17|2015/06/17T14:00:24.755| + 10.0.40.83| 192.168.70.10|53984| 8082| 6|2015/06/17T14:00:32.741| +``` + +If you would like to make use of [linux pipes](https://en.wikipedia.org/wiki/Pipeline_(Unix)), you can overwrite the container entrypoint and set the `-c` option to bash. For example: + +```bash +docker run --rm -it -v $PWD/FCCX-silk:/data:ro \ + --entrypoint=/bin/bash \ + cmusei/silk_analysis:latest \ + -c 'rwfilter \ + --start=2015/06/17T14 \ + --end=2015/06/17T14 \ + --sensor=S1 \ + --type=all \ + --any-address=192.168.70.10 \ + --pass=stdout | \ + rwcut \ + --fields=sip,dip,sport,dport,protocol,stime \ + --num-recs=10' +``` +``` + sIP| dIP|sPort|dPort|pro| sTime| + 10.0.40.83| 192.168.70.10|53981| 8082| 6|2015/06/17T14:00:02.631| + 10.0.40.20| 192.168.70.10| 53|58887| 17|2015/06/17T14:00:04.619| + 10.0.40.20| 192.168.70.10| 53|55004| 17|2015/06/17T14:00:04.621| + 10.0.40.83| 192.168.70.10|53982| 8082| 6|2015/06/17T14:00:12.673| + 10.0.40.20| 192.168.70.10| 53|64408| 17|2015/06/17T14:00:14.685| + 10.0.40.20| 192.168.70.10| 53|57734| 17|2015/06/17T14:00:14.689| + 10.0.40.83| 192.168.70.10|53983| 8082| 6|2015/06/17T14:00:22.709| + 10.0.40.20| 192.168.70.10| 53|63770| 17|2015/06/17T14:00:24.753| + 10.0.40.20| 192.168.70.10| 53|53374| 17|2015/06/17T14:00:24.755| + 10.0.40.83| 192.168.70.10|53984| 8082| 6|2015/06/17T14:00:32.741| +``` + +More examples of using the SiLK analysis tools can be found in the [SiLK Analysis Handbook](https://tools.netsa.cert.org/silk/analysis-handbook.pdf). diff --git a/tests/default/test_default.py b/tests/default/test_default.py new file mode 100644 index 0000000..120d6c6 --- /dev/null +++ b/tests/default/test_default.py @@ -0,0 +1,7 @@ +def test_silk_version(host): + version = "3.23.1" + command = """/netsa/bin/silk_config --silk-version""" + + cmd = host.run(command) + + assert version in cmd.stdout