#!/usr/bin/env python3
# coding=UTF-8
# Created at 2019/11/9 19:52
# 此脚本适用于最新64bit(10.0)版本的010editor
from __future__ import print_function
import ctypes, sys
import os,time
binpath = r"C:\Program Files\010 Editor"
patchpath = r"D:\Cracked"
filename = "010Editor.exe"
if(os.path.isdir(patchpath)):
print("Patch path already exsit!")
else:
os.mkdir(patchpath)
#patch函数
def patchfile():
with open(binpath +'\\' + filename,"rb") as fr:
data = fr.read()
with open(patchpath+"\\" + filename, 'wb') as fw:
fw.write(data)
fw.seek(0xC659A3)
fw.write(b'\xEB')
print("010Editor.exe has been patched successfully.")
#获取administrator权限
def is_admin():
try:
return ctypes.windll.shell32.IsUserAnAdmin()
except:
return False
if is_admin():
try:
print("*"*50)
print("Waiting.......")
patchfile()
print("*"*50)
print("A patched file has been generated in patchpath,you could replace the target file with it.")
time.sleep(3)
except:
print("Error occurred in patch procedure!")
time.sleep(3)
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使用的函数及参数