from
gmssl.sm4
import
CryptSM4, SM4_ENCRYPT, SM4_DECRYPT
import
binascii
from
heapq
import
heappush, heappop
from
collections
import
OrderedDict
import
time
import
requests
def
decrypt(iv, value):
s
=
"Dem0_wants_girls"
keys
=
[
ord
(i)
for
i
in
s]
key
=
bytes(b
%
256
for
b
in
keys)
crypt_sm4
=
CryptSM4()
crypt_sm4.set_key(key, SM4_DECRYPT)
d_value
=
crypt_sm4.crypt_cbc(iv, bytes.fromhex(value))
return
d_value
if
__name__
=
=
"__main__"
:
with
open
(r
"F:\SafeIm\1.txt"
, mode
=
"r"
) as f:
content
=
f.read()
iv_xor
=
b
"\x37\x0c\x52\x00\x6e\x18\xa4\x00\xa5\x24\xf6\x00\xdc\x30\x48\x01"
count
=
0
for
i
in
content.split(
"\n"
):
desc
=
i[:
64
]
encontent
=
i[
64
:]
enciv
=
encontent[:
32
]
encocontent
=
encontent[
32
:]
encivb
=
bytes.fromhex(enciv)
iv
=
bytes([encivb[i] ^ iv_xor[i]
for
i
in
range
(
16
)])
content
=
decrypt(iv, encocontent)
print
(bytes.fromhex(desc[
24
:]).replace(b
"\x00"
, b"
").replace(b'\x0fFZ\xe7', b''), end="
:")
if
b
'PNG'
in
content:
filename
=
r
"F:\SafeIm\other\%d.png"
%
count
print
(
"是png"
)
elif
b
'\xff\xd8\xff\xe1'
in
content:
filename
=
r
"F:\SafeIm\other\%d.jpg"
%
count
print
(
"是 jpg"
)
else
:
filename
=
r
"F:\SafeIm\other\%d.txt"
%
count
print
(content.replace(b
"\x00"
, b"").decode())
with
open
(filename, mode
=
"wb"
) as f:
f.write(content)
count
+
=
1