May 4, 2024 07:36 AM
(This post was last modified: Mar 16, 2026 08:43 AM by Hackers.)
![[Image: header4.gif]](https://i.ibb.co/C33BJJJg/header4.gif)
Hello, today I will be showing you a prototype script I wrote that can fetch the details about your computer's anti-virus.
This is good for making sure your software is up to date, and to verify that you are protected.
Interested in more of this content?
Thank Fallen members!
We are using Python today, with the win32com package to interact with lower level Windows functions.
Code
import win32com.client
objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator")
swbemServices = objWMIService.ConnectServer(".", "ROOT\\SecurityCenter2")We use COM on Windows, in combo with the WMI service. This allows us to execute basic SQL queries to find more information.
Code
SELECT * FROM AntivirusProductOnce we get the results, we must loop through them to analyze.
We can get the display name, product state (enabled/disabled), and other information.
Code
for objItem in colItems:
name = objItem.displayName
state = objItem.productState
state_hex = f'{state:06x}' # Format as hex with leading zerosThe values are represented with hex values, which can obviously be interpreted in binary or other types too.
For hex, we can extract certain values to know if it is enabled or not.
For example, Windows defender may have a state of "060100". This is also represented as "0x60100"
You can get the "middle number", which would be "01" - as in there is "06 on the left" and "00 on the right"
- if this middle number = "10" then it is enabled, and if not, it is disabled.
- for Windows Defender in this case of 060100, the "01" means it is disabled.
When we look at my computer, AVG is set to "041000" or "0x41000". This is "04 on left" and "00 on right", which is "10" in the middle for enabled.
Code
Antivirus Name: Windows Defender
State (Hex): 060100
Enabled Status: Disabled
Update Status: Up to Date
Antivirus Name: AVG Antivirus
State (Hex): 041000
Enabled Status: Enabled
Update Status: Up to DateLastly, we can use the last 2 numbers of t he hex value to see if it's up to date or not.
If the last 2 digits are "00" this means it is updated already to latest available version, for your OS. For example "060100" ends in "00" and so does "041000" so we know that both AV options are updated on my current machine.
Full Source Code:
Code
import win32com.client
def check_antivirus_status():
# Connect to the WMI service
objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator")
swbemServices = objWMIService.ConnectServer(".", "ROOT\\SecurityCenter2")
# Execute the WMI query to get antivirus product information
colItems = swbemServices.ExecQuery("SELECT * FROM AntivirusProduct")
# Check the status of each antivirus product
for objItem in colItems:
name = objItem.displayName
state = objItem.productState
state_hex = f'{state:06x}' # Format as hex with leading zeros
# Extract the middle two hex digits and check if enabled
enabled_hex = state_hex[2:4]
enabled_status = 'Enabled' if enabled_hex == '10' else 'Disabled'
# Extract the last two hex digits for update status
update_hex = state_hex[4:6]
update_status = 'Up to Date' if update_hex == '00' else 'Not Up to Date'
print(f'Antivirus Name: {name}')
print(f'State (Hex): {state_hex.upper()}')
print(f'Enabled Status: {enabled_status}')
print(f'Update Status: {update_status}\n')
if __name__ == "__main__":
check_antivirus_status()



![[Image: vibesignature.gif]](https://i.ibb.co/8LvxwtYQ/vibesignature.gif)