Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
5f32005f
Commit
5f32005f
authored
May 27, 1999
by
Amos Latteier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed line-endings of monitor files. Thanks to Martijn Pieters for pointing out the problem.
parent
98368c63
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1052 additions
and
1052 deletions
+1052
-1052
ZServer/medusa/monitor.py
ZServer/medusa/monitor.py
+347
-347
ZServer/medusa/monitor_client.py
ZServer/medusa/monitor_client.py
+126
-126
ZServer/medusa/monitor_client_win32.py
ZServer/medusa/monitor_client_win32.py
+53
-53
lib/python/ZServer/medusa/monitor.py
lib/python/ZServer/medusa/monitor.py
+347
-347
lib/python/ZServer/medusa/monitor_client.py
lib/python/ZServer/medusa/monitor_client.py
+126
-126
lib/python/ZServer/medusa/monitor_client_win32.py
lib/python/ZServer/medusa/monitor_client_win32.py
+53
-53
No files found.
ZServer/medusa/monitor.py
View file @
5f32005f
This diff is collapsed.
Click to expand it.
ZServer/medusa/monitor_client.py
View file @
5f32005f
# -*- Mode: Python; tab-width: 4 -*-
# -*- Mode: Python; tab-width: 4 -*-
# monitor client, unix version.
# monitor client, unix version.
import
asyncore
import
asyncore
import
asynchat
import
asynchat
import
regsub
import
regsub
import
socket
import
socket
import
string
import
string
import
sys
import
sys
import
os
import
os
import
md5
import
md5
import
time
import
time
class
stdin_channel
(
asyncore
.
file_dispatcher
):
class
stdin_channel
(
asyncore
.
file_dispatcher
):
def
handle_read
(
self
):
def
handle_read
(
self
):
data
=
self
.
recv
(
512
)
data
=
self
.
recv
(
512
)
if
not
data
:
if
not
data
:
print
'
\
n
closed.'
print
'
\
n
closed.'
self
.
sock_channel
.
close
()
self
.
sock_channel
.
close
()
try
:
try
:
self
.
close
()
self
.
close
()
except
:
except
:
pass
pass
data
=
regsub
.
gsub
(
'
\
n
'
,
'
\
r
\
n
'
,
data
)
data
=
regsub
.
gsub
(
'
\
n
'
,
'
\
r
\
n
'
,
data
)
self
.
sock_channel
.
push
(
data
)
self
.
sock_channel
.
push
(
data
)
def
writable
(
self
):
def
writable
(
self
):
return
0
return
0
def
log
(
self
,
*
ignore
):
def
log
(
self
,
*
ignore
):
pass
pass
class
monitor_client
(
asynchat
.
async_chat
):
class
monitor_client
(
asynchat
.
async_chat
):
def
__init__
(
self
,
password
,
addr
=
(
''
,
8023
),
socket_type
=
socket
.
AF_INET
):
def
__init__
(
self
,
password
,
addr
=
(
''
,
8023
),
socket_type
=
socket
.
AF_INET
):
asynchat
.
async_chat
.
__init__
(
self
)
asynchat
.
async_chat
.
__init__
(
self
)
self
.
create_socket
(
socket_type
,
socket
.
SOCK_STREAM
)
self
.
create_socket
(
socket_type
,
socket
.
SOCK_STREAM
)
self
.
terminator
=
'
\
r
\
n
'
self
.
terminator
=
'
\
r
\
n
'
self
.
connect
(
addr
)
self
.
connect
(
addr
)
self
.
sent_auth
=
0
self
.
sent_auth
=
0
self
.
timestamp
=
''
self
.
timestamp
=
''
self
.
password
=
password
self
.
password
=
password
def
collect_incoming_data
(
self
,
data
):
def
collect_incoming_data
(
self
,
data
):
if
not
self
.
sent_auth
:
if
not
self
.
sent_auth
:
self
.
timestamp
=
self
.
timestamp
+
data
self
.
timestamp
=
self
.
timestamp
+
data
else
:
else
:
sys
.
stdout
.
write
(
data
)
sys
.
stdout
.
write
(
data
)
sys
.
stdout
.
flush
()
sys
.
stdout
.
flush
()
def
found_terminator
(
self
):
def
found_terminator
(
self
):
if
not
self
.
sent_auth
:
if
not
self
.
sent_auth
:
self
.
push
(
hex_digest
(
self
.
timestamp
+
self
.
password
)
+
'
\
r
\
n
'
)
self
.
push
(
hex_digest
(
self
.
timestamp
+
self
.
password
)
+
'
\
r
\
n
'
)
self
.
sent_auth
=
1
self
.
sent_auth
=
1
else
:
else
:
print
print
def
handle_close
(
self
):
def
handle_close
(
self
):
# close all the channels, which will make the standard main
# close all the channels, which will make the standard main
# loop exit.
# loop exit.
map
(
lambda
x
:
x
.
close
(),
asyncore
.
socket_map
.
keys
())
map
(
lambda
x
:
x
.
close
(),
asyncore
.
socket_map
.
keys
())
def
log
(
self
,
*
ignore
):
def
log
(
self
,
*
ignore
):
pass
pass
class
encrypted_monitor_client
(
monitor_client
):
class
encrypted_monitor_client
(
monitor_client
):
"Wrap push() and recv() with a stream cipher"
"Wrap push() and recv() with a stream cipher"
def
init_cipher
(
self
,
cipher
,
key
):
def
init_cipher
(
self
,
cipher
,
key
):
self
.
outgoing
=
cipher
.
new
(
key
)
self
.
outgoing
=
cipher
.
new
(
key
)
self
.
incoming
=
cipher
.
new
(
key
)
self
.
incoming
=
cipher
.
new
(
key
)
def
push
(
self
,
data
):
def
push
(
self
,
data
):
# push the encrypted data instead
# push the encrypted data instead
return
monitor_client
.
push
(
self
,
self
.
outgoing
.
encrypt
(
data
))
return
monitor_client
.
push
(
self
,
self
.
outgoing
.
encrypt
(
data
))
def
recv
(
self
,
block_size
):
def
recv
(
self
,
block_size
):
data
=
monitor_client
.
recv
(
self
,
block_size
)
data
=
monitor_client
.
recv
(
self
,
block_size
)
if
data
:
if
data
:
return
self
.
incoming
.
decrypt
(
data
)
return
self
.
incoming
.
decrypt
(
data
)
else
:
else
:
return
data
return
data
def
hex_digest
(
s
):
def
hex_digest
(
s
):
m
=
md5
.
md5
()
m
=
md5
.
md5
()
m
.
update
(
s
)
m
.
update
(
s
)
return
string
.
join
(
return
string
.
join
(
map
(
lambda
x
:
hex
(
ord
(
x
))[
2
:],
map
(
None
,
m
.
digest
())),
map
(
lambda
x
:
hex
(
ord
(
x
))[
2
:],
map
(
None
,
m
.
digest
())),
''
,
''
,
)
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
if
len
(
sys
.
argv
)
==
1
:
if
len
(
sys
.
argv
)
==
1
:
print
'Usage: %s host port'
%
sys
.
argv
[
0
]
print
'Usage: %s host port'
%
sys
.
argv
[
0
]
sys
.
exit
(
0
)
sys
.
exit
(
0
)
if
(
'-e'
in
sys
.
argv
):
if
(
'-e'
in
sys
.
argv
):
encrypt
=
1
encrypt
=
1
sys
.
argv
.
remove
(
'-e'
)
sys
.
argv
.
remove
(
'-e'
)
else
:
else
:
encrypt
=
0
encrypt
=
0
sys
.
stderr
.
write
(
'Enter Password: '
)
sys
.
stderr
.
write
(
'Enter Password: '
)
sys
.
stderr
.
flush
()
sys
.
stderr
.
flush
()
import
os
import
os
try
:
try
:
os
.
system
(
'stty -echo'
)
os
.
system
(
'stty -echo'
)
p
=
raw_input
()
p
=
raw_input
()
print
print
finally
:
finally
:
os
.
system
(
'stty echo'
)
os
.
system
(
'stty echo'
)
stdin
=
stdin_channel
(
0
)
stdin
=
stdin_channel
(
0
)
if
len
(
sys
.
argv
)
>
1
:
if
len
(
sys
.
argv
)
>
1
:
if
encrypt
:
if
encrypt
:
client
=
encrypted_monitor_client
(
p
,
(
sys
.
argv
[
1
],
string
.
atoi
(
sys
.
argv
[
2
])))
client
=
encrypted_monitor_client
(
p
,
(
sys
.
argv
[
1
],
string
.
atoi
(
sys
.
argv
[
2
])))
import
sapphire
import
sapphire
client
.
init_cipher
(
sapphire
,
p
)
client
.
init_cipher
(
sapphire
,
p
)
else
:
else
:
client
=
monitor_client
(
p
,
(
sys
.
argv
[
1
],
string
.
atoi
(
sys
.
argv
[
2
])))
client
=
monitor_client
(
p
,
(
sys
.
argv
[
1
],
string
.
atoi
(
sys
.
argv
[
2
])))
else
:
else
:
# default to local host, 'standard' port
# default to local host, 'standard' port
client
=
monitor_client
(
p
)
client
=
monitor_client
(
p
)
stdin
.
sock_channel
=
client
stdin
.
sock_channel
=
client
asyncore
.
loop
()
asyncore
.
loop
()
ZServer/medusa/monitor_client_win32.py
View file @
5f32005f
# -*- Mode: Python; tab-width: 4 -*-
# -*- Mode: Python; tab-width: 4 -*-
# monitor client, win32 version
# monitor client, win32 version
# since we can't do select() on stdin/stdout, we simply
# since we can't do select() on stdin/stdout, we simply
# use threads and blocking sockets. <sigh>
# use threads and blocking sockets. <sigh>
import
regsub
import
regsub
import
socket
import
socket
import
string
import
string
import
sys
import
sys
import
thread
import
thread
import
md5
import
md5
def
hex_digest
(
s
):
def
hex_digest
(
s
):
m
=
md5
.
md5
()
m
=
md5
.
md5
()
m
.
update
(
s
)
m
.
update
(
s
)
return
string
.
join
(
return
string
.
join
(
map
(
lambda
x
:
hex
(
ord
(
x
))[
2
:],
map
(
None
,
m
.
digest
())),
map
(
lambda
x
:
hex
(
ord
(
x
))[
2
:],
map
(
None
,
m
.
digest
())),
''
,
''
,
)
)
def
reader
(
lock
,
sock
,
password
):
def
reader
(
lock
,
sock
,
password
):
# first grab the timestamp
# first grab the timestamp
ts
=
sock
.
recv
(
1024
)[:
-
2
]
ts
=
sock
.
recv
(
1024
)[:
-
2
]
sock
.
send
(
hex_digest
(
ts
+
password
)
+
'
\
r
\
n
'
)
sock
.
send
(
hex_digest
(
ts
+
password
)
+
'
\
r
\
n
'
)
while
1
:
while
1
:
d
=
sock
.
recv
(
1024
)
d
=
sock
.
recv
(
1024
)
if
not
d
:
if
not
d
:
lock
.
release
()
lock
.
release
()
print
'Connection closed. Hit <return> to exit'
print
'Connection closed. Hit <return> to exit'
thread
.
exit
()
thread
.
exit
()
sys
.
stdout
.
write
(
d
)
sys
.
stdout
.
write
(
d
)
sys
.
stdout
.
flush
()
sys
.
stdout
.
flush
()
def
writer
(
lock
,
sock
,
barrel
=
"just kidding"
):
def
writer
(
lock
,
sock
,
barrel
=
"just kidding"
):
while
lock
.
locked
():
while
lock
.
locked
():
sock
.
send
(
sock
.
send
(
sys
.
stdin
.
readline
()[:
-
1
]
+
'
\
r
\
n
'
sys
.
stdin
.
readline
()[:
-
1
]
+
'
\
r
\
n
'
)
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
if
len
(
sys
.
argv
)
==
1
:
if
len
(
sys
.
argv
)
==
1
:
print
'Usage: %s host port'
print
'Usage: %s host port'
sys
.
exit
(
0
)
sys
.
exit
(
0
)
print
'Enter Password: '
,
print
'Enter Password: '
,
p
=
raw_input
()
p
=
raw_input
()
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
s
.
connect
((
sys
.
argv
[
1
],
string
.
atoi
(
sys
.
argv
[
2
])))
s
.
connect
((
sys
.
argv
[
1
],
string
.
atoi
(
sys
.
argv
[
2
])))
l
=
thread
.
allocate_lock
()
l
=
thread
.
allocate_lock
()
l
.
acquire
()
l
.
acquire
()
thread
.
start_new_thread
(
reader
,
(
l
,
s
,
p
))
thread
.
start_new_thread
(
reader
,
(
l
,
s
,
p
))
writer
(
l
,
s
)
writer
(
l
,
s
)
lib/python/ZServer/medusa/monitor.py
View file @
5f32005f
This diff is collapsed.
Click to expand it.
lib/python/ZServer/medusa/monitor_client.py
View file @
5f32005f
# -*- Mode: Python; tab-width: 4 -*-
# -*- Mode: Python; tab-width: 4 -*-
# monitor client, unix version.
# monitor client, unix version.
import
asyncore
import
asyncore
import
asynchat
import
asynchat
import
regsub
import
regsub
import
socket
import
socket
import
string
import
string
import
sys
import
sys
import
os
import
os
import
md5
import
md5
import
time
import
time
class
stdin_channel
(
asyncore
.
file_dispatcher
):
class
stdin_channel
(
asyncore
.
file_dispatcher
):
def
handle_read
(
self
):
def
handle_read
(
self
):
data
=
self
.
recv
(
512
)
data
=
self
.
recv
(
512
)
if
not
data
:
if
not
data
:
print
'
\
n
closed.'
print
'
\
n
closed.'
self
.
sock_channel
.
close
()
self
.
sock_channel
.
close
()
try
:
try
:
self
.
close
()
self
.
close
()
except
:
except
:
pass
pass
data
=
regsub
.
gsub
(
'
\
n
'
,
'
\
r
\
n
'
,
data
)
data
=
regsub
.
gsub
(
'
\
n
'
,
'
\
r
\
n
'
,
data
)
self
.
sock_channel
.
push
(
data
)
self
.
sock_channel
.
push
(
data
)
def
writable
(
self
):
def
writable
(
self
):
return
0
return
0
def
log
(
self
,
*
ignore
):
def
log
(
self
,
*
ignore
):
pass
pass
class
monitor_client
(
asynchat
.
async_chat
):
class
monitor_client
(
asynchat
.
async_chat
):
def
__init__
(
self
,
password
,
addr
=
(
''
,
8023
),
socket_type
=
socket
.
AF_INET
):
def
__init__
(
self
,
password
,
addr
=
(
''
,
8023
),
socket_type
=
socket
.
AF_INET
):
asynchat
.
async_chat
.
__init__
(
self
)
asynchat
.
async_chat
.
__init__
(
self
)
self
.
create_socket
(
socket_type
,
socket
.
SOCK_STREAM
)
self
.
create_socket
(
socket_type
,
socket
.
SOCK_STREAM
)
self
.
terminator
=
'
\
r
\
n
'
self
.
terminator
=
'
\
r
\
n
'
self
.
connect
(
addr
)
self
.
connect
(
addr
)
self
.
sent_auth
=
0
self
.
sent_auth
=
0
self
.
timestamp
=
''
self
.
timestamp
=
''
self
.
password
=
password
self
.
password
=
password
def
collect_incoming_data
(
self
,
data
):
def
collect_incoming_data
(
self
,
data
):
if
not
self
.
sent_auth
:
if
not
self
.
sent_auth
:
self
.
timestamp
=
self
.
timestamp
+
data
self
.
timestamp
=
self
.
timestamp
+
data
else
:
else
:
sys
.
stdout
.
write
(
data
)
sys
.
stdout
.
write
(
data
)
sys
.
stdout
.
flush
()
sys
.
stdout
.
flush
()
def
found_terminator
(
self
):
def
found_terminator
(
self
):
if
not
self
.
sent_auth
:
if
not
self
.
sent_auth
:
self
.
push
(
hex_digest
(
self
.
timestamp
+
self
.
password
)
+
'
\
r
\
n
'
)
self
.
push
(
hex_digest
(
self
.
timestamp
+
self
.
password
)
+
'
\
r
\
n
'
)
self
.
sent_auth
=
1
self
.
sent_auth
=
1
else
:
else
:
print
print
def
handle_close
(
self
):
def
handle_close
(
self
):
# close all the channels, which will make the standard main
# close all the channels, which will make the standard main
# loop exit.
# loop exit.
map
(
lambda
x
:
x
.
close
(),
asyncore
.
socket_map
.
keys
())
map
(
lambda
x
:
x
.
close
(),
asyncore
.
socket_map
.
keys
())
def
log
(
self
,
*
ignore
):
def
log
(
self
,
*
ignore
):
pass
pass
class
encrypted_monitor_client
(
monitor_client
):
class
encrypted_monitor_client
(
monitor_client
):
"Wrap push() and recv() with a stream cipher"
"Wrap push() and recv() with a stream cipher"
def
init_cipher
(
self
,
cipher
,
key
):
def
init_cipher
(
self
,
cipher
,
key
):
self
.
outgoing
=
cipher
.
new
(
key
)
self
.
outgoing
=
cipher
.
new
(
key
)
self
.
incoming
=
cipher
.
new
(
key
)
self
.
incoming
=
cipher
.
new
(
key
)
def
push
(
self
,
data
):
def
push
(
self
,
data
):
# push the encrypted data instead
# push the encrypted data instead
return
monitor_client
.
push
(
self
,
self
.
outgoing
.
encrypt
(
data
))
return
monitor_client
.
push
(
self
,
self
.
outgoing
.
encrypt
(
data
))
def
recv
(
self
,
block_size
):
def
recv
(
self
,
block_size
):
data
=
monitor_client
.
recv
(
self
,
block_size
)
data
=
monitor_client
.
recv
(
self
,
block_size
)
if
data
:
if
data
:
return
self
.
incoming
.
decrypt
(
data
)
return
self
.
incoming
.
decrypt
(
data
)
else
:
else
:
return
data
return
data
def
hex_digest
(
s
):
def
hex_digest
(
s
):
m
=
md5
.
md5
()
m
=
md5
.
md5
()
m
.
update
(
s
)
m
.
update
(
s
)
return
string
.
join
(
return
string
.
join
(
map
(
lambda
x
:
hex
(
ord
(
x
))[
2
:],
map
(
None
,
m
.
digest
())),
map
(
lambda
x
:
hex
(
ord
(
x
))[
2
:],
map
(
None
,
m
.
digest
())),
''
,
''
,
)
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
if
len
(
sys
.
argv
)
==
1
:
if
len
(
sys
.
argv
)
==
1
:
print
'Usage: %s host port'
%
sys
.
argv
[
0
]
print
'Usage: %s host port'
%
sys
.
argv
[
0
]
sys
.
exit
(
0
)
sys
.
exit
(
0
)
if
(
'-e'
in
sys
.
argv
):
if
(
'-e'
in
sys
.
argv
):
encrypt
=
1
encrypt
=
1
sys
.
argv
.
remove
(
'-e'
)
sys
.
argv
.
remove
(
'-e'
)
else
:
else
:
encrypt
=
0
encrypt
=
0
sys
.
stderr
.
write
(
'Enter Password: '
)
sys
.
stderr
.
write
(
'Enter Password: '
)
sys
.
stderr
.
flush
()
sys
.
stderr
.
flush
()
import
os
import
os
try
:
try
:
os
.
system
(
'stty -echo'
)
os
.
system
(
'stty -echo'
)
p
=
raw_input
()
p
=
raw_input
()
print
print
finally
:
finally
:
os
.
system
(
'stty echo'
)
os
.
system
(
'stty echo'
)
stdin
=
stdin_channel
(
0
)
stdin
=
stdin_channel
(
0
)
if
len
(
sys
.
argv
)
>
1
:
if
len
(
sys
.
argv
)
>
1
:
if
encrypt
:
if
encrypt
:
client
=
encrypted_monitor_client
(
p
,
(
sys
.
argv
[
1
],
string
.
atoi
(
sys
.
argv
[
2
])))
client
=
encrypted_monitor_client
(
p
,
(
sys
.
argv
[
1
],
string
.
atoi
(
sys
.
argv
[
2
])))
import
sapphire
import
sapphire
client
.
init_cipher
(
sapphire
,
p
)
client
.
init_cipher
(
sapphire
,
p
)
else
:
else
:
client
=
monitor_client
(
p
,
(
sys
.
argv
[
1
],
string
.
atoi
(
sys
.
argv
[
2
])))
client
=
monitor_client
(
p
,
(
sys
.
argv
[
1
],
string
.
atoi
(
sys
.
argv
[
2
])))
else
:
else
:
# default to local host, 'standard' port
# default to local host, 'standard' port
client
=
monitor_client
(
p
)
client
=
monitor_client
(
p
)
stdin
.
sock_channel
=
client
stdin
.
sock_channel
=
client
asyncore
.
loop
()
asyncore
.
loop
()
lib/python/ZServer/medusa/monitor_client_win32.py
View file @
5f32005f
# -*- Mode: Python; tab-width: 4 -*-
# -*- Mode: Python; tab-width: 4 -*-
# monitor client, win32 version
# monitor client, win32 version
# since we can't do select() on stdin/stdout, we simply
# since we can't do select() on stdin/stdout, we simply
# use threads and blocking sockets. <sigh>
# use threads and blocking sockets. <sigh>
import
regsub
import
regsub
import
socket
import
socket
import
string
import
string
import
sys
import
sys
import
thread
import
thread
import
md5
import
md5
def
hex_digest
(
s
):
def
hex_digest
(
s
):
m
=
md5
.
md5
()
m
=
md5
.
md5
()
m
.
update
(
s
)
m
.
update
(
s
)
return
string
.
join
(
return
string
.
join
(
map
(
lambda
x
:
hex
(
ord
(
x
))[
2
:],
map
(
None
,
m
.
digest
())),
map
(
lambda
x
:
hex
(
ord
(
x
))[
2
:],
map
(
None
,
m
.
digest
())),
''
,
''
,
)
)
def
reader
(
lock
,
sock
,
password
):
def
reader
(
lock
,
sock
,
password
):
# first grab the timestamp
# first grab the timestamp
ts
=
sock
.
recv
(
1024
)[:
-
2
]
ts
=
sock
.
recv
(
1024
)[:
-
2
]
sock
.
send
(
hex_digest
(
ts
+
password
)
+
'
\
r
\
n
'
)
sock
.
send
(
hex_digest
(
ts
+
password
)
+
'
\
r
\
n
'
)
while
1
:
while
1
:
d
=
sock
.
recv
(
1024
)
d
=
sock
.
recv
(
1024
)
if
not
d
:
if
not
d
:
lock
.
release
()
lock
.
release
()
print
'Connection closed. Hit <return> to exit'
print
'Connection closed. Hit <return> to exit'
thread
.
exit
()
thread
.
exit
()
sys
.
stdout
.
write
(
d
)
sys
.
stdout
.
write
(
d
)
sys
.
stdout
.
flush
()
sys
.
stdout
.
flush
()
def
writer
(
lock
,
sock
,
barrel
=
"just kidding"
):
def
writer
(
lock
,
sock
,
barrel
=
"just kidding"
):
while
lock
.
locked
():
while
lock
.
locked
():
sock
.
send
(
sock
.
send
(
sys
.
stdin
.
readline
()[:
-
1
]
+
'
\
r
\
n
'
sys
.
stdin
.
readline
()[:
-
1
]
+
'
\
r
\
n
'
)
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
if
len
(
sys
.
argv
)
==
1
:
if
len
(
sys
.
argv
)
==
1
:
print
'Usage: %s host port'
print
'Usage: %s host port'
sys
.
exit
(
0
)
sys
.
exit
(
0
)
print
'Enter Password: '
,
print
'Enter Password: '
,
p
=
raw_input
()
p
=
raw_input
()
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
s
.
connect
((
sys
.
argv
[
1
],
string
.
atoi
(
sys
.
argv
[
2
])))
s
.
connect
((
sys
.
argv
[
1
],
string
.
atoi
(
sys
.
argv
[
2
])))
l
=
thread
.
allocate_lock
()
l
=
thread
.
allocate_lock
()
l
.
acquire
()
l
.
acquire
()
thread
.
start_new_thread
(
reader
,
(
l
,
s
,
p
))
thread
.
start_new_thread
(
reader
,
(
l
,
s
,
p
))
writer
(
l
,
s
)
writer
(
l
,
s
)
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