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
45babef8
Kaydet (Commit)
45babef8
authored
Haz 21, 1995
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
security stuff added
üst
37a29118
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
0 deletions
+50
-0
client.py
Demo/pdist/client.py
+17
-0
server.py
Demo/pdist/server.py
+33
-0
No files found.
Demo/pdist/client.py
Dosyayı görüntüle @
45babef8
...
...
@@ -120,6 +120,23 @@ class Client:
self
.
_wf
.
flush
()
from
security
import
Security
class
SecureClient
(
Client
,
Security
):
def
__init__
(
self
,
*
args
):
import
string
apply
(
Client
.
__init__
,
(
self
,)
+
args
)
Security
.
__init__
(
self
)
line
=
self
.
_rf
.
readline
()
challenge
=
string
.
atoi
(
string
.
strip
(
firstline
))
response
=
self
.
_encode_challenge
(
challenge
)
line
=
`long(response)`
if
line
[
-
1
]
in
'Ll'
:
line
=
line
[:
-
1
]
self
.
_wf
.
write
(
line
+
'
\n
'
)
self
.
_wf
.
flush
()
class
_stub
:
"""Helper class for Client -- each instance serves as a method of the client."""
...
...
Demo/pdist/server.py
Dosyayı görüntüle @
45babef8
...
...
@@ -109,3 +109,36 @@ class Server:
basenames
=
filter
(
lambda
x
,
names
=
names
:
x
not
in
names
,
basenames
)
names
[
len
(
names
):]
=
basenames
return
names
from
security
import
Security
class
SecureServer
(
Server
,
Security
):
def
__init__
(
self
,
*
args
):
apply
(
Server
.
__init__
,
(
self
,)
+
args
)
Security
.
__init__
(
self
)
def
_verify
(
self
,
conn
,
address
):
challenge
=
self
.
_generate_challenge
()
conn
.
send
(
"
%
d
\n
"
%
challenge
)
response
=
""
while
"
\n
"
not
in
response
and
len
(
response
)
<
100
:
data
=
conn
.
recv
(
100
)
if
not
data
:
break
response
=
response
+
data
try
:
response
=
string
.
atol
(
string
.
strip
(
response
))
except
string
.
atol_error
:
if
self
.
_verbose
>
0
:
print
"Invalid response syntax"
,
`response`
return
0
if
not
self
.
_compare_challenge_response
(
challenge
,
response
):
if
self
.
_verbose
>
0
:
print
"Invalid response value"
,
`response`
return
0
if
self
.
_verbose
>
1
:
print
"Response matches challenge. Go ahead!"
return
1
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