Compare commits

...
9 Commits
Author SHA1 Message Date
RandyTheSilly 43351fd66f Bump version to v1.0.1
Former-commit-id: 73a9e537a08596e3a527f7c7b45405bd43818d54 [formerly 4aa9036d42]
Former-commit-id: 249daa62a333460a5c3142815872b3e26b4ad6a8
2022-06-21 03:46:24 -04:00
RandyTheSilly 096bdb0773 Updated changelog
Former-commit-id: 90c2c0be99f4e250b4a710c7f4013f73f648c0ed [formerly fdaff41f6f]
Former-commit-id: 4d8658fd6473e33ac3d4fecf88cfb500d2d44959
2022-06-21 03:44:48 -04:00
RandyTheSilly 330396c5f1 Improved usage of Popen in copy() function + removed import statement for subprocess.STDOUT
Former-commit-id: bbc39da1d30845aadac3430b0d8758d6958a159c [formerly 88417f5f67]
Former-commit-id: 5be7fe4d68ae5153ef1dbde3018b15ed5fe944b0
2022-06-21 03:28:56 -04:00
RandyTheSilly 8576f63479 Optimized copy_name_check() function
Former-commit-id: 07e02ab7b0bbf030b0ee1baedd8dbb7ec5ef2e4e [formerly 47e8383146]
Former-commit-id: 570a930a9c63aaa5315285ccf1a84316f4e6199a
2022-06-21 03:13:55 -04:00
RandyTheSilly 393f241538 Optimized decrypt() function (fixes issue #1)
Former-commit-id: d94cce05e9695f4d0744b5a3f4232ad48b146ed2 [formerly 3ad5acfc99]
Former-commit-id: b7edcf31903826ebb8010f6e694b728e1616a70f
2022-06-21 03:03:23 -04:00
rwinkhart c557d5bfee Update README.md
Added CodeQL badge

Former-commit-id: fa618db3f76919e31da43758bda1652f19e63912 [formerly 6f18076068]
Former-commit-id: 809209a1ba762b6dacb8a1eb9f7199873787438b
2022-06-20 09:15:39 +00:00
rwinkhart acca7d888c Create codeql-analysis.yml
Former-commit-id: 8323ea0d21b761f9ec50a79e926b15d691c9700a [formerly 492b10a44e]
Former-commit-id: 72b9d6a984840d399124efe919adaadd5d0d7f04
2022-06-20 09:05:07 +00:00
rwinkhart 2f3b3c67ba Delete codeql-analysis.yml
Former-commit-id: bedaabebf13648b28a564c575ff82723ddf70904 [formerly 94f5420f83]
Former-commit-id: 61593eb69cc8abb1120925965aaf81504cb8dd4f
2022-06-20 09:04:37 +00:00
rwinkhart 88d2402e88 Create codeql-analysis.yml
Former-commit-id: 3551b0bdb4902910a23abfcb369965f8bfb3dde8 [formerly 4f90e5ca0b]
Former-commit-id: b50cad12f70384329acc728a2628a83158c604af
2022-06-20 08:58:03 +00:00
5 changed files with 116 additions and 15 deletions
+72
View File
@@ -0,0 +1,72 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
- cron: '34 22 * * 5'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
+2
View File
@@ -1,5 +1,7 @@
![sshyp](https://github.com/rwinkhart/sshyp/blob/main/extra/sshyp-linux-banner.png) ![sshyp](https://github.com/rwinkhart/sshyp/blob/main/extra/sshyp-linux-banner.png)
[![CodeQL](https://github.com/rwinkhart/sshyp/actions/workflows/codeql-analysis.yml/badge.svg?branch=main)](https://github.com/rwinkhart/sshyp/actions/workflows/codeql-analysis.yml)
sshyp is a very simple self-hosted, synchronized password manager for UNIX(-like) systems (currently Haiku/FreeBSD/Linux). sshyp is a very simple self-hosted, synchronized password manager for UNIX(-like) systems (currently Haiku/FreeBSD/Linux).
sshyp is compatible with entries created by pass/password-store, as its original goal was to be like pass/password-store, but far more user-friendly to synchronize with a self-hosted server. sshyp is compatible with entries created by pass/password-store, as its original goal was to be like pass/password-store, but far more user-friendly to synchronize with a self-hosted server.
+12 -13
View File
@@ -8,7 +8,7 @@ import random
from shutil import get_terminal_size, move, rmtree from shutil import get_terminal_size, move, rmtree
import sshync import sshync
import string import string
from subprocess import Popen, PIPE, STDOUT from subprocess import CalledProcessError, Popen, PIPE, run
from sys import argv, exit as s_exit from sys import argv, exit as s_exit
from textwrap import fill from textwrap import fill
@@ -155,9 +155,9 @@ def decrypt(_entry_dir, _shm_folder, _shm_entry):
_command = f"{gpg} -qd --output /dev/null {path.expanduser('~/.config/sshyp/lock.gpg')}" _command = f"{gpg} -qd --output /dev/null {path.expanduser('~/.config/sshyp/lock.gpg')}"
else: else:
_command = f"{gpg} -qd --output {tmp_dir}{_shm_folder}/{_shm_entry} {_entry_dir}.gpg" _command = f"{gpg} -qd --output {tmp_dir}{_shm_folder}/{_shm_entry} {_entry_dir}.gpg"
_output = Popen(_command, shell=True, stdout=PIPE, stderr=STDOUT, close_fds=True) try:
_block = _output.communicate()[0].strip() run(_command, shell=True, stderr=PIPE, check=True, close_fds=True)
if _output.returncode == 2: except CalledProcessError:
print(f"\n\u001b[38;5;9merror: could not decrypt - ensure the correct gpg key is present\u001b[0m\n") print(f"\n\u001b[38;5;9merror: could not decrypt - ensure the correct gpg key is present\u001b[0m\n")
s_exit(1) s_exit(1)
@@ -174,15 +174,14 @@ def edit_note(_shm_folder, _shm_entry):
def copy_name_check(_port, _username_ssh, _ip, _client_device_name): def copy_name_check(_port, _username_ssh, _ip, _client_device_name):
_command = f"ssh -o ConnectTimeout=3 -i '{path.expanduser('~/.ssh/sshyp')}' -p {_port} {_username_ssh}@{_ip} " \ _command = f"ssh -o ConnectTimeout=3 -i '{path.expanduser('~/.ssh/sshyp')}' -p {_port} {_username_ssh}@{_ip} " \
f"\"touch '/home/{_username_ssh}/.config/sshyp/devices/{_client_device_name}'\"" f"\"touch '/home/{_username_ssh}/.config/sshyp/devices/{_client_device_name}'\""
_output = Popen(_command, shell=True, stdout=PIPE, stderr=STDOUT, close_fds=True) try:
_block = _output.communicate()[0].strip() run(_command, shell=True, stderr=PIPE, check=True, close_fds=True)
if _output.returncode != 0: except CalledProcessError:
print('\n\u001b[38;5;9mwarning: ssh connection could not be made - ensure the public key (~/.ssh/sshyp.pub) is ' print('\n\u001b[38;5;9mwarning: ssh connection could not be made - ensure the public key (~/.ssh/sshyp.pub) is '
'registered on the remote server and that the entered ip, port, and username are correct\n\nsyncing ' 'registered on the remote server and that the entered ip, port, and username are correct\n\nsyncing '
'functionality will be disabled until this is addressed\u001b[0m\n') 'functionality will be disabled until this is addressed\u001b[0m\n')
open(path.expanduser('~/.config/sshyp/ssh-error'), 'w').write('1') open(path.expanduser('~/.config/sshyp/ssh-error'), 'w').write('1')
return 1 return 1
else:
open(path.expanduser('~/.config/sshyp/ssh-error'), 'w').write('0') open(path.expanduser('~/.config/sshyp/ssh-error'), 'w').write('0')
return 0 return 0
@@ -311,7 +310,7 @@ def print_info(): # prints help text based on argument
'randall winkhart\u001b[38;5;15;48;5;15m \u001b[38;5;7;48;5;8m/\u001b[0m') 'randall winkhart\u001b[38;5;15;48;5;15m \u001b[38;5;7;48;5;8m/\u001b[0m')
print('\u001b[38;5;7;48;5;8m/\u001b[38;5;15;48;5;15m ' print('\u001b[38;5;7;48;5;8m/\u001b[38;5;15;48;5;15m '
'\u001b[38;5;7;48;5;8m/\u001b[0m') '\u001b[38;5;7;48;5;8m/\u001b[0m')
print('\u001b[38;5;7;48;5;8m/\u001b[38;5;15;48;5;15m \u001b[38;5;15;48;5;8mversion 1.0.0' print('\u001b[38;5;7;48;5;8m/\u001b[38;5;15;48;5;15m \u001b[38;5;15;48;5;8mversion 1.0.1'
'\u001b[38;5;15;48;5;15m \u001b[38;5;7;48;5;8m/\u001b[0m') '\u001b[38;5;15;48;5;15m \u001b[38;5;7;48;5;8m/\u001b[0m')
print('\u001b[38;5;7;48;5;8m/\u001b[38;5;15;48;5;15m \u001b[38;5;15;48;5;8mthe polished trotters ' print('\u001b[38;5;7;48;5;8m/\u001b[38;5;15;48;5;15m \u001b[38;5;15;48;5;8mthe polished trotters '
'update\u001b[38;5;15;48;5;15m \u001b[38;5;7;48;5;8m/\u001b[0m') 'update\u001b[38;5;15;48;5;15m \u001b[38;5;7;48;5;8m/\u001b[0m')
@@ -590,7 +589,7 @@ def copy_data(): # copies a specified field of an entry to the clipboard
system('clipboard -c ' + "'" + _copy_line[2].replace('\n', '').replace("'", "'\\''") + "'") system('clipboard -c ' + "'" + _copy_line[2].replace('\n', '').replace("'", "'\\''") + "'")
elif argument_list[1] == 'note' or argument_list[1] == '-n': elif argument_list[1] == 'note' or argument_list[1] == '-n':
system('clipboard -c ' + "'" + _copy_line[3].replace('\n', '').replace("'", "'\\''") + "'") system('clipboard -c ' + "'" + _copy_line[3].replace('\n', '').replace("'", "'\\''") + "'")
Popen('sleep 30; clipboard -r', shell=True) Popen('sleep 30; clipboard -r', shell=True, close_fds=True)
elif Path("/data/data/com.termux").exists(): # Termux (Android) clipboard detection elif Path("/data/data/com.termux").exists(): # Termux (Android) clipboard detection
if argument_list[1] == 'username' or argument_list[1] == '-u': if argument_list[1] == 'username' or argument_list[1] == '-u':
system('termux-clipboard-set ' + "'" + _copy_line[1].replace('\n', '').replace("'", "'\\''") + "'") system('termux-clipboard-set ' + "'" + _copy_line[1].replace('\n', '').replace("'", "'\\''") + "'")
@@ -600,7 +599,7 @@ def copy_data(): # copies a specified field of an entry to the clipboard
system('termux-clipboard-set ' + "'" + _copy_line[2].replace('\n', '').replace("'", "'\\''") + "'") system('termux-clipboard-set ' + "'" + _copy_line[2].replace('\n', '').replace("'", "'\\''") + "'")
elif argument_list[1] == 'note' or argument_list[1] == '-n': elif argument_list[1] == 'note' or argument_list[1] == '-n':
system('termux-clipboard-set ' + "'" + _copy_line[3].replace('\n', '').replace("'", "'\\''") + "'") system('termux-clipboard-set ' + "'" + _copy_line[3].replace('\n', '').replace("'", "'\\''") + "'")
Popen("sleep 30; termux-clipboard-set ''", shell=True) Popen("sleep 30; termux-clipboard-set ''", shell=True, close_fds=True)
elif environ.get('WAYLAND_DISPLAY') == 'wayland-0': # Wayland clipboard detection elif environ.get('WAYLAND_DISPLAY') == 'wayland-0': # Wayland clipboard detection
if argument_list[1] == 'username' or argument_list[1] == '-u': if argument_list[1] == 'username' or argument_list[1] == '-u':
system('wl-copy ' + "'" + _copy_line[1].replace('\n', '').replace("'", "'\\''") + "'") system('wl-copy ' + "'" + _copy_line[1].replace('\n', '').replace("'", "'\\''") + "'")
@@ -610,7 +609,7 @@ def copy_data(): # copies a specified field of an entry to the clipboard
system('wl-copy ' + "'" + _copy_line[2].replace('\n', '').replace("'", "'\\''") + "'") system('wl-copy ' + "'" + _copy_line[2].replace('\n', '').replace("'", "'\\''") + "'")
elif argument_list[1] == 'note' or argument_list[1] == '-n': elif argument_list[1] == 'note' or argument_list[1] == '-n':
system('wl-copy ' + "'" + _copy_line[3].replace('\n', '').replace("'", "'\\''") + "'") system('wl-copy ' + "'" + _copy_line[3].replace('\n', '').replace("'", "'\\''") + "'")
Popen('sleep 30; wl-copy -c', shell=True) Popen('sleep 30; wl-copy -c', shell=True, close_fds=True)
else: # X11 clipboard detection else: # X11 clipboard detection
if argument_list[1] == 'username' or argument_list[1] == '-u': if argument_list[1] == 'username' or argument_list[1] == '-u':
system('echo -n ' + "'" + _copy_line[1].replace('\n', '').replace("'", "'\\''") + "'" + ' | xclip -sel c') system('echo -n ' + "'" + _copy_line[1].replace('\n', '').replace("'", "'\\''") + "'" + ' | xclip -sel c')
@@ -620,7 +619,7 @@ def copy_data(): # copies a specified field of an entry to the clipboard
system('echo -n ' + "'" + _copy_line[2].replace('\n', '').replace("'", "'\\''") + "'" + ' | xclip -sel c') system('echo -n ' + "'" + _copy_line[2].replace('\n', '').replace("'", "'\\''") + "'" + ' | xclip -sel c')
elif argument_list[1] == 'note' or argument_list[1] == '-n': elif argument_list[1] == 'note' or argument_list[1] == '-n':
system('echo -n ' + "'" + _copy_line[3].replace('\n', '').replace("'", "'\\''") + "'" + ' | xclip -sel c') system('echo -n ' + "'" + _copy_line[3].replace('\n', '').replace("'", "'\\''") + "'" + ' | xclip -sel c')
Popen("sleep 30; echo -n '' | xclip -sel c", shell=True) Popen("sleep 30; echo -n '' | xclip -sel c", shell=True, close_fds=True)
rmtree(f"{tmp_dir}{_shm_folder}") rmtree(f"{tmp_dir}{_shm_folder}")
+14
View File
@@ -1,3 +1,17 @@
sshyp v1.0.1
The Polished Trotters Update - Patch 1
This is a hotfix for the Haiku decryption bug.
Changes:
- subprocess.Popen has been replaced with subprocess.run where applicable
- stdout is no longer captured with any subprocess.Popen or subprocess.run usages
^ this fixes decryption on Haiku
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
sshyp v1.0.0 sshyp v1.0.0
The Polished Trotters Update The Polished Trotters Update
+14
View File
@@ -1,3 +1,17 @@
sshyp v1.0.1
The Polished Trotters Update - Patch 1
This is a hotfix for the Haiku decryption bug.
Changes:
- subprocess.Popen has been replaced with subprocess.run where applicable
- stdout is no longer captured with any subprocess.Popen or subprocess.run usages
^ this fixes decryption on Haiku
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
sshyp v1.0.0 sshyp v1.0.0
The Polished Trotters Update The Polished Trotters Update