with
open
(
"yidian.exe"
,
"rb"
) as f:
f.seek(
0x3cc18
)
func
=
f.read(
10000
)
f.seek(
0x3f330
)
func
+
=
f.read(
10000
)
f.seek(
0x41A60
)
func
+
=
f.read(
10000
)
f.seek(
0x44188
)
func
+
=
f.read(
10000
)
f.seek(
0x468a8
)
func
+
=
f.read(
10000
)
f.seek(
0x48fc8
)
func
+
=
f.read(
10000
)
f.seek(
0x4b6e0
)
func
+
=
f.read(
4875
)
f.seek(
0x4c9f0
)
enc0
=
f.read(
1000
)
f.seek(
0x4cdf8
)
enc1_2
=
f.read(
8000
)
f.seek(
0x4ed40
)
enc1_2
+
=
f.read(
8335
)
class
Node:
def
__init__(
self
, s):
self
.left
=
self
.right
=
None
self
.val
=
s
if
s
in
[
"+"
,
"-"
,
"*"
,
"/"
,
"Power_xa"
,
"Power_ax"
,
"Log"
,
"Sin"
,
"Cos"
]:
self
.
type
=
1
elif
s
in
[
"x"
,
"e"
,
"pi"
]:
self
.
type
=
2
else
:
self
.
type
=
0
def
opernum(
self
):
if
self
.
type
!
=
1
:
raise
Exception(
"not oper"
)
if
self
.val
in
[
"Sin"
,
"Cos"
]:
return
1
return
2
def
__str__(
self
):
if
self
.
type
=
=
1
:
if
self
.opernum() >
1
:
s
=
"{},{}{}"
.
format
(
self
.val,
self
.left,
self
.right)
else
:
s
=
"{},{}"
.
format
(
self
.val,
self
.left)
else
:
s
=
self
.val
+
","
return
s
def
mid(
self
, n, m):
if
n
=
=
m:
return
"j"
if
self
.
type
=
=
1
:
if
self
.val
in
[
"+"
,
"-"
,
"*"
,
"/"
]:
s
=
"{} {} {}"
.
format
(
self
.left.mid(n
+
1
, m),
self
.val,
self
.right.mid(n
+
1
, m))
elif
self
.val
in
[
"Power_xa"
,
"Power_ax"
]:
s
=
"{} ^ {}"
.
format
(
self
.left.mid(n
+
1
, m),
self
.right.mid(n
+
1
, m))
elif
self
.val
=
=
"Log"
:
s
=
"log({}, {})"
.
format
(
self
.left.mid(n
+
1
, m),
self
.right.mid(n
+
1
, m))
else
:
s
=
"{}{}"
.
format
(
self
.val.lower(),
self
.left.mid(n
+
1
, m))
else
:
s
=
self
.val
return
"("
+
s
+
")"
pfunc
=
func
def
parseinit(s):
global
pfunc
pfunc
=
s
def
parse(parent):
global
pfunc
if
pfunc
is
None
:
return
idx
=
pfunc.find(
","
)
if
idx !
=
-
1
:
x
=
pfunc[:idx]
pfunc
=
pfunc[idx
+
1
:]
else
:
x
=
pfunc
pfunc
=
None
n
=
Node(x)
if
n.
type
=
=
1
:
parse(n)
if
parent
is
not
None
:
if
parent.left
is
not
None
:
if
parent.right
is
not
None
:
raise
Exception(
"must die"
)
else
:
parent.right
=
n
else
:
parent.left
=
n
if
parent.
type
=
=
1
and
parent.opernum() >
1
:
parse(parent)
return
n
import
base64
def
b62dec(b):
b
=
b.replace(
"9D"
,
"="
).replace(
"9C"
,
"/"
).replace(
"9B"
,
"+"
).replace(
"9A"
,
"9"
)
return
base64.b64decode(b)
def
b62enc(b):
b
=
base64.b64encode(b)
return
b.replace(
"9"
,
"9A"
).replace(
"+"
,
"9B"
).replace(
"/"
,
"9C"
).replace(
"="
,
"9D"
)