zoukankan      html  css  js  c++  java
  • Synthesia最新版patch脚本

    #!/usr/bin/env python3
    # coding=GBK
    # Created at 2019/11/9 19:52
    
    from __future__ import print_function
    import ctypes, sys
    import os,time
    
    binpath= r"C:Program Files (x86)Synthesia"
    filename = "Synthesia.exe"
    backup_path = r"c:ackup"
    
    if(os.path.isdir(backup_path)):
        print("Backup path already exsit!")
    else:
        os.mkdir(backup_path)
    
    
    def backfiles():
        os.system("copy " + filename + " " + backup_path)
        print("File has been backuped to " + backup_path)
    
    
    def patch_exe():
        with open (backup_path+"\" + filename,"rb") as fr:
            data = fr.read()
            data = data.replace(b'x64xA1x2Cx00x00x00x56x8BxF1', b'xB8x01x00x00x00xC3x56x8BxF1')
            with open(binpath + '\' + filename, "wb") as fw:
                fw.write(data)
                print(filename + " has been patached successfully!")
    
    #获取administrator权限
    def is_admin():
        try:
            return ctypes.windll.shell32.IsUserAnAdmin()
        except:
            return False
    
    if is_admin():
        os.chdir(binpath)
        try:
            print("-------------First Step--------------
    ")
            backfiles()
            time.sleep(3)
        except:
            print("Error occurred in backup procedure!")
        try:
            print("-------------Second Step--------------
    ")
            patch_exe()
            time.sleep(3)
        except:
            print("Error occurred in patch procedure!
    ")
    else:
        if sys.version_info[0] == 3:
            ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, __file__, None, 1)   #python3使用的函数及参数
        else:
            ctypes.windll.shell32.ShellExecuteW(None, u"runas", unicode(sys.executable), unicode(__file__), None, 1)   #python2使用的函数及参数
    
  • 相关阅读:
    解决“google快照无法打开”的简单而有效的方法~
    在Struts2里面嵌入Spring
    HDU
    设计模式大总结(二)
    Node.js入门笔记
    草图检索和识别[开源]
    2019-10-31-VisualStudio-断点调试详解
    2019-10-31-VisualStudio-断点调试详解
    2019-9-2-C#-设计模式-责任链
    2019-9-2-C#-设计模式-责任链
  • 原文地址:https://www.cnblogs.com/heycomputer/p/12198310.html
Copyright © 2011-2022 走看看