FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-script-compressor/compress_python_scripts.py at main · codassassin/python-script-compressor · GitHub
codassassin
/
python-script-compressor
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
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-script-compressor
/
compress_python_scripts.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
62 lines (49 loc) · 2.14 KB
Breadcrumbs
python-script-compressor
/
compress_python_scripts.py
Copy path
File metadata and controls
62 lines (49 loc) · 2.14 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import
argparse
import
os
import
sys
def
banner
():
print
(
'<<< PythonScript-Compressor v1.0>>>'
)
print
(
r'''
_
| |
| |___
| _ \ _ _
| |_) | (_) |
\____/ \__, |
__/ |
|___/
_ _
| | (_)
____ ____ ___| | ___ _ ______ ______ ___ _ ______ ______ _ _ ____
/ ___\ / \ / _ | / _ | | / ____| / ____| / _ | | / ____| / ____| | | | | | \
| |____ | () | | (_| | | (_|| | \_____ \ \_____ \ | (_|| | \_____ \ \_____ \ | | | | | |
\____/ \____/ \____/ \___|_| |______/ |______/ \___|_| |______/ |______/ |_| |_| |_|
'''
)
if
__name__
==
'__main__'
:
banner
()
try
:
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"script"
,
type
=
str
)
args
=
parser
.
parse_args
()
if
not
os
.
path
.
exists
(
args
.
script
):
sys
.
stderr
.
write
(
f"'
{
args
.
script
}
' not a file"
)
with
open
(
args
.
script
,
"rb"
)
as
h
:
contents
=
h
.
read
().
decode
(
'utf-8'
)
code
=
"+"
.
join
([
f"chr(
{
ord
(
x
)
}
)"
for
x
in
contents
])
code
=
f"
{
code
}
"
script
=
"+"
.
join
([
f"chr(
{
ord
(
x
)
}
)"
for
x
in
"<script>"
])
script
=
f"
{
script
}
"
executable
=
"+"
.
join
([
f"chr(
{
ord
(
x
)
}
)"
for
x
in
"exec"
])
executable
=
f"
{
executable
}
"
compressedCommand
=
f'python -c "exec(compile(
{
code
}
,
{
script
}
,
{
executable
}
))"'
with
open
(
'scripts.csv'
,
'r+'
)
as
f
:
myDataList
=
f
.
readlines
()
nameList
=
[]
for
line
in
myDataList
:
entry
=
line
.
split
(
','
)
nameList
.
append
(
entry
[
0
])
if
args
.
script
not
in
nameList
:
f
.
writelines
(
f'
\n
{
args
.
script
}
,
{
compressedCommand
}
'
)
print
(
"[+] The compressed command is: (just copy the command and run)
\n
\t
"
+
compressedCommand
)
except
Exception
as
e
:
print
(
f"[-] ERROR:
{
e
}
"
)
Back
|
FazBrowse Home
|
New Git URL