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
e9db82ca
Verified
Commit
e9db82ca
authored
4 years ago
by
me5na7qbjqbrp
Browse files
Options
Downloads
Patches
Plain Diff
Use crossplatform clipboard
parent
0b050981
No related branches found
No related tags found
No related merge requests found
Pipeline
#2903
passed with warnings with stage
Stage: quality-assurance
in 39 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.rst
+3
-0
3 additions, 0 deletions
README.rst
cpasswords/client.py
+6
-19
6 additions, 19 deletions
cpasswords/client.py
setup.py
+1
-0
1 addition, 0 deletions
setup.py
with
10 additions
and
19 deletions
README.rst
+
3
−
0
View file @
e9db82ca
...
...
@@ -7,6 +7,9 @@ cPasswords is a group password manager develop by the
Client installation
-------------------
Please install ``python3 gettext python3-paramiko python3-pyperclip`` and
``xclip`` (optionnal).
- Add you GPG fingerprint and your SSH key to the cpassword server. For
the CRANS, you can do this on the intranet.
...
...
This diff is collapsed.
Click to expand it.
cpasswords/client.py
+
6
−
19
View file @
e9db82ca
...
...
@@ -24,10 +24,11 @@ import gettext
from
configparser
import
ConfigParser
from
secrets
import
token_urlsafe
# Import setuptool
and
SSH client
# Import setuptool
,
SSH client
and clipboard
from
pkg_resources
import
resource_filename
from
paramiko.client
import
SSHClient
from
paramiko.ssh_exception
import
SSHException
import
pyperclip
# Import modules
from
.gpg
import
decrypt
,
encrypt
,
receive_keys
,
list_keys
,
GPG_TRUSTLEVELS
...
...
@@ -442,26 +443,11 @@ def saveclipboard(restore=False, old_clipboard=None):
"""
Enregistre le contenu du presse-papier. Le rétablit si ``restore=True``
"""
if
restore
and
old_clipboard
is
None
:
return
act
=
'
-in
'
if
restore
else
'
-out
'
proc
=
subprocess
.
Popen
([
'
xclip
'
,
act
,
'
-selection
'
,
'
clipboard
'
],
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
sys
.
stderr
)
if
not
restore
:
old_clipboard
=
p
roc
.
stdout
.
read
()
old_clipboard
=
p
yperclip
.
paste
()
else
:
input
(
_
(
"
Appuyez sur Entrée pour récupérer le contenu précédent du presse papier.
"
))
proc
.
stdin
.
write
(
old_clipboard
)
proc
.
stdin
.
close
()
proc
.
stdout
.
close
()
return
old_clipboard
def
clipboard
(
texte
):
"""
Place ``texte`` dans le presse-papier en mémorisant l
'
ancien contenu.
"""
old_clipboard
=
saveclipboard
()
proc
=
subprocess
.
Popen
([
'
xclip
'
,
'
-selection
'
,
'
clipboard
'
],
stdin
=
subprocess
.
PIPE
,
stdout
=
sys
.
stdout
,
stderr
=
sys
.
stderr
)
proc
.
stdin
.
write
(
texte
.
encode
(
"
utf-8
"
))
proc
.
stdin
.
close
()
pyperclip
.
copy
(
old_clipboard
)
return
old_clipboard
...
...
@@ -503,7 +489,8 @@ def show_file(options):
if
catch_pass
is
not
None
:
is_hidden
=
True
# On met le mdp dans le clipboard en mémorisant son ancien contenu
old_clipboard
=
clipboard
(
catch_pass
.
group
(
1
))
old_clipboard
=
saveclipboard
()
pyperclip
.
copy
(
catch_pass
.
group
(
1
))
# Et donc on override l'affichage
line
=
"
[Le mot de passe a été mis dans le presse papier]
"
filtered
+=
line
+
'
\n
'
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
1
−
0
View file @
e9db82ca
...
...
@@ -47,6 +47,7 @@ setup(
include_package_data
=
True
,
install_requires
=
[
'
paramiko>=2.2
'
,
'
pyperclip>=1.7.0
'
],
entry_points
=
{
"
console_scripts
"
:
[
...
...
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