Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Crans Passwords
Manage
Activity
Members
Labels
Plan
Issues
5
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nounous
Crans Passwords
Commits
37cba098
Commit
37cba098
authored
4 years ago
by
Maxime Bombar
Browse files
Options
Downloads
Patches
Plain Diff
Minimal cpasswords, to be used in external scripts.
parent
7468b5c7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!12
Minimal cpasswords, to be used in external scripts.
Pipeline
#4070
passed with warnings with stages
in 5 minutes and 1 second
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cpasswords/client.py
+42
-0
42 additions, 0 deletions
cpasswords/client.py
with
42 additions
and
0 deletions
cpasswords/client.py
+
42
−
0
View file @
37cba098
...
@@ -447,6 +447,41 @@ def show_file(options):
...
@@ -447,6 +447,41 @@ def show_file(options):
if
old_clipboard
is
not
None
:
if
old_clipboard
is
not
None
:
saveclipboard
(
restore
=
True
,
old_clipboard
=
old_clipboard
)
saveclipboard
(
restore
=
True
,
old_clipboard
=
old_clipboard
)
@need_filename
def
show_minimal
(
options
):
"""
Action that decrypt file content and only prints the password
"""
fname
=
options
.
filename
gotit
,
value
=
get_file
(
options
,
fname
)
if
not
gotit
:
log
.
warn
(
value
)
# value contient le message d'erreur
return
passfile
=
value
content
=
passfile
[
'
contents
'
]
# Kludge (broken db ?)
if
type
(
content
)
==
list
:
log
.
warn
(
"
Eau dans le gaz
"
)
content
=
content
[
-
1
]
# Déchiffre le contenu
texte
=
decrypt
(
content
)
found
=
None
# Essaie de planquer le mot de passe
for
line
in
texte
.
split
(
'
\n
'
):
catch_pass
=
None
if
not
found
:
catch_pass
=
pass_regexp
.
match
(
line
)
if
catch_pass
is
not
None
:
found
=
True
passwd
=
catch_pass
.
group
(
1
)
break
print
(
passwd
)
@need_filename
@need_filename
def
edit_file
(
options
):
def
edit_file
(
options
):
...
@@ -816,6 +851,13 @@ def main():
...
@@ -816,6 +851,13 @@ def main():
const
=
recrypt_files
,
const
=
recrypt_files
,
help
=
_
(
"
recrypt all files having a role listed in --roles
"
),
help
=
_
(
"
recrypt all files having a role listed in --roles
"
),
)
)
action_grp
.
add_argument
(
'
--minimal
'
,
action
=
'
store_const
'
,
dest
=
'
action
'
,
const
=
show_minimal
,
help
=
_
(
"
just print the password in a file, for use in an external script.
"
),
)
action_grp
.
set_defaults
(
action
=
show_file
)
action_grp
.
set_defaults
(
action
=
show_file
)
# On parse les options fournies en commandline
# On parse les options fournies en commandline
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment