Skip to content

Instantly share code, notes, and snippets.

@joshiji
Created December 31, 2016 03:18
Show Gist options
  • Save joshiji/16a85e84d18cc12e9e606a987e23de6f to your computer and use it in GitHub Desktop.
Save joshiji/16a85e84d18cc12e9e606a987e23de6f to your computer and use it in GitHub Desktop.
To Find ID used to a installer entry
#!python
# This is a script to calculate ID used in HKLM\Software\Classes\Installer\Products
# from the GUID of the product as mentioned in uninstall entry in registry.
# Explaination: http://superuser.com/questions/570598/how-to-force-uninstall-a-software-that-is-installed-by-msi-package/570620#570620
import sys
from _winreg import *
def reverse_alternate(s):
if len(s)%2 != 0:
print "Error in input for alternating reverse."
return s
x = ""
i = 0
while(i < len(s)):
x += s[i:i+2][::-1]
i += 2
return x
guid = sys.argv[1]
broken_guid = guid.strip().split('-')
output = broken_guid[0][::-1] + broken_guid[1][::-1] + broken_guid[2][::-1] + reverse_alternate(broken_guid[3]) + reverse_alternate(broken_guid[4])
print output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment