Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mailinabox
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mailinabox
Commits
5774205b
Commit
5774205b
authored
Jun 06, 2014
by
Michael Kropat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mask password input on stdin
parent
242cadeb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
mail.py
tools/mail.py
+11
-2
No files found.
tools/mail.py
View file @
5774205b
#!/usr/bin/python3
import
sys
,
urllib
.
request
,
urllib
.
error
import
sys
,
getpass
,
urllib
.
request
,
urllib
.
error
def
mgmt
(
cmd
,
data
=
None
):
req
=
urllib
.
request
.
Request
(
'http://localhost:10222'
+
cmd
,
urllib
.
parse
.
urlencode
(
data
)
.
encode
(
"utf8"
)
if
data
else
None
)
...
...
@@ -11,6 +11,15 @@ def mgmt(cmd, data=None):
sys
.
exit
(
1
)
return
response
.
read
()
.
decode
(
'utf8'
)
def
read_password
():
first
=
getpass
.
getpass
(
'password: '
)
second
=
getpass
.
getpass
(
' (again): '
)
while
first
!=
second
:
print
(
'Passwords not the same. Try again.'
)
first
=
getpass
.
getpass
(
'password: '
)
second
=
getpass
.
getpass
(
' (again): '
)
return
first
if
len
(
sys
.
argv
)
<
2
:
print
(
"Usage: "
)
print
(
" tools/mail.py user (lists users)"
)
...
...
@@ -33,7 +42,7 @@ elif sys.argv[1] == "user" and sys.argv[2] in ("add", "password"):
email
=
input
(
"email: "
)
else
:
email
=
sys
.
argv
[
3
]
pw
=
input
(
"password: "
)
pw
=
read_password
(
)
else
:
email
,
pw
=
sys
.
argv
[
3
:
5
]
...
...
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