Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Network Health
sbws
Commits
80497f12
Commit
80497f12
authored
Apr 17, 2018
by
Matt Traudt
Browse files
Stop pwgen from overwriting stdout
GH: closes #89
parent
0919c591
Changes
1
Hide whitespace changes
Inline
Side-by-side
sbws/core/pwgen.py
View file @
80497f12
...
...
@@ -10,8 +10,7 @@ def gen_parser(sub):
'authenticating to an sbws server.'
p
=
sub
.
add_parser
(
'pwgen'
,
formatter_class
=
ArgumentDefaultsHelpFormatter
,
description
=
d
)
p
.
add_argument
(
'--output'
,
type
=
str
,
default
=
'/dev/stdout'
,
help
=
'Where to write the password'
)
p
.
add_argument
(
'--output'
,
type
=
str
,
help
=
'Where to write the password'
)
def
rand_char
():
...
...
@@ -29,5 +28,8 @@ def rand_str():
def
main
(
args
,
conf
):
global
rng
rng
=
random
.
SystemRandom
()
with
open
(
args
.
output
,
'wt'
)
as
fd
:
fd
.
write
(
rand_str
()
+
'
\n
'
)
if
args
.
output
:
with
open
(
args
.
output
,
'wt'
)
as
fd
:
fd
.
write
(
rand_str
()
+
'
\n
'
)
else
:
print
(
rand_str
())
Write
Preview
Supports
Markdown
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