diff --git a/README.md b/README.md index 833f62f..ecbbfff 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -# D4N155 +# D4N155 +[![Documentation Status](https://readthedocs.org/projects/d4n155/badge/?version=documentation)](https://d4n155.readthedocs.io/en/documentation/?badge=documentation) [![made-with-bash](https://img.shields.io/badge/Made%20with-Bash-1f425f.svg)](https://github.com/OWASP/D4N155/search?l=shell) [![GPLv3 license](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://github.com/OWASP/D4N155/blob/master/LICENSE) + It's an information security audit tool that creates intelligent wordlists based on the content of the target page and Google hacking attack [Help us](CONTRIBUTING.md) diff --git a/main b/main index 0492ff7..79d09fd 100755 --- a/main +++ b/main @@ -5,9 +5,7 @@ here=`dirname "$0"` cd "$here" # colors art -green='\e[32m' -bgred='\e[41m' -red='\e[31m' +. ./modules/colors.sh # Banner echo -e """ $red /\ o @@ -25,14 +23,18 @@ $red /\ o {{{{{{{;.___.;}}&&&& '{{{{{{) (}}|//& ´''''': :''''´ - [ \e[5m$bgred\033[38;5;232mAt Segmentation Fault\e[m $red] + [ \e[5m$bgred\033[38;5;232mAt Segmentation Fault$end $red] """ # ignore lower and uppercase shopt -s nocasematch # and colors with dont fuck terminal -printf "\033[0m" +printf "$end" # Vars +bug=""" + You can report new bug or open a issue + \t$yellow→ $orange https://github.com/owasp/D4N155/issues$end +""" help=""" D4N155: Tool for smart audit security @@ -65,7 +67,10 @@ help=""" # All functions . modules/functions.sh +. modules/load.sh +printf "\033[32m" +trap -- "printf \"\n$bug\";exit 2" "SIGINT" # menu interative __interative(){ printf "\033[0m" @@ -156,7 +161,7 @@ else # Exists $narg? Then ok, go go echo "Find to vulnerabilties" echo "$narg" - [ "$narg" ] && __vul "$narg" || ( echo -e "\e[33m→ bash main --help\e[m";exit 2 ) + [ "$narg" ] && __vul "$narg" || ( echo -e " $orange → bash main --help$end ";exit 2 ) util=$(($util+1)) ;;& @@ -164,15 +169,15 @@ else echo "Make custom wordlist" if [ $save ] then - [ "$narg" ] && __cus "$narg" "$save" || ( echo -e "\e[33m→ bash main --help\e[m";exit 2) + [ "$narg" ] && __cus "$narg" "$save" || ( echo -e " $orange → bash main --help$end ";exit 2) else - [ "$narg" ] && __cus "$narg" || ( echo -e "\e[33m→ bash main --help\e[m";exit 2 ) + [ "$narg" ] && __cus "$narg" || ( echo -e " $orange → bash main --help$end ";exit 2 ) fi util=$(($util+1)) ;; --t* | "-t") - echo -e "Targets inputed in \e[33m$narg\e[32m" + echo -e "Targets inputed in $orange $narg $green " __fwordlist "$narg" "" "$time" diff --git a/modules/colors.sh b/modules/colors.sh new file mode 100644 index 0000000..53554d5 --- /dev/null +++ b/modules/colors.sh @@ -0,0 +1,11 @@ +# Default +orange='\e[33m' +yellow='\e[93m' +green='\e[32m' +red='\e[31m' +end='\e[0m' +bgred='\e[41m' + +# Status +correct="[\e[1m\e[92m ✔ $end$green]" +incorrect="[\e[1m\e[92m ✘ $end$green]" diff --git a/modules/functions.sh b/modules/functions.sh index 8e0c076..206b9d2 100644 --- a/modules/functions.sh +++ b/modules/functions.sh @@ -6,20 +6,9 @@ # _wordlist # _fwordlist -# Get expression and get all dorks of google hacking -# All vul. pages and routers :] -__vul(){ - # Check arguments - if [ "$1" ] - then - echo "Attacking $1" - target="$1" - else - printf "Target is: $1"; read target - fi - - # Update db - echo -e "\033[33mYou want update the list Google hacking? (y/n)\033[32m" +# Update db +_updateDB(){ + printf "$orange You want update the list Google hacking? (y/n)$green\n → " read typed case $typed in "Yes" | y*) @@ -30,13 +19,24 @@ __vul(){ echo "OK ..." ;; esac +} - # Make the attack - echo -e "\033[33mBenning attack using diferents user agents ;)\033[32m" - cd pagodo/ - echo "It will to delay..." +# Check Time format +_checkTime(){ + if [ "$1" == "" ] || [[ ! "$1" =~ ^[+-]?([0-9]*[.])?[0-9]+$ ]] + then + export time="0" + elif [[ "$1" =~ ^[+-]?([0-9]*[.])?[0-9]+$ ]] || [[ "$1" =~ ^-?[0-9]+$ ]] + then + export time="$settime" + fi +} + +# Run the pagodo +_checkVul(){ + cd pagodo/ # It's good? Then go go go go - python3 pagodo.py -d $target -g google_dorks.txt -l 40 -s -e 1 + _load "$orange Find vulners urls $green " "python3 pagodo.py -d $target -g google_dorks.txt -l 40 -s -e 1" if [ "$?" = "0" ] then mv $target.txt ../reports/ @@ -44,15 +44,36 @@ __vul(){ then echo "Finalized attack to $target, see in reports/$target.txt" else - echo -e "\033[31mThe file dont has been saved, The result are found?\033[32m" + echo -e "$green The file dont has been saved, The result are found?$green" exit 2 fi else - echo -e "Error: in \033[31mpagodo.py\033[33m\nrun: pip3 install -r requirements.txt\033[32m" + echo -e "Error: in $green pagodo.py$orange\nrun: pip3 install -r requirements.txt$green" fi cd ../ } +# Get expression and get all dorks of google hacking +# All vul. pages and routers :] +__vul(){ + # Check arguments + if [ "$1" ] + then + echo "Attacking $1" + target="$1" + else + printf "Target is: $1"; read target + fi + # Update list of dork + _updateDB + + # Make the attack + echo -e "$orange Benning attack using diferents user agents ;)$green" + echo "It will to delay..." + # Attack + _checkVul +} + # Get expression and get all pages indexes of google # 1# just read page # 2# get all texts, alts etc. @@ -73,73 +94,53 @@ __wordlist(){ target="$(printf $target | awk '{ gsub("['/',':','-']","");print }')"; # Get time rate - printf "Time interval in seconds (Default: 0): ";read settime - if [ "$settime" == "" ] || [[ ! "$settime" =~ ^[+-]?([0-9]*[.])?[0-9]+$ ]] - then - export time="0" - elif [[ "$settime" =~ ^[+-]?([0-9]*[.])?[0-9]+$ ]] || [[ "$settime" =~ ^-?[0-9]+$ ]] - then - export time="$settime" - fi + printf "Time interval in seconds (Default: -1): ";read settime + _checkTime fi + # Define destination to save [ "$#" == "2" ] && \ export dest="$2" || \ export dest="reports/wordlist/$target.wordlist.txt" # Make the attack - echo -e "\033[33mBeginning attack, with Google indexations\033[32m" - cd pagodo/ - # It's good? Then go go go go + echo -e "$orange Beginning attack, with Google indexations$end" + + # Run pagodo for get all urls + cd pagodo/ python3 pagodo.py -d $target -g blank.txt -l 300 -s -e 1 + cd ../ + + # If get all ok then: if [ "$?" = "0" ] then - # Check if be ok - mv "$target.txt" "../reports/db/" + mv "pagodo/$target.txt" "reports/db/" + if [ "$?" == "0" ] then - echo -e "Finalized search to $target, database\nhas been saved in reports/db/$target.txt" + echo -e "Finalized search to $target, database\nhas been saved in$orange reports/db/$target.txt$green" else - echo -e "\033[31mThe file dont has been saved, the result are found?\033[32m" + echo -e "$red The file dont has been saved, the result are found?$green" exit 2 fi - # Generate the wordlist - # get all urls and read all text - # Check for equals worlds and remove - # remove characters like: , or ? + echo "Make the wordlist *-*" - cat ../reports/db/$target.txt | \ - while read url - do - echo "$url"; - python3 "../objetive/objetive.py" "$url" \ - >> ../reports/db/$target.blob.txt && \ - echo -e ":.........................................[\e[92m✔\e[32m]" || \ - echo -e ":.........................................[\e[31m✘\e[32m]" - sleep $time - done && \ - \ - python3 "../modules/generator.py" "$(cat ../reports/db/$target.blob.txt)" \ - > ../$dest - if [ "$?" != "0" ] - then - echo -e "\033[031mError fatal\033[32m" - exit 2 - fi - - test "$?" == 0 && \ - echo -e "\033[032mWordlist has been saved in\n\033[033m$dest\033[0m" || \ - exit 1 + + . modules/operations/calc.sh "reports/db/$target.txt" "$target" "$dest" + + test "$?" == 0 && \ + echo -e "$green Wordlist has been saved in\n$orange$dest$end" || \ + exit 1 + # clear trash files # Call report pdf - . ../modules/report/main.sh "../reports/db/$target.txt" "../reports/db/$target.blob.txt" \ - "../$dest" "$target" - rm -rf ../reports/db/$target.* - exit 0 + . modules/report/main.sh "reports/db/$target.txt" "reports/db/$target.blob.txt" \ + "$dest" "$target" + rm -rf reports/db/$target.* + exit 0 else - echo -e "Error: in \033[31mpagodo.py\033[33m\nrun: pip3 install -r requirements.txt\033[32m" + echo -e "Error: in$red pagodo.py$orange \nrun: pip3 install -r requirements.txt$green" fi - cd ../ } # _fwordlist @@ -150,40 +151,24 @@ __fwordlist (){ [ "$3" != "" ] && export time="$3" || export time="0" - cat $1 |\ - while read url || exit 2 - do - echo "$url"; - python3 "objetive/objetive.py" "$url" \ - >> reports/db/wordlist.blob.txt && \ - echo -e ":.........................................[\e[92m✔\e[32m]" || \ - echo -e ":.........................................[\e[31m✘\e[32m]" - sleep $time - done && \ - python3 "modules/generator.py" "$(cat reports/db/wordlist.blob.txt)" \ - > "reports/wordlist/wordlist.txt" - if [ "$?" != "0" ] - then - echo -e "\033[031mError fatal\033[32m" - exit 2 - fi + . modules/operations/calc.sh "$1" "wordlist" "reports/wordlist/wordlist.txt" - if [ "$?" == "0" ] - then - echo -e "\033[032mWordlist has been saved in\n\033[033m./reports/wordlist/wordlist.txt\033[0m" - # clear trash files - # Report in pdf - # pagodo, default of script - cd pagodo/ - . ../modules/report/main.sh "../$1" "../reports/db/wordlist.blob.txt" \ - "../reports/wordlist/wordlist.txt" "custom" - cd .. - rm -rf reports/db/wordlist.blob.txt - exit 0 - else - echo -e "\033[31mError in save the wordlist\033[32m" - exit 1 - fi + if [ "$?" == "0" ] + then + echo -e "$green Wordlist has been saved in\n$orange./reports/wordlist/wordlist.txt$end" + # clear trash files + # Report in pdf + # pagodo, default of script + cd pagodo/ + . ../modules/report/main.sh "../$1" "../reports/db/wordlist.blob.txt" \ + "../reports/wordlist/wordlist.txt" "custom" + cd .. + rm -rf reports/db/wordlist.blob.txt + exit 0 + else + echo -e "$red Error in save the wordlist $green" + exit 1 + fi } # Cus of custom :] | Staps # 1 - Get text @@ -196,8 +181,8 @@ __cus() { [ $2 ] && export save="$2" || export save="_wordlist.txt" echo "$save" echo "Processing all data..." - python3 "modules/generator.py" "$(cat $1 | awk '{ gsub("['–',',']","");print }')" >> "$save" && \ - ( echo -e "[\e[92m✔\e[m] Wordlist been created in $save"; exit 0 ) || \ - echo -e "[\e[31m✘\e[m] Error fatal, don't create file"; exit 2 + python3 "modules/generator.py" "$1" >> "$save" && \ + ( echo -e "$correct Wordlist been created in $save"; exit 0 ) || \ + echo -e "$incorrect Error fatal, don't create file"; exit 2 } diff --git a/modules/generator.py b/modules/generator.py index 087d791..ce50895 100644 --- a/modules/generator.py +++ b/modules/generator.py @@ -1,11 +1,12 @@ # It module make the word list -import sys +import sys from multiprocessing.dummy import Pool as ThreadPool from permutations.main import * # All modules for permutations details = False + # Root text -texts = sys.argv[1].split() +texts = open(sys.argv[1], 'r').read().split() new = [] # Alternations texts = texts+list(map(inverter, texts)) diff --git a/modules/load.sh b/modules/load.sh new file mode 100644 index 0000000..36ba4d9 --- /dev/null +++ b/modules/load.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +sp="⡿⣟⣯⣷⣾⣽⣻⢿" +sc=0 +spin() { + printf "\r${sp:sc++:1} $1 " + ((sc==${#sp})) && sc=0 +} + +_load(){ + while :;do + spin "$1" + done & trap "kill $!" kill -9 $! &> /dev/null + eval "$2" +} diff --git a/modules/operations/calc.sh b/modules/operations/calc.sh new file mode 100644 index 0000000..5f9bcc3 --- /dev/null +++ b/modules/operations/calc.sh @@ -0,0 +1,26 @@ +#!/usr/env/bin bash + +# Run operations +{ + # 1: Source + # 2: Target + # 3: Output + + cat "$1" | while read url + do + echo "$url"; + python3 "objetive/objetive.py" "$url" \ + >> "reports/db/$2.blob.txt" && \ + echo -e ":.........................................$correct" || \ + echo -e ":.........................................$incorrect" + sleep $time + done && _load "Make operations:" """python3 'modules/generator.py' reports/db/$2.blob.txt > $3 + if [ \"$?\" != \"0\" ] + then + echo -e \"\n$red Error fatal$green\" + [ -e reports/db/$2.blob.txt ] && rm -rf reports/db/$2.* + exit 2 + fi + """ + kill -9 $! &> /dev/null +} diff --git a/modules/report/main.sh b/modules/report/main.sh index 4f8efdb..23df70f 100644 --- a/modules/report/main.sh +++ b/modules/report/main.sh @@ -38,8 +38,8 @@ echo -e """