R0X4R / Garud

An automation tool that scans sub-domains, sub-domain takeover, then filters out XSS, SSTI, SSRF, and more injection point parameters and scans for some low hanging vulnerabilities automatically.
MIT License
768 stars 176 forks source link

Add verbosity to Garud's output #41

Closed frost19k closed 2 years ago

frost19k commented 2 years ago

Problem Description: Currently Garud does not print STDOUT or STDERR from any tool. Which is to say that its working is opaque. Given that some commands can take up to 50 minutes to complete (line 141) this causes confusion among users about whether Garud is actually doing anything. Further, if something goes wrong then Users cannot post error messages when opening issues, making the maintainer's job more difficult.

Porposed solution: Make Garud more verbose. A simple message to STDOUT about what is hapening behind the scenes & whether or not it succeeded.

Example:

red="\e[31m"
green="\e[32m"
bold="\e[1m"
normal="\e[0m"

success="[${green}done${normal}]"
failure="[${red}error${normal}]"

if [ ! -f tmp/crt.txt ] || [ ! -s tmp/crt.txt ]; then
    echo -n "Quering https://crt.sh..."
    curl -s "https://crt.sh/?q=%25.$domain&output=json" | jq -r '.[].name_value' 2>/dev/null | sed 's/\*\.//g' | sort -u | grep -o "\w.*$domain" | anew -q tmp/crt.txt
    if [ "${#PIPESTATUS[@]}" -gt 0 ]; then  #> If the sum of return codes from all commands in the pipe is greater than zero (i.e. an error occured somewhere)
        echo -e "${failure}"
    else
        echo -e "${success}"
    fi
fi

Output will look like this.

# When run...
Starting subdomain enumeration of hackerone.com
Quering https://crt.sh...
# On completion
Starting subdomain enumeration of hackerone.com
Quering https://crt.sh...[done]

Pros: This code adds transparency while maintaining the clean look of Garud's output.

Cons: The code baloons each line 9x - which would make the script nearly unmaintainable!


Given that each command is unique in it's input, output, & operation, I cannot determine a pattern which allows for functionalising the code above.

@R0X4R thoughts?

R0X4R commented 2 years ago

Hii @frost19k,

Thanks for your suggestion. To debug the script users can use bash -x command to debug the script file.

$ bash -x /usr/bin/garud -d target.tld -o output -s -t 100

Also adding verbose mode option make the code so big it will make the script slow.