代码拉取完成,页面将自动刷新
import binascii
class UpdatePycHead:
"""
update pyc head
"""
@staticmethod
def hexadecimal_read_file(filename):
"""convert the file to hexadecimal
"""
byte_list = []
with open(f'{filename}', 'rb') as f:
byte = f.read(1)
while byte:
byte_list.append('%02x' % (ord(byte)))
byte = f.read(1)
f.close()
return byte_list
def correct_the_data(self, filename):
"""get your papers right
"""
struct = self.hexadecimal_read_file('struct')
norm = self.hexadecimal_read_file(filename)
for i in range(16):
norm.insert(i, struct[i])
return norm
def restore_file(self, filename):
"""restore hexadecimal byte to file
"""
norm = self.correct_the_data(filename)
pyc_name = filename.split(".")[0]
with open(f'{pyc_name}.pyc', 'wb') as f:
for byte in norm:
ascii_byte = binascii.a2b_hex(byte)
f.write(ascii_byte)
f.close()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。