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
62629c57
Commit
62629c57
authored
12 years ago
by
Daniel STAN
Browse files
Options
Downloads
Patches
Plain Diff
Ajout d'un less pour bypasser les buffer
parent
081eab8c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cranspasswords.py
+27
-19
27 additions, 19 deletions
cranspasswords.py
with
27 additions
and
19 deletions
cranspasswords.py
+
27
−
19
View file @
62629c57
...
@@ -204,13 +204,18 @@ def editor(texte):
...
@@ -204,13 +204,18 @@ def editor(texte):
return
texte
<>
ntexte
and
ntexte
or
None
return
texte
<>
ntexte
and
ntexte
or
None
def
show_files
():
def
show_files
():
print
"""
Liste des fichiers disponibles
"""
proc
=
subprocess
.
Popen
(
"
less
"
,
stdin
=
subprocess
.
PIPE
,
shell
=
True
)
out
=
proc
.
stdin
out
.
write
(
"""
Liste des fichiers disponibles
\n
"""
)
my_roles
=
get_my_roles
()
my_roles
=
get_my_roles
()
for
(
fname
,
froles
)
in
all_files
().
iteritems
():
for
(
fname
,
froles
)
in
all_files
().
iteritems
():
access
=
set
(
my_roles
).
intersection
(
froles
)
!=
set
([])
access
=
set
(
my_roles
).
intersection
(
froles
)
!=
set
([])
print
"
%s %s (%s)
"
%
((
access
and
'
+
'
or
'
-
'
),
fname
,
"
,
"
.
join
(
froles
))
out
.
write
(
"
%s %s (%s)
\n
"
%
((
access
and
'
+
'
or
'
-
'
),
fname
,
"
,
"
.
join
(
froles
)))
print
"""
--Mes roles: %s
"""
%
\
out
.
write
(
"""
--Mes roles: %s
\n
"""
%
\
"
,
"
.
join
(
my_roles
)
"
,
"
.
join
(
my_roles
))
out
.
close
()
os
.
waitpid
(
proc
.
pid
,
0
)
def
show_roles
():
def
show_roles
():
print
"""
Liste des roles disponibles
"""
print
"""
Liste des roles disponibles
"""
...
@@ -223,32 +228,35 @@ def clipboard(texte):
...
@@ -223,32 +228,35 @@ def clipboard(texte):
stdin
=
subprocess
.
PIPE
,
stdout
=
sys
.
stdout
,
stderr
=
sys
.
stderr
)
stdin
=
subprocess
.
PIPE
,
stdout
=
sys
.
stdout
,
stderr
=
sys
.
stderr
)
proc
.
stdin
.
write
(
texte
)
proc
.
stdin
.
write
(
texte
)
proc
.
stdin
.
close
()
proc
.
stdin
.
close
()
print
"
[Le mot de passe a été mis dans le presse papier]
"
return
"
[Le mot de passe a été mis dans le presse papier]
"
def
show_file
(
fname
):
def
show_file
(
fname
):
value
=
get_file
(
fname
)
value
=
get_file
(
fname
)
if
value
==
False
:
if
value
==
False
:
print
"
Fichier introuvable
"
;
return
print
"
Fichier introuvable
"
;
return
print
"
Fichier %s:
"
%
fname
proc
=
subprocess
.
Popen
(
"
less
"
,
stdin
=
subprocess
.
PIPE
,
shell
=
True
)
out
=
proc
.
stdin
out
.
write
(
"
Fichier %s:
\n\n
"
%
fname
)
(
sin
,
sout
)
=
gpg
(
'
decrypt
'
)
(
sin
,
sout
)
=
gpg
(
'
decrypt
'
)
sin
.
write
(
value
[
'
contents
'
])
sin
.
write
(
value
[
'
contents
'
])
sin
.
close
()
sin
.
close
()
texte
=
sout
.
read
()
if
CLIPBOARD
:
# Ça ne va pas plaire à tout le monde
if
CLIPBOARD
:
# Ça ne va pas plaire à tout le monde
texte
=
sout
.
read
()
lines
=
texte
.
split
(
'
\n
'
)
lines
=
texte
.
split
(
'
\n
'
)
if
len
(
lines
)
==
2
:
for
line
in
lines
:
clipboard
(
lines
[
0
])
if
line
.
startswith
(
'
pass:
'
):
else
:
out
.
write
(
clipboard
(
line
[
5
:].
strip
(
'
\t\r\n
'
))
+
'
\n
'
)
for
line
in
lines
:
else
:
if
line
.
startswith
(
'
pass:
'
):
out
.
write
(
line
+
'
\n
'
)
clipboard
(
line
[
5
:].
strip
(
'
\t\r\n
'
))
else
:
# Si pas de presse papier, on fait passer ça dans un less
else
:
out
.
write
(
sout
.
read
())
print
line
out
.
write
(
"
-----
\n
"
)
else
:
out
.
write
(
"
Visible par: %s
\n
"
%
'
,
'
.
join
(
value
[
'
roles
'
]))
print
texte
print
"
-----
"
out
.
close
()
print
"
Visible par: %s
"
%
'
,
'
.
join
(
value
[
'
roles
'
])
os
.
waitpid
(
proc
.
pid
,
0
)
def
edit_file
(
fname
):
def
edit_file
(
fname
):
value
=
get_file
(
fname
)
value
=
get_file
(
fname
)
...
...
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