Created
March 2, 2022 22:50
-
-
Save cw2k/f879cc81abb57d149eccd35dbd23ef89 to your computer and use it in GitHub Desktop.
Activation helper for Wingware Wing IDE 2-8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################ | |
# Wing IDE Professional 8.x KeyGen | |
# https://wingware.com/downloads | |
# for Python3.x | |
# uncomment these to get also support for Python2.7 | |
#from __future__ import print_function | |
# try: | |
# from future import standard_library | |
# except ImportError as e: | |
# try: | |
# m = "Probably something with module 'future' not found" | |
# m = e.message | |
# finally: | |
# input ('ImportError: ' + m + ' \nrun [c:\Python27\Scripts\]\n' | |
# '-> pip install future\n' | |
# 'To install python 2/3 compatibility layer') | |
# # exit() | |
# standard_library.install_aliases() | |
# from future.builtins import (input, str, range) | |
import string | |
import random | |
import hashlib | |
import sys, os | |
def printerr(*args, **kwargs): | |
kwargs["file"] = sys.stderr | |
print (args, kwargs) | |
def randomstring(size = 20, chars = string.ascii_uppercase + string.digits): | |
return ''.join(( random.choice( chars ) for _ in range(size) ) ) | |
def BaseConvertHex( number, to_digits, | |
ignore_negative = True): | |
# isNegative = number < 0 | |
# if isNegative and not ignore_negative: | |
# number = abs( number ) | |
# make an integer out of the number | |
x = int( number, 16) | |
# create the result in base 'len(to_digits)' | |
res = '' | |
toDigitsLen = len( to_digits ) | |
while x > 0: # divide of /seperate digit's from x until it's empty | |
digit = x % toDigitsLen | |
res = to_digits[ digit ] + res | |
x //= toDigitsLen | |
# if isNegative: | |
# res = - res | |
return res | |
def AddHyphens( code ): | |
"""Insert hyphens into given license id or activation request to | |
make it easier to read""" | |
return code[ : 5 ] + '-' + \ | |
code[ 5:10 ] + '-' + \ | |
code[ 10:15 ] + '-' + \ | |
code[ 15: ] | |
def ToBase30( digest ): | |
result = BaseConvertHex( digest .upper(), BASE30) | |
return result .rjust( KeyLen, '1' ) | |
def mulHash16( inValue, lichash ): | |
part = 0 | |
for c in lichash: | |
part *= inValue | |
part += ord( c ) | |
part &= 0xFFFFF | |
return format( part, '05x' ) | |
def GenRandomLicID( kPrefix_LicenseId ): | |
LicenseId = AddHyphens( kPrefix_LicenseId + | |
randomstring( KeyLen + 1, BASE30 if Randomness else BASE30[0] )) # KeyLen + 1 = 18 | |
return LicenseId | |
def CreateActivationRequest(license): | |
"""Create hash value from license that can be shipped to the license | |
activation server""" | |
hasher = hashlib.sha1() | |
# for key in kHashLicenseFields: | |
# if license['termdays'] != '*' and \ | |
# license['license'][0] != 'T' and \ | |
# key == 'termdays': | |
# continue | |
value = license# [key] | |
# if bulkctl is not None and \ | |
# key == 'license' and \ | |
# value[2] not in '123456789' and \ | |
# value.replace('-', '')[10:] == 'XXXXXXXXXX': | |
lic = value.replace('-','') | |
value = lic[:10] + bulkctl._hash30(lic[:10])[:10] | |
value = AddHyphens(value) | |
hasher.update( value.encode() ) | |
# if license['termdays'] != '*': | |
# hasher.update(str(license['date'])) | |
digest = hasher.hexdigest().upper() | |
return AddHyphens(kRequestPrefix + ToBase30(digest)) # + textutils.SHAToBase30(digest)) | |
def GetRequestCode(kRequestPrefix, LicenseId): | |
# try: | |
# RequestCode = CreateActivationRequest(LicenseId) | |
# print ('Let me guess that is ya request code : ' + RequestCode ) | |
# except ModuleNotFoundError: | |
# print ( (' '*14) + 'Whoops error. \'sha\' where are you? Anyway I can still ask you:') | |
try: | |
RequestCode = input( 'Enter request code : ' ) | |
except : | |
RequestCode = raw_input( 'Enter request code : ' ) | |
RequestCode = RequestCode.upper() | |
if RequestCode.startswith(kRequestPrefix) == False: | |
print( | |
(' '*19) + ' ' + kRequestPrefix.ljust(5,"x") + '-xxxxx'*3 + '\n' + | |
(' '*14) + 'OOPS : Your request code should start with: ' + kRequestPrefix + '...\n' + | |
(' '*14) + ' You probably made a mistake, \n' + | |
(' '*14) + ' ...or didn\'t enter anything at all.\n' + | |
(' '*14) + ' Like this the activation code WON\'T WORK !\n' + | |
(' '*14) + '' + | |
(' '*14) + ' or this keygen is not setup for the requested 2.OSVersion or 3.WingVersion, \n' | |
) | |
return RequestCode | |
def GenActivationCode( LicenseId, RequestCode): | |
# 1. Gen SHA1 from 'activation code' and 'LicenseId' | |
hasher = hashlib.sha1( (RequestCode + LicenseId) .encode() ) \ | |
.hexdigest() | |
# 2. Take only every second diget; starting with the first | |
Every2ndDigest = ''.join( [ c for i, c in enumerate( hasher ) if i % 2 == 0 ] ) | |
lichash = ToBase30( Every2ndDigest ) | |
return lichash | |
def GenActivationCode2( lichash ): | |
# 3. Apply mulhash | |
part5 = [ mulHash16( key, lichash) \ | |
for key in KeyLicVer ] | |
part5 = ''.join( part5 ) | |
part5 = Prefix_ActivationId + \ | |
ToBase30( part5 ) | |
return AddHyphens ( part5 ) | |
######################################################### | |
## | |
## M a i n | |
## | |
# Key vectors for Wing IDE Professional x | |
#<Wing IDE 6.0>\bin\ide-2.7\src\process\pycontrol.pyo | |
#<Wing IDE 8.0>\bin\ide-2.7\src\process\__os__\win32\ctlutil.pyd | |
# Last function in the *.pyd dll - in IDA Hexray Decompiler it's some switch case | |
KeyLicVerX_unknown = [ 0, 0, 0, 0 ] | |
# Other | |
KeyLicVer2_sunos = [ 48, 104, 234, 247 ] | |
KeyLicVer3_sunos = [ 254, 52, 98, 235 ] | |
KeyLicVer4_sunos = [ 207, 45, 198, 189 ] | |
# "macosx" | |
KeyLicVer2_darwi = [ 41, 207, 104, 77 ] | |
KeyLicVer3_darwi = [ 128, 178, 104, 95 ] | |
KeyLicVer4_darwi = [ 67, 167, 74, 13 ] | |
# "linux" | |
KeyLicVer2_linux = [ 142, 43, 201, 38 ] | |
KeyLicVer3_linux = [ 123, 163, 2, 115 ] | |
KeyLicVer4_linux = [ 17, 87, 120, 34 ] | |
# "windows" | |
KeyLicVer2_win32 = [ 123, 202, 97, 211 ] | |
KeyLicVer3_win32 = [ 127, 45, 209, 198 ] | |
KeyLicVer4_win32 = [ 240, 4, 47, 98 ] | |
KeyLicVer5_win32 = [ 7, 123, 23, 87 ] | |
KeyLicVer6_win32 = [ 23, 161, 47, 9 ] | |
KeyLicVer7_win32 = [ 221, 13, 93, 27 ] | |
KeyLicVer8_win32 = [ 179, 95, 45, 245 ] | |
## | |
## NEW Value go in here ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
## | |
WingVer = 8 | |
# key for Ver6 | |
# KeyLicVer = KeyLicVer7_win32 | |
kVersionRequestCodes = { | |
'2': 'X', | |
'3': '3', | |
'4': '4', | |
'5': '5', | |
'6': '6', | |
'7': '7', | |
'8': '8', | |
'9': '9', | |
} | |
## | |
## End of config for NEW Values | |
## | |
kRequestVersionCode = kVersionRequestCodes[ str(WingVer) ] | |
KeyLicVer = KeyLicVer8_win32 | |
Randomness = False | |
kOSRequestCodes = { | |
'win32': 'W', | |
'linux': 'L', | |
'darwi': 'M', | |
'sunos': 'N', | |
'freeb': 'F', | |
'tru64': 'T', | |
'netbs': 'E', | |
'openb': 'B' | |
} | |
kRequestPrefix = 'R' | |
if sys.platform.startswith('linux') and \ | |
os.uname()[4] in ('ppc', 'ppc64'): | |
kVerPrefix = 'P' | |
else: | |
kVerPrefix = kOSRequestCodes [ sys.platform[:5] ] | |
kVerPrefix += kRequestVersionCode | |
kLicenseUseCodes = \ | |
[ 'C' , #'Perpetual License - Commercial Use' | |
'E' , #'Perpetual License - Non-Commercial Use' | |
'N' , #'Perpetual License - Educational Use' | |
'T' , #'Trial License - Evaluation Use Only' | |
'Y' , #'Annual License - Commercial Use') | |
'H' , #'Annual License - Non-Commercial Use' | |
'6' , #'Free Annual License - Educational Use' | |
] | |
Prefix_LicenseId = kLicenseUseCodes[0] + "N" # "CN6" | |
Prefix_RequestId = kRequestPrefix + kVerPrefix # "RW6" | |
Prefix_ActivationId = "AXX" # = kActivationPrefix # "AXX" | |
KeyLen = 17 | |
BASE16 = '0123456789ABCDEF' | |
BASE30 = BASE16[1:] +'GH''JKLMNPQR''T''VWXY' # no I,S,U | |
print('Wing IDE Professional ' + str(WingVer) + '.x - Keygen v3\n' + \ | |
'=' * 37 + '\n') | |
#0. Module Testing: | |
def Testing(): | |
Test_LicenseId = "CN222-22222-22222-22222" | |
Test_ReqCode = "RW62G-VARNH-H8KEG-EH82G" | |
Test_ActCode = "AXX37-R7JNG-RNF1R-D1MWE" | |
RemovePreFixAndHyphens = lambda x : x.replace('-','')[3:] | |
assert RemovePreFixAndHyphens ( Test_LicenseId ) == \ | |
ToBase30( "5E4C5A46401C8CC33DCB" ) , \ | |
"T0-1: Testing ToBase30()" | |
Test_ReqCode2 = "RW62W-9C7JP-RRLRK-VKRT7" # note: that's some intermediate code requestcode that is not shown | |
assert RemovePreFixAndHyphens (Test_ReqCode2 ) == \ | |
GenActivationCode(Test_LicenseId, Test_ReqCode) , \ | |
"T0-2: Testing GenActivationCode()" | |
if KeyLicVer == KeyLicVer6_win32: | |
assert Test_ActCode == \ | |
GenActivationCode2(Test_ReqCode2), \ | |
"T0-3: Testing GenActivationCode2()" | |
#Oldversion | |
assert "AXX" + "23-QB7YB-6RG4M-YFQ86" == \ | |
GenActivationCode2( \ | |
GenActivationCode( Test_LicenseId, "" ) ) , \ | |
"0-4: Test GenActivationCode() [OldStyle]" | |
# else: | |
# printerr ("Warning some tests were skipped.) " | |
# "They are only for version6. " | |
# "'KeyLicVer' was set to another version.") | |
Testing() | |
if not Randomness: | |
print ('Randomness :', Randomness) | |
# 1. Gen random LicID | |
LicenseId = GenRandomLicID( Prefix_LicenseId ) | |
print('License id : ' + LicenseId) | |
# 2. GetRequestCode | |
RequestCode = GetRequestCode( Prefix_RequestId, LicenseId ) | |
# 3. Gen activation code | |
ActivationCode = GenActivationCode( LicenseId, RequestCode ) | |
# That's what somehow got updated in ver 6.00 to 6.09 | |
ActivationCode = AddHyphens( RequestCode[:3] + ActivationCode ) | |
ActivationCode = GenActivationCode2( ActivationCode ) | |
print('Activation code : ' + ActivationCode ) | |
input('\nGood luck ! cw2k [at] gmx [dot] net') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment