Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #142

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
14 changes: 14 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

FROM mcr.microsoft.com/devcontainers/python:0-3.11

ENV app /app

RUN mkdir $app
WORKDIR $app
COPY requirements.txt $app

RUN pip install -r requirements.txt && rm requirements.txt
WORKDIR $app/API/

EXPOSE 8094
CMD ["tail -f /app/logs/scan.log"]
24 changes: 24 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "Python 3",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"dockerComposeFile": "docker-compose.yml",
"service": "devcontainer",

// "workspaceMount": "source=${localWorkspaceFolder},target=/app,type=bind",
"workspaceFolder": "/app"

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "pip3 install --user -r requirements.txt",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
24 changes: 24 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: '3.8'

services:
devcontainer:
build:
context: "../"
dockerfile: "./.devcontainer/Dockerfile"
volumes:
- ../:/app
command: sleep infinity
depends_on: [ "mongo" ]

mongo:
image: mongo
restart: unless-stopped
healthcheck:
test: [ "CMD", "bash", "-c", "echo 'db.runCommand(\"ping\").ok' | mongosh --quiet" ]
interval: 10s
timeout: 5s
retries: 4
start_period: 1s

rabbit:
image: rabbitmq:3
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
*.pyc
*.log

.idea/
venv/
/logs/scan.log
23 changes: 23 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"command": "celery -A celery_app worker --loglevel=INFO",
"name": "Start worker",
"request": "launch",
"type": "node-terminal"
},
{
"name": "Start python api",
"type": "python",
"request": "launch",
"cwd": "${workspaceFolder}/API/",
"program": "${workspaceFolder}/API/api.py",
"console": "integratedTerminal",
"justMyCode": true
}
]
}
Binary file added API/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
Binary file added API/__pycache__/dbconnection.cpython-311.pyc
Binary file not shown.
Binary file added API/__pycache__/scanstatus.cpython-311.pyc
Binary file not shown.
5 changes: 2 additions & 3 deletions API/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def get_postman():
appname = request.form['appname']
url = request.form['url']
auth_token =request.form['authheader']
print(url)

if not url:
return jsonify({"status" : "Failed! (add URL)"})
# print(request.files)
Expand All @@ -329,7 +329,7 @@ def get_postman():
return jsonify(msg)
try:
scan_id = generate_hash()
db.scanids.insert({"scanid" : scan_id, "name" : appname, "url" : url})
db.scanids.insert_one({"scanid" : scan_id, "name" : appname, "url" : url})
scan_result = scan_postman_collection(filename,scan_id,auth_token,url)
print(scan_result)
except Exception as e:
Expand All @@ -343,7 +343,6 @@ def get_postman():
# db.email.insert({"email" : email, "scanid" : scan_id, "to_email" : email, "email_notification" : 'N'})
msg = {"status" : "Success", "scanid" : scan_id}
else:

msg = {"status" : "Failed!"}

return jsonify(msg)
Expand Down
Binary file added __pycache__/astra.cpython-311.pyc
Binary file not shown.
Binary file added __pycache__/celery_app.cpython-311.pyc
Binary file not shown.
4 changes: 2 additions & 2 deletions astra.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ def scan_postman_collection(file_name,scanid,auth_token, new_url=None):
except:
pass
# Add the value for the authorization header here
login_body = ast.literal_eval(get_value('config.property','login','loginbody'))
auth_token_name = get_value('config.property','login','auth_token')
# login_body = ast.literal_eval(get_value('config.property','login','loginbody'))
# auth_token_name = get_value('config.property','login','auth_token')
# print(login_body)
# print(auth_token_name)
headers['Authorization'] = auth_token#get_auth_from_url(os.environ["auth_url"],login_body, auth_token_name)
Expand Down
1 change: 1 addition & 0 deletions celery_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os

sys.path.append(os.getcwd())
# app = Celery('celery_app', broker='amqp://guest@rabbit//')
app = Celery('celery_app', broker='amqp://guest@localhost//')
# app.conf.task_serializer = 'pickle'
# app.conf.result_serializer = 'pickle'
Expand Down
Binary file added core/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
Binary file added core/__pycache__/login.cpython-311.pyc
Binary file not shown.
Binary file added core/__pycache__/parsers.cpython-311.pyc
Binary file not shown.
Binary file added core/__pycache__/zap_config.cpython-311.pyc
Binary file not shown.
Binary file added core/__pycache__/zapscan.cpython-311.pyc
Binary file not shown.
Loading