diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..5ed30bf2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM python:3.9-slim-buster + +WORKDIR /app + +COPY requirements.txt . + +COPY .gf /root/.gf + +RUN apt-get update -y && apt-get install -y --no-install-recommends gcc libcurl4-openssl-dev libc6-dev libssl-dev dnsutils && rm -rf /var/lib/apt/lists/* + +RUN pip install --upgrade pip + +RUN pip install -r requirements.txt + +COPY app.py . + +COPY . . + +ENV PYTHONWARNINGS=ignore + +RUN chmod -R 777 . + +CMD ["python3", "app.py"] diff --git a/Dockerfile.bak b/Dockerfile.bak new file mode 100644 index 00000000..57d041b4 --- /dev/null +++ b/Dockerfile.bak @@ -0,0 +1,16 @@ +FROM python:3.9 + +WORKDIR /app + +COPY . /app + +RUN apt-get update && apt-get install -y libcurl4-openssl-dev + +RUN pip install --upgrade pip + +RUN pip install --no-cache-dir -r requirements.txt + +EXPOSE 5000 + +CMD ["python", "app.py"] + diff --git a/app.py b/app.py index da28f10f..88c2be39 100644 --- a/app.py +++ b/app.py @@ -5,6 +5,15 @@ app = Flask(__name__) +conn = psycopg2.connect( + host="db", + database="test_db", + user="test_user", + password="test_password" +) + +cur = conn.cursor() + ######################################################################### @app.route("/") @@ -21,17 +30,10 @@ def home(): def adder(): if request.method == "POST": url = request.form.get('url') - DATABASE_URL = os.environ['DATABASE_URL'] - - conn = psycopg2.connect(DATABASE_URL, sslmode='require') - cur = conn.cursor() cur.execute(f"insert into queue (target) values ('{url}')") conn.commit() - cur.close() - conn.close() - return render_template("index.html", info="Added to queue !") ######################################################################### @@ -369,9 +371,6 @@ def check_queue(): res = '' res = res + q1 - DATABASE_URL = os.environ['DATABASE_URL'] - conn = psycopg2.connect(DATABASE_URL, sslmode='require') - cur = conn.cursor() cur.execute("select * from queue") t = cur.fetchall() @@ -387,8 +386,6 @@ def check_queue(): res = res + q2 conn.commit() - cur.close() - conn.close() return res @@ -724,9 +721,6 @@ def scanned(): res = '' res = res + s1 - DATABASE_URL = os.environ['DATABASE_URL'] - conn = psycopg2.connect(DATABASE_URL, sslmode='require') - cur = conn.cursor() cur.execute("select domain from output") t = cur.fetchall() @@ -742,8 +736,6 @@ def scanned(): res = res + s2 conn.commit() - cur.close() - conn.close() return res ######################################################################### @@ -755,13 +747,9 @@ def delete_item(): key = list(dic.keys()) id = key[0] - DATABASE_URL = os.environ['DATABASE_URL'] - conn = psycopg2.connect(DATABASE_URL, sslmode='require') - cur = conn.cursor() cur.execute("delete from queue where id={}".format(id)) conn.commit() - cur.close() - conn.close() + return redirect(url_for("check_queue")) ######################################################################### @@ -781,9 +769,6 @@ def about(): @app.route("/output/") def output(url): url = url - DATABASE_URL = os.environ['DATABASE_URL'] - conn = psycopg2.connect(DATABASE_URL, sslmode='require') - cur = conn.cursor() cur.execute(f"select result from output where domain = '{url}'") t = cur.fetchall() @@ -797,8 +782,7 @@ def output(url): f.close() conn.commit() - cur.close() - conn.close() + return send_file("/app/results/{}-output.txt".format(url)) ######################################################################### @@ -822,9 +806,6 @@ def results(): @app.route("/gau/") def gau_urls(url): url = url - DATABASE_URL = os.environ['DATABASE_URL'] - conn = psycopg2.connect(DATABASE_URL, sslmode='require') - cur = conn.cursor() cur.execute(f"select gau from output where domain = '{url}'") t = cur.fetchall() @@ -838,11 +819,11 @@ def gau_urls(url): f.close() conn.commit() - cur.close() - conn.close() + return send_file("/app/results/{}-gau.txt".format(url)) ######################################################################### if __name__ == "__main__": - app.run(port=8000) + app.run(host='0.0.0.0', port=5000) + diff --git a/cron.py b/cron.py index 3288a121..9b93770b 100644 --- a/cron.py +++ b/cron.py @@ -3,9 +3,13 @@ import psycopg2 import base64 -DATABASE_URL = os.environ['DATABASE_URL'] +conn = psycopg2.connect( + host="db", + database="test_db", + user="test_user", + password="test_password" +) -conn = psycopg2.connect(DATABASE_URL, sslmode='require') cur = conn.cursor() #checks the db queue table every 60 secs diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..7a52a1b6 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,29 @@ +version: '3' + +services: + db: + image: postgres + container_name: reconator-db + environment: + POSTGRES_USER: test_user + POSTGRES_PASSWORD: test_password + POSTGRES_DB: test_db + volumes: + - db-data:/var/lib/postgresql/data + ports: + - "5432:5432" + + app: + build: . + container_name: reconator-app + environment: + CHAT_ID: 1214546863 + API_KEY: 6247297064:AAFlsbd24qvsVBJXwwoBwbf562F6ty8ml-M + ports: + - "5000:5000" + depends_on: + - db + +volumes: + db-data: + diff --git a/docker-compose.yml.bak b/docker-compose.yml.bak new file mode 100644 index 00000000..5a7ddd1f --- /dev/null +++ b/docker-compose.yml.bak @@ -0,0 +1,29 @@ +version: '3' + +services: + db: + image: postgres + restart: always + environment: + POSTGRES_USER: myuser + POSTGRES_PASSWORD: mypassword + POSTGRES_DB: mydb + volumes: + - db-data:/var/lib/postgresql/data + - ./pg_hba.conf:/var/lib/postgresql/data/pg_hba.conf + ports: + - 5432:5432 + + app: + build: . + ports: + - 5000:5000 + environment: + CHAT_ID: 1214546863 + API_KEY: 6247297064:AAFlsbd24qvsVBJXwwoBwbf562F6ty8ml-M + depends_on: + - db + +volumes: + db-data: + diff --git a/initialise.py b/initialise.py index 9e8c82fd..8f40306e 100644 --- a/initialise.py +++ b/initialise.py @@ -10,11 +10,16 @@ CHAT_ID = os.environ['CHAT_ID'] API_KEY = os.environ['API_KEY'] -DATABASE_URL = os.environ['DATABASE_URL'] bot = telebot.TeleBot(API_KEY) -conn = psycopg2.connect(DATABASE_URL, sslmode='require') +conn = psycopg2.connect( + host="db", + database="test_db", + user="test_user", + password="test_password" +) + cur = conn.cursor() # to save the result of recon on target diff --git a/insert.py b/insert.py index d5a72ba0..8039af70 100644 --- a/insert.py +++ b/insert.py @@ -11,7 +11,6 @@ last = False url = sys.argv[1] -DATABASE_URL = os.environ['DATABASE_URL'] try: temp = sys.argv[2] @@ -19,7 +18,13 @@ except: pass -conn = psycopg2.connect(DATABASE_URL, sslmode='require') +conn = psycopg2.connect( + host="db", + database="test_db", + user="test_user", + password="test_password" +) + cur = conn.cursor() #checking if any previous entry in the database to avoid duplicates diff --git a/modules/binaries/ffuf b/modules/binaries/ffuf index ae122d28..f95d1afb 100755 Binary files a/modules/binaries/ffuf and b/modules/binaries/ffuf differ diff --git a/modules/binaries/gau b/modules/binaries/gau index cd62bf44..fc284e7b 100755 Binary files a/modules/binaries/gau and b/modules/binaries/gau differ diff --git a/modules/binaries/gf b/modules/binaries/gf index 03d44495..47de4d04 100755 Binary files a/modules/binaries/gf and b/modules/binaries/gf differ diff --git a/modules/binaries/gobuster b/modules/binaries/gobuster index 8150ee58..4d793243 100755 Binary files a/modules/binaries/gobuster and b/modules/binaries/gobuster differ diff --git a/modules/binaries/gospider b/modules/binaries/gospider index e982fa79..2d5ce180 100755 Binary files a/modules/binaries/gospider and b/modules/binaries/gospider differ diff --git a/modules/binaries/hakrawler b/modules/binaries/hakrawler index af71b7aa..dd573d2e 100755 Binary files a/modules/binaries/hakrawler and b/modules/binaries/hakrawler differ diff --git a/modules/binaries/httpx b/modules/binaries/httpx index aef90b58..894f60d8 100755 Binary files a/modules/binaries/httpx and b/modules/binaries/httpx differ diff --git a/modules/binaries/nuclei b/modules/binaries/nuclei index 5a3eaf2c..7defcb5a 100755 Binary files a/modules/binaries/nuclei and b/modules/binaries/nuclei differ diff --git a/modules/binaries/qsreplace b/modules/binaries/qsreplace index 616d0387..1c06ae2a 100755 Binary files a/modules/binaries/qsreplace and b/modules/binaries/qsreplace differ diff --git a/modules/binaries/robots b/modules/binaries/robots index 828c1183..3e6c6b60 100755 --- a/modules/binaries/robots +++ b/modules/binaries/robots @@ -1,3 +1,5 @@ +#!/usr/local/bin/python3 + import requests import sys diff --git a/modules/binaries/shcheck b/modules/binaries/shcheck index d8c398db..f9f6cc62 100755 --- a/modules/binaries/shcheck +++ b/modules/binaries/shcheck @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/local/bin/python3 # shcheck - Security headers check! # Copyright (C) 2019-2021 santoru diff --git a/modules/binaries/subfinder b/modules/binaries/subfinder index 5511ee22..6fa1cdeb 100755 Binary files a/modules/binaries/subfinder and b/modules/binaries/subfinder differ diff --git a/modules/binaries/subzy b/modules/binaries/subzy index 7c99d085..28915e54 100755 Binary files a/modules/binaries/subzy and b/modules/binaries/subzy differ diff --git a/modules/binaries/unfurl b/modules/binaries/unfurl index b6078703..e114006b 100755 Binary files a/modules/binaries/unfurl and b/modules/binaries/unfurl differ diff --git a/modules/binaries/wappy b/modules/binaries/wappy index bd2c4cc3..f3764367 100755 --- a/modules/binaries/wappy +++ b/modules/binaries/wappy @@ -1,3 +1,5 @@ +#!/usr/local/bin/python3 + from Wappalyzer import Wappalyzer, WebPage import argparse import requests diff --git a/requirements.txt b/requirements.txt index aaa618a2..888aa2a5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -35,4 +35,6 @@ spyse-python==2.2.3 starlette==0.14.2 lxml uvicorn==0.15.0 -uvloop==0.16.0 +uvloop +emailprotectionslib +Resolver diff --git a/retrieve.py b/retrieve.py index fbe03497..fa9f1c5d 100644 --- a/retrieve.py +++ b/retrieve.py @@ -7,9 +7,14 @@ import sys url = sys.argv[1] -DATABASE_URL = os.environ['DATABASE_URL'] -conn = psycopg2.connect(DATABASE_URL, sslmode='require') +conn = psycopg2.connect( + host="db", + database="test_db", + user="test_user", + password="test_password" +) + cur = conn.cursor() cur.execute(f"select result from output where domain = '{url}'")