Clean Code Grab.sh
This commit is contained in:
parent
8fcc167a4c
commit
cabe4bdf40
17
grab.sh
17
grab.sh
|
@ -23,8 +23,7 @@ file=temp/msff #Filename to search in metasploit output folder
|
|||
conf=config/grab.conf #Maximum time to wait for all process to be done
|
||||
|
||||
#If timeout configuration file does not exist then abort script
|
||||
if [ ! -f "$conf" ]
|
||||
then
|
||||
if [ ! -f "$conf" ]; then
|
||||
echo "Timeout configuration was not found"
|
||||
echo "Aborting"
|
||||
exit
|
||||
|
@ -40,15 +39,15 @@ rm -rf $HOME/.msf4/local/* >/dev/null 2>&1
|
|||
# Look for the name of the file to be search in metasploit output in msff
|
||||
# msff file will be created by fatrat
|
||||
|
||||
if [ -f "$file" ]
|
||||
then
|
||||
if [ -f "$file" ]; then
|
||||
|
||||
#msff file exists then read 1st line (filename to search)
|
||||
#msf file exists then read 1st line (filename to search)
|
||||
var=`sed -n 1p $file`
|
||||
else
|
||||
#msff does not exist , abort
|
||||
#msf does not exist , abort
|
||||
exit 1
|
||||
fi
|
||||
|
||||
function outf(){
|
||||
clear
|
||||
echo -e $orange "---------------------------------------------------"
|
||||
|
@ -62,8 +61,7 @@ out="$HOME/.msf4/local/$var"
|
|||
|
||||
#sleep variable is equal to itself + 1 second
|
||||
sleep=$((sleep+1))
|
||||
if [ $sleep == "$tmo" ]
|
||||
then
|
||||
if [ $sleep == "$tmo" ] ; then
|
||||
|
||||
#in case timeout value achieved without any metasploit output file created
|
||||
#then exits this script
|
||||
|
@ -98,8 +96,7 @@ echo -e $okegreen "Waiting for msfconsole output to be generated in Xterm Window
|
|||
echo -e $orange "Max waiting time = $tmo seconds"
|
||||
#if the current value from msff is empty then abort this script
|
||||
#this will mean that msff file exists but does not have anything written
|
||||
if [ -z "$var" ]
|
||||
then
|
||||
if [ -z "$var" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in New Issue