Day 59/100 Hack and Improvement

1 minute read

Day 59 comes with simple bash scripting for noobies :)

Bash Scripting that saves time

Have you ever found yourself typing the same commands over and over thinking that the job can be more easier? Well, if you’re in a unix environment, it is pretty easy and possible to make the job way easier! You don’t need to be a master in programming, making simple bash scripts is not complicated. This is aimed to noobie audience who might be afraid of making simple scripts in order to make their workflow more unique and faster.

Bash scripting basically is typing the commands that you constantly use, and changing some words so the computer understands the input, and takes care of the output. In this case I’ll explain the “code” in a simple way so you can do it yourself and add more things. If you’re making your own scripts, I strongly recommend to move them to the /usr/local/bin folder.

Directory searching with ffuf (simple bash script)

To avoid typing the same command in ffuf over and over, you can start making a simple bash script as:

#!/bin/bash

ffuf -c -w wordlist.txt -u $1/FUZZ/ -mc 200,301,302

To explain:

  • #!/bin/bash makes the computer understand that you’re executing a bash script.
  • $1 makes the computer understand that it is going to take the first input to fuzz.
  • Remember to save the file with a .sh extension and give executable permissions.

Running the script

In this case, you just have to run the script as:

./fuzzer.sh https://yahoo.com

Subdomain enumeration with amass by just getting a wordlist

I usually like to make enumerate subdomains all of them at the time by putting the in a list and running an script with the following code.

#!/bin/bash

filename=$1

while read line; do 
	amass enum -d $line -o $filename-amass.txt
done < $filename

To explain:

  • while is a simple loop that will work until something is false.
  • filename variable will take the first part of the input.
  • while read line; do basically we’re telling while you read the line please do the scan by each line.

Running the script

In this case, you just have to run the script as:

./subenum.sh domains.txt

Gathering all the ideas

Once you now your workflow and how you like to do your recon you can always automated and will result something like this tool :)

nmap scan

Note

There are amazing automated recon tools out there. Everything depends on how you like to make yours :)

Leave a comment