Carnivore - Predator
Formerly known as THC HackSuite, Carnivore - Predator stands at the forefront of cutting-edge cybersecurity tools, redefining the landscape of penetration testing with unparalleled innovation. Designed to empower ethical hackers, security professionals, and enthusiasts alike, Carnivore - Predator is the ultimate Pentest CMS that puts you in command.
current version: 0.7.0 - PREDATOR
home > documentation > apps > How to use ModGlue
This article explains how to effectively make use of ModGlue.
author: Remco Kouw
created: 08-Jun-2024
updated: 08-Jun-2024

How to use Modglue

In this documentation we will go through the functionality of the Modglue app.

Modglue is probably the best feature in the first Carnivore version, it allows users to share output of modules with other modules. Modglue uses a pseudo language in which you can tell Modglue what variables to set, which variables to store and which files to include. Modglue basically sets the variables, includes the required (screen) files, saves the desired output as specified by the user and then moves on to the next task.

Interface Parameters:

  • hide iframe: hide editor
  • clear editor: remove all code in the textarea
  • run code: executes code
  • send to editor: creates code template based on module and sends it to the editor

Options:

  • module interaction: share content among modules

Basic Usage:

ModGlue might seem a little difficult to understand at first because of its strange tag like syntax to assign and store variables. Before we dive into that matter we'll take a look at how to set up the ModGlue interface.

When you click analyze properties ModGlue will analyze the file screen.php in order to return the variables that are being sent from user input in the program and the case values in the switch statements.

In this case thc_xc(xConverter) is analyzed. It returns a lot of variables, all of them are _POST variables. ModGlue always returns all _POST variables, most of the times you only need a few.

  • sOption: this is the variable of the selection menu where you can select a function you want to use
  • submit: the form submission button
  • sInputx: these are dynamic variables that allows you to add more parameters to the function, starting with sInput0 which corresponds to the first parameter in any xConverter function. You can remove the excess parameters. In this case we'll use substr, so we need three parameters: sInput0, sInput1 and sInput2. We also need the submission button(variable submit) with the value Send to process the form properly. If you're not sure which values to use, just open the module in your browser and look at the value of the submission button.

When you click on send to editor ModGlue creates a basic tag template for you in the textarea or editor as you can see below.

Each call to a module starts with the opening load tag followed by all instructions and ends with the closing load tag.

  • [load=thc_xx]..[/load]: let's ModGlue know that all content between these tags are used for module thc_xx
  • [p]..[/p]: all content between these tags are _POST variables, each variable must be placed on a new line, so the structure looks like: "nameofvariable"="value"\n, there's also a [g]...[/g] structure for _GET variables which works exactly the same
  • [f]..[/f]: these are the include files that will be included when all _POST variables were set

Now let's do a very simple action, we'll turn a Hello Carnivore User! message into a Carnivore text string. Obviously we will use the function substr for that.

This script is exactly the same as when you would run the module thc_xc with these settings below.

In PHP the output would be the same as:
substr("Hello Carnivore User!",6,9):

When you click on run code, you will get a warning message telling you not to close your browser window. Click on Ok to start the execution of the code.

ModGlue will do a basic validation of the code you used and will abort when the content doesn't look valid. When ModGlue doesn't encounter any irregularities it will display the settings you've provided and finally output the result which in this case is the Carnivore text.

The program is obviously capable of way more advanced tasks. For that we'll need to understand how ModGlue stores and uses variables.

Advanced Usage:

Now that we have seen a basic example, we'll let ModGlue interact with a module. We can't really interact with other modules unless we share their output and for that we need ModGlue variables.

Your new best digital friend is the variable $_CONTEXT['modglue'] as it contains all data from executed modules. All data will be stored as follows:
$_CONTEXT['modglue']['thc_xx'] where the xx part of course is the module that was executed, all variables of the executed module can be found in that array.

Then the most important thing is to access that data. ModGlue can access three different types of variables in Carnivore.

  1. xSomeVar: just basic variables that could be defined anywhere in Carnivore, the x is the first letter of the type eg i=integer,s=string etc
  2. $_CONTEXT['modglue']['thc_xx'][...]: variables created by modules
  3. $_CONTEXT['somevar']: context variables created anywhere in Carnivore

In order to pass a variable value to a _POST variable you need to place a tilde character(~) as a prefix to the variable name this will indicate that the value is not static but from an earlier defined variable.

To demonstrate this we will take similar code to the previous code a step further.

This looks a bit more confusing doesn't it? In this example you can see the [l]..[/l] parameter which is used to create variables. For this example we will need some extra variables.

Before I'm going into the details, here is the output.

As you can see both commands are using thc_xc and are sharing output.

Now let's start from the beginning, the l parameter is used to store data like this:
"sResult"="output", creates a variable $_CONTEXT['modglue']['thc_xc']['sResult'], the value part is the variable $_CONTEXT['thc_xc']['output'] which contains the output for thc_xc.

So now that we stored that value we can use it:
"~sInput0"="*thc_xc*sResult" this command tells ModGlue to set $_POST['sInput0'] and give it the value of $_CONTEXT['modglue']['thc_xc']['sResult'], asterixes are always used for data stored in $_CONTEXT['modglue']. As mentioned earlier when the variable name starts with a tilde character a variable is used.

Next command is:
"~sInput1"="@three" this command tells ModGlue to set $_POST['sInput1'] and give it the value of $_CONTEXT['three'], at symbols are always used for data stored in $_CONTEXT arrays.

And for the last command:
"~sInput2"="#aTest#five" this command tells ModGlue to set $_POST['sInput2'] and give it the value of $aTest['five'], pound or hashtags can be used to access non-modglue or context variables.

There's three more things I'd like to discuss before the end of this documentation.

  1. data removal: you can remove variables from modglue and context module data by using the c parameter

    This removes all data in both $_CONTEXT['modglue']['thc_xc'] and $_CONTEXT['thc_xc'] because the value is 1, in case the value is 0 it will only remove the ModGlue data.

  2. type casting: turns bVars in booleans, aVars in arrays, iVars in integers

    "aVar"="text1,text2,text3" becomes array $_POST['aVar'] = array("text1","text2","text3");
    "bValue"="1" becomes boolean $_POST['bValue'] = true; or false when the value is 0
    "iNumber"="7.1" becomes integer $_POST['iNumber'] = 7;

  3. conditions: this is the validation part of ModGlue when executing a module, the parameter used for this is the [v] parameter:

    "rSocketPointer"="resource" validates variable to see if the variable is a resource pointer, if false the macro will be terminated
    "bBoolean1"="false" validates boolean on a false value, if false the macro will be terminated
    "bBoolean2"="true" validates boolean on a true value, if false the macro will be terminated
    "aData"="array" validates on array data, if false the macro will be terminated
    "sSomeOtherVar"="some value" validates anything else: if($_CONTEXT['modglue']['thc_current_mod']['sSomeOtherVar']=="some value"), if false the macro will be terminated

Parameters Order:

There's a specific order in which the parameters are executed.

  1. [g]...[/g]: define _GET variables
  2. [p]...[/p]: define _POST variables
  3. [f]...[/f]: include files
  4. [l]...[/l]: set variables in ModGlue - optional
  5. [v]...[/v]: variables to validate - optional
  6. [c]...[/c]: clear variables - optional

Resource Settings:

  • time limit: php default
  • memory limit: php default

Dependencies:

Depends which modules are used

Expanding ModGlue:

Even though it's possible to expand ModGlue with new parameters, it's not recommended unless you fully understand how the program works. In order to add new parameters you would need to edit two files:

  1. modglue/modgluerun.php: the file that interprets the parameter's function
  2. modglue/functions/load.php: extracts data from the code specified in the editor

Known Issues:

Apps are not compatible with ModGlue, hence the name. Only modules that have screen files are compatible with ModGlue.

Created by Remco Kouw: 2008-2024