FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python_zip_null_patch/zip_null_patch.py at master · char/python_zip_null_patch · GitHub
char
/
python_zip_null_patch
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
3
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python_zip_null_patch
/
zip_null_patch.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
21 lines (16 loc) · 752 Bytes
Breadcrumbs
python_zip_null_patch
/
zip_null_patch.py
Copy path
File metadata and controls
21 lines (16 loc) · 752 Bytes
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
import
zipfile
,
opcode
from
types
import
CodeType
def
_patch_code_obj
(
code
,
custom_co_code
):
return
CodeType
(
code
.
co_argcount
,
code
.
co_kwonlyargcount
,
code
.
co_nlocals
,
code
.
co_stacksize
,
code
.
co_flags
,
custom_co_code
,
code
.
co_consts
,
code
.
co_names
,
code
.
co_varnames
,
code
.
co_filename
,
code
.
co_name
,
code
.
co_firstlineno
,
code
.
co_lnotab
,
code
.
co_freevars
,
code
.
co_cellvars
)
def
patch_zipfile
():
code
=
zipfile
.
ZipInfo
.
__init__
.
__code__
patched_co_code
=
code
.
co_code
nop_padding
=
bytes
([
opcode
.
opmap
[
"NOP"
]
for
_
in
range
(
34
)])
patched_co_code
=
patched_co_code
[:
6
]
+
nop_padding
+
patched_co_code
[
40
:]
zipfile
.
ZipInfo
.
__init__
.
__code__
=
_patch_code_obj
(
code
,
patched_co_code
)
Back
|
FazBrowse Home
|
New Git URL