Skip to content

Commit 1be8085

Browse files
author
Paul Sokolovsky
committed
webrepl_cli.py: login: Make a proper method, inject password param.
1 parent 9975359 commit 1be8085

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

webrepl_cli.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import sys
44
import os
55
import struct
6-
import getpass
76
try:
87
import usocket as socket
98
except ImportError:
@@ -86,13 +85,12 @@ def ioctl(self, req, val):
8685
assert req == 9 and val == 2
8786

8887

89-
def login(ws):
88+
def login(ws, passwd):
9089
while True:
9190
c = ws.read(1, text_ok=True)
9291
if c == b":":
9392
assert ws.read(1, text_ok=True) == b" "
9493
break
95-
passwd = getpass.getpass()
9694
ws.write(passwd.encode("utf-8") + b"\r")
9795

9896
def read_resp(ws):
@@ -168,6 +166,7 @@ def parse_remote(remote):
168166
port = int(port)
169167
return (host, port, fname)
170168

169+
171170
def main():
172171

173172
if len(sys.argv) != 3:
@@ -208,7 +207,9 @@ def main():
208207

209208
ws = websocket(s)
210209

211-
login(ws)
210+
import getpass
211+
passwd = getpass.getpass()
212+
login(ws, passwd)
212213

213214
# Set websocket to send data marked as "binary"
214215
ws.ioctl(9, 2)

0 commit comments

Comments
 (0)