Skip to content

Commit efcab85

Browse files
authored
Merge pull request #3 from morpheuslord/basecodeupdate
env and new docker added
2 parents fe13284 + bb69782 commit efcab85

27 files changed

+698
-509
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
API_KEY = ''

.pre-commit-config.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Borrowed initially from https://github.com/lyft/cartography
2+
default_language_version:
3+
# force all unspecified python hooks to run python3
4+
python: python3
5+
repos:
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: v4.0.1
8+
hooks:
9+
- id: check-executables-have-shebangs
10+
- id: check-merge-conflict
11+
- id: check-vcs-permalinks
12+
# Disabling this as it is giving false positives for sam templates
13+
# - id: check-yaml
14+
# args: ['--unsafe'] # Just check the syntax
15+
- id: debug-statements
16+
- id: end-of-file-fixer
17+
- id: trailing-whitespace
18+
- repo: https://github.com/PyCQA/flake8
19+
rev: 3.9.2
20+
hooks:
21+
- id: flake8
22+
- repo: https://github.com/pre-commit/mirrors-autopep8
23+
rev: v1.5.7
24+
hooks:
25+
- id: autopep8
26+
# disable a few rewrites which will cause autopep8 to reflow
27+
args: [--in-place, '--ignore=E265,E501,W504']
28+
- repo: https://github.com/asottile/reorder_python_imports
29+
rev: v2.6.0
30+
hooks:
31+
- id: reorder-python-imports
32+
args: [--py3-plus]
33+
- repo: https://github.com/pre-commit/mirrors-mypy
34+
rev: v1.0.0
35+
hooks:
36+
- id: mypy
37+
exclude: ^pb/
38+
additional_dependencies:
39+
- types-requests
40+
- types-PyYAML
41+
- types-python-dateutil

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"[python]": {
3+
"editor.defaultFormatter": "ms-python.autopep8"
4+
},
5+
"python.formatting.provider": "none"
6+
}

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,6 @@ RUN apt update && apt upgrade -y
2424
RUN apt install nmap -y
2525
RUN pip install -r requirements.txt
2626

27-
CMD [ "python", "./app.py" ]
27+
ENV OPENAI_API_KEY=''
28+
29+
CMD [ "sh", "-c","python ./app.py ${OPENAI_API_KEY}" ]

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
lint:
2+
pre-commit run --all-files --show-diff-on-failure

__pycache__/app.cpython-310.pyc

601 Bytes
Binary file not shown.
4.65 KB
Binary file not shown.

app.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@
99

1010
import nmap
1111
import openai
12+
13+
from dotenv import load_dotenv
1214
from flask import Flask
1315
from flask import render_template
1416
from flask_restful import Api
1517
from flask_restful import Resource
1618

17-
openai.api_key = "__API__KEY__"
19+
load_dotenv()
20+
openai.api_key = os.getenv('API_KEY')
1821
model_engine = "text-davinci-003"
1922

2023
app = Flask(__name__)

package/LICENSE

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
MIT License
2-
3-
Copyright (c) 2023 morpheuslord
4-
5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
11-
12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
14-
15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1+
MIT License
2+
3+
Copyright (c) 2023 morpheuslord
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
SOFTWARE.

package/MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
include nmap_api/*.py
1+
include nmap_api/*.py
22
include nmap_api/*.txt

0 commit comments

Comments
 (0)