Commit 7cca5aa3 authored by Likun Zhang's avatar Likun Zhang
Browse files

Prompt the user for a password without echoing.

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/parkinglot@550 e5f2f494-b856-4b98-b285-d166d9295462
parent ee8fefea
#define the message format between different modules
'command' : [module_name, command_name, {param1 = value1, param2 = value2}]
...@@ -4,4 +4,5 @@ ...@@ -4,4 +4,5 @@
4. RESTful API document for cmd-ctrld. 4. RESTful API document for cmd-ctrld.
5. Unit tests for cmd-ctrld. 5. Unit tests for cmd-ctrld.
6. Man page for cmd-ctrld? 6. Man page for cmd-ctrld?
7. Support 'make install', Save user information and ssl certificate file to configmanager.
...@@ -83,7 +83,7 @@ class SecureHTTPRequestHandler(http.server.BaseHTTPRequestHandler): ...@@ -83,7 +83,7 @@ class SecureHTTPRequestHandler(http.server.BaseHTTPRequestHandler):
reply_msg = [] reply_msg = []
rcode = 200 rcode = 200
if self.path == '/': if self.path == '/login':
reply_msg, rcode = self.check() reply_msg, rcode = self.check()
elif "username" not in self.server.session[id]: elif "username" not in self.server.session[id]:
reply_msg, rcode = ["please login!"], http.client.UNAUTHORIZED reply_msg, rcode = ["please login!"], http.client.UNAUTHORIZED
......
...@@ -13,6 +13,7 @@ import inspect ...@@ -13,6 +13,7 @@ import inspect
import pprint import pprint
import ssl, socket import ssl, socket
import os, time, random, re import os, time, random, re
import getpass
from hashlib import sha1 from hashlib import sha1
try: try:
...@@ -67,10 +68,10 @@ class BindCmdInterpreter(Cmd): ...@@ -67,10 +68,10 @@ class BindCmdInterpreter(Cmd):
try: try:
while count < 3: while count < 3:
count = count + 1 count = count + 1
username = input("username:") username = input("Username:")
passwd = input("password:") passwd = getpass.getpass()
param = {'username': username, 'password' : passwd} param = {'username': username, 'password' : passwd}
response = self.send_POST('/', param) response = self.send_POST('/login', param)
data = response.read().decode() data = response.read().decode()
print(data) print(data)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment