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

Chequeo de dependencias #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
134 changes: 113 additions & 21 deletions mainRecon/mainRecon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ echo -e $yellow"
._ _ _. o ._ |_) _ _ _ ._
| | | (_| | | | | \ (/_ (_ (_) | |

By_l34r00t | {v1.0}
By_l34r00t | {v1.1}
@leapintos | [email protected]

Collaborator: @p0ch4t | [email protected]
"$end

# Usage
Expand All @@ -29,16 +31,92 @@ bot_token=$token
chat_ID=$chat_ID
url="https://api.telegram.org/bot$bot_token/sendMessage"

# Function
# Functions

check_root(){
if [ "$(id -u)" != "0" ]; then
echo -e $red"[X] Este programa solo puede ejecutarse siendo ROOT!"$end
exit 1
fi
}

check_dependencies(){
echo -e $green"[+] "$end"Chequeando dependencias...\n"
mkdir -p /opt/tools_mainRecon > /dev/null 2>&1
export PATH="$PATH:/opt/tools_mainRecon"
dependencies=(findomain assetfinder amass subfinder httprobe waybackurls aquatone zile.py linkfinder.py paramspider.py subjs dirsearch.py unfurl)
for program in "${dependencies[@]}"; do
which $program > /dev/null 2>&1
if [ "$(echo $?)" -ne "0" ]; then
echo -e $red"[X] $program "$end"no esta instalado."
case $program in
findomain)
echo -e "${yellow}[..]${end} Instalando $program"
wget -q --show-progress https://github.com/Findomain/Findomain/releases/download/5.1.1/findomain-linux -O /opt/tools_mainRecon/findomain && chmod +x /opt/tools_mainRecon/findomain && echo -e "${green}[V] $program${end} instalado correctamente!"
;;
assetfinder)
echo -e "${yellow}[..]${end} Instalando $program"
apt install $program -y > /dev/null 2>&1 && echo -e "${green}[V] $program${end} instalado correctamente!"
;;
amass)
echo -e "${yellow}[..]${end} Instalando $program"
apt install $program -y > /dev/null 2>&1 && echo -e "${green}[V] $program${end} instalado correctamente!"
;;
subfinder)
echo -e "${yellow}[..]${end} Instalando $program"
apt install $program -y > /dev/null 2>&1 && echo -e "${green}[V] $program${end} instalado correctamente!"
;;
httprobe)
echo -e "${yellow}[..]${end} Instalando $program"
apt install $program -y > /dev/null 2>&1 && echo -e "${green}[V] $program${end} instalado correctamente!"
;;
waybackurls)
echo -e "${yellow}[..]${end} Instalando $program"
wget -q --show-progress https://github.com/tomnomnom/waybackurls/releases/download/v0.1.0/waybackurls-linux-amd64-0.1.0.tgz -O /opt/tools_mainRecon/waybackurls.tgz && tar -xzf /opt/tools_mainRecon/waybackurls.tgz -C /opt/tools_mainRecon/ && rm /opt/tools_mainRecon/waybackurls.tgz && echo -e "${green}[V] $program${end} instalado correctamente!"
;;
aquatone)
echo -e "${yellow}[..]${end} Instalando $program"
wget -q --show-progress https://github.com/michenriksen/aquatone/releases/download/v1.7.0/aquatone_linux_amd64_1.7.0.zip -O /opt/tools_mainRecon/aquatone.zip && unzip -q /opt/tools_mainRecon/aquatone.zip -d /opt/tools_mainRecon && rm /opt/tools_mainRecon/aquatone.zip /opt/tools_mainRecon/README.md /opt/tools_mainRecon/LICENSE.txt && echo -e "${green}[V] $program${end} instalado correctamente!"
;;
zile.py)
echo -e "${yellow}[..]${end} Instalando $program"
wget https://raw.githubusercontent.com/bonino97/new-zile/master/zile.py -q --show-progress -O /opt/tools_mainRecon/zile.py && chmod +x /opt/tools_mainRecon/zile.py && sed -i '1s/^/#!\/usr\/bin\/python3\n/' /opt/tools_mainRecon/zile.py && pip3 install termcolor -q && echo -e "${green}[V] $program${end} instalado correctamente!"
;;
linkfinder.py)
echo -e "${yellow}[..]${end} Instalando $program"
cd /opt/tools_mainRecon; git clone https://github.com/GerbenJavado/LinkFinder.git -q && pip3 install -r LinkFinder/requirements.txt -q && ln -s /opt/tools_mainRecon/LinkFinder/linkfinder.py /opt/tools_mainRecon/linkfinder.py && echo -e "${green}[V] $program${end} instalado correctamente!"
;;
paramspider.py)
echo -e "${yellow}[..]${end} Instalando $program"
cd /opt/tools_mainRecon; git clone https://github.com/devanshbatham/ParamSpider -q && pip3 install -r ParamSpider/requirements.txt -q && ln -s /opt/tools_mainRecon/ParamSpider/paramspider.py /opt/tools_mainRecon/paramspider.py && echo -e "${green}[V] $program${end} instalado correctamente!"
;;
subjs)
echo -e "${yellow}[..]${end} Instalando $program"
wget -q --show-progress https://github.com/lc/subjs/releases/download/v1.0.1/subjs_1.0.1_linux_amd64.tar.gz -O /opt/tools_mainRecon/subjs.tar.gz && tar -xzf /opt/tools_mainRecon/subjs.tar.gz -C /opt/tools_mainRecon/ && rm /opt/tools_mainRecon/subjs.tar.gz /opt/tools_mainRecon/LICENSE /opt/tools_mainRecon/README.md && echo -e "${green}[V] $program${end} instalado correctamente!"
;;
dirsearch.py)
echo -e "${yellow}[..]${end} Instalando $program"
wget -q --show-progress https://github.com/maurosoria/dirsearch/archive/refs/tags/v0.4.0.zip -O /opt/tools_mainRecon/dirsearch.zip && unzip -q /opt/tools_mainRecon/dirsearch.zip -d /opt/tools_mainRecon/ && rm /opt/tools_mainRecon/dirsearch.zip && ln -s /opt/tools_mainRecon/dirsearch-0.4.0/dirsearch.py /opt/tools_mainRecon/dirsearch.py && echo -e "${green}[V] $program${end} instalado correctamente!"
;;
unfurl)
echo -e "${yellow}[..]${end} Instalando $program"
wget -q --show-progress https://github.com/tomnomnom/unfurl/releases/download/v0.4.0/unfurl-linux-amd64-0.4.0.tgz -O /opt/tools_mainRecon/unfurl-linux-amd64-0.4.0.tgz && tar -xzf /opt/tools_mainRecon/unfurl-linux-amd64-0.4.0.tgz -C /opt/tools_mainRecon/ && rm /opt/tools_mainRecon/unfurl-linux-amd64-0.4.0.tgz && echo -e "${green}[V] $program${end} instalado correctamente!"
esac
else
echo -e $green"[V] $program"$end
fi
done
}

get_subdomains() {
echo -e $red"[+]"$end $bold"Get Subdomains"$end
folder=$program-$(date '-I')
mkdir $folder && cd $folder
folder=$programa-$(date '-I')
mkdir -p /opt/BugBountyPrograms/$folder && cd /opt/BugBountyPrograms/$folder

findomain -q -f /mainData/$file -r -u findomain_domains.txt
cat /mainData/$file | assetfinder --subs-only >>assetfinder_domains.txt
amass enum -df /mainData/$file -passive -o ammas_passive_domains.txt
subfinder -dL /mainData/$file -o subfinder_domains.txt
findomain -q -f $file -r -u findomain_domains.txt
cat $file | assetfinder --subs-only >>assetfinder_domains.txt
amass enum -df $file -passive -o ammas_passive_domains.txt
subfinder -dL $file -o subfinder_domains.txt
sort -u *_domains.txt -o subdomains.txt
cat subdomains.txt | rev | cut -d . -f 1-3 | rev | sort -u | tee root_subdomains.txt
cat *.txt | sort -u >domains.txt
Expand All @@ -56,14 +134,16 @@ get_alive() {
[ --> ] alive.txt for: $program
$($result)"
curl --silent --output /dev/null -F chat_id="$chat_ID" -F "text=$message" $url -X POST

echo -e $green"[V] "$end"Dominios vivos obtenidos correctamente."
}

get_waybackurl() {
echo -e $red"[+]"$end $bold"Get Waybackurl"$end

mkdir waybackdata

cat alive.txt | waybackurls >waybackdata/waybackurls.txt
cat alive.txt | waybackurls > waybackdata/waybackurls.txt
cat waybackdata/waybackurls.txt | sort -u | unfurl --unique keys >waybackdata/paramlist.txt
cat waybackdata/waybackurls.txt | sort -u | grep -P "\w+\.js(\?|$)" | sort -u >waybackdata/jsurls.txt
cat waybackdata/waybackurls.txt | sort -u | grep -P "\w+\.php(\?|$)" | sort -u >waybackdata/phpurls.txt
Expand All @@ -85,20 +165,23 @@ get_waybackurl() {
cat waybackdata/waybackurls.txt | sort -u | grep result= >waybackdata/open_result.txt

find waybackdata/ -size 0 -delete

echo -e $green"[V] "$end"Waybackurl machine consultada correctamente."

}

get_aquatone() {
echo -e $red"[+]"$end $bold"Get Aquatone"$end
current_path=$(pwd)
cat alive.txt | aquatone -silent --ports xlarge -out $current_path/aquatone/ -scan-timeout 500 -screenshot-timeout 50000 -http-timeout 6000
cat alive.txt | aquatone --ports xlarge -out $current_path/aquatone/ -scan-timeout 500 -screenshot-timeout 50000 -http-timeout 6000
}

get_js() {
echo -e $red"[+]"$end $bold"Get JS"$end

mkdir jslinks

cat alive.txt | subjs >>jslinks/all_jslinks.txt
cat alive.txt | subjs >>jslinks/all_jslinks.txt && echo -e $green"[V] "$end"Archivos JS obtenidos correctamente."
}

get_tokens() {
Expand All @@ -108,7 +191,7 @@ get_tokens() {

cat alive.txt waybackdata/jsurls.txt jslinks/all_jslinks.txt >tokens/all_js_urls.txt
sort -u tokens/all_js_urls.txt -o tokens/all_js_urls.txt
cat tokens/all_js_urls.txt | python3 /tools/new-zile/zile.py --request >>tokens/all_tokens.txt
cat tokens/all_js_urls.txt | zile.py --request >>tokens/all_tokens.txt && echo -e $green"[V] "$end"Tokens obtenidos correctamente."
sort -u tokens/all_tokens.txt -o tokens/all_tokens.txt
}

Expand All @@ -119,18 +202,20 @@ get_endpoints() {

for link in $(cat jslinks/all_jslinks.txt); do
links_file=$(echo $link | sed -E 's/[\.|\/|:]+/_/g').txt
python3 /tools/LinkFinder/linkfinder.py -i $link -o cli >>endpoints/$links_file
python3 /opt/tools_mainRecon/LinkFinder/linkfinder.py -i $link -o cli >>endpoints/$links_file
done

echo -e $green"[V] "$end"Endpoints obtenidos correctamente."
}

get_paramspider() {
echo -e $red"[+]"$end $bold"Get ParamSpider"$end

mkdir paramspider

for targets in $(cat /mainData/targets.txt); do
for targets in $(cat $file); do
targets_file=$(echo $targets | sed -E 's/[\.|\/|:]+/_/g')
python3 /tools/ParamSpider/paramspider.py --domain $targets --exclude woff,css,js,png,svg,php,jpg --output paramspider/"$targets_file"_paramspider.txt
python3 /opt/tools_mainRecon/ParamSpider/paramspider.py --domain $targets --exclude woff,css,js,png,svg,php,jpg --output paramspider/"$targets_file"_paramspider.txt
done
}

Expand All @@ -141,7 +226,7 @@ get_paths() {

for host in $(cat alive.txt); do
dirsearch_file=$(echo $host | sed -E 's/[\.|\/|:]+/_/g').txt
python3 /tools/dirsearch/dirsearch.py -E -t 50 --plain-text dirsearch/$dirsearch_file -u $host -w /tools/dirsearch/db/dicc.txt | grep Target && tput sgr0
python3 /opt/tools_mainRecon/dirsearch-0.4.0/dirsearch.py -E -t 50 --plain-text dirsearch/$dirsearch_file -u $host -w /opt/tools_mainRecon/dirsearch-0.4.0/db/dicc.txt | grep Target && tput sgr0
done

grep -R '200' dirsearch/ > dirsearch/status200.txt 2>/dev/null
Expand All @@ -159,25 +244,29 @@ get_paths() {
}

get_zip() {
echo -e $red"[+]"$end $bold"Get ZIP"$end
echo -e $red"[+]"$end $bold"Zipping.."$end

cd ..
zip -r $folder.zip $folder
}

get_message() {
echo -e $red"[+]"$end $bold"Get Message"$end
echo -e $red"[+]"$end $bold"Sending Message.."$end

message="[ + ] mainRecon Alert:
[ --> ] Recon Completed for $program #happyhacking"

curl --silent --output /dev/null -F chat_id="$chat_ID" -F "text=$message" $url -X POST

echo -e $green"[+] "$end"Escaneo completado con exito. Datos almacenados en: /opt/BugBountyPrograms/$folder"
}

program=False
file=False

list=(
check_root
check_dependencies
get_subdomains
get_alive
get_waybackurl
Expand All @@ -194,11 +283,11 @@ list=(
while [ -n "$1" ]; do
case "$1" in
-p | --program)
program=$2
programa=$2
shift
;;
-f | --file)
file=$2
file=$(pwd)/$2
shift
;;
*)
Expand All @@ -213,7 +302,10 @@ done
echo -e $red"[-]"$end "Argument: -p/--program & -f/--file is Required"
Usage
}

(
check_root
check_dependencies
get_subdomains
get_alive
get_waybackurl
Expand All @@ -225,4 +317,4 @@ done
get_paths
get_zip
get_message
)
)