Skip to content

Instantly share code, notes, and snippets.

@jlejeune
Last active April 9, 2019 09:19
Show Gist options
  • Save jlejeune/acecd5fccf8810eb426b0c733e2e4523 to your computer and use it in GitHub Desktop.
Save jlejeune/acecd5fccf8810eb426b0c733e2e4523 to your computer and use it in GitHub Desktop.
#!/bin/bash
##########################################################################
# Copyright: Leon Teale @leonteale http://leonteale.co.uk
##########################################################################
##########################################################################
# Program: <APPLICATION DESCRIPTION HERE>
##########################################################################
VERSION="0.0.1"
PROGNAME=""
AUTHOR=""
##########################################################################
## Pipeline:
## TODO:
##########################################################################
##########################################################################
# Coloured variables
##########################################################################
red=`echo -e "\033[31m"`
lcyan=`echo -e "\033[36m"`
yellow=`echo -e "\033[33m"`
green=`echo -e "\033[32m"`
blue=`echo -e "\033[34m"`
purple=`echo -e "\033[35m"`
normal=`echo -e "\033[m"`
##########################################################################
# Configuration
##########################################################################
declare -A EXIT_CODES
EXIT_CODES['unknown']=-1
EXIT_CODES['ok']=0
EXIT_CODES['generic']=1
EXIT_CODES['limit']=3
EXIT_CODES['missing']=5
EXIT_CODES['failure']=10
DEBUG=0
param=""
##########################################################################
# Help Functions
##########################################################################
show_usage() {
echo -e """Web Application scanner using an array of different pre-made tools\n
Usage: $0 <target>
\t-h\t\tshows this help menu
\t-v\t\tshows the version number and other misc info
\t-D\t\tdisplays more verbose output for debugging purposes"""
exit 1
exit ${EXIT_CODES['ok']};
}
show_version() {
echo "$PROGNAME version: $VERSION ($AUTHOR)";
exit ${EXIT_CODES['ok']};
}
log_msg() {
logger -i -t "${PROGNAME}" "$@"
echo "$@"
}
debug()
{
if [ "$DEBUG" == 1 ]; then
log_msg "$*"
fi
}
err() {
echo "$@" 1>&2;
exit ${EXIT_CODES['generic']};
}
##########################################################################
# Initialisation and menu
##########################################################################
if [ $# == 0 ] ; then
show_usage;
fi
while getopts :vhx opt
do
case $opt in
v) show_version;;
h) show_usage;;
*) echo "Unknown Option: -$OPTARG" >&2; exit 1;;
esac
done
# Make sure we have all the parameters we need (if you need to force any parameters)
#if [[ -z "$param" ]]; then
# err "This is a required parameter";
#fi
##########################################################################
# Kick off
##########################################################################
header() {
clear
echo -e """
----------------------------------
$PROGNAME v$VERSION $AUTHOR
----------------------------------\n"""
}
main() {
#start coding here
echo "start coding here"
}
header
main "$@"
debug $param;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment