if self.__fRadioActivate.get_active():
id = self.__fLicenseIDEntry.get_text()
errs, lic = abstract.[COLOR="Red"]ValidateAndNormalizeLicenseID(id)[/COLOR]
if len(errs) == 0 and id[0] == 'T':
errs.append(_('You cannot enter a trial license id here'))
if len(errs) > 0:
msg = _('Invalid license id: %s. Please check and correct it. Errors found were:\n\n%s') % (id, '\n'.join(errs))
buttons = [dialogs.CButtonSpec(_('_OK'), None, wgtk.STOCK_OK)]
dlg = messages.CMessageDialog(self.fSingletons, _('Invalid License ID'), msg, [], buttons)
dlg.RunAsModal(self)
return True
这可以看到,License ID首字符如果是’T’的话,则是trial license,这当然不是我们要的。
右键点击ValidateAndNormalizeLicenseID,选Go to Definition,到
def ValidateAndNormalizeLicenseID(id):
errs, id2 = __ValidateAndNormalize(id)
if len(id2) > 0 and id2[0] not in kLicenseUseCodes:
errs.append(_('Invalid first character: Should be one of %s') % str(kLicenseUseCodes))
if len(id2) > 1 and id2[1] != kLicenseProdCode:
cur_product = 'Wing IDE %s' % config.kProduct
lic_product = kLicenseProdForCode.get(id2[1], None)
if lic_product is None:
lic_product = _('an unknown product')
else:
lic_product = 'Wing IDE %s' % config.k_ProductNames[lic_product]
errs.append(_('Your license is for %s, but you are currently running %s. Please download the correct product from http://wingware.com/downloads or upgrade your license at https://wingware.com/store/upgrade') % (lic_product, cur_product))
if len(errs) > 0:
check_code = id.strip().upper().replace('-', '')
if len(check_code) == 16:
looks_like_11 = True
for c in check_code:
if c not in '0123456789ABCDEF':
looks_like_11 = False
if looks_like_11:
errs = [_('You cannot activate using a Wing IDE 1.1 license: Please use a trial license or upgrade your license at http://wingware.com/store/upgrade')]
if len(errs) > 0:
return (errs, None)
else:
return ([], id2)
def __ValidateAndNormalize(code):
"""Remove hyphens and extra space/chars in a license id or activation
request, and validate it as within the realm of possibility. Returns
errs, value."""
errs = []
code = code.strip().upper()
code2 = ''
badchars = ''
for c in code:
if c in ('-', ' ', '\t'):
pass
elif c not in textutils.BASE30:
code2 += c
if badchars.find(c) == -1:
badchars += c
else:
code2 += c
if len(badchars) > 0:
errs.append(_('Contains invalid characters: %s') % badchars)
if len(code2) != 20:
errs.append(_('Wrong length (should contain 20 non-hyphen characters)'))
if len(errs) > 0:
return (errs, code2)
else:
return ([], AddHyphens(code2))
class CObtainLicenseDialog(dialogs.CGenericDialog):
"""Dialog used to obtain a new license"""
kCharWidth = 60
def __init__(self, singletons, lic = None):
self.fSingletons = singletons
[COLOR="red"]self.fLicMgr = singletons.fLicMgr[/COLOR]
self.fLicense = lic
self.fLicMg是这个类初始化时传进来的,在类名上右键,点Find Points of Use,来到这里
def _ObtainLicense(self):
"""Prompt user to obtain a license, or quit if they don't get one"""
if self._fPromptForSaveDialog or not wgtk.kQt and wgtk.gdk.pointer_is_grabbed():
return
if self.__fObtainLicenseDialog is not None:
self.__fObtainLicenseDialog.Show()
return
self.__fObtainLicenseDialog =[COLOR="red"] CObtainLicenseDialog(self.fSingletons)[/COLOR]
class CWingLicenseManager(abstract.CLicenseManager):
""" Specialization of the generic license manager for use in Wing IDE """
def __init__(self, singletons):
""" Constructor """
abstract.CLicenseManager.__init__(self)
[COLOR="red"]self.fSingletons = singletons[/COLOR]
self._fExpiringLicenseCheck = False
self.__fObtainLicenseDialog = None
self._fPromptForSaveDialog = False
找CWingLicenseManager这个类的使用点,来到singleton.py中
def CreateLicMgr(self):
""" Create license manager. Mucking with this code is a violation of
your software license and a generally sleazy thing to do to a bunch of
guys trying to make a living by creating some decent tools for you. So
please don't do it. """
[COLOR="red"] lic_mgr = process.wingctl.CWingLicenseManager(self)
self.fLicMgr = lic_mgr[/COLOR]
self.emit('changed', self)
if sys.platform[:5] in ('win32', 'darwi') or sys.platform[:5] == 'linux' and os.uname()[4] not in ('ppc', 'ppc64', 'arm7l'):
[COLOR="Red"]import ctlutil as control[/COLOR]
else:
try:
import pycontrol
control = pycontrol
except ImportError:
dirname = os.path.dirname(__file__).replace('.zip', '')
control = LoadFromDat(fileutils.join(dirname, 'pycontrol.dat'), 'pycontrol')
这个ctlutil是啥?搜,我用的Everyting这软件,搜到C:\Wing IDE 5.0\bin\2.7\src\process\ctutil.pyd,这其实就是个dll,IDA反编译它。
反编译后的哑名函数不多,就5个,挨个看。看到sub_10001410这函数的时候,猛然发现有个”_locale_valid”