The Fisrt Updated
This commit is contained in:
73
Script.py
Normal file
73
Script.py
Normal file
@@ -0,0 +1,73 @@
|
||||
import MathMethod
|
||||
import binascii
|
||||
import tools
|
||||
import shlex
|
||||
import json
|
||||
import fio
|
||||
import re
|
||||
import os
|
||||
|
||||
def is_in(json,key):
|
||||
if key in json:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
def is_kin(list,index):
|
||||
if 0 <= index < len(list):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
#基本读取
|
||||
read=fio.openr("./PyBase.psm")
|
||||
pybasecode=binascii.hexlify(read.encode('utf-8'))
|
||||
|
||||
_IStart={"VERSION":"3.7.5","MAIN":".MAIN"}
|
||||
|
||||
#获取所有头内容(.Start)
|
||||
_=MathMethod.GetFlatDivision(read,"[END_HIT]",0)
|
||||
_=MathMethod.GetCarriageSpacesSmooth(_)
|
||||
_=MathMethod.GetBeforeAfterRuleLookup(_,"[","]")
|
||||
_Start=MathMethod.GetRulesConvertedToJson(_,"[","]")
|
||||
if is_in(_Start,"STATED"):
|
||||
if is_kin(_Start["STATED"],0):
|
||||
if _Start["STATED"][0].lower() == "pybase":
|
||||
pass
|
||||
else:
|
||||
print("- * - Error: [STATED] isn't pybase")
|
||||
os._exit(0)
|
||||
else:
|
||||
print("- * - Error: [STATED] isn't be <Key>")
|
||||
os._exit(0)
|
||||
else:
|
||||
print("- * - Error: There is no [STATED]")
|
||||
os._exit(0)
|
||||
if is_in(_Start,"VERSION"):
|
||||
if is_kin(_Start["VERSION"],0):
|
||||
if len(_Start["VERSION"][0]) <= 10:
|
||||
_IStart["VERSION"]=_Start["VERSION"][0]
|
||||
else:
|
||||
print("- * - Warning: [VERSION] len(<Key>) > 10")
|
||||
else:
|
||||
print("- * - Warning: [VERSION] isn't be <Key>")
|
||||
else:
|
||||
print("- * - Warning: There is no [VERSION]")
|
||||
if is_in(_Start,"MAIN"):
|
||||
if is_kin(_Start["MAIN"],0):
|
||||
_IStart["MAIN"]=_Start["MAIN"][0]
|
||||
print("- * - InFo: [MAIN] .MAIN -> "+_Start["MAIN"][0])
|
||||
else:
|
||||
print("- * - Warning: [MAIN] isn't be <Key>(Use .MAIN)")
|
||||
else:
|
||||
print("- * - Warning: There is no [MAIN](Use .MAIN)")
|
||||
#获取所有代码内容(.Code)
|
||||
_=MathMethod.GetFlatDivision(read,"[END_HIT]",1,lambda x:x,"")
|
||||
_Code=MathMethod.AssemblyToJson(_,MakeRules=lambda x:MathMethod.GetRulesConvertedToJson2(x))
|
||||
|
||||
#编译(甚至不需要分析意思)
|
||||
_Base=bytes()
|
||||
_Base+=bytes.fromhex("0020"*2+"507942617365"+"AA"*5+"00")
|
||||
_Base+=bytes.fromhex("5468697320697320612070726F6772616D20746861742063616E206265206C61756E63686564206279205079426173650A")
|
||||
_Base+=bytes.fromhex(binascii.hexlify(_IStart["VERSION"].rjust(10).encode()).decode())
|
||||
_Base+=bytes.fromhex(binascii.hexlify(tools.CBDS(str(_Code))).decode())
|
||||
fio.openw("./PyBase.Bin",_Base,2)
|
||||
Reference in New Issue
Block a user