Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
b4728153
Kaydet (Commit)
b4728153
authored
Haz 22, 1995
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
use imp.new_module(), not new.module(); and /usr/local
üst
8afa8245
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
rexec.py
Lib/rexec.py
+4
-4
No files found.
Lib/rexec.py
Dosyayı görüntüle @
b4728153
# Implement restricted execution of Python code
import
__builtin__
import
new
import
imp
import
os
import
sys
import
types
...
...
@@ -22,7 +22,7 @@ def copydict(src, dst, exceptions = [], only = None):
def
copymodule
(
src
,
dst
,
exceptions
=
[],
only
=
None
):
copydict
(
src
.
__dict__
,
dst
.
__dict__
,
exceptions
,
only
)
safe_path
=
[
'/u
fs/guido
/lib/python'
]
safe_path
=
[
'/u
sr/local
/lib/python'
]
safe_modules
=
[
'array'
,
'math'
,
'regex'
,
'strop'
,
'time'
]
unsafe_builtin_names
=
[
'open'
,
'reload'
,
'__import__'
,
'raw_input'
,
'input'
]
...
...
@@ -30,7 +30,7 @@ safe_posix_names = ['error', 'fstat', 'listdir', 'lstat', 'readlink', 'stat',
'times'
,
'uname'
,
'getpid'
,
'getppid'
,
'getcwd'
,
'getuid'
,
'getgid'
,
'geteuid'
,
'getegid'
]
safe_sys
=
new
.
module
(
'sys'
)
safe_sys
=
imp
.
new_
module
(
'sys'
)
safe_sys
.
modules
=
{}
safe_sys
.
modules
[
'sys'
]
=
safe_sys
safe_sys
.
path
=
safe_path
[:]
...
...
@@ -42,7 +42,7 @@ safe_sys.version = sys.version + ' [restricted mode]'
safe_sys
.
exit
=
sys
.
exit
def
new_module
(
name
):
safe_sys
.
modules
[
name
]
=
m
=
new
.
module
(
name
)
safe_sys
.
modules
[
name
]
=
m
=
imp
.
new_
module
(
name
)
return
m
safe_builtin
=
new_module
(
'__builtin__'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment