https://github.com/ethicalhackingplayground/recon_db_scripts
Creating a Database for Mass Recon
https://github.com/ethicalhackingplayground/recon_db_scripts
Last synced: 9 months ago
JSON representation
Creating a Database for Mass Recon
- Host: GitHub
- URL: https://github.com/ethicalhackingplayground/recon_db_scripts
- Owner: ethicalhackingplayground
- Created: 2021-02-23T08:02:23.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-02-25T02:32:34.000Z (over 4 years ago)
- Last Synced: 2025-01-02T01:19:29.905Z (10 months ago)
- Homepage:
- Size: 5.86 KB
- Stars: 12
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-hacking-lists - ethicalhackingplayground/recon_db_scripts - Creating a Database for Mass Recon (Others)
README
# recon_db_scripts
### Install MariaDB
```bash
apt -y install mariadb-client
```
```bash
apt -y install mariadb-server
```
### Installing The Database
```bash
mysql_secure_installation
```
### Creating The Database
```sql
mysql -u root -p
```
```sql
create database recon_test;
```
```sql
use recon_test;
```
```sql
create table if not exists subdomains(id INT AUTO_INCREMENT KEY, data VARCHAR(255) NOT NULL);
```
```sql
create table if not exists resolved(id INT AUTO_INCREMENT KEY, data VARCHAR(255) NOT NULL);
```
### Setting Up the Scripts
```bash
mkdir recontest
```
***nano insert_subs.sh***
```bash
#!/bin/bash
if [[ -z $1 ]]; then
echo "Usage: ./insert_subs.sh newfile"
exit
fi
cat $1 | grep -vE "access.telenet|github|myshopify|shopify|facebook|google|microsoft|aliyun|amazoncloud|stanford.edu|huaweicloud" >> o1
mysql recondb -e "select * from subdomains" | awk '{print $2}' | grep -v "data" >> o
paste -d@ o o1 | while IFS="@" read -r f1 f2
do
if [[ "$f2" != "$f1" ]]; then
mysql recondb -e "insert ignore into subdomains (data) values('$f2')"
fi
done
rm o
rm o1
```
***nano insert_resolved.sh***
```bash
#!/bin/bash
if [[ -z $1 ]]; then
echo "Usage: ./insert_resolved.sh newfile"
exit
fi
cat $1 | grep -vE "access.telenet|github|myshopify|shopify|facebook|google|microsoft|aliyun|amazoncloud|stanford.edu|huaweicloud" >> o3
mysql recondb -e "select * from resolved" | awk '{print $2}' | grep -v "data" >> o2
paste -d@ o2 o3 | while IFS="@" read -r f1 f2
do
if [[ "$f2" != "$f1" ]]; then
mysql recondb -e "insert ignore into resolved (data) values('$f2')"
fi
done
rm o2
rm o3
```
### Download All Subdomains From Chaos
https://chaos.projectdiscovery.io/
```bash
find . -name="*.txt" | xargs -I@ bash -c '{ cat "@" >> chaos.txt ; }'
```
```bash
cat /root/recon/chaos/chaos.txt | rev | cut -d '.' -f1,2 | rev | sort -u >> /root/recon/chaos/root.txt
```
***nano run_scans.sh***
```bash
subfinder -dL /root/recon/chaos/roots.txt -silent >> new.txt
./insert_subs.sh new.txt
cat new.txt | httpx -silent >> resolved.txt
./insert_resolved.sh resolved.txt
```
***nano run_attacks.sh***
```bash
#Insert new data into the database
if [[ -z $1 ]]; then
echo "Usage: "
echo " ./run_attack.sh resolved"
echo " ./run_attack.sh subdomains"
exit
fi
if [[ "$1" != "subdomains" ]] && [[ "$1" != "resolved" ]]; then
exit
fi
# Run attacks all the time
while true; do
# Kill all jobs first
jobs -p | grep "nuclei" | xargs -n1 pkill -SIGINT -g
mysql recondb -e "select * from $1" | awk '{print $2}' | nuclei -t /root/nuclei-templates/ -severity critical,high -exclude takeovers -c 200 | notify -silent
done
```
#### Run the attacks in the background
```bash
chmod +x run_attacks.sh; ./run_attacks.sh &
````
### Creating Cron Rules
```bash
crontab -e
```
### Visualising Cron Rules
https://crontab.guru/#0_1_*_*_1
### Starting the Cron Job
```bash
0 1 * * 1 bash /root/recontest/run_scans.sh
```
```bash
service cron restart
```
#### Done