Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.git
25 changes: 25 additions & 0 deletions .github/workflows/semgrep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

on:
pull_request: {}
workflow_dispatch: {}
push:
branches:
- main
- master
schedule:
- cron: '0 0 * * *'
name: Semgrep config
jobs:
semgrep:
name: semgrep/ci
runs-on: ubuntu-20.04
env:
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
SEMGREP_URL: https://cloudflare.semgrep.dev
SEMGREP_APP_URL: https://cloudflare.semgrep.dev
SEMGREP_VERSION_CHECK_URL: https://cloudflare.semgrep.dev/api/check-version
container:
image: returntocorp/semgrep
steps:
- uses: actions/checkout@v3
- run: semgrep ci
21 changes: 10 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
FROM python:3.5-alpine
FROM python:3.9-alpine

RUN apk add --no-cache nmap nmap-scripts git
COPY requirements.txt /
RUN pip install --no-cache-dir -r requirements.txt

RUN git clone https://github.com/vulnersCom/nmap-vulners /usr/share/nmap/scripts/vulners && nmap --script-updatedb
RUN mkdir /shared

COPY run.sh output_report.py gcp_push.py aws_push.py /
COPY aws_push.py gcp_push.py output_report.py requirements.txt run.sh /
COPY contrib /contrib
COPY shared /shared

RUN chmod +x /run.sh
RUN apk add --no-cache nmap nmap-scripts git && \
pip install --no-cache-dir -r requirements.txt && \
git clone https://github.com/vulnersCom/nmap-vulners \
/usr/share/nmap/scripts/vulners && \
nmap --script-updatedb && \
apk del git && \
chmod +x /run.sh

ENTRYPOINT ["/run.sh"]
ENTRYPOINT ["/bin/sh","-c","/run.sh"]
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
build :
docker build -t flan_scan .
build :
docker build --no-cache -t flan_scan -f Dockerfile .

container_name = flan_$(shell date +'%s')
start :
docker run --name $(container_name) -v "$(CURDIR)/shared:/shared:Z" flan_scan
start :
docker run --rm --cap-drop=all --cap-add=NET_RAW --name $(container_name) -v "$(CURDIR)/shared:/shared:Z" flan_scan

md :
docker run --name $(container_name) -v "$(CURDIR)/shared:/shared:Z" -e format=md flan_scan
docker run --rm --cap-drop=all --cap-add=NET_RAW --name $(container_name) -v "$(CURDIR)/shared:/shared:Z" -e format=md flan_scan

html :
docker run --name $(container_name) -v "$(CURDIR)/shared:/shared:Z" -e format=html flan_scan
docker run --rm --cap-drop=all --cap-add=NET_RAW --name $(container_name) -v "$(CURDIR)/shared:/shared:Z" -e format=html flan_scan

json :
docker run --name $(container_name) -v "$(CURDIR)/shared:/shared:Z" -e format=json flan_scan
docker run --rm --cap-drop=all --cap-add=NET_RAW --name $(container_name) -v "$(CURDIR)/shared:/shared:Z" -e format=json flan_scan
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ $ nmap -sV -oX /shared/xml_files -oN - -v1 $@ --script=vulners/vulners.nse <ip-a
```
The `-oX` flag adds an XML version of the scan results to the `/shared/xml_files` directory and the `-oN -` flag outputs "normal" Nmap results to the console. The `-v1` flag increases the verbosity to 1 and the `-sV` flag runs a service detection scan (aside from Nmap's default port and SYN scans). The `--script=vulners/vulners.nse` is the script that matches the services detected with relevant CVEs.

Nmap also allows you to run UDP scans and to scan IPv6 addresses. To add these and other flags to Scan Flan's Nmap command after running `make build` run the container and pass in your Nmap flags like so:
Nmap also allows you to run UDP scans and to scan IPv6 addresses. To add these and other flags to Flan Scan's Nmap command after running `make build` run the container and pass in your Nmap flags like so:

```bash
$ docker run -v $(CURDIR)/shared:/shared flan_scan <Nmap-flags>
Expand Down
5 changes: 4 additions & 1 deletion contrib/parsers/flan_xml_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ def parse_port(self, ip_addr: str, port: Dict[str, Any]):
if port['state']['@state'] == 'closed':
return

app_name = self.get_app_name(port['service'])
try:
app_name = self.get_app_name(port['service'])
except KeyError:
app_name = "unknown"
port_num = port['@portid']
new_app = app_name not in self.results
self.results[app_name].locations[ip_addr].append(port_num)
Expand Down
2 changes: 2 additions & 0 deletions contrib/report_builders/latex_report_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ def _append(self, text: str):
\usepackage{hyperref}
\usepackage{fontawesome}
\usepackage{listings}
\extrafloats{600}
\maxdeadcycles 600
\lstset{
basicstyle=\small\ttfamily,
columns=flexible,
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
xmltodict==0.12.0
google-cloud-storage==1.23.0
boto3==1.12.15
Jinja2==2.10.3
Jinja2==2.11.3
markupsafe==2.0.1