-
-
未解决 [求助]关于反编译pyo和py修改转pyo
-
发表于: 2019-4-27 17:59 2551
-
要汉化(mainprefs.pyo)或破解的是:https://wingware.com/pub/wingpro/7.0.0.11/wingpro-7.0.0.11-win32.zip
看了这篇https://www.cnblogs.com/rainduck/p/3524557.html文章
于是我就试着用下载到的 ,做了下面的批处理,
./uncompyle2 C:\Program Files (x86)\Wing IDE 6.1\bin\ide-2.7\src\mainprefs.pyo > c:\test.py
可是没有输出呢
希望论坛高人指点下,如何处理?
还是看来不能直接修改PYO文件关键点,会造成无法启动,必须反编译。
字符串就算能汉化到,也不能用中文,因为貌似py中没有引入utf-8(试了等大小的英文可以不报错,并显示出来)
实验后:
只有pyc还是没得到 pyo
看了这篇https://www.cnblogs.com/rainduck/p/3524557.html文章
于是我就试着用下载到的 ,做了下面的批处理,
./uncompyle2 C:\Program Files (x86)\Wing IDE 6.1\bin\ide-2.7\src\mainprefs.pyo > c:\test.py
可是没有输出呢
希望论坛高人指点下,如何处理?
还是看来不能直接修改PYO文件关键点,会造成无法启动,必须反编译。
字符串就算能汉化到,也不能用中文,因为貌似py中没有引入utf-8(试了等大小的英文可以不报错,并显示出来)
所以,也就必须反编译才能破解 或 汉化中文了。
python -m py_compile C:\Users\Administrator.DESKTOP-8JRMERI\Desktop\prefs.py
python -O -m py_compile C:\Users\Administrator.DESKTOP-8JRMERI\Desktop\prefs.py
python -OO -m py_compile C:\Users\Administrator.DESKTOP-8JRMERI\Desktop\prefs.py
实验后:
只有pyc还是没得到 pyo
#! /usr/bin/env python 2.7 (62211) #coding=utf-8 # Compiled at: 2019-03-01 16:01:26 #Powered by BugScaner #[url]http://tools.bugscaner.com/[/url] #如果觉得不错,请分享给你朋友使用吧! """ prefs.py -- Preferences for top-level of IDE Copyright (c) 1999-2012, Archaeopteryx Software, Inc. All rights reserved. Written by Stephan R.A. Deibel and John P. Ehresman """ import sys, os from wingutils.textio import * from guiutils.formbuilder import * from wingbase import miscutils from wingbase import mime from wingbase import filefilter from wingutils import encoding_utils from wingbase import fileutils import types, config, gettext _ = gettext.translation('src', fallback=1).ugettext kPrefsVersion = CTextIOValueDef('main', 'prefs-version', 'Used internally to identify prefs file version', None, CNoneOr(CType('')), CHiddenGui()) _kLanguages = [ ( _('System Default'), None), ('English', 'en'), ('Chinese(ZhongWen', 'de'), (u'Fran\xe7ais (French)', 'fr'), (u'\u0420\u0443\u0441\u0441\u043a\u0438\u0439 (Russian)', 'ru')] kDisplayLanguage = CTextIOValueDef('main', 'display-language', _('The language to use for the user interface. Either the default for this system, or set to a specific supported language.'), None, CValue(*[ l[1] for l in _kLanguages ]), CPopupChoiceGui(_kLanguages)) kDocumentationLanguage = CTextIOValueDef('main', 'documentation-language', _('The language to use for the documentation, when available (not all documentation is translated into all supported languages).'), 'en', CValue(*[ l[1] for l in _kLanguages ]), CPopupChoiceGui(_kLanguages)) kAutoReopenLastProject = CTextIOValueDef('main', 'auto-reopen-last-project', _('Controls whether most recent project is reopened at startup, in the absence of any other project on the command line.'), 1, CBoolean(), CBooleanGui()) from guiutils import scintilla _kSyntaxChoices = [] for mime_type, name in scintilla.kMimeTypeNames.items(): _kSyntaxChoices.append((name, mime_type)) _kSyntaxChoices.sort() kExtraMimeTypes = CTextIOValueDef('main', 'extra-mime-types', _('This is a map from file extension or wildcard to mime type. It adds additional file type mappings to those built into Wing. File extensions can be specified alone without dot or wildcard, for example "xcf" or using wildcards containing "*" and/or "?", for example "Makefile*". The mime type to use for Python files is "text/x-python".'), {}, CDict(CType(''), CValue(*[ m for n, m in _kSyntaxChoices ])), CDictGui((_('File Extension'), _('Mime Type')), CSmallTextGui(), CPopupChoiceGui(_kSyntaxChoices))) kExtraMimeTypeNames = CTextIOValueDef('main', 'extra-mime-type-names', _('This is a map from mime type to displayable name for that mime type; one entry should be added for each new mime type added with the main.extra-mime-types preference.'), {}, CDict(CType(''), CType('')), CDictGui((_('Mime Type'), _('Name')), CSmallTextGui(), CSmallTextGui())) kExtraMimeTypeComments = CTextIOValueDef('main', 'extra-mime-type-comments', _('This is a map from mime type to tuple of start/end comment characters for each mime type. One entry should be added for each new mime type added with the main.extra-mime-types preference.'), {}, CDict(CType(''), CFixed(CType(''), CType(''))), CDictGui((_('Mime Type'), _('Comment Characters')), CSmallTextGui(), CEntryGroupGui(True, [_('Start'), _('End')], [CSmallTextGui(), CSmallTextGui()]))) _kEncodings = encoding_utils._kEncodings[:] _kEncodings.insert(0, (None, None)) _kEncodings.insert(0, (_('System default (%s)') % miscutils.GetSystemTextEncoding(), None)) kDefaultEncoding = CTextIOValueDef('edit', 'default-encoding', _('The default encoding to use for text files opened in the source editor and other tools, when an encoding for that file cannot be determined by reading the file. Other encodings may also be tried. This also sets the encoding to use for newly created files.'), None, CNoneOr(CValue(*[ x[0] for x in _kEncodings ])), CPopupChoiceGui(_kEncodings, use_underline=False)) import codecs kMaxErrorLogSize = CTextIOValueDef('main', 'max-error-log-size', _('The number of bytes at which the IDE log file (%s) is truncated. This file can be sent to technical support to help diagnose problems with the IDE.') % config.kErrorLogFile, 500000, CRange(10000, 10000000), CNumberGui(10000, 10000000, 10000, 0)) kUnchangedReloadOptions = CValue('auto-reload', 'request-reload', 'edit-reload', 'never-reload') kUnchangedReloadChoices = ( ( _('Auto Reload'), 'auto-reload'), ( _('Immediately Request Reload'), 'request-reload'), ( _('Request Reload on Edit'), 'edit-reload'), ( _('Never Reload'), 'never-reload')) kChangedReloadOptions = CValue('request-reload', 'edit-reload', 'never-reload') kChangedReloadChoices = ( ( _('Immediately Request Reload'), 'request-reload'), ( _('Request Reload on Edit'), 'edit-reload'), ( _('Never Reload'), 'never-reload')) if config.kAvail101Support: _unchanged_reload_default = 'never-reload' _changed_reload_dfeault = 'never-reload' else: _unchanged_reload_default = 'auto-reload' _changed_reload_dfeault = 'request-reload' kUnchangedReloadPolicy = CTextIOValueDef('cache', 'unchanged-reload-policy', _('Selects action to perform on files found to be externally changed but unaltered within the IDE. Use Auto Reload to automatically reload these files, Immediately Request Reload to ask via a dialog box upon detection, Request Reload on Edit to ask only if the unchanged file is edited within the IDE subsequently, or Never Reload to ignore external changes (although you will still be warned if you try to save over an externally changed file)'), _unchanged_reload_default, kUnchangedReloadOptions, CPopupChoiceGui(kUnchangedReloadChoices)) kChangedReloadPolicy = CTextIOValueDef('cache', 'changed-reload-policy', _('Selects action to perform on files found to be externally changed and that also have been altered in the IDE. One of Immediately Request Reload to ask via a dialog box upon detection, Request Reload on Edit to ask if the file is edited further, or Never Reload to ignore external changes (although you will always be warned if you try to save over an externally changed file)'), _changed_reload_dfeault, kChangedReloadOptions, CPopupChoiceGui(kChangedReloadChoices)) kExternalCheckFreq = CTextIOValueDef('cache', 'external-check-freq', _('Time in seconds indicating the frequency with which the IDE should check the disk for files that have changed externally. Set to 0 to disable entirely.'), 5, CType(0.1, 1), CNumberGui(0, 10000000, 5, 1)) kCheckHashBeforeReload = CTextIOValueDef('cache', 'check-hash-before-reload', _("Don't reload files if size has not changed and a hash of the contents matches the hash when it was last read. This check is skipped if file is larger than 5 MB."), True, CBoolean(), CBooleanGui()) script_dir = config.GetWingFilename('scripts') kScriptPath = CTextIOValueDef('main', 'script-path', _('Specifies the directories in which Wing will look for user-defined scripts that extend the functionality of the IDE itself. The directory names may contain environment variables in the $(envname) form. Use $(WING:PROJECT_DIR) for the project directory.For each directory, Wing will load all found Python modules and packages, treating any function whose name starts with a letter (not _ or __) as a script-provided command. Extension scripts found in files within directories later in the list will override scripts of the same name found earlier, except that scripts can never override commands that are defined internally in Wing itself (these are documented in the Command Reference in the users manual). See the Scripting and Extending chapter of the manual for more information on writing and using extension scripts. Note that %s is always appended to the given path since it contains scripts that ship with Wing.') % script_dir, [ fileutils.join(config.kUserWingDir, 'scripts')], CValueList(CType('')), CPathSequenceGui()) kAutoReloadScripts = CTextIOValueDef('main', 'auto-reload-scripts', _('When enabled, Wing will automatically reload scripts that extend the IDE when they are edited and saved from the IDE. This makes developing extension scripts for the IDE very fast, and should work in most cases. Disable this when working on extension scripts that do not reload properly, such as those that reach through the scripting API extensively.'), True, CBoolean(), CBooleanGui()) if config.kAvail101Support: _kAutoCheckUpdatesDefault = 0 else: _kAutoCheckUpdatesDefault = 1 kAutoCheckUpdates = CTextIOValueDef('main', 'auto-check-updates', _('Automatically attempt to connect to wingware.com to check for updates once every day after Wing is started.'), _kAutoCheckUpdatesDefault, CBoolean(), CBooleanGui()) if config.kAvail101Support or config.kSteam: _kAutoCheckSupportDefault = 0 else: _kAutoCheckSupportDefault = 1 kMonitorSupportUpdates = CTextIOValueDef('main', 'monitor-support-upgrades', _('Show a reminder when Support+Upgrades for the active license is expired or will expire soon.'), _kAutoCheckSupportDefault, CBoolean(), CBooleanGui()) kIgnoredUpdates = CTextIOValueDef('main', 'ignored-updates', _('Used internally to keep track of updates the user is not interested in'), [], CValueList(CType('')), None) kStartDirPolicyChoices = ( ( _('Base on the Current File or Selection'), 'current-focus'), ( _("Use Project's Home Directory"), 'current-project'), ( _('Use Last Open/Save Directory'), 'recent-directory'), ( _('Use Startup or Current Directory'), 'current-directory'), ( _('Use Fixed Directory Specified Below'), 'selected-directory')) kStartDirPolicy = CTextIOValueDef('main', 'start-dir-policy', _('Defines how Wing determines the starting directory to use when prompting for a file name: Either based on location of the resource at current focus, location of the current project home directory, the last directory visited for file selection, the current directory at startup (or selected since), or always the specific fixed directory entered here.'), ('current-focus', ''), CFixed(CValue(*[ i[1] for i in kStartDirPolicyChoices ]), CType('')), CPopupPlusOtherGui(kStartDirPolicyChoices, CFileSelectorGui(want_dir=1, name_type=dialogs.kExistingDirectoryName), ('selected-directory', ))) _kBaseExcludes = ( ( filefilter.kFileNameSpec, '*~'), ( filefilter.kFileNameSpec, '#*#'), ( filefilter.kFileNameSpec, '.#*'), ( filefilter.kFileNameSpec, '*.svn-base'), ( filefilter.kFileNameSpec, '/.coverage'), ( filefilter.kFileNameSpec, '*.orig'), ( filefilter.kDirNameSpec, '__pycache__'), ( filefilter.kDirNameSpec, '.bzr'), ( filefilter.kDirNameSpec, 'CVS'), ( filefilter.kDirNameSpec, '.hg'), ( filefilter.kDirNameSpec, '.git'), ( filefilter.kDirNameSpec, '.svn'), ( filefilter.kDirNameSpec, '_svn'), ( filefilter.kDirNameSpec, '.xvpics')) kPythonFilterName = 'Python Files' kHiddenAndTempFilterName = 'Hidden & Temporary Files' kNonGeneratedFilterName = 'All Source Files' kCCPPFilterName = 'C/C++ Files' kHTMLXMLFilterName = 'HTML and XML Files' kPythonFilterNameX = _('Python Files') kHiddenAndTempFilterNameX = _('Hidden & Temporary Files') kNonGeneratedFilterNameX = _('All Source Files') kCCPPFilterNameX = _('C/C++ Files') kHTMLXMLFilterNameX = _('HTML and XML Files') _kFilterNameToTranslatedName = {kPythonFilterName: kPythonFilterNameX, kHiddenAndTempFilterName: kHiddenAndTempFilterNameX, kNonGeneratedFilterName: kNonGeneratedFilterNameX, kCCPPFilterName: kCCPPFilterNameX, kHTMLXMLFilterName: kHTMLXMLFilterNameX} def _FilterNameToTranslatedName(name): return _kFilterNameToTranslatedName.get(name, name) _kTranslatedNameToFilterName = {} for key, value in _kFilterNameToTranslatedName.items(): _kTranslatedNameToFilterName[value] = key def _TranslatedNameToFilterName(tname): """Get untranslated filter name for given translated name; may return the same name if already in English or is a user-named file filter""" return _kTranslatedNameToFilterName.get(tname, tname) _kDefaultFilters = {kPythonFilterName: ( ( ( filefilter.kMimeTypeSpec, mime.kPythonMimeType), ( filefilter.kMimeTypeSpec, mime.kCythonMimeType)), _kBaseExcludes[:]), kCCPPFilterName: ( ( ( filefilter.kMimeTypeSpec, 'text/x-c-source'), ( filefilter.kMimeTypeSpec, 'text/x-cpp-source')), _kBaseExcludes[:]), kHTMLXMLFilterName: ( ( ( filefilter.kMimeTypeSpec, 'text/html'), ( filefilter.kMimeTypeSpec, 'text/xml'), ( filefilter.kMimeTypeSpec, 'text/x-zope-pt')), _kBaseExcludes[:]), kNonGeneratedFilterName: ( (), ( ( filefilter.kFileNameSpec, '*.o'), ( filefilter.kFileNameSpec, '*.obj'), ( filefilter.kFileNameSpec, '*.a'), ( filefilter.kFileNameSpec, '*.lib'), ( filefilter.kFileNameSpec, '*.so'), ( filefilter.kFileNameSpec, '*.dll'), ( filefilter.kFileNameSpec, '*.exe'), ( filefilter.kFileNameSpec, '*.ilk'), ( filefilter.kFileNameSpec, '*.pdb'), ( filefilter.kFileNameSpec, '*.pyc'), ( filefilter.kFileNameSpec, '*.pyo'), ( filefilter.kFileNameSpec, '*.pyd'), ( filefilter.kFileNameSpec, '*$py.class'), ( filefilter.kFileNameSpec, '/core'), ( filefilter.kFileNameSpec, '*.bak'), ( filefilter.kFileNameSpec, '*.tmp'), ( filefilter.kFileNameSpec, '*.temp'), ( filefilter.kFileNameSpec, '*-old'), ( filefilter.kFileNameSpec, '*.old'), ( filefilter.kFileNameSpec, '*.wpr'), ( filefilter.kFileNameSpec, '*.wpu'), ( filefilter.kFileNameSpec, '*.zip'), ( filefilter.kFileNameSpec, '*.tgz'), ( filefilter.kFileNameSpec, '*.tar.gz'), ( filefilter.kFileNameSpec, '*.dsp'), ( filefilter.kFileNameSpec, '*.dsw'), ( filefilter.kFileNameSpec, '*.sln'), ( filefilter.kFileNameSpec, '*.suo'), ( filefilter.kFileNameSpec, '*.vcproj'), ( filefilter.kFileNameSpec, '*.user'), ( filefilter.kFileNameSpec, '*.manifest'), ( filefilter.kFileNameSpec, '*.ncb'), ( filefilter.kFileNameSpec, '*.bsc'), ( filefilter.kFileNameSpec, '*.sbr'), ( filefilter.kFileNameSpec, '*.log')) + _kBaseExcludes), kHiddenAndTempFilterName: ( ( ( filefilter.kFileNameSpec, '*.o'), ( filefilter.kFileNameSpec, '*.obj'), ( filefilter.kFileNameSpec, '*.a'), ( filefilter.kFileNameSpec, '*.lib'), ( filefilter.kFileNameSpec, '*.so'), ( filefilter.kFileNameSpec, '*.dll'), ( filefilter.kFileNameSpec, '*.exe'), ( filefilter.kFileNameSpec, '*.ilk'), ( filefilter.kFileNameSpec, '*.pdb'), ( filefilter.kFileNameSpec, '*.pyc'), ( filefilter.kFileNameSpec, '*.pyo'), ( filefilter.kFileNameSpec, '*.pyd'), ( filefilter.kFileNameSpec, '*$py.class'), ( filefilter.kFileNameSpec, '/core'), ( filefilter.kFileNameSpec, '*.bak'), ( filefilter.kFileNameSpec, '*.tmp'), ( filefilter.kFileNameSpec, '*.temp'), ( filefilter.kFileNameSpec, '*-old'), ( filefilter.kFileNameSpec, '*.old'), ( filefilter.kFileNameSpec, '*.wpr'), ( filefilter.kFileNameSpec, '*.wpu'), ( filefilter.kFileNameSpec, '*.zip'), ( filefilter.kFileNameSpec, '*.tgz'), ( filefilter.kFileNameSpec, '*.tar.gz'), ( filefilter.kFileNameSpec, '*.ncb'), ( filefilter.kFileNameSpec, '*.bsc'), ( filefilter.kFileNameSpec, '*.sbr')) + _kBaseExcludes, ())} _kFilterPopupItems = [ (value, key) for key, value in filefilter.kFileFilterSpecTypes.items() ] _kSpecItemGui1 = CEntryGroupGui(0, (_('Type'), _('Spec')), (CPopupChoiceGui(_kFilterPopupItems), CSmallTextGui())) _kSpecItemGui2 = CEntryGroupGui(0, (_('Type'), _('Spec')), (CPopupChoiceGui(_kFilterPopupItems), CSmallTextGui())) _kSpecGui1 = CSequenceGui(_kSpecItemGui1) _kSpecGui2 = CSequenceGui(_kSpecItemGui2) _kFilterGui = CEntryGroupGui(0, (_('Include'), _('Exclude')), (_kSpecGui1, _kSpecGui2)) _filters_doc = _('Defines file filters to apply to file names for inclusion and exclusion from a larger set (such as scanned disk files or all project files).\n\nEach filter is named and contains one list of inclusion patterns and one list of exclusion patterns. The patterns can be a wildcard on the file name, wildcard on a directory name, or a mime type name.\n\n Only a single pattern needs to be matched for inclusion or exclusion. Exclusion patterns take precedence over inclusion patterns, so any match on an exclusion pattern will always exclude a file from the selected set. Filters are used in constraining search, adding project files, and for other operations on collections of files.') _filters_prefname = 'file-filters' _filters_type = CFileFiltersType() _defaults = CFileFilters() for name, (inc, exc) in _kDefaultFilters.items(): _defaults[name] = ( set(inc), set(exc)) _kDefaultFilters = _defaults def _translate_filters(inout, values, key, value): if inout == 'in': xkey, xvalue = _FilterNameToTranslatedName(key), value if xkey == key and xkey in _kTranslatedNameToFilterName and _kTranslatedNameToFilterName[xkey] != xkey: raise KeyError else: return ( xkey, xvalue) else: return ( _TranslatedNameToFilterName(key), value) kFileFilters = CTextIOValueDef('main', _filters_prefname, _filters_doc, _kDefaultFilters, _filters_type, CDictGui((_('Name'), _('Specification')), CSmallTextGui(), _kFilterGui, dict_class=datatype.CFileFilters, translate_cb=_translate_filters)) kBreakOnCritical = CTextIOValueDef('main', 'debug-break-on-critical', _('If True and a gtk, gdk, or glib critical message is logged, Wing tries to start a C debugger and break at the current execution point'), False, CBoolean(), CBooleanGui()) kShowSplashScreen = CTextIOValueDef('main', 'show-splash-screen', _('Controls whether or not the splash screen is shown at startup.'), 1, CBoolean(), CBooleanGui()) _kInstanceReusePolicy = [ ( _('Reuse Existing Instance to Open Files'), None), ( _('Always Reuse Existing Instance'), 'reuse'), ( _('Always Launch New Instance'), 'new')] kInstanceReusePolicy = CTextIOValueDef('main', 'instance-reuse-policy', _('Controls whether Wing tries to reuse an existing running instance of the IDE when it is launched again.'), None, CTuple(CValue(*[ i[1] for i in _kInstanceReusePolicy ])), CPopupChoiceGui(_kInstanceReusePolicy)) if config.kAvailRemoteSupport: kAutoCheckRemoteAgentVersion = CTextIOValueDef('main', 'autocheck-remote-agent-version', _("When enabled, Wing will show a dialog offerring to update any remote agent that does not match Wing's version."), True, CBoolean(), CBooleanGui()) if sys.platform != 'win32': _ssh_default_label = 'ssh' else: _ssh_default_label = 'plink.exe or ssh.exe' kSSHExecutable = CTextIOValueDef('main', 'ssh-executable', _('The executable to use in order to run the SSH client on the host where Wing is running. This is used to establish secure SSH tunnels to remote hosts. You must configure SSH and a key server outside of Wing, since Wing assumes it can connect to remote hosts without entering a password.'), None, CNoneOr(CType('')), CDefaultsOrSpecifyGui(False, ((_('Find %s on PATH') % _ssh_default_label, None),), _('Use executable:'), CSmallTextGui())) kSSHRemotePort = CTextIOValueDef('main', 'ssh-remote-port', _("The TCP/IP port number to use for the remote end of the SSH tunnel to Wing's remote agent. Using a random port should work in most cases and avoids collisions if there are multiple active sessions, but a fixed port is needed if the random port generated IDE-side is not also available on the remote host."), None, CNoneOr(CType(1)), CDefaultsOrSpecifyGui(False, ((_('Use Random Port'), None),), _('Use specified port:'), CNumberGui(1024, 65535, 1, 0, 50010))) kSSHTimeout = CTextIOValueDef('main', 'ssh-timeout', _('The maximum time in seconds to wait for SSH tunnels to be established.'), 10, CType(1), CNumberGui(3, 60, 1, 0, 5)) kHungConnectionTimeout = CTextIOValueDef('main', 'hung-connection-threshold', _('The maximum time in seconds to wait if a connection to a remote host is not responding. Afterwards the connection is closed and retried.'), 15, CType(1), CNumberGui(3, 60, 1, 0, 5)) kHTTPProxy = CTextIOValueDef('main', 'http-proxy', _('Allows manual configuration of an http proxy to be used for feedback, bug reports, and license activation, all of which result in Wing connecting to wingware.com via http. Leave user name and password blank if not required.'), None, CNoneOr(CFixed(CType(''), CType(1), CType(''), CType(''))), CDefaultsOrSpecifyGui(False, ((_('No proxy server (or auto-detected)'), None),), _('Configure proxy server manually:'), CEntryGroupGui(False, (_('Host name'), _('Port'), _('User name'), _('Password')), ( CSmallTextGui(), CNumberGui(1, 65535, 1, 0), CSmallTextGui(), CSmallTextGui())))) _kAutoRStripChoices = ( ( _('Never'), 'disabled'), ( _('When saving files'), 'on-save'), ( _('When saving files in project'), 'on-save-project')) kAutoRStripOnSave = CTextIOValueDef('main', 'auto-rstrip-on-save', _('Controls whether to automatically strip trailing white space in the editor. May be enabled for any file or only files that are part of the current project.'), 'disabled', CFixed(CValue(*[ i[1] for i in _kAutoRStripChoices ]), CType('')), CPopupChoiceGui(_kAutoRStripChoices)) _kPerspectiveStyles = ( ( _('Tools and Layout'), 'tools-only'), ( _('Tools, Layout, and Editors'), 'tools-and-editors'), ( _('All Visual State'), 'all')) kPerspectiveSharedFile = CTextIOValueDef('main', 'perspective-shared-file', _("Selects the file to use for storing and retrieving shared perspectives. By default (when value is None) the file 'perspectives' in the user settings directory is used."), None, COneOf(CType(None), CType('')), CDefaultsOrSpecifyGui(0, ((_('Default'), None),), _('File:'), CFileSelectorGui(name_type=dialogs.kSaveAsFilename, hostname=None))) _kPerspectiveAutoSaveOptions = ( ( _('Always'), 'always'), ( _('Never'), 'never'), ( _('Prompt'), 'prompt'), ( _('Configured by Perspective'), 'choose')) kPerspectiveAutoSave = CTextIOValueDef('main', 'perspective-auto-save', _('Selects whether to auto-save perspectives when switching to another perspective. Can always auto-save, never auto-save, prompt each time a perspective is left, or auto-save as configured on a per-perspective basis.'), 'always', CFixed(CValue(*[ i[1] for i in _kPerspectiveAutoSaveOptions ]), CType('')), CPopupChoiceGui(_kPerspectiveAutoSaveOptions)) kFileSetSharedFile = CTextIOValueDef('main', 'fileset-shared-file', _("Selects the file to use for storing and retrieving shared named files sets. By default (when value is None) the file 'filesets' in the user settings directory is used."), None, COneOf(CType(None), CType('')), CDefaultsOrSpecifyGui(0, ((_('Default'), None),), _('File:'), CFileSelectorGui(name_type=dialogs.kSaveAsFilename, hostname=None))) kPluginOverrides = CTextIOValueDef('main', 'plugin-overrides', _('Defines which plugins are enabled or disabled.'), {}, CDict(CType(''), CBoolean()), None) kHelpFontZoom = CTextIOValueDef('main', 'help-font-zoom', _('The amount by which to zoom font sizes in or out in the documentation viewer.'), 1.0, CType(1.0), CNumberGui(0.7, 5.0, 0.1, 1, default=1.0)) kSourceAssistantUsePEP287 = CTextIOValueDef('main', 'sassist-tries-pep287', _('Whether to try parsing docstrings as ReST format for display in the Source Assistant. This may destroy formatting of some docstrings.'), True, CBoolean(), CBooleanGui()) _kPEP287ErrorLevels = [ ( _('Debug'), 0), ( _('Informational'), 1), ( _('Warning'), 2), ( _('Error'), 3), ( _('Severe'), 4)] kSourceAssistantPEP287ErrorThreshold = CTextIOValueDef('main', 'sassist-pep287-error-level', _('The error level at or above which the source assistant will display parse errors in PEP287 docstrings (if showing PEP287 errors) or will fall back to showing plain text (if not showing PEP287 errors). For errors below this threshold, a best attempt is made to achieve a reasonable rendering.'), 2, CValue(0, 1, 2, 3, 4), CPopupChoiceGui(_kPEP287ErrorLevels)) kSourceAssistantAllowPEP287Errors = CTextIOValueDef('main', 'sassist-allow-pep287-errors', _('Whether to render docstrings even if they contain parse errors at or above the threshold set by Source Assistant PEP 287 Error Threshold. When disabled, failing docstrings are shown as plain text instead. When enabled, a best effort is made to display the formatted docstring while suppressing errors.'), False, CBoolean(), CBooleanGui()) kSourceAssistantRewrapsDocstrings = CTextIOValueDef('main', 'sassist-tries-rewrap', _('Whether to rewrap plain text docstrings for display in the Source Assistant. This may destroy formatting of some docstrings.'), True, CBoolean(), CBooleanGui()) kSourceAssistantAlwaysShowDocstrings = CTextIOValueDef('main', 'sassist-always-show-docstrings', _('Whether to always show docstrings in the Source Assistant. When disabled, only the docstring for the last displayed symbol is shown.'), False, CBoolean(), CBooleanGui()) kSourceAssistantShowValidity = CTextIOValueDef('main', 'sassist-show-validity', _('Whether show docstring type and validity in the Source Assistant.'), True, CBoolean(), CBooleanGui()) kLastPrefsPage = CTextIOValueDef('main', 'last-prefs-page', _('Used internally to select the most recently used prefs page.'), (-1, -1), CFixed(CType(1), CType(1)), CHiddenGui()) kLastPropertiesPages = CTextIOValueDef('main', 'last-properties-pages', _('Used internally to select the most recently used properties dialog pages.'), {}, CDict(CType(''), CType(1)), CHiddenGui())
#! /usr/bin/env python 2.7 (62211) #coding=utf-8 # Compiled at: 2017-08-28 15:22:22 #Powered by BugScaner #[url]http://tools.bugscaner.com/[/url] #如果觉得不错,请分享给你朋友使用吧! """ process/abstract.py -- License manager support Copyright (c) 1999-2012, Archaeopteryx Software, Inc. All rights reserved. """ import sys, os, string, time, socket, tempfile, random, marshal, binascii, new, sha, logging, urllib, urllib2 logger = logging.getLogger('general') from wingbase import destroyable from wingbase import spawn from wingbase import location from wingutils import hostinfo from wingutils import textio from wingbase import textutils from wingbase import fileutils import config, gettext _ = gettext.translation('src_process', fallback=1).ugettext kHashLicenseFields = [ 'license', 'termdays', 'usercount', 'product', 'version', 'os', 'restrictions', 'hostinfo'] kRequiredLicenseFields = kHashLicenseFields + ['date', 'customerdata', 'activation'] kLicenseUseCodes = [ 'T', 'N', 'E', 'C', '6', 'Y', 'H'] kLicenseProdCodes = {config.kProd101: '1', config.kProdPersonal: 'L', config.kProdProfessional: 'N'} kLicenseProdCode = kLicenseProdCodes[config.kProductCode] kLicenseProdForCode = {} for prod, code in kLicenseProdCodes.items(): kLicenseProdForCode[code] = prod kOSRequestCodes = {'win32': 'W', 'linux': 'L', 'darwi': 'M', 'sunos': 'N', 'freeb': 'F', 'tru64': 'T', 'netbs': 'E', 'openb': 'B'} kVersionRequestCodes = {'2': 'X', '3': '3', '4': '4', '5': '5', '6': '6'} kRequestVersionCode = kVersionRequestCodes[config.kVersion[:config.kVersion.find('.')]] if sys.platform.startswith('linux') and os.uname()[4] in ('ppc', 'ppc64'): kRequestPrefix = 'RP' + kRequestVersionCode else: kRequestPrefix = 'R' + kOSRequestCodes[sys.platform[:5]] + kRequestVersionCode kActivationPrefix = 'AXX' kHyphens = (u'-', u'\u2012', u'\u2013', u'\u2014', u'\u2015', u'\u2010', u'\u2212') def LoadFromDat(filename, modname): """ Load code from pycontrol.dat file into a module -- this allows us to do some weak code hiding. """ file = open(filename, 'rb') try: dict = marshal.load(file) finally: file.close() if type(dict) != type({}): raise SystemExit(-1) mco = dict.get(sys.hexversion & 4294901760L) if mco is None: raise SystemExit(-1) co = marshal.loads(mco) mod = new.module(modname) exec co in mod.__dict__ return mod if sys.platform[:5] in ('win32', 'darwi') or sys.platform[:5] == 'linux' and os.uname()[4] not in ('ppc', 'ppc64', 'arm7l'): import ctlutil as control else: try: import pycontrol control = pycontrol except ImportError: dirname = os.path.dirname(__file__).replace('.zip', '') control = LoadFromDat(fileutils.join(dirname, 'pycontrol.dat'), 'pycontrol') try: dirname = os.path.dirname(__file__).replace('.zip', '') bulkctl = LoadFromDat(fileutils.join(dirname, 'bulkctl.dat'), 'bulkctl') bulkctl.init(control) except: bulkctl = None kLicenseOK = 1 kLicenseNotFound = 2 kLicenseCorrupt = 3 kLicenseExpired = 4 kLicenseTooManyUsers = 5 kLicenseInternalError = 6 kLicenseWrongPlatform = 7 kLicenseWrongProduct = 8 kLicenseHostMismatch = 9 def CreateTrialLicenseDict(): """ Create license dict with given information for the current machine. The "activation" field is omitted and needs to be added in a separate step before writing license to disk. Note that trial licenses are unique to product level and version, as well as factoring in machine identity.""" host = hostinfo.GetHostID() shost = hostinfo.SecureHostID(host, (kRequestVersionCode,)) license = AddHyphens('T' + kLicenseProdCode + 'X' + textutils.SHAToBase30(shost)) return CreateLicenseDict(license) def CreateLicenseDict(license): """ Create license dict with given information for the current machine. The "activation" field is omitted and needs to be added in a separate step before writing license to disk. """ lic = {} vparts = config.kVersion.split('.') version = vparts[0] + '.*' termdays = '*' if license.startswith('Y') or license.startswith('H'): termdays = 0 restrictions = 'Expiring annual license' if license.startswith('6'): termdays = 0 restrictions = 'Expiring restricted use license' else: if license.startswith('T'): restrictions = 'Evaluation use only' termdays = 11 else: if license.startswith('N'): restrictions = 'Educational use only' else: if license.startswith('E'): restrictions = 'Non-commercial use only' else: restrictions = 'None' lic['license'] = license lic['date'] = time.strftime('%m/%d/%y', time.localtime(time.time())) lic['termdays'] = termdays lic['usercount'] = 1 lic['product'] = config.k_WingideNameMap[config.kProductCode] lic['version'] = version config._os = '' lic['os'] = control.get_os() lic['os'] = config._os lic['restrictions'] = restrictions lic['hostinfo'] = hostinfo.GetHostID() lic['customerdata'] = '' return lic def ReadLicenseDict(filename): """ Read license file into a dict of values """ iomgr = textio.CTextIOManager() reader = textio.CFileReader(iomgr) try: try: layers = reader.Read(location.CreateFromName(filename)) except: return if len(layers) != 1: return items = layers[0].GetValueItems() lic = dict(items) finally: iomgr.destroy() if lic.has_key('hostinfo'): hostid = lic['hostinfo'] try: hostid = textutils.BaseConvert(hostid, textutils.BASEMAX, textutils.BASE16).lower() hostid = binascii.unhexlify(hostid) hostid = marshal.loads(hostid) except: hostid = {} lic['hostinfo'] = hostid lic['filename'] = filename return lic def WriteLicenseDict(filename, license, ignore=()): """ Write license file from a dict of values """ errs = [] for key in kRequiredLicenseFields: if not license.has_key(key) and key not in ignore: errs.append(_('License missing required %s') % key) license = license.copy() hostid = license['hostinfo'] try: hostid = marshal.dumps(hostid) hexhostid = binascii.hexlify(hostid).upper() license['hostinfo'] = textutils.BaseConvert(hexhostid, textutils.BASE16, textutils.BASEMAX) except: errs.append(_('Failed to package host information')) if len(errs) > 0: return errs for key in license.keys(): if key not in kRequiredLicenseFields: del license[key] lic = license['license'] if lic[2] in 'LWM': lic = RemoveHyphens(lic) lic = lic[:10] + 'XXXXXXXXXX' license['license'] = AddHyphens(lic) header = ('# Wing license file', '# Editing this file will invalidate your license') iomgr = textio.CTextIOManager() writer = textio.CFileWriter(iomgr) layer = textio.CTextIOValueLayer(iomgr) layer.SetValuesFromDict(license) try: try: if os.path.exists(filename): os.chmod(filename, 384) errs = writer.Write(location.CreateFromName(filename), [ layer], header) except: return [ 'Exception while writing license file'] if len(errs) > 0: return errs os.chmod(filename, 256) finally: iomgr.destroy() return [] def CreateActivationRequest(license): """Create hash value from license that can be shipped to the license activation server""" license = license.copy() hostid = license['hostinfo'] hostid = marshal.dumps(hostid) hexhostid = binascii.hexlify(hostid).upper() license['hostinfo'] = textutils.BaseConvert(hexhostid, textutils.BASE16, textutils.BASEMAX) hasher = sha.new() for key in kHashLicenseFields: if license['termdays'] != '*' and license['license'][0] != 'T' and key == 'termdays': continue value = license[key] if key == 'license' and value[2] not in '123456789' and value.replace('-', '')[10:] == 'XXXXXXXXXX': lic = RemoveHyphens(value) value = lic[:10] + bulkctl._hash30(lic[:10])[:10] value = AddHyphens(value) hasher.update(str(value)) if license['termdays'] != '*': hasher.update(str(license['date'])) digest = hasher.hexdigest().upper() return AddHyphens(kRequestPrefix + textutils.SHAToBase30(digest)) 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 RemoveHyphens(code): """Remove hyphens from given license id or activation request""" for hyphen in kHyphens: code = code.replace(hyphen, '') return code 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 = set() for c in code: if c in (' ', '\t') + kHyphens: pass elif c not in textutils.BASE30: code2 += c badchars.add(c) else: code2 += c if badchars: try: badchars = ('').join(badchars) except: badchars = '<could decode="" not="">' errs.append(_('Contains invalid characters: %s') % str(badchars)) if len(code2) != 20: errs.append(_('Wrong length (should contain 20 non-hyphen characters)')) if len(errs) > 0: return (errs, code2) return ([], AddHyphens(code2)) 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 %s' % config.kProduct lic_product = kLicenseProdForCode.get(id2[1], None) if lic_product is None: lic_product = _('an unknown product') else: lic_product = 'Wing %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 [url]https://wingware.com/downloads[/url] or upgrade your license at [url]https://wingware.com/store/upgrade'[/url]) % ( lic_product, cur_product)) if len(errs) > 0: return (errs, None) return ([], id2) return def ValidateAndNormalizeRequest(id): errs, id2 = __ValidateAndNormalize(id) if len(errs) == 0: if id2[0] != 'R': errs.append(_('Request code should start with R')) if id2[1] not in kOSRequestCodes.values(): errs.append(_('Invalid second character: Should be one of %s') % str(kOSRequestCodes.values())) if id2[2] not in kVersionRequestCodes.values(): errs.append(_('Invalid third character: Should be one of %s') % str(kVersionRequestCodes.values())) if len(errs) > 0: return (errs, None) return ([], id2) return def ValidateAndNormalizeActivation(id): errs, id2 = __ValidateAndNormalize(id) if id2[:3] != kActivationPrefix: errs.append(_("Invalid prefix: Should be '%s'") % kActivationPrefix) if len(errs) > 0: return (errs, None) return ([], id2) return class CLicenseManager(destroyable.CDestroyable): kWebAPIKey = 'AE7B2181D1B3E4657F2AD63E17708BE8' def __init__(self): """ Constructor """ destroyable.CDestroyable.__init__(self, ('license-ok', )) self.fLicenseData = None self.fLicenseFile = None self.__fLicense = None self._fStartTime = time.time() return def _destroy_impl(self): """ Explicit destructor (needed to break circular refs) """ self.__ReleaseLicense() def LicenseOK(self): """ Convenience function for checking license at key points. Returns 1 if OK and 0 if not but not detailed info """ if not config.kAvailProfessionalSupport: return 1 if self.__fLicense == None: return 0 return 1 def UseLicense(self, filename): """ Checks for valid license contained in the given filename. If license is found and is valid, it is set as the license to use. Returns status, info tuple. The second part of the returned tuple is extra error info. Currently this is only used for some error messages as follows (None for those not listed). kLicenseOK -- Tuple of users currently using the license, in addition to the this user: (host, uid, user name, process id) kLicenseTooManyUsers -- Same kLicenseCorrupt -- String with detail kLicenseWrongPlatform -- String with detail kLicenseWrongProduct -- String with detail """ lic = ReadLicenseDict(filename) if lic == None: return (kLicenseNotFound, None) status = self.__GrabLicense(lic, filename) return status def _StatusToErrString(self, status): """ Convert status indicator to list of error strings for user """ retval = [] if status[0] == kLicenseOK: retval.append(_('License is valid.')) self.__AppendUserInfo(status, retval) else: if status[0] == kLicenseNotFound: retval.append(_('License file not found or could not be read.')) else: if status[0] == kLicenseCorrupt: retval.append(_('Activation key not valid for this license:')) retval.append(status[1]) else: if status[0] == kLicenseExpired: retval.append(_('The license has expired.')) else: if status[0] == kLicenseTooManyUsers: retval.append(_('The maximum number of users for this license has been reached.')) self.__AppendUserInfo(status, retval) else: if status[0] == kLicenseWrongPlatform: retval.append(_('License OS does not match current OS.')) retval.append(status[1]) else: if status[0] == kLicenseWrongProduct: retval.append(_('License does not match this product or product level.')) retval.append(status[1]) else: if status[0] == kLicenseHostMismatch: retval.append(_("License does not match this host's identity.")) else: if status[0] == kLicenseInternalError: retval.append(_('An internal error occurred:')) retval.append(status[1]) else: print 'UNKNOWN LICENSE ERR', status import traceback traceback.print_stack() retval.append(_('Unknown error')) return retval def __AppendUserInfo(self, status, retval): """ Add user info list to given string; should only be called with status kLicenseOK or kLicenseTooManyUsers """ if len(status[1]) > 0: retval.append(_('Other users are:')) for host, ipaddr, uid, name, pid in status[1]: retval.append(_('(%s) on host %s (%s) process id %s') % (uid, host, ipaddr, pid)) else: retval.append(_('No other users at this time.')) return retval def ValidateLicense(self, filename): """ Checks the license in given file for validity and availability """ if not os.path.isfile(filename): return (kLicenseNotFound, None) lic = ReadLicenseDict(filename) if lic == None: return (kLicenseNotFound, None) license_check = self._ValidateLicenseDict(lic, filename) return license_check def _ValidatePlatform(self, license, license_os): """ Check license os; by default we require oss to match but descendents can override. Should return (err, msg) tuple. """ if license[2] == 'L': license_os = 'linux' else: if license[2] == 'W': license_os = 'windows' else: if license[2] == 'M': license_os = 'macosx' config._os = '' cur_os = control.get_os() cur_os = config._os if cur_os == 'INVALID': return (kLicenseWrongPlatform, _("Current OS '%s' is not supported") % cur_os) if string.find(string.lower(cur_os), string.lower(license_os)) != 0: return (kLicenseWrongPlatform, _("License OS '%s' does not match current OS '%s'") % ( license_os, cur_os)) return (None, None) def _ValidateProduct(self, license_product): """ Check license product: By default we just accept it but descendents can override this. Should return (err, msg) tuple. """ return (None, None) def _ValidateVersion(self, license_version): """ Check license version: By default we just accept it but descendents can override this. Should return (err, msg) tuple. """ return (None, None) def _GetTermDaysLeft(self, lic=None): """ Get number of days left on license. Returns the days, or 0 if expired, -1 if unlimited, or -2 on error """ if lic is None: lic = self.fLicenseData if lic is None: return 0 if lic['termdays'] != '*': try: fields = string.split(lic['date'], '/') if len(fields) != 3: raise ValueError m, d, y = map(string.atoi, fields) if m < 1 or m > 12 or d < 1 or d > 31 or y < 0: raise ValueError if y < 100: y = 2000 + y lic_date = time.mktime((y, m, d, 0, 0, 0, 0, 0, -1)) except (ValueError, TypeError, OverflowError): return -2 cur_date = time.time() try: lic_secs = int(lic['termdays']) * 24 * 60 * 60 except ValueError: return -2 if cur_date > lic_date + lic_secs: return 0 if lic_date > cur_date + 86400: return 0 return int((lic_secs - (cur_date - lic_date)) / 86400) return -1 return def _ValidateLicenseDict(self, lic, filename): """ Check license for internal integrity and expiration """ lic['daysleft'] = _('expired') for key in kRequiredLicenseFields: if not lic.has_key(key): return (kLicenseCorrupt, _('Missing a required line %s') % key) err, msg = self._ValidatePlatform(lic['license'], lic['os']) if err != None: return (err, msg) err, msg = self._ValidateProduct(lic['product']) if err != None: return (err, msg) err, msg = self._ValidateVersion(lic['version']) if err != None: return (err, msg) try: lichash = CreateActivationRequest(lic) act30 = lic['activation'] hasher = sha.new() hasher.update(lichash) hasher.update(lic['license']) if lic['termdays'] != '*' and lic['license'][0] != 'T': termdays_base30 = textutils.BaseConvert(lic['termdays'], textutils.BASE10, textutils.BASE30) hasher.update(termdays_base30) digest = hasher.hexdigest().upper() lichash = lichash[:3] + textutils.SHAToBase30(digest) errs, lichash = ValidateAndNormalizeRequest(lichash) act = act30.replace('-', '')[3:] hexact = textutils.BaseConvert(act, textutils.BASE30, textutils.BASE16) while len(hexact) < 20: hexact = '0' + hexact config._locale_valid = 0 valid = control.validate(lichash, lic['os'], lic['version'][:lic['version'].find('.')], hexact) valid = config._locale_valid except: valid = 0 if not valid: return (kLicenseCorrupt, _('Invalid license activation')) daysleft = self._GetTermDaysLeft(lic) if daysleft == -1: lic['daysleft'] = _('unlimited') else: if daysleft == -2: return (kLicenseCorrupt, _('Invalid date or termdays in file')) if daysleft == 0: return (kLicenseExpired, None) if daysleft > 12 and lic['license'][0] == 'T': return (kLicenseCorrupt, _('Invalid date or termdays in file')) lic['daysleft'] = str(daysleft) + _(' days left') errs = hostinfo.IDMatch(lic['hostinfo']) if len(errs) > 0: return (kLicenseHostMismatch, None) return ( kLicenseOK, []) def _DeactivateLicense(self): """Deactivate the current license, if any, by unloading it and removing the activation file from disk. Returns (success, filename) where filename is None or the license.act file name, if any.""" license = self.fLicenseData.get('license', '') if license.startswith('T'): return (False, None) filename = self.fLicenseData.get('filename', None) if filename: try: os.remove(filename) except: return ( False, filename) self.__ReleaseLicense() return ( True, filename) return ( False, None) def __GrabLicense(self, lic, filename): """ Grab one user slot in the given license, if available and not exceeding allowed number of users """ status, info = self._ValidateLicenseDict(lic, filename) if status != kLicenseOK: return (status, info) self.__ReleaseLicense() self.__fLicense = lic['license'] self.fLicenseData = lic self.fLicenseFile = filename self.emit('license-ok') return ( kLicenseOK, info) def __ReleaseLicense(self): """ Release one users slot in current in-use license """ if self.__fLicense == None: return self.__fLicense = None self.fLicenseData = None self.fLicenseFile = None return</could>
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课
赞赏
|
|
---|---|
|
帮助我解决的,可以得到最新汉化版一套,我可是整整汉化了一周,活人操作的。
|
|
killbr 帮助我解决的,可以得到最新汉化版一套,我可是整整汉化了一周,活人操作的。一周的时间绝对汉化不完的,另外汉化是不需要进行破解的。 |
他的文章
看原图
赞赏
雪币:
留言: