Bash Part Two Adding Functionality with Variables and User Input

Welcome back to part two of are bash on hacking a rise im the laughingman this is about adding Functionality with variables and user input this were you script starts to come to life and starts to do stuff so lets start with this section

what is variables

Are you for real like the title explains what they do ….
Ahhhh NO ONLY HAVING A LAUGH . A variable is an area of storage that can hold something in memory.
That something might be some letters or words (strings) or numbers.
It’s known as a variable because the values held within it are changeable.
This is extremely useful feature for adding functionality to a script.

Getting started

so lets open are text editor and fill in are first line as you know is the shebang #! /bin/bash then # for comment if any .

    #! /bin/bash
    #port scanner wrote in bash by laughingman
    figlet “openport”
    echo” By Laughingman”


    function pingcheck
    ping=`ping -c 1 $host | grep bytes | wc -l`
    if [ $ping -gt 1 ]; then
    # if [[ $ping > 1 ]]; then
    echo “$host is up”;
    echo “$host is down quitting”;

    function portcheck
    for ((counter=$startport; counter /dev/tcp/$host/$counter) > /dev/null 2>&1 && echo “$counter open”


Bash Part Two Adding Functionality with Variables and User Input 1

as you the variables in the script we let me explain them in the most easiest way i can for ya

bash commands

: Returns 0 or true

. Executes a shell script

bg Puts a job in the background

break Exits the current loop

cd Changes directory

continue Resumes the current loop

echo Displays the command arguments

eval Evaluates the following expression

exec Executes the following command without creating a new

exit Quits the shell

export Makes a variable or function available to other programs

fg Brings a job to the foreground

getopts Parses arguments to the shell script

jobs Lists background ( bg ) jobs

pwd Displays the current directory

read Reads a line from standard input

readonly Declares as variable as read-only

set Lists all variables

shift Moves the parameters to the left

test Evaluates arguments

[ Performs a conditional test

times Prints the user and system times

trap Traps a signal

type Displays how each argument would be interpreted as a

command umask Changes the default permissions for a new file

pingcheck is just the ping command

portcheck is to see what ports are open

$1,$2,$3 are use for when you use the read command they tell the system what ip in this case to use

function this to tell the system what function to use

figlet this adds banners to your script i love it hahahahahahahh

theres a few the commands used in bash scripting

there ya have it open port is now working hope u understood this as its only a short example of bash scripting ad how to use the variables to make scripts

Just to let u all know i thought me self bash so the way i explain is not the same as anyone else as fuck that hahahaha but hope it helps you and dont worry there be more on bash scripting how to make brute force scripts and auto sql scripts and more so as every real hacker can script thos who can we i say FUCK YOU SCRIPT KIDDIE

Hi im the laughing man im a pentester and the owner of Hacking a rise

Leave a Reply