FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
php2shell/tools/php2shell_paths.py at main · AlulCode45/php2shell · GitHub
AlulCode45
php2shell
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
php2shell
/
tools
/
php2shell_paths.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
32 lines (25 loc) · 853 Bytes
Breadcrumbs
php2shell
/
tools
/
php2shell_paths.py
Copy path
File metadata and controls
32 lines (25 loc) · 853 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
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python3
"""Shared path resolution for the upstream PHP2Shell checkout."""
from
__future__
import
annotations
import
os
from
pathlib
import
Path
ROOT
=
Path
(
__file__
).
resolve
().
parent
.
parent
VENDOR
=
ROOT
/
"vendor"
/
"php2shell-upstream"
FALLBACK
=
Path
(
"/tmp/php2shell-rce"
)
def
prepare_lab_out
(
path
:
str
|
Path
)
->
str
:
"""Create a lab output directory the container user can write to."""
target
=
Path
(
path
)
target
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
try
:
target
.
chmod
(
0o777
)
except
OSError
:
pass
return
str
(
target
)
def
default_repo_dir
()
->
str
:
"""Prefer the bootstrapped checkout, then the historical /tmp clone."""
env
=
os
.
environ
.
get
(
"P2S_REPO_DIR"
)
if
env
:
return
env
if
(
VENDOR
/
"exploit.py"
).
is_file
():
return
str
(
VENDOR
)
return
str
(
FALLBACK
)
Back
|
FazBrowse Home
|
New Git URL