Skip to content

Commit

Permalink
Merge pull request #25 from CiscoSecurity/release-2.0.2
Browse files Browse the repository at this point in the history
Release 2.0.2
  • Loading branch information
oshynk authored Aug 26, 2021
2 parents 1a9aaf0 + 5432295 commit 2cea5f6
Show file tree
Hide file tree
Showing 8 changed files with 353 additions and 31 deletions.
12 changes: 0 additions & 12 deletions .travis.yml

This file was deleted.

8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
FROM alpine:3.14
LABEL maintainer="Ian Redden <[email protected]>"

ENV PIP_IGNORE_INSTALLED 1

# install packages we need
RUN apk update && apk add --no-cache musl-dev openssl-dev gcc py3-configobj \
supervisor git libffi-dev uwsgi-python3 uwsgi-http jq syslog-ng uwsgi-syslog \
supervisor libffi-dev uwsgi-python3 uwsgi-http jq syslog-ng uwsgi-syslog \
py3-pip python3-dev

# do the Python dependencies
ADD code /app
RUN pip3 install -r /app/requirements.txt
ADD code/Pipfile code/Pipfile.lock /
RUN set -ex && pip install --no-cache-dir --upgrade pipenv && \
pipenv install --system
RUN chown -R uwsgi.uwsgi /etc/uwsgi

# copy over scripts to init
Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,24 @@ The code is provided here purely for educational purposes.

## Testing (Optional)

If you want to test the application you will require Docker and several dependencies from the [requirements.txt](code/requirements.txt) file:
Open the code folder in your terminal.
```
pip install --upgrade --requirement code/requirements.txt
cd code
```

If you want to test the application you will require Docker and several dependencies from the [Pipfile](code/Pipfile) file:
```
pip install --no-cache-dir --upgrade pipenv && pipenv install --dev
```

You can perform two kinds of testing:

- Run static code analysis checking for any semantic discrepancies and [PEP 8](https://www.python.org/dev/peps/pep-0008/) compliance:

`flake8 code`
`flake8 .`

- Run the suite of unit tests and measure the code coverage:
```
cd code
coverage run --source api/ -m pytest --verbose tests/unit/ && coverage report
```

Expand Down
17 changes: 17 additions & 0 deletions code/Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
Flask = "==2.0.1"
marshmallow = "==3.12.1"
requests = "==2.25.1"

[dev-packages]
flake8 = "==3.9.2"
coverage = "==5.5"
pytest = "==6.2.4"

[requires]
python_version = "3.9"
321 changes: 321 additions & 0 deletions code/Pipfile.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion code/container_settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"VERSION": "2.0.1",
"VERSION": "2.0.2",
"NAME": "Shodan"
}
6 changes: 0 additions & 6 deletions code/requirements.txt

This file was deleted.

6 changes: 0 additions & 6 deletions scripts/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#!/usr/bin/env sh
set -e

# Grab the repository
if [ -n "$GITREPO" ]; then
echo "rm -rf /app && git clone $GITREPO /app"
rm -rf /app && git clone $GITREPO /app
fi


if [ -n "$ALPINEPYTHON" ] ; then
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/$ALPINEPYTHON/site-packages:/usr/lib/$ALPINEPYTHON/site-packages
Expand Down

0 comments on commit 2cea5f6

Please sign in to comment.