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

Blog post #3

Open
wants to merge 4 commits into
base: blog-post
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
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
this is the branch for the pdiscovery-bot!
this is the branch for the pdiscovery-bot!

https://blog.projectdiscovery.io/asm-platform-using-projectdiscovery-tools/

To run use the following commands:
```
cd ./bin
pip3 install -r requirements.txt
sh ./start_db.sh
flask run
streamlit run ./bin/ui.py
python3 worker.py
```
Results can be viewed with the simple UI utilising streamlit.

<img width="1069" alt="image" src="https://user-images.githubusercontent.com/954507/184242099-64a426cc-a224-4187-8e0e-3e02729b97bd.png">
1 change: 1 addition & 0 deletions bin/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pymongo
redis
apscheduler
streamlit
71 changes: 71 additions & 0 deletions bin/ui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/usr/bin/env python3
import streamlit as st
import pymongo
from pymongo import MongoClient
import pandas as pd
import string
import io
import re
import lxml

st.set_page_config(
page_title="ASM Viewer",
page_icon="🧊",
layout="wide",
initial_sidebar_state="expanded"

)

st.title("ASM Viewer")
st.sidebar.header('ASM Viewer')
scans = st.sidebar.text_input('Scan Search')
st.sidebar.info('Please start by typing the target id.')

# Initialize connection.
# Uses st.experimental_singleton to only run once.
@st.experimental_singleton
def init_connection():
return pymongo.MongoClient("mongodb://127.0.0.1:27017")

client = init_connection()

# pipeline for subs


def query(scans,keywords):

subspipeline = [
{
"$match": {
'target_id': '%s' % (scans)
}
},
{
"$sort": {
"scan_id": pymongo.ASCENDING
}
},
{
"$project": {
"_id": 0, # Change to 0 if you wish to ignore "_id" field.
"name": 1,
"host": 1,
"source": 1,
"scan_id": 1
}
}]

result = client['asm']['subs'].aggregate(subspipeline)

results_as_dataframe = pd.DataFrame(list(result))

return results_as_dataframe



if st.sidebar.button('Search'):
df = query(scans,scans)
if df.empty:
st.error("No matches found!")
else:
st.write(df)