-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmain.go
257 lines (178 loc) · 5.4 KB
/
main.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
package main
//#include "dllmain.h"
import (
"C"
"fmt"
"os/user"
"runtime"
"unsafe"
"golang.org/x/sys/windows"
)
const template = `
FnCall: %s
WorkDir: %s
CmdLine: %s
Arch: %s
User: %s
Integrity: %s
`
//export OnProcessAttach
func OnProcessAttach(
hinstDLL unsafe.Pointer, // handle to DLL module
fdwReason uint32, // reason for calling function
lpReserved unsafe.Pointer, // reserved
) {
alert()
}
func alert() {
imageName, path, cmdLine := hostingImageInfo()
title := fmt.Sprintf("Host Image: %s", imageName)
arch := runtime.GOARCH
usr, err := user.Current()
if err != nil {
usr.Username = "Unknown Error"
}
integrity, err := getProcessIntegrityLevel()
if err != nil {
integrity = "Unknown Error"
}
msg := fmt.Sprintf(template, caller(), path, cmdLine, arch, usr.Username, integrity)
MessageBox(title, msg, MB_OK|MB_ICONEXCLAMATION|MB_TOPMOST)
}
func hostingImageInfo() (imageName, path, cmdLine string) {
peb := windows.RtlGetCurrentPeb()
userProcParams := peb.ProcessParameters
imageName = userProcParams.ImagePathName.String()
path = userProcParams.CurrentDirectory.DosPath.String()
cmdLine = userProcParams.CommandLine.String()
return
}
//export CallNtPowerInformation
func CallNtPowerInformation() { alert() }
//export ClrCreateManagedInstance
func ClrCreateManagedInstance() { alert() }
//export ConstructPartialMsgVW
func ConstructPartialMsgVW() { alert() }
//export CorBindToRuntimeEx
func CorBindToRuntimeEx() { alert() }
//export CreateUri
func CreateUri() { alert() }
//export CurrentIP
func CurrentIP() { alert() }
//export DevObjCreateDeviceInfoList
func DevObjCreateDeviceInfoList() { alert() }
//export DevObjDestroyDeviceInfoList
func DevObjDestroyDeviceInfoList() { alert() }
//export DevObjEnumDeviceInterfaces
func DevObjEnumDeviceInterfaces() { alert() }
//export DevObjGetClassDevs
func DevObjGetClassDevs() { alert() }
//export DllCanUnloadNow
func DllCanUnloadNow() { alert() }
//export DllGetClassObject
func DllGetClassObject() { alert() }
//export DllProcessAttach
func DllProcessAttach() { alert() }
//export DevObjOpenDeviceInfo
func DevObjOpenDeviceInfo() { alert() }
//export DllRegisterServer
func DllRegisterServer() { alert() }
//export DllUnregisterServer
func DllUnregisterServer() { alert() }
//export DpxNewJob
func DpxNewJob() { alert() }
//export ExtractMachineName
func ExtractMachineName() { alert() }
//export FveCloseVolume
func FveCloseVolume() { alert() }
//export FveCommitChanges
func FveCommitChanges() { alert() }
//export FveConversionDecrypt
func FveConversionDecrypt() { alert() }
//export FveDeleteAuthMethod
func FveDeleteAuthMethod() { alert() }
//export FveDeleteDeviceEncryptionOptOutForVolumeW
func FveDeleteDeviceEncryptionOptOutForVolumeW() { alert() }
//export FveGetAuthMethodInformation
func FveGetAuthMethodInformation() { alert() }
//export FveGetStatus
func FveGetStatus() { alert() }
//export FveOpenVolume
func FveOpenVolume() { alert() }
//export FveRevertVolume
func FveRevertVolume() { alert() }
//export GenerateActionQueue
func GenerateActionQueue() { alert() }
//export GetFQDN_Ipv4
func GetFQDN_Ipv4() { alert() }
//export GetMemLogObject
func GetMemLogObject() { alert() }
//export GetFQDN_Ipv6
func GetFQDN_Ipv6() { alert() }
//export InitCommonControlsEx
func InitCommonControlsEx() { alert() }
//export IsLocalConnection
func IsLocalConnection() { alert() }
//export LoadLibraryShim
func LoadLibraryShim() { alert() }
//export NetApiBufferAllocate
func NetApiBufferAllocate() { alert() }
//export NetApiBufferFree
func NetApiBufferFree() { alert() }
//export NetApiBufferReallocate
func NetApiBufferReallocate() { alert() }
//export NetApiBufferSize
func NetApiBufferSize() { alert() }
//export NetRemoteComputerSupports
func NetRemoteComputerSupports() { alert() }
//export NetapipBufferAllocate
func NetapipBufferAllocate() { alert() }
//export NetpIsComputerNameValid
func NetpIsComputerNameValid() { alert() }
//export NetpIsDomainNameValid
func NetpIsDomainNameValid() { alert() }
//export NetpIsGroupNameValid
func NetpIsGroupNameValid() { alert() }
//export NetpIsRemote
func NetpIsRemote() { alert() }
//export NetpIsRemoteNameValid
func NetpIsRemoteNameValid() { alert() }
//export NetpIsShareNameValid
func NetpIsShareNameValid() { alert() }
//export NetpIsUncComputerNameValid
func NetpIsUncComputerNameValid() { alert() }
//export NetpIsUserNameValid
func NetpIsUserNameValid() { alert() }
//export NetpwListCanonicalize
func NetpwListCanonicalize() { alert() }
//export NetpwListTraverse
func NetpwListTraverse() { alert() }
//export NetpwNameCanonicalize
func NetpwNameCanonicalize() { alert() }
//export NetpwNameCompare
func NetpwNameCompare() { alert() }
//export NetpwNameValidate
func NetpwNameValidate() { alert() }
//export NetpwPathCanonicalize
func NetpwPathCanonicalize() { alert() }
//export NetpwPathCompare
func NetpwPathCompare() { alert() }
//export NetpwPathType
func NetpwPathType() { alert() }
//export PowerGetActiveScheme
func PowerGetActiveScheme() { alert() }
//export PrivateCoInternetCombineUri
func PrivateCoInternetCombineUri() { alert() }
//export ProcessActionQueue
func ProcessActionQueue() { alert() }
//export RegisterDLL
func RegisterDLL() { alert() }
//export Run
func Run() { alert() }
//export SLGetWindowsInformation
func SLGetWindowsInformation() { alert() }
//export UnRegisterDLL
func UnRegisterDLL() { alert() }
//export WdsAbortBlackboa
func WdsAbortBlackboa() { alert() }
func main() {}