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

     1  //go:build !implant
     2  // +build !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/com"
    23  
    24  // ProxyRemove returns a remove Proxy Packet. This can be used to instruct the
    25  // client to attempt to remove the Proxy setup by the name, or the single Proxy
    26  // instance (if multi-proxy mode is disabled).
    27  //
    28  // Returns an NotFound error if the Proxy is not registered or Proxy support is
    29  // disabled
    30  //
    31  // C2 Details:
    32  //
    33  //	ID: MvProxy
    34  //
    35  //	Input:
    36  //	    string // Proxy Name (may be empty)
    37  //	    uint8  // Always set to true for this task.
    38  //	Output:
    39  //	    <none>
    40  func ProxyRemove(name string) *com.Packet {
    41  	n := &com.Packet{ID: MvProxy}
    42  	n.WriteString(name)
    43  	n.WriteUint8(0)
    44  	return n
    45  }
    46  
    47  // Proxy returns an add Proxy Packet. This can be used to instruct the client to
    48  // attempt to add the specified Proxy with the name, bind address and Profile
    49  // bytes.
    50  //
    51  // Returns an error if Proxy support is disabled, a listen/setup error occurs or
    52  // the name already is in use.
    53  //
    54  // C2 Details:
    55  //
    56  //	ID: MvProxy
    57  //
    58  //	Input:
    59  //	    string // Proxy Name (may be empty)
    60  //	    uint8  // Always set to false for this task.
    61  //	    string // Proxy Bind Address
    62  //	    []byte // Proxy Profile
    63  //	Output:
    64  //	    <none>
    65  func Proxy(name, addr string, p []byte) *com.Packet {
    66  	n := &com.Packet{ID: MvProxy}
    67  	n.WriteString(name)
    68  	n.WriteUint8(2)
    69  	n.WriteString(addr)
    70  	n.WriteBytes(p)
    71  	return n
    72  }
    73  
    74  // ProxyReplace returns a replace Proxy Packet. This can be used to instruct
    75  // the client to attempt to call the 'Replace' function on the specified Proxy
    76  // with the name, bind address and Profile bytes as the arguments.
    77  //
    78  // Returns an error if Proxy support is disabled, a listen/setup error occurs or
    79  // the name already is in use.
    80  //
    81  // C2 Details:
    82  //
    83  //	ID: MvProxy
    84  //
    85  //	Input:
    86  //	    string // Proxy Name (may be empty)
    87  //	    uint8  // Always set to false for this task.
    88  //	    string // Proxy Bind Address
    89  //	    []byte // Proxy Profile
    90  //	Output:
    91  //	    <none>
    92  func ProxyReplace(name, addr string, p []byte) *com.Packet {
    93  	n := &com.Packet{ID: MvProxy}
    94  	n.WriteString(name)
    95  	n.WriteUint8(1)
    96  	n.WriteString(addr)
    97  	n.WriteBytes(p)
    98  	return n
    99  }