Skip to content

Commit

Permalink
Updated org api and fixed search apis in dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
wisdomfreak-1 committed Apr 17, 2024
1 parent e907c7f commit 93f43ea
Show file tree
Hide file tree
Showing 17 changed files with 180 additions and 204 deletions.
3 changes: 0 additions & 3 deletions dashboard/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,4 @@ async def custom_404_handler(request, __):
Assets_collection = db["assets_collection"]
Findings_collection = db["findings_collection"]

@app.get("/", status_code=status.HTTP_201_CREATED)
async def get_assets_count():
return "Working "

6 changes: 3 additions & 3 deletions dashboard/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ charset-normalizer==3.3.2
click==8.1.7
cryptography==42.0.5
dnspython==2.6.1
ecdsa==0.18.0
ecdsa==0.19.0
email_validator==2.1.1
fastapi==0.110.0
h11==0.14.0
idna==3.6
idna==3.7
Jinja2==3.1.3
jose==1.0.0
jwt==1.3.1
Expand All @@ -28,7 +28,7 @@ pycryptodome==3.20.0
pycryptodomex==3.20.0
pydantic==2.6.4
pydantic_core==2.16.3
PyJWT==2.1.0
PyJWT==2.8.0
pymongo==4.6.2
python-dateutil==2.9.0.post0
python-jose==3.3.0
Expand Down
2 changes: 1 addition & 1 deletion dashboard/routes/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ async def vulnerability_download_csv(current_user: Annotated[User, Security(get_
}
]

result = list(Findings_collection.aggregate(pipeline))
result = list(Assets_collection.aggregate(pipeline))

df = pd.DataFrame(result) # Convert data to a DataFrame
csv_file = io.StringIO() # Create an in-memory file-like object
Expand Down
11 changes: 6 additions & 5 deletions dashboard/routes/org.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
from fastapi import APIRouter, HTTPException, status, Query
from pymongo import MongoClient
from config.db import db, Assets_collection, Findings_collection

router = APIRouter(prefix="/org", tags=["org details"])

client = MongoClient("mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+2.2.1")
# client = MongoClient("mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+2.2.1")


#mongodb details
db = client["mantis"]
Assets_collection = db["assets_collection"]
Findings_collection = db["findings_collection"]
# #mongodb details
# db = client["mantis"]
# Assets_collection = db["assets_collection"]
# Findings_collection = db["findings_collection"]

@router.get("/organizations", status_code=status.HTTP_200_OK)
async def get_organizations():
Expand Down
7 changes: 5 additions & 2 deletions dashboard/routes/static_page_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@
)

#tempelete and static file mount

@router.get("/", response_class=HTMLResponse)
async def read_item(request: Request):
return templates.TemplateResponse("login.html", {"request": request})

router.mount("/static", StaticFiles(directory="static"), name="static")
templates = Jinja2Templates(directory="templates")

#route for the testing
@router.get("/login", response_class=HTMLResponse)
async def read_item(request: Request):

return templates.TemplateResponse("login.html", {"request": request})

@router.get("/registration", response_class=HTMLResponse)
Expand Down
45 changes: 0 additions & 45 deletions dashboard/static/chart/test/bar.js

This file was deleted.

86 changes: 0 additions & 86 deletions dashboard/static/chart/test/line.js

This file was deleted.

49 changes: 0 additions & 49 deletions dashboard/static/chart/test/pie.js

This file was deleted.

6 changes: 3 additions & 3 deletions dashboard/templates/Phishing.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ <h3 class="p-4 mt-2 mb-2 ml-2 font-bold">Phishing</h3>
<input id="searchInput" class="p-2 rounded-lg bg-gray-200 mr-2 text-black border-none" placeholder="Search...">
</div>
<!-- Add a button to toggle visibility on small screens -->
<button id="searchBtn" class="hidden md:block hover:bg-indigo-800 bg-indigo-600 p-2 rounded-lg bg-gray-200 mr-2 text-white border-none flex items-center">
<button id="searchBtn" class="hidden md:block border-2 border-indigo-600 text-indigo-600 py-2 px-4 mr-2 rounded-2xl">
Search
</button>
<a href="#" id="exportLink" class="hover:bg-indigo-800 bg-indigo-600 p-2 rounded-lg bg-gray-200 mr-2 text-white border-none flex items-center">
<a href="#" id="exportLink" class="border-2 border-indigo-600 text-indigo-600 py-2 px-4 mr-2 rounded-2xl">
Export <svg class="h-6 ml-2 mr-1" viewBox="-2.4 -2.4 28.80 28.80" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round" stroke="#CCCCCC" stroke-width="4.8"> <path d="M12 3V16M12 16L16 11.625M12 16L8 11.625" stroke="#ffffff" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"></path> <path d="M15 21H9C6.17157 21 4.75736 21 3.87868 20.1213C3 19.2426 3 17.8284 3 15M21 15C21 17.8284 21 19.2426 20.1213 20.1213C19.8215 20.4211 19.4594 20.6186 19 20.7487" stroke="#ffffff" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"></path> </g><g id="SVGRepo_iconCarrier"> <path d="M12 3V16M12 16L16 11.625M12 16L8 11.625" stroke="#ffffff" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"></path> <path d="M15 21H9C6.17157 21 4.75736 21 3.87868 20.1213C3 19.2426 3 17.8284 3 15M21 15C21 17.8284 21 19.2426 20.1213 20.1213C19.8215 20.4211 19.4594 20.6186 19 20.7487" stroke="#ffffff" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>
</a>
</div>
Expand Down Expand Up @@ -273,7 +273,7 @@ <h3 class="p-4 mt-2 mb-2 ml-2 font-bold">Phishing</h3>
const url = window.URL.createObjectURL(new Blob([blob]));
const a = document.createElement('a');
a.href = url;
a.download = `vulnerability_data_${download_org}.csv`; // Set the filename for download
a.download = `phishing_${download_org}.csv`; // Set the filename for download
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
Expand Down
3 changes: 1 addition & 2 deletions dashboard/templates/assets.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@
<script src="{{ url_for('static', path='chart/bar.js') }}"></script>
<script src="{{ url_for('static', path='chart/PolarArea.js') }}"></script>
<script src="{{ url_for('static', path='chart/radar.js') }}"></script>
<script src="{{ url_for('static', path='chart/test/pie.js') }}"></script>
<script src="{{ url_for('static', path='chart/line.js') }}"></script>

<script>
Expand Down Expand Up @@ -337,7 +336,7 @@ <h3 class="p-4 mt-2 mb-2 ml-2 font-bold">Assets Table</h3>
const url = window.URL.createObjectURL(new Blob([blob]));
const a = document.createElement('a');
a.href = url;
a.download = `vulnerability_data_${download_org}.csv`; // Set the filename for download
a.download = `assets_${download_org}.csv`; // Set the filename for download
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
Expand Down
2 changes: 1 addition & 1 deletion dashboard/templates/certificates.html
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ <h3 class="p-4 mt-2 mb-2 ml-2 font-bold">Certificate</h3>
const url = window.URL.createObjectURL(new Blob([blob]));
const a = document.createElement('a');
a.href = url;
a.download = `vulnerability_data_${download_org}.csv`; // Set the filename for download
a.download = `cert_${download_org}.csv`; // Set the filename for download
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
Expand Down
68 changes: 68 additions & 0 deletions dashboard/templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/tailwind.min.css" rel="stylesheet">

<title>Mantis</title>
<style>
*{
box-sizing: border-box;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

}
.card {
transition: transform 0.3s ease;
}

.card:hover {
transform: scale(1.05); /* Enlarge the card on hover */
}


</style>
</head>
<body class="bg-gray-900">
<pre class="text-green-500">

__ __ _ _
| \/ | __ _ _ __ | |_(_)___
| |\/| |/ _` | '_ \| __| / __|
| | | | (_| | | | | |_| \__ \
|_| |_|\__,_|_| |_|\__|_|___/

Recon Automation Framework (v1.0)

usage:
ONBOARD: (First time scan, Run this !!)

mantis onboard -o example_org -t www.example.org
mantis onboard -o example_org -f file.txt

SCAN:

mantis scan -o example_org
mantis scan -o example_org -a example_app


1. You can find the Mantis shell below where you can run mantis commands. Run help for further instructions.
- You can always access Mantis container again using: docker exec -it mantis bash
- For ease of use, run mantis-activate command anywhere on the system to exec into Mantis docker

2. Mantis dashboard is accessible on the host's localhost port 8000
- For ease of use, you can access dashboard from your system at http://mantis.dashboard:8000
- You can access dashboard container using - docker exec -it mantis-dashboard bash

3. You can access MongoDB container using: docker exec -it mongodb bash

4. Mantis documentation is available at https://phonepe.github.io/mantis
5. Get help and give feedback at https://discord.gg/uJV8Y3uSGu

Mantis has been setup successfully on docker!

<a href="/login" class="border-2 border-indigo-600 text-indigo-600 py-2 px-4 rounded-2xl">Login </a>
</pre>
</body>
</html>
2 changes: 1 addition & 1 deletion dashboard/templates/information_vul.html
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ <h3 class="p-4 mt-2 mb-2 ml-2 font-bold">Info Vulnerabilities</h3>
const url = window.URL.createObjectURL(new Blob([blob]));
const a = document.createElement('a');
a.href = url;
a.download = `vulnerability_data_${download_org}.csv`; // Set the filename for download
a.download = `info_vul_${download_org}.csv`; // Set the filename for download
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
Expand Down
Loading

0 comments on commit 93f43ea

Please sign in to comment.