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
541df3e9
Kaydet (Commit)
541df3e9
authored
Haz 21, 1995
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bugfixes
üst
d1972af2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
client.py
Demo/pdist/client.py
+9
-2
security.py
Demo/pdist/security.py
+3
-3
No files found.
Demo/pdist/client.py
Dosyayı görüntüle @
541df3e9
...
...
@@ -16,6 +16,10 @@ class Client:
"""RPC Client class. No need to derive a class -- it's fully generic."""
def
__init__
(
self
,
address
,
verbose
=
VERBOSE
):
self
.
_pre_init
(
address
,
verbose
)
self
.
_post_init
()
def
_pre_init
(
self
,
address
,
verbose
=
VERBOSE
):
if
type
(
address
)
==
type
(
0
):
address
=
(
''
,
address
)
self
.
_address
=
address
...
...
@@ -29,6 +33,8 @@ class Client:
self
.
_replies
=
{}
# Unprocessed replies
self
.
_rf
=
self
.
_socket
.
makefile
(
'r'
)
self
.
_wf
=
self
.
_socket
.
makefile
(
'w'
)
def
_post_init
(
self
):
self
.
_methods
=
self
.
_call
(
'.methods'
)
def
__del__
(
self
):
...
...
@@ -127,15 +133,16 @@ class SecureClient(Client, Security):
def
__init__
(
self
,
*
args
):
import
string
apply
(
Client
.
__init__
,
(
self
,)
+
args
)
apply
(
self
.
_pre_init
,
args
)
Security
.
__init__
(
self
)
line
=
self
.
_rf
.
readline
()
challenge
=
string
.
atoi
(
string
.
strip
(
first
line
))
challenge
=
string
.
atoi
(
string
.
strip
(
line
))
response
=
self
.
_encode_challenge
(
challenge
)
line
=
`long(response)`
if
line
[
-
1
]
in
'Ll'
:
line
=
line
[:
-
1
]
self
.
_wf
.
write
(
line
+
'
\n
'
)
self
.
_wf
.
flush
()
self
.
_post_init
()
class
_stub
:
...
...
Demo/pdist/security.py
Dosyayı görüntüle @
541df3e9
...
...
@@ -5,10 +5,10 @@ class Security:
env
=
os
.
environ
if
env
.
has_key
(
'PYTHON_KEYFILE'
):
keyfile
=
env
[
'PYTHON_KEYFILE'
]
elif
env
.
has_key
(
'HOME'
):
keyfile
=
env
[
'HOME'
]
+
'.python_keyfile'
else
:
keyfile
=
'.python_keyfile'
if
env
.
has_key
(
'HOME'
):
keyfile
=
os
.
path
.
join
(
env
[
'HOME'
],
keyfile
)
try
:
self
.
_key
=
eval
(
open
(
keyfile
)
.
readline
())
except
IOError
:
...
...
@@ -23,4 +23,4 @@ class Security:
def
_encode_challenge
(
self
,
challenge
):
p
,
m
=
self
.
_key
return
pow
(
challenge
,
p
,
m
)
return
pow
(
long
(
challenge
)
,
p
,
m
)
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