-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New SMB/WMI Module BitLocker #286
Conversation
Would it perhaps be better to run this via WMI? Seems slightly more op-sec safe. I haven't tested, but it seems possible: https://4sysops.com/archives/check-the-bitlocker-status-of-all-pcs-in-the-network/#rtoc-3 |
Test's an great idea, I'm testing now, I will share results manually. Thank you. |
It works @Adamkadaban I can also adapt it to this method. Let me edit it. |
@termanix Sorry, I should've been clearer. I meant through the WMI protocol rather than through powershell Just checked with wmiquery and it seems to work. Also produces less security events I think this should work for doing it through WMI: iInterface = dcom.CoCreateInstanceEx(wmi.CLSID_WbemLevel1Login,wmi.IID_IWbemLevel1Login)
iWbemLevel1Login = wmi.IWbemLevel1Login(iInterface)
bitlockerNamespace = "root\\CIMv2\\Security\\MicrosoftVolumeEncryption"
try:
iWbemServices= iWbemLevel1Login.NTLMLogin(bitlockerNamespace, NULL, NULL)
except Exception as e:
if str(e).find("WBEM_E_INVALID_NAMESPACE") >= 0:
iWbemLevel1Login.RemRelease()
dcom.disconnect()
else:
nxc_logger.debug(str(e))
iWbemServices.get_dce_rpc().set_auth_level(RPC_C_AUTHN_LEVEL_PKT_PRIVACY)
classQuery = "SELECT DriveLetter, ConversionStatus, ProtectionStatus, EncryptionMethod FROM Win32_EncryptableVolume"
try:
iEnumWbemClassObject = iWbemServices.ExecQuery(classQuery)
iWbemClassObject = iEnumWbemClassObject.Next(0xffffffff,1)[0]
queryResult = iWbemClassObject.getProperties()
# parse and print data from here
iEnumWbemClassObject.RemRelease()
except Exception as e:
if str(e).find("WBEM_E_INVALID_CLASS") >= 0:
iWbemLevel1Login.RemRelease()
iWbemServices.RemRelease()
dcom.disconnect()
print(str(e))
nxc_logger.debug(str(e))
iWbemLevel1Login.RemRelease()
iWbemServices.RemRelease()
dcom.disconnect() |
Oh okay, I didn't test it with wmi protocol yet. I was just be quick for get result. Using WMI is your idea and I don't want to steal your idea :D I can add it for WMI if it's okay to you. |
Yes, feel free. Add me as a co-author to the commit if you so please ;) |
You could check |
Ofc. I will add it for WMI too then. If you joined discord can you contact me? We can implement it together. |
@termanix can you add this module to the e2e tests file? |
4738952
to
78ce0f4
Compare
Removed bitlocker modules for adding to Pennyw0rth#286 Signed-off-by: termanix <50464194+termanix@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update e2e_commands.txt
Updated @Marshall-Hallenbeck , It can be review. |
@termanix , I see you're coding now. My mistake; I told you to use the -ErrorAction SilentlyContinue approach in my situation. However, since the function doesn't exist yet, you cannot call -EA, as it will also raise an error. |
Oh okay got it. But about try catch, I just want to show it on NetExec output if system has not get-bitlocker. Code checks it in output. But I got it what you mean. |
Using WMI command Signed-off-by: termanix <50464194+termanix@users.noreply.github.com>
Co-authored-by: Adamkadaban <adamkadaban@gmail.com> Signed-off-by: termanix <50464194+termanix@users.noreply.github.com>
Fixed a bug, if bitlockervolume and namespace does not exist. Co-authored-by: Adamkadaban <adamkadaban@gmail.com> Signed-off-by: termanix <50464194+termanix@users.noreply.github.com>
Signed-off-by: termanix <50464194+termanix@users.noreply.github.com>
Updated according to the new powershell update. Signed-off-by: termanix <50464194+termanix@users.noreply.github.com>
Fixed smb error line. Signed-off-by: termanix <50464194+termanix@users.noreply.github.com>
Signed-off-by: termanix <50464194+termanix@users.noreply.github.com>
3767109
to
610bad1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't test wmi on my notebook as it is not domain joined, but the negative detectin on the dc seems to work: @Marshall-Hallenbeck also saw your command regarding ps_execute. Changed it for now cause it fails on my most of the time and also is flagged pretty often by AVs (for example even win defender yelled at me lol). If that's fine for you please also approve (you have a pending change request) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NeffIsBack sounds good! Looks like my other changes were fixed
Great! I'll merge🚀 |
Checking BitLocker status on all drives.