273 Commits
Author SHA1 Message Date
RandyTheSilly 353b6a67de Prepare for release v0.3.1 2025-11-23 04:25:14 -05:00
RandyTheSilly bc35766de5 Sync with libmutton v0.4.2 2025-11-09 18:15:18 -05:00
RandyTheSilly 3cb0bdce59 Rename all occurrences of "passphrase" to "password"; bump libmutton 2025-10-26 13:25:42 -04:00
RandyTheSilly bfb6372c29 Correct misleading variable name 2025-10-26 12:10:09 -04:00
RandyTheSilly 32f9dd45fa Prepare for release v0.3.0 2025-08-17 14:03:28 -04:00
RandyTheSilly 25aaeb74a3 Bump libmutton to latest development version 2025-08-17 13:26:11 -04:00
RandyTheSilly d8842138ea Bump libmutton to latest development version 2025-07-08 19:11:14 -04:00
Randall Winkhart a7a92e78b5 Re-license under AGPL 3.0 for legal binary distribution of go-highlite, based on https://github.com/jessp01/gohighlight
I would rather keep this project under a permissive license, but a dependency forced this change.

libmutton will remain MIT licensed.
2025-07-03 03:04:44 +00:00
RandyTheSilly 49d23b365d Re-use text editor input code 2025-07-02 22:52:18 -04:00
RandyTheSilly 2712fecf68 Update draft release notes for v0.4.0 2025-07-02 22:48:19 -04:00
RandyTheSilly 45c03f0fe4 Handle cases where the user initialized libmutton in a different client and has no text editor specified (also allow setting a text editor in the tweak menu) 2025-07-02 22:38:51 -04:00
RandyTheSilly 97d49fdba1 Add draft release notes for v0.3.0 2025-06-19 20:09:12 -04:00
RandyTheSilly 52628dba0a Remove alternative Markdown renderer build options (Glamour performance issues addressed in custom fork; other options need more work) 2025-06-19 14:55:29 -04:00
RandyTheSilly d2b2dcf7cf Bump dependencies 2025-06-19 14:42:11 -04:00
RandyTheSilly 0895dcba8a Replace glamour with (temporary) custom fork using lighter syntax highlighter 2025-06-19 14:36:37 -04:00
RandyTheSilly b942867692 Assign vanity name for upcoming update 2025-06-07 20:18:32 -04:00
RandyTheSilly bdaaf0906c Bump libmutton/go-boilerplate 2025-06-01 17:04:27 -04:00
RandyTheSilly 9201e3857c Port to latest libmutton development version 2025-06-01 16:54:04 -04:00
RandyTheSilly 511204d17a Fix folder sync 2025-06-01 15:44:31 -04:00
RandyTheSilly 9ee2f7ae0f Port to latest libmutton development version 2025-06-01 15:31:33 -04:00
RandyTheSilly 499c9cdd40 Simplify error codes 2025-06-01 14:31:46 -04:00
RandyTheSilly 1488c7d536 Add ability to change device ID through tweak menu 2025-06-01 12:18:48 -04:00
RandyTheSilly 05f95a4c0c Advertise "tweak" argument 2025-06-01 11:55:59 -04:00
RandyTheSilly 59cb9ac0d1 Support libmutton's EntryRefresh() feature 2025-05-31 23:29:12 -04:00
RandyTheSilly eda08ad9b6 Standardize some variable names; port to latest libmutton development version 2025-05-31 17:54:12 -04:00
RandyTheSilly 1370f5cd80 Port to latest libmutton development version 2025-05-30 00:38:59 -04:00
RandyTheSilly 5af8caf680 Port to latest libmutton development version; address JetBrains warnings 2025-05-29 22:38:07 -04:00
RandyTheSilly 2ab8eac7a4 Port to latest libmutton development version 2025-05-29 23:38:23 +00:00
RandyTheSilly 9cd248eb8b Add output binary comments 2025-05-21 16:48:44 +00:00
RandyTheSilly cc3416a89c Build release binaries to target x86_64_v2 and arm64v8.7+crypto (v8.0 still offered on Linux) 2025-05-21 16:45:06 +00:00
RandyTheSilly a0cde0aff0 wiki: Link to libmutton TOTP usage info 2025-05-21 15:30:34 +00:00
RandyTheSilly b1853dd763 Sync changes from all dependencies 2025-05-20 17:40:25 +00:00
RandyTheSilly 85584da807 Fix non-functional break statement 2025-05-19 20:43:25 +00:00
RandyTheSilly 72755e91b5 Default to "edit" for note editing on Windows; bump libmutton 2025-05-19 19:58:19 +00:00
RandyTheSilly 310c935d2d Port to latest libmutton development version (account for massive refactor) 2025-05-12 16:46:17 +00:00
RandyTheSilly 392af55b4c Bump RCW to v0.1.1 (fix RCWD on Termux) 2025-05-11 17:09:45 -04:00
RandyTheSilly 2f9d5df285 Bump libmutton to latest development version (fix decryption across devices) 2025-05-11 15:40:16 -04:00
RandyTheSilly d15e71a88f Fix building for many non-Linux platforms 2025-05-11 00:44:46 -04:00
RandyTheSilly 5acb7e47bf Simplify sanity check file generation 2025-05-11 00:30:24 -04:00
RandyTheSilly 2def48e58b Add clipboard utilities to dependency documentation 2025-05-09 19:18:15 +00:00
RandyTheSilly 7ed199cba1 Update wiki for migration off of GPG 2025-05-09 19:15:48 +00:00
RandyTheSilly 1ed4b8d4dc Drop gnupg dependency in build scripts 2025-05-09 18:28:52 +00:00
RandyTheSilly 74926a2577 Update roadmap 2025-05-09 18:25:28 +00:00
RandyTheSilly 54a7d51efa Port to latest libmutton development version (use go-boilerplate) 2025-05-09 16:57:57 +00:00
RandyTheSilly 2f34fc2c0c Port to latest libmutton/rcw development versions 2025-05-08 19:44:51 -04:00
RandyTheSilly 752b9d616a Bump libmutton to latest development version (fix RCWD cleanup on force exit) 2025-05-04 20:06:26 -04:00
RandyTheSilly 6504bdc8a6 Add support for the RCW daemon 2025-05-04 19:51:16 -04:00
RandyTheSilly 1180112967 Remove unneeded variable declaration 2025-05-04 18:09:50 -04:00
RandyTheSilly a144b2769d Port to latest libmutton development version & begin migration from GPG to RCW 2025-05-04 18:07:02 -04:00
RandyTheSilly b366d1e13e Prepare for release v0.2.6 2025-04-21 18:17:53 -04:00
RandyTheSilly 34136633d9 Bump libmutton & support new password generation options; bump other dependencies 2025-04-21 12:19:56 -04:00
RandyTheSilly 8166bfcfbe Fix inability to remove notes from entries 2025-04-20 00:21:11 -04:00
RandyTheSilly 63c663ab36 Port to newest libmutton development version 2025-03-18 23:09:11 -04:00
RandyTheSilly fab4bd8d37 Port to newest libmutton development version 2025-03-16 18:30:51 -04:00
RandyTheSilly c6ea3b0136 Prepare for release v0.2.5 2025-02-22 17:23:09 -05:00
RandyTheSilly a0d75aad20 Bump libmutton to v0.3.0; bump select indirect dependencies 2025-02-22 17:02:14 -05:00
RandyTheSilly 0a622765cc Bump Go to v1.24.0; bump dependencies (libmutton and glamour-related) 2025-02-15 13:09:04 -05:00
RandyTheSilly e2d79d4ce3 Make use of libmutton's new core.PrintError utility function 2025-02-01 21:01:35 -05:00
RandyTheSilly d323f2f75a Do not re-upload entries when adding a blank note 2025-02-01 12:19:27 -05:00
RandyTheSilly 4556e38e32 Save and restore space indices for new PowerShell sessions (fixes up arrow commands) 2025-01-28 22:06:58 -05:00
RandyTheSilly edc2ef25de Fix PowerShell completions breaking when multiple entries with similar names (containing spaces) exist in the same directory 2025-01-28 21:10:10 -05:00
RandyTheSilly f21041a38d Fix sync error when syncing a folder that was previously sheared (via libmutton bump) 2025-01-26 18:14:52 -05:00
RandyTheSilly 0c57bd5764 Allow leaving trailing spaces (two) in note lines for manual breaks in Markdown (currently only supported in BEAN) 2025-01-18 21:23:48 -05:00
RandyTheSilly dd8464ecd9 Do not check if an entry already exists when writing (add); an earlier check is already performed 2025-01-18 19:33:54 -05:00
RandyTheSilly 38ddc32656 Make "ansiEmptyDirectoryWarning" more visible in light terminal themes 2025-01-18 18:39:44 -05:00
RandyTheSilly 27e6972d82 Fix build failures on MacOS, Windows, and Termux (via libmutton bump) 2025-01-16 16:45:56 -05:00
RandyTheSilly 118ffc2adb Move expandPathWithHome to libmutton 2025-01-16 14:26:57 -05:00
RandyTheSilly d1d88c2e69 Port to newest libmutton development version 2025-01-16 13:49:21 -05:00
RandyTheSilly cb1b010e0a Timeout SSH dialing after 3 seconds (via libmutton bump) 2025-01-12 21:18:29 -05:00
RandyTheSilly 6210c9cd31 Port to newest libmutton development version; bump copyright date 2025-01-11 18:06:11 -05:00
RandyTheSilly 6d557a77c2 Port to newest libmutton development version 2024-12-29 16:42:34 -05:00
RandyTheSilly 4933da4c37 Bump libmutton and support new SSH identity file passphrase entry 2024-12-28 15:13:40 -05:00
RandyTheSilly 0e056822ef Bump golang.org/x/net to address CVE-2024-45338 2024-12-20 20:38:59 -05:00
RandyTheSilly c323899bf8 Update for compatibility with upcoming libmutton version's new copy behavior 2024-12-20 20:36:56 -05:00
RandyTheSilly cfb4a2ad51 Prepare for release v0.2.4 2024-12-13 12:43:46 -05:00
RandyTheSilly dda33755b3 Bump Go to v1.23.4; bump dependencies (including golang.org/x/crypto to address CVE-2024-45337) 2024-12-13 12:05:06 -05:00
RandyTheSilly 544261a461 Remove commit.sh 2024-10-29 17:18:02 -04:00
RandyTheSilly 77014cf5e3 Add optional build tag for experimental BEAN Markdown renderer support 2024-10-29 17:08:57 -04:00
RandyTheSilly 750029a491 Add Go bump to patch notes 2024-10-19 17:00:40 -04:00
RandyTheSilly 380c49bd00 Prepare for release v0.2.3 2024-10-19 16:53:04 -04:00
RandyTheSilly 33b8704f0c Bump dependencies 2024-10-19 16:32:25 -04:00
RandyTheSilly f96b60d3ef Bump Go to v1.23.2 2024-10-19 16:02:20 -04:00
RandyTheSilly 13422e12c4 Add script to generate Alpine APKBUILDs 2024-10-19 15:34:08 -04:00
RandyTheSilly 880d633da0 Improve Arch PKGBUILD's CPU feature detection 2024-10-19 11:37:41 -04:00
RandyTheSilly cbf9035969 Add gnupg as a dependency in Arch PKGBUILD 2024-10-18 12:37:38 -04:00
RandyTheSilly a5d93d4527 Correct typo in release notes archive 2024-10-18 12:21:46 -04:00
RandyTheSilly 0c62a84195 Prepare for release v0.2.2 2024-08-20 21:17:13 -04:00
RandyTheSilly 8c1b986e20 Fix adding new entries on Windows 2024-08-19 22:14:47 -04:00
RandyTheSilly a44bef1db9 Prepare for release v0.2.1 2024-08-13 22:33:37 -04:00
RandyTheSilly 9cc4965ed8 Bump: github.com/rwinkhart/libmutton PRE-TAG => v0.2.1; add script for generating release binaries 2024-08-13 21:46:14 -04:00
RandyTheSilly b68b2a8931 Implement error-specific exit codes defined by libmutton 2024-08-13 17:36:15 -04:00
RandyTheSilly 888b1ca80d Properly format function documentation comments 2024-08-11 19:05:16 -04:00
RandyTheSilly 498fe20d95 [wiki] Update to match libmutton wiki changes 2024-08-08 20:06:22 -04:00
RandyTheSilly 35df3b078f Add AUR link to README.md; update roadmap 2024-08-08 19:39:33 -04:00
RandyTheSilly 113883f40a Remove gofmt targets that have been relocated 2024-08-08 19:14:56 -04:00
RandyTheSilly 73346b15cb [wiki] Fix links to various wiki pages 2024-08-08 19:13:25 -04:00
RandyTheSilly 66ea87aa11 Update README.md to accommodate repo split 2024-08-08 19:06:14 -04:00
RandyTheSilly 369aab5074 Update .gitignore 2024-08-08 18:42:57 -04:00
RandyTheSilly d8a239237c Decouple MUTN and libmutton versions 2024-08-08 18:38:12 -04:00
RandyTheSilly 39bc3bc442 Bump libmutton to v0.0.0-20240808213918-f5e5cd31bb85 2024-08-08 18:08:26 -04:00
RandyTheSilly 58dde7ed5d Move libmuttonserver.go to github.com/rwinkhart/libmutton 2024-08-08 17:41:22 -04:00
RandyTheSilly a23ae4a4b9 Switch to dependence on github.com/rwinkhart/libmutton 2024-08-08 17:24:48 -04:00
RandyTheSilly 57378c521a [wiki] Remove extra subdirectory 2024-08-08 17:09:47 -04:00
RandyTheSilly 3480fd8fdb Ship man page in PKGBUILD 2024-08-06 16:33:34 -04:00
RandyTheSilly bb127860c3 PKGBUILD description: specify for CLI 2024-08-06 16:10:08 -04:00
RandyTheSilly 68ea24fc15 [wiki/MUTN] Mention AUR package from install guide and mention that pre-built binaries do not use CGO 2024-08-06 15:55:36 -04:00
RandyTheSilly db7e95d4af Fix PKGBUILD x86_64 feature level check 2024-08-06 15:35:51 -04:00
RandyTheSilly 871897b6ce [wiki/MUTN] Link to release page from install guide; mention server binary must be called "libmuttonserver" 2024-08-06 15:24:17 -04:00
RandyTheSilly c80f875623 Prepare for release v0.2.0 2024-08-06 14:57:09 -04:00
RandyTheSilly 3e2a2839c5 Bump Go to v1.22.6; bump dependencies 2024-08-06 14:34:23 -04:00
RandyTheSilly fe412daa8d [wiki/MUTN] Link Glamour issue for v0.8.0 regression 2024-08-05 23:10:17 -04:00
RandyTheSilly e59cdaa88e Do not use deprecated golang.org/x/crypto/ssh/terminal 2024-08-05 22:29:43 -04:00
RandyTheSilly 72da94d682 [wiki/MUTN] Specify why MUTN is using out-of-date Glamour 2024-08-05 15:42:40 -04:00
RandyTheSilly ffe220fa9b Retrieve packaging version number from a temporary Go program 2024-08-05 14:00:49 -04:00
RandyTheSilly 0494143318 Add initial packaging script (currently only for generating source PKGBUILD) 2024-08-05 13:36:05 -04:00
RandyTheSilly 322877d273 Bump dependencies 2024-08-05 10:09:16 -04:00
RandyTheSilly 15e9f77f59 Announce TOTP code has been copied only after the entry has already been decrypted 2024-07-30 18:32:14 -04:00
RandyTheSilly 4785634454 [wiki/MUTN] Fix ordered list in usage guide 2024-07-30 16:20:44 -04:00
RandyTheSilly b839dc2772 [wiki/MUTN] Link to usage guide from installation guide 2024-07-30 16:00:24 -04:00
RandyTheSilly 6b04d7367e Update README.md w/banner image and a link to the installation guide 2024-07-30 15:57:43 -04:00
RandyTheSilly 4b82738048 Add fallback SSH identity file (~/.ssh/id_ed25519) 2024-07-21 22:56:24 -04:00
RandyTheSilly cdb2c949f0 Verify user-specified SSH identity file exists 2024-07-21 22:41:13 -04:00
RandyTheSilly 79d1713080 [wiki/MUTN] Add basic setup and usage instructions 2024-07-19 17:56:42 -04:00
RandyTheSilly d659291a2f Fail early if adding an entry to a directory that does not exist (or if the directory is a file) 2024-07-19 15:53:54 -04:00
RandyTheSilly 9077501d66 Fix rename prompting for new location before verifying old one exists 2024-07-19 13:48:14 -04:00
RandyTheSilly 07d2c5fd04 Update README.md 2024-07-19 03:17:30 -04:00
RandyTheSilly cdf554179a Improve StringGen to allow creating file name-safe complex strings; remove in-code references to future additions 2024-07-18 17:04:48 -04:00
RandyTheSilly ba197006a5 Do not upload/download any entries if the client and server time are more than 30 seconds out of sync; appropriately warn the user 2024-07-18 15:55:50 -04:00
RandyTheSilly 19bccf1464 Fix ANSI escapes (on Windows) not being interpreted after using GPG pinentry 2024-07-17 18:54:29 -04:00
RandyTheSilly 1e5c0feaba Simplify text editor fallback 2024-07-17 17:26:01 -04:00
RandyTheSilly c9b87dd121 Move text editor config under [MUTN] section header in libmutton.ini 2024-07-17 15:53:17 -04:00
RandyTheSilly 4daa031c0e Allow writing to different section headers in libmutton.ini 2024-07-17 15:49:45 -04:00
RandyTheSilly e6edc7c336 Move text editor determination to cli package 2024-07-17 14:59:57 -04:00
RandyTheSilly d46a2eddfc Allow parsing different section headers in libmutton.ini 2024-07-17 14:44:18 -04:00
RandyTheSilly 5d32636816 Use more specific names for global variables in Bash and ZSH completions 2024-07-16 18:35:31 -04:00
RandyTheSilly f7555f35ec Allow using Powershell completions on non-Windows platforms 2024-07-16 18:12:34 -04:00
RandyTheSilly fa93b53aba [wiki/MUTN] Add more Glamour-related issues to known bugs list 2024-07-16 16:24:57 -04:00
RandyTheSilly 0a56130d94 Clarify key-based authentication requirement in man page 2024-07-16 16:05:29 -04:00
RandyTheSilly c6734dd283 Add tag for building without Markdown support 2024-07-16 15:30:48 -04:00
RandyTheSilly 66e9511eec Do not initialize extra iterator in EntryReader() 2024-07-16 14:52:09 -04:00
RandyTheSilly 3535368424 Update .gitignore to ignore specific files rather than everything not manually added 2024-07-16 14:17:38 -04:00
RandyTheSilly 3c896b492c Bump "regexp2" to v1.11.2 2024-07-15 16:59:58 -04:00
RandyTheSilly 54d5d8bd0e Add initial man page and make help info wording more consistent 2024-07-15 16:01:43 -04:00
RandyTheSilly 82b1e31e5b Replace use of ASCII control characters with unicode characters allowed in Windows filenames (fixes shearing with a Windows server) 2024-07-10 15:23:13 -04:00
RandyTheSilly 0ebc404db2 Remove "-v" and "-h" shortcuts from server for consistency with MUTN cli 2024-07-10 03:44:59 -04:00
RandyTheSilly 08e8a64d29 Split sync.Rename into separate functions for client and server to avoid compiling SSH into the server binary 2024-07-10 00:01:59 -04:00
RandyTheSilly b9ac59fb67 Implement synchronized renaming 2024-07-09 23:18:13 -04:00
RandyTheSilly 9614ffc513 Expand "~" to home directory when specifying ssh identity file 2024-07-09 17:23:36 -04:00
RandyTheSilly 20c70bac9e Prompt for SSH port before IP (to avoid users responding to the IP prompt with a socket); specify SSH address may be a domain name 2024-07-09 15:26:17 -04:00
RandyTheSilly 48576ced29 [wiki/MUTN] Add known bugs list 2024-07-09 14:51:47 -04:00
RandyTheSilly e3aabfb7e4 Fix PowerShell completions not completing after directories containing spaces 2024-07-09 14:29:15 -04:00
RandyTheSilly d749452943 [wiki/MUTN] Move shell completions download link to completions.md 2024-07-07 23:08:11 -04:00
RandyTheSilly a6abd6c04e Sort shell completions scripts into folders so that their intended names can be used 2024-07-07 23:04:53 -04:00
RandyTheSilly 565f869da1 [wiki/MUTN] Add basic building/installation instructions 2024-07-07 22:59:55 -04:00
RandyTheSilly 995e2bd982 [wiki/MUTN] Add list of Windows quirks 2024-07-06 00:18:32 -04:00
RandyTheSilly 37f5883893 [wiki/MUTN] Add shell completions troubleshooting guide 2024-07-06 00:04:28 -04:00
RandyTheSilly 4b16bb9d22 Implement initial markdown wiki w/copy of clipboard troubleshooting info from sshyp 2024-07-05 23:42:40 -04:00
RandyTheSilly 964b6ea589 Bump Go to v1.22.5, bump dependencies 2024-07-05 22:32:34 -04:00
RandyTheSilly b757cdc30d Remove "-v" shortcut for "version" argument, as it does not work with Powershell completion; remove "-h" visual option for "help" for consistency 2024-07-05 21:41:18 -04:00
RandyTheSilly 6511ac6b6a Improve error clarity in cli.editNote 2024-06-05 18:19:01 -04:00
RandyTheSilly 71b5dc75cf Improve generic UNIX clipboard clearing logic 2024-06-05 17:43:21 -04:00
RandyTheSilly 6dc26859e9 Provide feedback after successful server directory initialization 2024-06-05 17:24:45 -04:00
RandyTheSilly 295b126d3a Write and append to config file using ini package 2024-06-05 14:56:17 -04:00
RandyTheSilly 1ec966b396 Enforce more consistent meanings for the various field separator characters 2024-06-04 21:51:58 -04:00
RandyTheSilly 4bec8d3e83 Server stdin migration: register 2024-06-04 20:05:12 -04:00
RandyTheSilly e49a7d8f0a Server stdin migration: shear 2024-06-04 15:57:00 -04:00
RandyTheSilly b2ba8b84d9 Server stdin migration: fetch 2024-06-04 15:38:46 -04:00
RandyTheSilly 6aaa9611ac Server stdin migration: addfolder 2024-06-04 15:33:50 -04:00
RandyTheSilly 7ab46f7402 Add initial support for reading stdin from the server binary 2024-06-04 15:09:57 -04:00
RandyTheSilly 182b50cd27 Fix Windows sync (WalkEntryDir now returns only UNIX-style separators); fix setting remote mod time on remote files when downloading; fix server binary compilation; fix init failing silently during SSH configuration 2024-05-31 01:23:50 -04:00
RandyTheSilly 423ea8a81b Fix init deleting device ID immediately after generating it; fix sync failure for non-manual syncs 2024-05-30 23:25:08 -04:00
RandyTheSilly 7dd313add0 Save server EntryRoot and OS type during init, use to progress toward Windows server support 2024-05-30 22:57:05 -04:00
RandyTheSilly 29d7f4d655 Simplify clipboard build constraints 2024-05-30 22:21:39 -04:00
RandyTheSilly b0d6c6121b Lay groundwork for NT/UNIX-like sync interoperability 2024-05-30 22:12:29 -04:00
RandyTheSilly 7ff5e5abfd Add "wsl_clipboard" build tag for creating Linux binaries that use the Windows clipboard 2024-05-29 15:42:15 -04:00
RandyTheSilly 7abad339af Update README.md now that native sync has been implemented 2024-05-29 13:59:43 -04:00
RandyTheSilly 7c29bde27a Bump dependencies 2024-05-29 13:26:28 -04:00
RandyTheSilly c7a2b4fb95 Reorganize function parameters to not specify repeat types 2024-05-29 13:23:08 -04:00
RandyTheSilly 4d735d220b Rename "hidePassword" to "hideSecrets" for clarity 2024-05-29 12:50:47 -04:00
RandyTheSilly ca160adabc Move TOTP secrets to a dedicated entry field (breaks sshyp entry format compatibility) 2024-05-21 19:21:42 -04:00
RandyTheSilly f5c5a28545 Reduce size of server binary by not compiling SSH 2024-05-19 19:34:28 -04:00
RandyTheSilly 665d4d4cb1 Switch from SCP to SFTP for sync 2024-05-19 17:30:39 -04:00
RandyTheSilly bc51f20d41 Promote native sync to replace sshyp-based sync on all platforms 2024-05-17 19:49:49 -04:00
RandyTheSilly 1230c8a437 Make server respond to "fetch" with output formatted for the client's OS family 2024-05-17 19:36:23 -04:00
RandyTheSilly 5ecd7142b3 Implement initial SCP functionality (not yet usable due to mod times not being preserved) 2024-05-17 15:44:15 -04:00
RandyTheSilly 8c1eaf3d65 Fix import cycle (over SSH keyfile passphrase input) 2024-05-17 12:25:10 -04:00
RandyTheSilly 66995c3c06 Implement initial support for passphrase-protected SSH keyfiles 2024-05-17 11:42:44 -04:00
RandyTheSilly d8fa62f1ad Add help and version info for server binary 2024-05-16 22:22:12 -04:00
RandyTheSilly da044ca59a Remove pre-existing config directory during init, structure Windows config directory more similarly to UNIX 2024-05-16 21:40:02 -04:00
RandyTheSilly a703c6b2ac Move device ID generation to sync.DeviceIDGen 2024-05-16 21:26:42 -04:00
RandyTheSilly 854bd906f0 When a folder is created on the client, also create it on the server 2024-05-16 21:15:16 -04:00
RandyTheSilly ddb2f257f3 Parse deletions per-deviceID 2024-05-16 17:46:03 -04:00
RandyTheSilly f18a023bb7 Implement device ID server registration and server-side init 2024-05-16 17:14:42 -04:00
RandyTheSilly bb67446653 Implement initial server-side shearing logic 2024-05-16 16:35:05 -04:00
RandyTheSilly 043a17de59 Bump dependencies 2024-05-15 17:14:36 -04:00
RandyTheSilly 102d2a8ee6 Better fetch remote data in a way that does not add blank items to slices 2024-05-15 16:57:46 -04:00
RandyTheSilly 7ab5e67256 Implement initial server-side code 2024-05-15 16:25:42 -04:00
RandyTheSilly e4b9ca6c34 Implement initial SSH data retrieval 2024-05-15 14:58:21 -04:00
RandyTheSilly 570e257f08 Initial groundwork for native sync support 2024-05-11 20:52:38 -04:00
RandyTheSilly db5f3ec7f4 Prepare to tag v0.1.0 2024-04-16 11:33:06 -04:00
RandyTheSilly 93d7670508 Merge EditEntryNote into EditEntryField 2024-04-16 11:20:22 -04:00
RandyTheSilly f33eb3d480 Refactor for better modularity (share more code among edit functions, rename "offline" package to "backend" 2024-04-15 18:16:05 -04:00
RandyTheSilly d124080813 Strip trailing whitespace from each line in notes before saving 2024-04-15 16:52:16 -04:00
RandyTheSilly 995fcac0ab Use gruvbox colors for version info graphic 2024-04-12 21:32:06 -04:00
RandyTheSilly 3be77fe1ac Move initial directory indentation multiplier determination to be with rest of indentation logic 2024-04-12 16:00:34 -04:00
RandyTheSilly 9eefcb7c47 Show total entry count in entry list 2024-04-12 11:32:25 -04:00
RandyTheSilly 8b2b7ac7ff Bump dependencies 2024-04-12 11:16:34 -04:00
RandyTheSilly 426f91bda0 (Markdown) Improve consistency of in-line code and block quote colors (block quotes are currently busted) 2024-04-11 16:46:31 -04:00
RandyTheSilly 468a28a036 (Markdown) Reduce quantity of "+" in lower-tier headings 2024-04-11 16:15:12 -04:00
RandyTheSilly e3ebcf0db4 (Markdown) Fix definitions lists, set color for HR, images 2024-04-11 16:10:44 -04:00
RandyTheSilly 513fdd6f2e (Markdown) Make code block syntax highlighting more consistent with gruvbox 2024-04-11 15:45:41 -04:00
RandyTheSilly 58facd2ad0 (Markdown) Make headers more aesthetically pleasing 2024-04-11 14:49:13 -04:00
RandyTheSilly d85abd6b37 (Markdown) Add new, more consistent header design 2024-04-10 22:30:42 -04:00
RandyTheSilly 1b27121c26 (Markdown) More clearly identify code blocks 2024-04-10 21:32:17 -04:00
RandyTheSilly 6b0ad509f5 (Markdown) Use full terminal width for horizontal rulers 2024-04-10 20:16:39 -04:00
RandyTheSilly 09eec99fe1 Lay groundwork for multiple color-scheme support 2024-04-10 17:03:37 -04:00
RandyTheSilly 13352ec2b4 Wrap markdown text at full terminal width 2024-04-05 18:48:48 -04:00
RandyTheSilly 34a01f3688 Do not surround in-line code with spaces 2024-04-05 15:37:02 -04:00
RandyTheSilly 3e37ae8173 Support hard line breaks in markdown notes 2024-04-05 14:18:35 -04:00
RandyTheSilly ad7e90c43e Break out of switch after printing notes (no need to check additional lines) 2024-04-05 12:57:57 -04:00
RandyTheSilly 074e74b622 Build default Glamour style into binary 2024-04-04 19:57:22 -04:00
RandyTheSilly 8c5109e904 Commit WIP glamour style 2024-04-04 18:28:40 -04:00
RandyTheSilly dce483909b Implement initial markdown notes support with Glamour (buggy, not ready for daily use) 2024-04-04 18:26:32 -04:00
RandyTheSilly 115e0a3e0f Implement Steam TOTP support using github.com/fortis/go-steam-totp 2024-03-22 20:53:08 -04:00
RandyTheSilly 5be819e9db Advertise TOTP support in printInfo.go, add to shell completions 2024-03-18 18:38:42 -04:00
RandyTheSilly aed342c42f Update README.md with current progress 2024-03-18 17:03:19 -04:00
RandyTheSilly 9af89d5c85 Implement initial TOTP support (secret in third notes line, will eventually have its own dedicated field) 2024-03-18 16:44:22 -04:00
RandyTheSilly 782f03e276 Better document new blank option="password" shortcut, order arguments in order of expected use, list passwords first in entry reader 2024-03-18 12:59:18 -04:00
RandyTheSilly f3d747a5af Revert use of ":" for options on Windows, use "-" but replace "-p" with "-pw" to avoid ambiguity, interpret no options as "password" 2024-03-17 17:32:13 -04:00
RandyTheSilly 4882dec678 Fix slice bounds errors when editing notes on short entries 2024-03-17 15:59:47 -04:00
RandyTheSilly 6a345d2206 Switch Windows to use ":" instead of "-" for options flags because PowerShell is horrible and interprets "-" as a named parameter 2024-03-14 17:01:12 -04:00
RandyTheSilly 7d91dc5e75 Specify that "mutn init" generates libmutton.ini 2024-03-08 13:15:16 -05:00
RandyTheSilly 81a4fca89d Use panic in editNote to prevent temp files from being left behind 2024-03-08 12:57:10 -05:00
RandyTheSilly 05a15260fd Strip carriage returns from user input 2024-03-08 12:48:19 -05:00
RandyTheSilly 4394020dd2 Properly close files to fix various issues on Windows (fixes GPG keygen, note temp files not being deleted) 2024-03-08 12:19:05 -05:00
RandyTheSilly f8bf12677f Better sanitize user input in inputInt 2024-03-08 11:23:08 -05:00
RandyTheSilly 8e1987f250 Disable sshyp-sync-shim on Windows 2024-03-08 10:43:00 -05:00
RandyTheSilly 5fc2ef81bc Add current UNIX timestamp to generated GPG ID, identify key based on it 2024-03-08 10:36:01 -05:00
RandyTheSilly cd61d3ada3 Manually select auto-generated GPG key due to inconsistent GPG output, use tempfile for gpg-gen 2024-03-08 00:46:22 -05:00
RandyTheSilly d552f03de1 Better detect if fallback editor needs to be used 2024-03-07 23:51:34 -05:00
RandyTheSilly 834b37abda Prevent EntryListGen errors from appearing in-line with header 2024-03-07 23:46:19 -05:00
RandyTheSilly 8fcb8958ce Exit after errors in EntryListGen 2024-03-07 23:43:35 -05:00
RandyTheSilly 27c70e84c8 Remove the gpg-gen file after use 2024-03-07 23:40:35 -05:00
RandyTheSilly 276da8222f Allow automatic generation of GPG keys 2024-03-07 23:35:38 -05:00
RandyTheSilly 7fc1c46018 Allow picking GPG key ID from a generated list 2024-03-07 22:48:57 -05:00
RandyTheSilly 93a1a2209c Implement temporary "init" functionality 2024-03-07 22:12:38 -05:00
RandyTheSilly 865490927b Fixed indentation in main help menu for "edit -r" 2024-03-07 20:38:25 -05:00
RandyTheSilly 8f315fe587 Add TEMPORARY sshyp-sync shim so that MUTN can be tested while native sync is under development 2024-03-07 20:35:24 -05:00
RandyTheSilly 7d5c960fcb Replace TODO comment to correspond with learned information 2024-03-07 20:20:30 -05:00
RandyTheSilly 80f1e27507 Implement note editing 2024-03-07 20:15:01 -05:00
RandyTheSilly c0d141a02e Allow generating new passwords for existing entries 2024-03-07 19:09:23 -05:00
RandyTheSilly b208ea415a Implement initial entry editing support (no notes editing or gen update) 2024-03-07 18:34:12 -05:00
RandyTheSilly e729953cab Implement entry/directory renaming/moving 2024-03-07 17:40:57 -05:00
RandyTheSilly 5bc0ff96c0 Do not print redundant newline after creating a notes-only entry 2024-03-07 16:09:54 -05:00
RandyTheSilly 349fd807b5 Implement password generation on new entries 2024-03-07 16:04:46 -05:00
RandyTheSilly 1982a5c0d6 Do not allow creating empty entries 2024-03-07 12:13:31 -05:00
RandyTheSilly 844b726343 Allow optionally adding notes to new password entries 2024-03-07 12:01:49 -05:00
RandyTheSilly e269b304cd More correctly use build constraints in entryList.go 2024-03-06 20:45:02 -05:00
RandyTheSilly 9606bf6af6 Implement notes editor (required rewrite of offline.ReadConfig) 2024-03-05 17:11:53 -05:00
RandyTheSilly f58c789c60 Implement initial entry adding (partial, missing notes support) 2024-03-05 14:09:50 -05:00
RandyTheSilly b09a1c8132 Greatly reduce code duplication in clipboard implementations 2024-03-03 23:26:39 -05:00
RandyTheSilly e822bd89dc Implement password hiding in entry readouts 2024-03-01 22:11:59 -05:00
RandyTheSilly 3ed3424adc Re-write argument parsing, implement skeleton of copy functionality 2024-03-01 21:09:56 -05:00
RandyTheSilly 1ffd375950 Implement initial entry readout formatting 2024-03-01 18:26:05 -05:00
RandyTheSilly 775d7e605b Do not trim file extensions from entries (file extensions are no longer expected) 2024-03-01 14:07:53 -05:00
RandyTheSilly 61ca2fffa9 Fix initial entry reader shortcut on Windows 2024-03-01 13:47:28 -05:00
RandyTheSilly cdf1b0863e Replace remaining ANSI escape codes with constants 2024-02-27 12:01:35 -05:00
RandyTheSilly e7b3a21cf7 Implement ReadConfig for reading ~/.config/libmutton/libmutton.ini 2024-02-27 11:48:02 -05:00
RandyTheSilly b5cb7f02e1 Fix awkward wording, clarify extension support 2024-02-26 17:16:09 -05:00
RandyTheSilly 3c6eed63ba Split into separate packages 2024-02-26 16:58:39 -05:00
RandyTheSilly 0b9d854a90 Fix incorrect method of simplifying directory headers 2024-01-30 22:06:46 -05:00
RandyTheSilly 4ccae3e5a8 Initial code commit 2024-01-16 14:35:34 -05:00
Randall Winkhart 53e0799a4a Initial commit 2024-01-16 12:33:11 -05:00
56 changed files with 2273 additions and 1568 deletions
+8 -1
View File
@@ -1 +1,8 @@
*
/mutn
/mutn.exe
/MUTN
/MUTN.exe
/main
/main.exe
/version.go
1output
+663 -17
View File
@@ -1,21 +1,667 @@
MIT License
MUTN
Copyright (c) 2024-2025 Randall Winkhart
Copyright (c) 2024 Randall Winkhart
MUTN is licensed under the AGPL 3.0 due to its usage of
a custom fork of https://github.com/jessp01/gohighlight.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.
+33 -36
View File
@@ -1,46 +1,43 @@
# MUTN Password Manager
![banner](https://raw.githubusercontent.com/rwinkhart/sshyp-labs/main/extra/artwork/MUTN-banner.webp)
---
Pronounced as: "mutton", "muh·tn"
MUTN is a simple, self-hosted, SSH-synchronized password manager based on libmutton.
MUTN is a simple, self-hosted, SSH-synchronized password and note manager based on [libmutton](https://github.com/rwinkhart/libmutton). It is the successor to [sshyp](https://github.com/rwinkhart/sshyp).
MUTN is an expanded re-implementation of [sshyp](https://github.com/rwinkhart/sshyp) written in Go.
> [!WARNING]
>It is your responsibility to assess the security and stability of MUTN and to ensure it meets your needs before using it.
>I am not responsible for any data loss or breaches of your information resulting from the use of MUTN.
>MUTN is a new project that is constantly being updated, and though safety and security are priorities, they cannot be guaranteed.
Though MUTN will feel very familiar to users of sshyp, it is intended to differ and will break entry compatibility before reaching a stable release.
# WARNING
It is your responsibility to assess the security and stability of MUTN and to ensure it meets your needs before using it.
I am not responsible for any data loss or breaches of your information resulting from the use of MUTN.
MUTN is a new project that is constantly being updated, and though safety and security are priorities, they cannot be guaranteed.
# Demo Tape
![mutn-demo.webp](https://raw.githubusercontent.com/rwinkhart/sshyp-labs/main/extra/mutn-vhs/mutn-demo.webp)
# Mission Statement
MUTN aims to make it as simple as possible to manage passwords and notes via CLI across multiple devices in a secure, self-hosted fashion.
MUTN aims to make it as easy as possible to manage passwords and notes via CLI across multiple devices in a secure, self-hosted fashion.
# Building
MUTN is currently in early development and does not yet have online synchronization functionality (offline only).
# Installation/Building
See the [installation guide](https://github.com/rwinkhart/MUTN/blob/main/wiki/install.md).
To build the current version of MUTN, simply clone this repository and run `go build` in its root directory.
Additionally, MUTN is available as a source package ("[mutn](https://aur.archlinux.org/packages/mutn)") on the AUR.
After installing, please review the [usage guide](https://github.com/rwinkhart/MUTN/blob/main/wiki/usage.md).
# Roadmap
- Release v0.2.0 - No binaries
- Crete server software
- Add native sync (based on golang.org/x/crypto/ssh)
- Update entry format with reserved space for TOTP
- Release v0.2.1 - No binaries
- Replace init with interactive ttyPod-based menu
- Release v0.3.0 - Make repo public - x86_64_v1 binary
- Swap to native encryption, consider making GPG optional or removing entirely
- Release v0.4.0 - x86_64_v1 binary
- Password aging support
- Add password aging info to entry names
- Make constant character count to easily trim for user interaction
- Release v1.0.0 - Distribution packages (from here on out)
- Perform extensive testing, fixing, and optimizing
- Create artwork
- Create manpage
- Create packaging script
- Release v1.1.0
- Cascading encryption support
- Release v1.2.0
- Custom color scheme support
- Release v1.3.0
- Add build option for breaking markdown support and menus into separate binaries
- Greatly reduces startup time
### Release v0.4.0
- [ ] Switch to fully compliant Markdown (do not preserve new lines)
- [ ] Switch to alternative Markdown renderer (minimark or BEAN)
### Release v0.5.0
- [ ] libmutton v0.5.0
- [ ] Implement "netpin" (quick-unlock)
- [ ] Password aging support
- [ ] Add yellow/red dot indicators to entry list readout for when passwords should be changed
### Release v1.0.0 - Distribution packages
- [ ] Create packaging scripts
- [x] Stable source PKGBUILD
- [x] Stable source APKBUILD
- [ ] Debian/Ubuntu
- [ ] Fedora
- [ ] FreeBSD
- [ ] Windows installer
- [ ] Brew formula
- Perform extensive testing
-6
View File
@@ -1,6 +0,0 @@
#!/bin/sh
gofmt -l -w -s ./src/cli/*.go
gofmt -l -w -s ./src/backend/*.go
git add -f extra src .gitignore commit.sh go.mod go.sum LICENSE main.go README.md
git commit -m "$1"
git push
@@ -1,16 +1,16 @@
# mutn(1) completion
_path_gen() {
local mutnPath="$HOME/.local/share/libmutton"
local entryRoot="$HOME/.local/share/libmutton"
local globStatus=$(shopt -p globstar)
[ -z "${globStatus##*u*}" ] && shopt -s globstar # if recursive globbing is disabled, enable it
local fullPaths=("$mutnPath"/**/*)
local fullPaths=("$entryRoot"/**/*)
$globStatus # set recursive globbing to user default
for scanPath in "${fullPaths[@]}"; do
# exclude directories
[ -f "$scanPath" ] && trimmedPaths+=("${scanPath#$mutnPath}")
[ -f "$scanPath" ] && libmuttonTrimmedPaths+=("${scanPath#$entryRoot}")
done
if [ "${trimmedPaths[0]}" == '' ]; then trimmedPaths[0]=help; fi
if [ "${libmuttonTrimmedPaths[0]}" == '' ]; then libmuttonTrimmedPaths[0]=help; fi
} &&
_mutnCompletions() {
@@ -19,7 +19,7 @@ _mutnCompletions() {
case $prev in
mutn )
while read -r; do ITEM=${REPLY// /\\ }; COMPREPLY+=( "$ITEM" ); done < <( compgen -W "$(printf "'%s' " "${trimmedPaths[@]}")" -- "$cur" )
while read -r; do ITEM=${REPLY// /\\ }; COMPREPLY+=( "$ITEM" ); done < <( compgen -W "$(printf "'%s' " "${libmuttonTrimmedPaths[@]}")" -- "$cur" )
;;
/* )
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "copy edit gen add shear" -- "$cur" )
@@ -31,7 +31,7 @@ _mutnCompletions() {
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "password username totp url note" -- "$cur" )
;;
edit )
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "password username url note rename" -- "$cur" )
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "password username totp url note rename" -- "$cur" )
;;
gen )
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "update" -- "$cur" )
+129
View File
@@ -0,0 +1,129 @@
$global:cliMUTN_entriesToSpaceIndicesMap = @{}
if (!$IsWindows) {
# since the executable has the same name as the completion function (on non-Windows platforms), its path must be stored before the function is registered
$MUTNExecutablePath = (Get-Command mutn).Path
$spaceIndicesFilePath = '~/.config/libmutton/psCompletionsCache.json'
} else {
$spaceIndicesFilePath = '~\AppData\Local\libmutton\psCompletionsCache.json'
}
function cliMUTN-loadSpaceIndices {
if (Test-Path $global:spaceIndicesFilePath) {
$jsonContent = Get-Content -Path $global:spaceIndicesFilePath -Raw
$global:cliMUTN_entriesToSpaceIndicesMap = ConvertFrom-Json -InputObject $jsonContent -AsHashtable
}
}
function cliMUTN-saveSpaceIndices {
$jsonContent = $global:cliMUTN_entriesToSpaceIndicesMap | ConvertTo-Json -Compress
$jsonContent | Set-Content -Path $global:spaceIndicesFilePath
}
function cliMUTN-getSpaceIndices {
param ([string]$inputString)
$indices = @()
# loop through each character in the string
for ($i = 0; $i -lt $inputString.Length; $i++) {
if ($inputString[$i] -eq ' ') {
# if the character is a space, add the index to the array
$indices += $i
}
}
return $indices
}
function cliMUTN-getEscapedEntryName {
param ([int[]]$Indices, [string]$InputString)
$charArray = $InputString.ToCharArray()
# loop through each index in the provided array,
# replacing the character at that index with a space
foreach ($index in $Indices) {
$charArray[$index] = ' '
}
# convert the character array back to a string
$outputString = -join $charArray
# return the modified string with spaces escaped
return $outputString -replace ' ', '` '
}
function cliMUTN-entryCompleter {
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
if ($IsWindows) {
$entryRoot = (Resolve-Path '~\AppData\Local\libmutton\entries').Path
} else {
$entryRoot = (Resolve-Path '~/.local/share/libmutton').Path
}
try {
$trimmedPaths = If (Test-Path $entryRoot) {
(Get-ChildItem -Path $entryRoot -Recurse -File).FullName.Substring($entryRoot.Length) -replace '\\', '/'
}
} catch {
$trimmedPaths = $null # if any errors occur (especially, "You cannot call a method on a null-valued expression", set $trimmedPaths to $null
}
if ($null -eq $trimmedPaths) { # if no entries are found, add 'help' to $trimmedPaths
$trimmedPaths = 'help'
} else {
# replace spaces with underscores, tracking the indices of the spaces in a global variable for later restoration of spaces
$trimmedPaths = $trimmedPaths | ForEach-Object {
$spaceIndices = cliMUTN-getSpaceIndices -inputString $_
$replacedEntry = $_ -replace ' ', '_'
$replacedEntry
$global:cliMUTN_entriesToSpaceIndicesMap[$replacedEntry] = $spaceIndices
}
cliMUTN-saveSpaceIndices
}
$trimmedPaths | Where-Object { $_ -like "$wordToComplete*" }
}
function cliMUTN-optionCompleter {
param ($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters)
$possibleValues = @{
add = @('password', 'note', 'folder')
copy = @('password', 'username', 'totp', 'url', 'note')
edit = @('password', 'username', 'totp', 'url', 'note', 'rename')
gen = @('update')
}
if ($fakeBoundParameters.ContainsKey('argument')) {
$possibleValues[$fakeBoundParameters.argument] | Where-Object {
$_ -like "$wordToComplete*"
}
} else {
$possibleValues.Values | ForEach-Object {$_}
}
}
function mutn {
[CmdletBinding()]
param (
[Parameter(Position = 0)]
[ArgumentCompleter({ cliMUTN-entryCompleter @args })]
[string]$entry,
[Parameter(Position = 1)]
[ArgumentCompletions('copy', 'edit', 'gen', 'add', 'shear')]
[string]$argument,
[Parameter(Position = 2, ValueFromRemainingArguments=$true)]
[ArgumentCompleter({ cliMUTN-optionCompleter @args })]
[string]$option
)
# replace placeholder underscores with escaped spaces
$escapedEntry = cliMUTN-getEscapedEntryName -Indices $global:cliMUTN_entriesToSpaceIndicesMap[$entry] -InputString $entry
if ($IsWindows) {
Invoke-Expression -Command ('mutn.exe ' + $escapedEntry, $argument, $option).Trim()
} else {
Invoke-Expression -Command ($global:MUTNExecutablePath + ' ' + $escapedEntry, $argument, $option).Trim()
}
}
cliMUTN-loadSpaceIndices
+31
View File
@@ -0,0 +1,31 @@
#compdef mutn
libmuttonEntryRoot="$HOME/.local/share/libmutton"
libmuttonFullPaths=("$libmuttonEntryRoot"/**/*)
libmuttonTrimmedPaths=()
for scanPath in "${libmuttonFullPaths[@]}"; do
# exclude directories
[ -f "$scanPath" ] && libmuttonTrimmedPaths+=("${scanPath#$libmuttonEntryRoot}")
done
[[ -z $libmuttonTrimmedPaths ]] && libmuttonTrimmedPaths=(help)
case ${words[-2]} in
mutn )
compadd $libmuttonTrimmedPaths
;;
/* )
compadd {copy,edit,gen,add,shear}
;;
add )
compadd {password,note,folder}
;;
copy )
compadd {password,username,totp,url,note}
;;
edit )
compadd {password,username,totp,url,note,rename}
;;
gen )
compadd update
;;
esac
+166
View File
@@ -0,0 +1,166 @@
.TH MUTN 1 "23 November 2025" "v0.3.1" "MUTN man page"
.SH NAME
\fBmutn\fR - Simple, self-hosted, SSH-synchronized password and note management based on libmutton. It is the successor to sshyp.
.SH SYNOPSIS
Usage: mutn [/<entry name> [argument] [option]] | [argument]
.SH DESCRIPTION
mutn is a lightweight password, TOTP, and note management program for the CLI. MUTN is self-hosted with a client-server model and expects that you have access to a personal server with a properly configured SSH server.
.SH EXAMPLES
Setting up MUTN for the first time:
mutn init
Viewing the entry database:
mutn
Reading an existing entry saved as '~/.local/share/libmutton/development/github':
mutn /development/github
Reading the same entry without hiding the password:
mutn /development/github show
Removing an existing folder saved as '~/.local/share/libmutton/social':
mutn /social shear
Copying the password of an existing entry saved as '~/.local/share/libmutton/financial/bank':
mutn /financial/bank copy
Copying the TOTP token of an existing entry saved as '~/.local/share/libmutton/financial/bank':
mutn /financial/bank copy -t
Editing the username of an existing entry saved as '~/.local/share/libmutton/game':
mutn /game edit -u
Making a new entry saved as '~/.local/share/libmutton/school/university' using the built-in password generator:
mutn /school/university gen
Creating a note-only entry saved as '~/.local/share/libmutton/notes/test note':
mutn /notes/test\ note add -n
Manually synchronizing entries with the server:
mutn sync
.SH ARGUMENTS
help Bring up the help menu
version Display version and license information
init Set up MUTN (generates libmutton.ini)
tweak Make changes to the libmutton configuration
copy Copy details of an entry to your clipboard
edit Edit an existing entry
gen Generate a new password
add Add a new entry
shear Delete an existing entry
sync Manually sync the entry directory
.SH OPTIONS
copy:
password|-pw|<blank> Copy the password in an entry to your clipboard
username|-u Copy the username in an entry to your clipboard
totp|-t Generate and copy the TOTP token for an entry to your clipboard
url|-l Copy the URL in an entry to your clipboard
note|-n Copy the first note line in an entry to your clipboard
edit:
password|-pw Change the password in an entry
username|-u Change the username in an entry
totp|-t Change the TOTP secret in an entry
url|-l Change the URL in an entry
note|-n Change the note in an entry
rename|-r Rename or relocate an entry
gen:
update|-u Generate a password for an existing entry
add:
password|-pw Add a password entry
note|-n Add a note entry
folder|-f Add a new folder for entries
.SH TIPS
1. You can quickly read an entry with "mutn /<entry name>"
2. Type "mutn" (no arguments/options) to view a list of saved entries
3. Provide "add", "edit", "copy", or "gen" as the only argument to receive more specific help
4. Using "add", "edit", or "copy" without specifying an option (field) will default to "password"
.SH SETUP
libmutton operates on a client-server model, and thus sync support requires you to have access to your own server (whether it be a physical home server or a cloud rental) with remote access via SSH.
For security reasons, libmutton deliberately does not support password-based SSH authentication; you must use key-based authentication to connect to your server (password-protected keys are also supported). You are responsible for setting up SSH connectivity on your own.
The libmutton server software is shipped as its own dedicated binary and must be installed on the server and configured with "libmuttonserver init".
Once this has been done, you may proceed with the client setup:
1. Install MUTN
2. Run "mutn init" and follow the prompts
3. If you already have entries on the server, sync them using "mutn sync"
4. Optionally, shell completions (Bash, ZSH, and PowerShell 7+) can be enabled with your shell's respective method
.SH TROUBLESHOOTING
.B Clipboard not clearing:
The intended way for libmutton to interact with the system clipboard is for it to clear it 30 seconds after copying a field. Unfortunately, this does not work by default on all systems due to the prevalence of clipboard managers.
Clipboard managers save a history of what has been copied to the clipboard, which is already a big enough issue on its own for people who copy sensitive information to their clipboard. Some clipboard managers simply will not allow the clipboard to be empty and will replace its contents with the last copied item if you attempt to clear it. One such naughty clipboard manager is KDE Klipper, which comes packaged into KDE Plasma and is typically enabled by default on most distributions. Due to this behavior, KDE Klipper breaks libmutton's clipboard clearing functionality and should not be left enabled.
It is likely other popular clipboard managers exhibit this behavior.
.B Shell completions not working:
ZSH:
Make sure your ~/.zshrc contains the following (if sourcing from default completions location, usually /usr/share/zsh/functions/Completion/Unix/_mutn):
autoload -Uz compinit && compinit
...and then restart your shell.
Bash:
Install your distribution's "bash-completion" package
OR
Source the completion script manually by adding the following to your ~/.bashrc (then restart your shell):
Linux:
source /usr/share/bash-completion/completions/mutn
FreeBSD:
source /usr/local/share/bash-completion/completions/mutn
...and then restart your shell.
Please note that Bash completions are slightly more limited than ZSH completions, and as such, new entries will not be auto-completed until the completions script is re-sourced.
PowerShell 7+:
Currently, completions must be manually installed and sourced in your PowerShell profile as such:
. /path/to/mutn.ps1
...and then restart your shell.
.SH EXIT CODES (defined by libmutton)
0: no error
101: read error
102: write error
103: target not found
104: sync process error
105: decryption error
106: encryption error
107: clipboard error
.SH AUTHOR
Randall Winkhart (https://github.com/rwinkhart)
+189
View File
@@ -0,0 +1,189 @@
**MUTN v0.2.4**
Built with libmutton v0.2.4
December 13, 2024
# The Tripe Transmission Update - Patch 4
This release updates libmutton to v0.2.4 and includes only a minor tweak and some dependency bumps.
## IMPORTANT
- This release includes a dependency bump to address a high-severity CVE (CVE-2024-45337) - Please update as soon as possible!
## Changes
- A build option/tag was added (`BEAN`) for building with experimental [BEAN](https://github.com/Trojan2021/BEAN) Markdown rendering support (instead of Glamour)
- Note that the BEAN Markdown renderer is a new project and is **not** near complete
- The pre-compiled binaries provided below do **not** make use of this new build tag (they are still Glamour-based)
- From libmutton v0.2.4:
- The MIME type of data copied to the clipboard on UNIX-like systems (X11 and Wayland) is now statically set to "text/plain" to avoid potential issues with type inference
## Dependencies
- Bumps (direct and indirect)
- Go: v1.23.2 => 1.23.4
- github.com/rwinkhart/libmutton: v0.2.3 => v0.2.4
- github.com/charmbracelet/x/ansi: v0.4.0 => v0.5.2
- github.com/pkg/sftp: v1.13.6 => v1.13.7
- golang.org/x/crypto: v0.28.0 => v0.31.0
- golang.org/x/net: v0.30.0 => v0.32.0
- golang.org/x/sys: v0.26.0 => v0.28.0
- golang.org/x/term: v0.25.0 => v0.27.0
---
**MUTN v0.2.3**
Built with libmutton v0.2.3
October 19, 2024
# The Tripe Transmission Update - Patch 3
This release updates libmutton to v0.2.3 to fix a minor bug causing the client to make a request to the server under an inappropriate condition.
## Fixes
- From libmutton v0.2.3:
- Fixed renaming/moving an entry/folder to an invalid path still having clients request the operation on the server
## Dependencies
- Bumps (direct and indirect)
- Go: v1.22.6 => 1.23.2
- github.com/rwinkhart/libmutton: v0.2.2 => v0.2.3
- github.com/yuin/goldmark: v1.7.4 => v1.7.8
- github.com/yuin/goldmark-emoji: v1.0.3 => v1.0.4
- golang.org/x/crypto: v0.26.0 => v0.28.0
- golang.org/x/net: v0.28.0 => v0.30.0
- golang.org/x/sys: v0.24.0 => v0.26.0
- golang.org/x/term: v0.23.0 => v0.25.0
---
**MUTN v0.2.2**
Built with libmutton v0.2.2
August 20, 2024
# The Tripe Transmission Update - Patch 2
This release updates libmutton to v0.2.2 to address a regression from v0.2.1. Additionally, a Windows-only entry adding bug has been fixed.
## Fixes
- From libmutton v0.2.2:
- Edited entries are no longer improperly synced if their line count is reduced
- (8c1b986e20bf8e02b4b27e18748f7677be2b2743) Adding new entries from Windows now works as intended
## Dependencies
- Bumps (direct and indirect)
- github.com/rwinkhart/libmutton: v0.2.1 => v0.2.2
---
**MUTN v0.2.1**
Built with libmutton v0.2.1
August 13, 2024
# The Tripe Transmission Update - Patch 1
This release marks the completion of splitting MUTN and [libmutton](https://github.com/rwinkhart/libmutton) into separate repositories. The server binary must now be downloaded from the [libmutton releases page](https://github.com/rwinkhart/libmutton/releases).
Please see the [installation guide](https://github.com/rwinkhart/MUTN/blob/main/wiki/install.md) for updated instructions.
## Breaking Changes
- The server binary must also be updated to v0.2.1 (grab it [here](https://github.com/rwinkhart/libmutton/releases/tag/v0.2.1))
## Features
- From libmutton v0.2.1:
- MUTN will now remove the previous device ID from the server when creating a new one
- Exit codes are now specific to the type of error encountered
## Fixes
- From libmutton v0.2.1:
- The user is no longer prompted for their ssh keyfile passphrase multiple times during synchronization
- Config/entry files are now created with 0600 permissions
- The TOTP copy message is no longer unnecessarily verbose
- Function documentation is now properly formatted for display on pkg.go.dev
## Dependencies
- Bumps (direct and indirect)
- golang.org/x/sys: v0.23.0 => v0.24.0
- New (direct)
- github.com/rwinkhart/libmutton: v0.2.1
- Was previously included in this repo
---
**MUTN v0.2.0**
August 06, 2024
# The Tripe Transmission Update
This release marks the public debut of MUTN and its underlying library, libmutton.
Compared to v0.1.0, this version adds fully native SSH synchronization with self-hosted servers. It also makes tweaks to the entry format to better integrate TOTP support. The full patch notes are below.
## Breaking Changes
#### Given MUTN was not public prior to this release, these should not affect anyone and are listed purely for historical documentation
- (67bf6e42b9c623f24d9547d822ea4d2fd45002d1) TOTP secrets now have their own dedicated entry field, meaning entries from v0.1.0 are not compatible
- Various changes have been made to libmutton.ini (re-generating it with `mutn init` is needed)
## Features
- Native SSH sync support with self-hosted servers
- Replaces sshyp-based partial sync implementation, requires libmuttonserver)
- (ea34f644f31ff871d8766d3971dac5eed5bb2c3b) MUTN/libmutton can now be built for WSL with working clipboard support
- Build tag: `wsl`
- (356d1eab4e4cd0c68db9bd9aa0d3164c13cd254f) libmutton can now be built to allow functions to exit the program (desirable for CLI) or return (desirable for GUI/TUI)
- Build tag: `returnOnExit`
- (cbf625b2d3b8a18d1f7e3214e065b5baa1dc0829) MUTN can now be built without Markdown support
- Build tag: `noMarkdown`
- Reduces the binary size by more than half and greatly reduces startup time (because of this, Glamour is likely to be replaced with a different Markdown renderer in the future)
- (f0cdd217d958109f36a0e8a7048a5d73b7f68a96) PowerShell completions now also work on non-Windows platforms
- (2ae4fe19e84d9beacfc616c9aa4fe9c166d28003) (e81bfa935a1f461edf2171f99f37ac2794a928e8) It is now possible for third-party clients to store and retrieve data from arbitrary section headers in libmutton.ini
## Fixes
- Several previously unhandled errors are not handled properly
- sync/client.go is the last to have not received this treatment (coming in v0.2.1)
- PowerShell completions can now complete after directories containing spaces
- (0fc0a2cfc09289271bc90a292fa7f40289a35294) Bash and ZSH completions no longer declare generically named global variables that could conflict with other software
- (43d87a5b464b997b7f719b71626d62840e385333) "-v" and "-h" shortcuts (for "version" and "help", respectively) have been removed to prevent ambiguity in PowerShell
- (df5f10d188b80a17eeed48961c4e64c90166f7e6) ANSI escapes are no longer intermittently dumped to the terminal on Windows
- (35192fa568010a72f49536197115081b00b4f0da) MUTN will no longer wait for you to fill out the contents of a new entry before telling you its location is invalid
- (b7a470116ab90b327d16e96e9576f002eeea2902) MUTN no longer announces the copying of TOTP codes until the entry has been successfully decrypted
## Dependencies
- Bumps (direct and indirect)
- Go: v1.22.2 => v1.22.6
- golang.org/x/crypto: v0.22.0 => v0.26.0
- golang.org/x/term: v0.19.0 => v0.23.0
- github.com/alecthomas/chroma/v2: v2.13.0 => v2.14.0
- github.com/boombuler/barcode: v1.0.1 => v1.0.2
- github.com/dlclark/regexp2: v1.11.0 => v1.11.4
- github.com/mattn/go-runewidth: v0.0.15 => v0.0.16
- github.com/microcosm-cc/bluemonday: v1.0.26 => v1.0.27
- github.com/yuin/goldmark: v1.7.1 => v1.7.4
- github.com/yuin/goldmark-emoji: v1.0.2 => v1.0.3
- golang.org/x/net: v0.24.0 => v0.28.0
- golang.org/x/sys: v0.19.0 => v0.23.0
- New (direct)
- github.com/pkg/sftp: v1.13.6
## Installation Notes
Though this is the initial public debut, it is still an overall early release of MUTN/libmutton. Because of this, no distribution packages are provided as of yet. MUTN is, however, available as a source package from the AUR as "mutn". Please see the [install guide](https://github.com/rwinkhart/MUTN/blob/main/wiki/install.md) for help installing or building MUTN in its current state (as well as getting started).
Note that libmuttonserver, libmutton, and MUTN have not yet been separated into their own respective repos (this will be done for v0.2.1). As such, libmuttonserver is built with the `noMarkdown` build tag to avoid pulling in Glamour and its dependencies.
It is highly recommended to also install the relevant [shell completions](https://github.com/rwinkhart/MUTN/blob/main/wiki/completions.md).
---
**MUTN v0.1.0**
April 16, 2024
# The Butchered Update
This is the first tagged release of MUTN.
It is a mostly complete implementation of MUTN's offline functionality.
It supports basic online synchronization if [sshyp](https://github.com/rwinkhart/sshyp) is also installed and configured (UNIX-based systems only).
**Breaking changes will be made after this release, including, but not limited to:**
- GPG will be replaced as the default encryption method
- The entry format will be adjusted to contain a dedicated field for TOTP secrets
- sshyp-based synchronization will be replaced with a native implementation
**No pre-compiled binaries or distribution packages will be published for this release.**
+127
View File
@@ -0,0 +1,127 @@
**WARNING: AS LIBMUTTON HAS NOT YET REACHED v1.0.0, [BREAKING CHANGES](https://github.com/rwinkhart/libmutton/blob/main/wiki/breaking.md) IN FUTURE UPDATES ARE PLANNED**
**MUTN v0.3.1**
Built with libmutton v0.4.4
November 23, 2025
This is a simple dependency bump and bugfix release. Security issues are addressed. See the [libmutton v0.4.4 patchnotes](https://github.com/rwinkhart/libmutton/releases/tag/v0.4.4) for more information.
A new major version is well underway. This is likely the last release in the v0.3.x series before more breaking changes are made.
---
**MUTN v0.3.0**
Built with libmutton v0.4.0
August 17, 2025
# The Cryptic Cuts Update
This is the largest update to MUTN yet, and as such, these patch notes are non-exhaustive.
Many minor changes and fixes to features mentioned in these patch notes have been made.
Please see the commit history for a more complete list of changes.
This is a major, breaking release that changes the encryption scheme used for entries.
This version of MUTN requires `mutn init` to be run before use.
Additionally, it requires previously created entries to be converted using the conversion program linked below.
## libmutton-derived Changes
- **PLEASE** read [libmutton's release notes](https://github.com/rwinkhart/libmutton/releases/tag/v0.4.0), as they detail severe breaking changes
- Highlight feature: GPG has been entirely replaced with [RCW](https://github.com/rwinkhart/rcw)
- All entries created in previous versions _**MUST**_ be converted using [this conversion program](https://github.com/rwinkhart/sshyp-labs/releases/tag/v2.0.0)
## Features
- (05f95a4c0c8a854828161c9d3f70e8cff6da0fc5) Implemented "mutn tweak" for performing various quick operations
- These currently include:
1. (1488c7d5360fc6f0ac7489e4925247732f687f1e) Changing the device ID
2. (59cb9ac0d18defa201713f91f033702339ff45e6) Re-encrypting/optimizing entries (changing the passphrase)
3. (45c03f0fe4435cb7e619c80b2a91157405d2a7c9) Setting/changing the editor used for notes
## Changes
- (a7a92e78b565799a04e683d8eae28b6791720c08) Re-licensed under the AGPL 3.0
- I would prefer a more permissive license, but this is a legal requirement due to MUTN's use of go-highlite, which is based on [an AGPL project](https://github.com/jessp01/gohighlight)
- (0895dcba8ae3435b35e1821ece9a6a924fde5905) (52628dba0a3a959784a6706216615bb7babced09) A temporary fork of Glamour v0.7.0 is now used
- This fixes the long-dreaded startup latency caused by Glamour's dependency on [Chroma](https://github.com/alecthomas/chroma)
- Chroma has been replaced with [go-highlite](https://github.com/rwinkhart/go-highlite)
- This also reduces the binary size by several megabytes
- This solution is temporary: Two alternative markdown rendering solutions are in the works and one will be chosen to replace Glamour entirely
- (72755e91b582dd2f6b93f0aa30992da4dc10750d) `edit` is now the default note editor on Windows
- (cc3416a89c119076e3ce84252029e952288ecf35) Release binaries now target x86_64_v2 and arm64v8.7+crypto (v8.0 still offered on Linux)
## Fixes
- (85584da807a5d973078d6357decdc7a1092582f3) The entry reader loop is now broken as intended once notes have been printed
## Dependencies
- Dropped
- Many dependencies were dropped due to the removal of experimental build options
- github.com/alecthomas/chroma/v2 was dropped as part of the Glamour fork
- github.com/fortis/go-steam-totp was dropped due to libmutton now using one package for all TOTP generation
- Bumped (direct)
- Go: v1.24.2 => 1.24.6
- github.com/rwinkhart/libmutton: v0.3.1 => v0.4.0
- golang.org/x/term: v0.31.0 => v0.34.0
- Added (direct)
- github.com/rwinkhart/go-boilerplate v0.1.0
---
**MUTN v0.2.6**
Built with libmutton v0.3.1
April 21, 2025
# The Tripe Transmission Update - Patch 6
This release updates libmutton to v0.3.1 and brings in some minor bug fixes.
## libmutton-derived Changes
- See [libmutton's release notes](https://github.com/rwinkhart/libmutton/releases/tag/v0.3.1)
- Highlight feature: (34136633d93749bb75d680537ee2191a49d9d276) Added a new password generation option for moderately complex strings (better compatibility with many services than the previous complex passwords)
- The previous generator is still accessible as the "ultra complex" option
## Fixes
- (8166bfcfbe960d77b33e42de35fd0b31c9751039) Notes can once again be removed from entries
## Dependencies
- Bumps (direct and indirect)
- Go: v1.24.0 => 1.24.2
- github.com/rwinkhart/libmutton: v0.3.0 => v0.3.1
- golang.org/x/term: v0.29.0 => v0.31.0
- golang.org/x/crypto: v0.34.0 => v0.37.0
- golang.org/x/net: v0.35.0 => v0.39.0
- golang.org/x/sys: v0.30.0 => v0.32.0
- github.com/pkg/sftp: v1.13.7 => v1.13.9
- github.com/alecthomas/chroma/v2: v2.15.0 => v2.16.0
- github.com/yuin/goldmark: v1.7.8 => v1.7.10
- github.com/yuin/goldmark-emoji: v1.0.4 => v1.0.6
---
**MUTN v0.2.5**
Built with libmutton v0.3.0
February 22, 2025
# The Tripe Transmission Update - Patch 5
This release updates libmutton to v0.3.0 and brings in some minor bug fixes.
## libmutton-derived Changes
- See [libmutton's release notes](https://github.com/rwinkhart/libmutton/releases/tag/v0.3.0)
## Changes
- (38ddc3265634275d999781dbc0ce827392ed77e0) Some ANSI-colored text is now more visible in light terminal themes
- (0c57bd576447c4b61f67c22f81db7543ba30ff3f) Trailing double spaces are now preserved in notes for Markdown manual line breaks
- Currently only supported in [BEAN](https://github.com/Trojan2021/BEAN)
## Fixes
- (edc2ef25dea9d702bf8a096fd23795957ae721f1) (4556e38e32c52862ecf3d88e7b8faeae231b44a2) PowerShell completions no longer become unusable when multiple entries with similar names (containing spaces) exist in the same directory
- (d323f2f75a219163f3b6b3fbb2b7c1b21930fd0b) Entries are no longer re-uploaded when the user adds a blank note
## Dependencies
- Bumps (direct and indirect)
- Go: v1.23.4 => 1.24.0
- github.com/rwinkhart/libmutton: v0.2.4 => v0.3.0
- github.com/alecthomas/chroma/v2: v2.14.0 => v2.15.0
- github.com/dlclark/regexp2: v1.11.4 => v1.11.5
- github.com/muesli/termenv: v0.15.2 => v0.16.0
- golang.org/x/term: v0.27.0 => v0.29.0
- golang.org/x/crypto: v0.31.0 => v0.34.0
- golang.org/x/net: v0.32.0 => v0.35.0
- golang.org/x/sys: v0.28.0 => v0.30.0
-55
View File
@@ -1,55 +0,0 @@
function cliMUTNEntryCompleter {
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
#$mutnPath = (Resolve-Path '~/.local/share/libmutton').Path # UNIX testing
$mutnPath = (Resolve-Path '~/AppData/Local/libmutton/entries').Path
try {
$trimmedPaths = If (Test-Path $mutnPath) {
(Get-ChildItem -Path $mutnPath -Recurse -File).FullName.Substring($mutnPath.Length) -replace '\\', '/' -replace ' ', '` '
}
} catch {
$trimmedPaths = $null # If any errors occur (especially, "You cannot call a method on a null-valued expression", set $trimmedPaths to $null
}
if ($null -eq $trimmedPaths) { # If no entries are found, add 'help' to $trimmedPaths
$trimmedPaths = 'help'
}
$trimmedPaths | Where-Object { $_ -like "$wordToComplete*" }
}
function cliMUTNOptionCompleter {
param ($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters)
$possibleValues = @{
add = @('password', 'note', 'folder')
copy = @('password', 'username', 'totp', 'url', 'note')
edit = @('password', 'username', 'url', 'note', 'rename')
gen = @('update')
}
if ($fakeBoundParameters.ContainsKey('argument')) {
$possibleValues[$fakeBoundParameters.argument] | Where-Object {
$_ -like "$wordToComplete*"
}
} else {
$possibleValues.Values | ForEach-Object {$_}
}
}
function mutn {
[CmdletBinding()]
param (
[Parameter(Position = 0)]
[ArgumentCompleter({ cliMUTNEntryCompleter @args })]
[string]$entry,
[Parameter(Position = 1)]
[ArgumentCompletions('copy', 'edit', 'gen', 'add', 'shear')]
[string]$argument,
[Parameter(Position = 2, ValueFromRemainingArguments=$true)]
[ArgumentCompleter({ cliMUTNOptionCompleter @args })]
[string]$option
)
#Invoke-Expression -Command ('/usr/local/bin/mutn ' + ($entry -replace ' ', '` '), $argument, $option).Trim() # UNIX testing
Invoke-Expression -Command ('./mutn.exe ' + ($entry -replace ' ', '` '), $argument, $option).Trim()
}
-31
View File
@@ -1,31 +0,0 @@
#compdef mutn
mutnPath="$HOME/.local/share/libmutton"
fullPaths=("$mutnPath"/**/*)
trimmedPaths=()
for scanPath in "${fullPaths[@]}"; do
# exclude directories
[ -f "$scanPath" ] && trimmedPaths+=("${scanPath#$mutnPath}")
done
[[ -z $trimmedPaths ]] && trimmedPaths=(help)
case ${words[-2]} in
mutn )
compadd $trimmedPaths
;;
/* )
compadd {copy,edit,gen,add,shear}
;;
add )
compadd {password,note,folder}
;;
copy )
compadd {password,username,totp,url,note}
;;
edit )
compadd {password,username,url,note,rename}
;;
gen )
compadd update
;;
esac
+32 -17
View File
@@ -1,34 +1,49 @@
module github.com/rwinkhart/MUTN
go 1.22.2
go 1.25.4
require (
github.com/charmbracelet/glamour v0.7.0
github.com/fortis/go-steam-totp v0.0.0-20171114202746-18e928674727
github.com/pquerna/otp v1.4.1-0.20231130234153-3357de7c0481
golang.org/x/crypto v0.22.0
gopkg.in/ini.v1 v1.67.0
github.com/rwinkhart/go-boilerplate v0.1.1-0.20251110055016-10ee4f91fcb6
github.com/rwinkhart/libmutton v0.4.4
golang.org/x/term v0.37.0
)
require (
github.com/alecthomas/chroma/v2 v2.13.0 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
github.com/boombuler/barcode v1.0.1 // indirect
github.com/dlclark/regexp2 v1.11.0 // indirect
github.com/boombuler/barcode v1.1.0 // indirect
github.com/gorilla/css v1.0.1 // indirect
github.com/kr/fs v0.1.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/microcosm-cc/bluemonday v1.0.26 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/microcosm-cc/bluemonday v1.0.27 // indirect
github.com/muesli/reflow v0.3.0 // indirect
github.com/muesli/termenv v0.15.2 // indirect
github.com/muesli/termenv v0.16.0 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/pkg/sftp v1.13.10 // indirect
github.com/pquerna/otp v1.5.0 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/stretchr/testify v1.8.4 // indirect
github.com/yuin/goldmark v1.7.1 // indirect
github.com/yuin/goldmark-emoji v1.0.2 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/term v0.19.0 // indirect
github.com/rwinkhart/go-highlite v0.1.1 // indirect
github.com/rwinkhart/peercred-mini v0.1.2 // indirect
github.com/rwinkhart/rcw v0.2.4 // indirect
github.com/yuin/goldmark v1.7.13 // indirect
github.com/yuin/goldmark-emoji v1.0.6 // indirect
golang.design/x/clipboard v0.7.1 // indirect
golang.org/x/crypto v0.45.0 // indirect
golang.org/x/exp/shiny v0.0.0-20251017212417-90e834f514db // indirect
golang.org/x/image v0.32.0 // indirect
golang.org/x/mobile v0.0.0-20251021151156-188f512ec823 // indirect
golang.org/x/net v0.47.0 // indirect
golang.org/x/sys v0.38.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
replace golang.org/x/sys => github.com/rwinkhart/sys v0.38.0
replace github.com/Microsoft/go-winio => github.com/rwinkhart/go-winio v0.1.0
replace github.com/charmbracelet/glamour => github.com/rwinkhart/glamour-temp-MUTN v0.7.2
+54 -40
View File
@@ -1,72 +1,86 @@
github.com/alecthomas/assert/v2 v2.6.0 h1:o3WJwILtexrEUk3cUVal3oiQY2tfgr/FHWiz/v2n4FU=
github.com/alecthomas/assert/v2 v2.6.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
github.com/alecthomas/chroma/v2 v2.13.0 h1:VP72+99Fb2zEcYM0MeaWJmV+xQvz5v5cxRHd+ooU1lI=
github.com/alecthomas/chroma/v2 v2.13.0/go.mod h1:BUGjjsD+ndS6eX37YgTchSEG+Jg9Jv1GiZs9sqPqztk=
github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc=
github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
github.com/boombuler/barcode v1.0.1 h1:NDBbPmhS+EqABEs5Kg3n/5ZNjy73Pz7SIV+KCeqyXcs=
github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
github.com/charmbracelet/glamour v0.7.0 h1:2BtKGZ4iVJCDfMF229EzbeR1QRKLWztO9dMtjmqZSng=
github.com/charmbracelet/glamour v0.7.0/go.mod h1:jUMh5MeihljJPQbJ/wf4ldw2+yBP59+ctV36jASy7ps=
github.com/boombuler/barcode v1.1.0 h1:ChaYjBR63fr4LFyGn8E8nt7dBSt3MiU3zMOZqFvVkHo=
github.com/boombuler/barcode v1.1.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI=
github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
github.com/fortis/go-steam-totp v0.0.0-20171114202746-18e928674727 h1:1RkPJqfzrncAuh9xgoslr9OplZskm+VRA9lkucHPQZ4=
github.com/fortis/go-steam-totp v0.0.0-20171114202746-18e928674727/go.mod h1:wRAWHbTlpt0C4kwnKoa42L2Phrv6uIq+c50P2uKpb7I=
github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8=
github.com/gorilla/css v1.0.1/go.mod h1:BvnYkspnSzMmwRK+b8/xgNPLiIuNZr6vbZBTPQ2A3b0=
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8=
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/microcosm-cc/bluemonday v1.0.26 h1:xbqSvqzQMeEHCqMi64VAs4d8uy6Mequs3rQ0k/Khz58=
github.com/microcosm-cc/bluemonday v1.0.26/go.mod h1:JyzOCs9gkyQyjs+6h10UEVSe02CGwkhd72Xdqh78TWs=
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk=
github.com/microcosm-cc/bluemonday v1.0.27/go.mod h1:jFi9vgW+H7c3V0lb6nR74Ib/DIB5OBs92Dimizgw2cA=
github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s=
github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8=
github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo=
github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8=
github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc=
github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk=
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
github.com/pkg/sftp v1.13.10 h1:+5FbKNTe5Z9aspU88DPIKJ9z2KZoaGCu6Sr6kKR/5mU=
github.com/pkg/sftp v1.13.10/go.mod h1:bJ1a7uDhrX/4OII+agvy28lzRvQrmIQuaHrcI1HbeGA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pquerna/otp v1.4.1-0.20231130234153-3357de7c0481 h1:FkxbO331O7mS5EJkP+MCi0o2gswh/Aezs+//NmefrR8=
github.com/pquerna/otp v1.4.1-0.20231130234153-3357de7c0481/go.mod h1:dkJfzwRKNiegxyNb54X/3fLwhCynbMspSyWKnvi1AEg=
github.com/pquerna/otp v1.5.0 h1:NMMR+WrmaqXU4EzdGJEE1aUUI0AMRzsp96fFFWNPwxs=
github.com/pquerna/otp v1.5.0/go.mod h1:dkJfzwRKNiegxyNb54X/3fLwhCynbMspSyWKnvi1AEg=
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/rwinkhart/glamour-temp-MUTN v0.7.2 h1:/CBexwkGdL8HuZjO7M0zzjGHaHCr9/r4XTOtUJa+pPE=
github.com/rwinkhart/glamour-temp-MUTN v0.7.2/go.mod h1:DN/eJaNQ5h7dgxzfmWFo7By+b82CKEUdNaY6z4R4v3c=
github.com/rwinkhart/go-boilerplate v0.1.1-0.20251110055016-10ee4f91fcb6 h1:tGGtw5Wr4laDrU7Ooe95g4E+O6c+oY18atamcMPaMY8=
github.com/rwinkhart/go-boilerplate v0.1.1-0.20251110055016-10ee4f91fcb6/go.mod h1:cnzIF45I0FCOvE4YIB+26pLCUx2kWyY2llKYZruNaRY=
github.com/rwinkhart/go-highlite v0.1.1 h1:9TxbRhYVfD/3YaEgNk1BtEiZ0t8/5mxDUZqNMXHodT0=
github.com/rwinkhart/go-highlite v0.1.1/go.mod h1:mWLMtCWcyV0BG4NeyPyAUGMjPvI0ds6vXmUq89QwBFA=
github.com/rwinkhart/go-winio v0.1.0 h1:b72agLW+dETGmhR3VbcbwnStfgKfc5AfgJOXBJDkaHg=
github.com/rwinkhart/go-winio v0.1.0/go.mod h1:ZWa7ssZJT30CCDGJ7fk/2SBTq9BIQrrVjrcss0UW2s0=
github.com/rwinkhart/libmutton v0.4.4 h1:tUGU0JLf0aQ0YQy+1RSzOy5yujfpJ4b3iXuxAhUjhzE=
github.com/rwinkhart/libmutton v0.4.4/go.mod h1:2GV6ILW7dawIGvBoOcV0K3Uw7llc0ZWFRYcV+kM9K8g=
github.com/rwinkhart/peercred-mini v0.1.2 h1:4cGWDbv0whvLeVvbUdx84V/9p+2fS+DEXgrA1KxlRFo=
github.com/rwinkhart/peercred-mini v0.1.2/go.mod h1:LLHG7YshHEpbpJJP+Il9nx2dnGj5O3VGE32rWmflj0c=
github.com/rwinkhart/rcw v0.2.4 h1:FrRSsl+ui1WLmDwqjLSROtFPKqSeGLEfF2SPENt4qP0=
github.com/rwinkhart/rcw v0.2.4/go.mod h1:nhW4RAHvEjW2QcOlqEdWqRQOFJLjoOGSPkSRZlMjU3s=
github.com/rwinkhart/sys v0.38.0 h1:V1PGKcUutWtD3+VdHvyvfGtPy7PDXzKHNM1IzVq1ysY=
github.com/rwinkhart/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/yuin/goldmark v1.3.7/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.7.1 h1:3bajkSilaCbjdKVsKdZjZCLBNPL9pYzrCakKaf4U49U=
github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
github.com/yuin/goldmark-emoji v1.0.2 h1:c/RgTShNgHTtc6xdz2KKI74jJr6rWi7FPgnP9GAsO5s=
github.com/yuin/goldmark-emoji v1.0.2/go.mod h1:RhP/RWpexdp+KHs7ghKnifRoIs/Bq4nDS7tRbCkOwKY=
golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30=
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q=
golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/yuin/goldmark v1.7.13 h1:GPddIs617DnBLFFVJFgpo1aBfe/4xcvMc3SB5t/D0pA=
github.com/yuin/goldmark v1.7.13/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg=
github.com/yuin/goldmark-emoji v1.0.6 h1:QWfF2FYaXwL74tfGOW5izeiZepUDroDJfWubQI9HTHs=
github.com/yuin/goldmark-emoji v1.0.6/go.mod h1:ukxJDKFpdFb5x0a5HqbdlcKtebh086iJpI31LTKmWuA=
golang.design/x/clipboard v0.7.1 h1:OEG3CmcYRBNnRwpDp7+uWLiZi3hrMRJpE9JkkkYtz2c=
golang.design/x/clipboard v0.7.1/go.mod h1:i5SiIqj0wLFw9P/1D7vfILFK0KHMk7ydE72HRrUIgkg=
golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q=
golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4=
golang.org/x/exp/shiny v0.0.0-20251017212417-90e834f514db h1:NmsmaSkEAq6A8r0Q78WxD0IygJNCs6J3uYDgNuPkXYM=
golang.org/x/exp/shiny v0.0.0-20251017212417-90e834f514db/go.mod h1:QMAAUorQ8fzCK0C6mr4X4XV9BEp7Al6+jlejJvfYKw4=
golang.org/x/image v0.32.0 h1:6lZQWq75h7L5IWNk0r+SCpUJ6tUVd3v4ZHnbRKLkUDQ=
golang.org/x/image v0.32.0/go.mod h1:/R37rrQmKXtO6tYXAjtDLwQgFLHmhW+V6ayXlxzP2Pc=
golang.org/x/mobile v0.0.0-20251021151156-188f512ec823 h1:M0DtBf/UvJoTH+tk6tgHT2NVxNEJCYhVu1g/xeD+GEk=
golang.org/x/mobile v0.0.0-20251021151156-188f512ec823/go.mod h1:3QSlP0AtP6HPTLbsxfgfefGN76jpIB9yBsMqB8UY37I=
golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY=
golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU=
golang.org/x/term v0.37.0 h1:8EGAD0qCmHYZg6J17DvsMy9/wJ7/D/4pV/wfnld5lTU=
golang.org/x/term v0.37.0/go.mod h1:5pB4lxRNYYVZuTLmy8oR2BH8dflOR+IbTYFD8fi3254=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
-186
View File
@@ -1,186 +0,0 @@
package main
import (
"fmt"
"github.com/rwinkhart/MUTN/src/backend"
"github.com/rwinkhart/MUTN/src/cli"
"os"
"strings"
)
func main() {
args := os.Args
argsCount := len(args)
// if no arguments are supplied...
if argsCount == 1 {
// list all entries
cli.EntryListGen()
} else {
// if the first argument is an entry...
if strings.HasPrefix(args[1], "/") {
// store location of target entry
targetLocation := backend.TargetLocationFormat(args[1][1:])
// entry reader shortcut (if no other arguments are supplied)
if argsCount == 2 {
cli.EntryReaderDecrypt(targetLocation, true, false)
// perform other operations on the entry (if other arguments are supplied)
} else if argsCount == 3 || (argsCount == 4 && (args[3] == "show" || args[3] == "-s")) {
if argsCount == 3 { // default to "password" if no field is specified (for copy, edit, and add)
switch args[2] {
case "show", "-s":
cli.EntryReaderDecrypt(targetLocation, false, false)
case "copy":
backend.CopyArgument(targetLocation, 0, args[0])
case "edit":
cli.EditEntryField(targetLocation, true, 0)
case "gen":
cli.AddEntry(targetLocation, true, 1)
case "add":
cli.AddEntry(targetLocation, true, 0)
case "shear":
backend.Shear(targetLocation)
default:
cli.HelpMain()
}
} else { // handle "show" or "-s" argument for gen, edit, and add
switch args[2] {
case "edit":
cli.EditEntryField(targetLocation, false, 0)
case "gen":
cli.AddEntry(targetLocation, false, 1)
case "add":
cli.AddEntry(targetLocation, false, 0)
default:
cli.HelpMain()
}
}
} else if argsCount >= 4 {
switch args[2] {
case "copy":
var field int // indicates which (numbered) field to copy
switch args[3] {
case "password", "-pw":
field = 0
case "username", "-u":
field = 1
case "url", "-l":
field = 2
case "note", "-n":
field = 3
case "totp", "-t":
fmt.Println("TOTP code will be copied to clipboard - your clipboard will be kept up to date with the current TOTP code until this process is closed")
field = 5 // TODO Update field after removed from notes (breaking sshyp entry compatibility)
default:
cli.HelpCopy()
}
backend.CopyArgument(targetLocation, field, args[0])
case "edit":
var field int // indicates which (numbered) field to edit
switch args[3] {
case "password", "-pw":
field = 0
case "username", "-u":
field = 1
case "url", "-l":
field = 2
case "note", "-n":
field = 3
case "rename", "-r":
cli.RenameCli(targetLocation)
default:
cli.HelpEdit()
}
if argsCount == 4 {
cli.EditEntryField(targetLocation, true, field)
} else {
switch args[4] {
case "show", "-s":
cli.EditEntryField(targetLocation, false, field)
default:
cli.EditEntryField(targetLocation, true, field)
}
}
case "gen":
if argsCount == 4 {
switch args[3] {
case "update", "-u":
cli.GenUpdate(targetLocation, true)
default:
cli.HelpGen()
}
} else if args[3] == "update" || args[3] == "-u" {
switch args[4] {
case "show", "-s":
cli.GenUpdate(targetLocation, false)
default:
cli.GenUpdate(targetLocation, true)
}
}
cli.HelpGen()
case "add":
switch args[3] {
case "password", "-pw":
if argsCount == 4 {
cli.AddEntry(targetLocation, true, 0)
} else {
switch args[4] {
case "show", "-s":
cli.AddEntry(targetLocation, false, 0)
default:
cli.AddEntry(targetLocation, true, 0)
}
}
case "note", "-n":
cli.AddEntry(targetLocation, true, 2)
case "folder", "-f":
backend.AddFolder(targetLocation)
default:
cli.HelpAdd()
}
default:
cli.HelpMain()
}
}
// if the first argument is not an entry...
} else {
switch args[1] {
case "clipclear":
backend.ClipClearArgument()
case "sync":
if !backend.Windows {
cli.SshypSync() // TODO Remove after native sync is implemented
} else {
fmt.Println(backend.AnsiError + "\"sync\" is not yet implemented" + backend.AnsiReset)
}
os.Exit(0)
case "init":
cli.TempInitCli()
case "tweak":
fmt.Println(backend.AnsiError + "\"tweak\" is not yet implemented" + backend.AnsiReset)
os.Exit(0)
// TODO backend.Tweak()
case "copy":
cli.HelpCopy()
case "edit":
cli.HelpEdit()
case "gen":
cli.HelpGen()
case "add":
cli.HelpAdd()
case "version", "-v":
cli.Version()
default:
cli.HelpMain()
}
}
}
}
+265
View File
@@ -0,0 +1,265 @@
package main
import (
"bytes"
"cmp"
"fmt"
"os"
"strings"
"github.com/rwinkhart/MUTN/src/cli"
"github.com/rwinkhart/go-boilerplate/back"
"github.com/rwinkhart/go-boilerplate/front"
"github.com/rwinkhart/go-boilerplate/other"
"github.com/rwinkhart/libmutton/cfg"
"github.com/rwinkhart/libmutton/core"
"github.com/rwinkhart/libmutton/crypt"
"github.com/rwinkhart/libmutton/global"
"github.com/rwinkhart/libmutton/syncclient"
"github.com/rwinkhart/libmutton/synccycles"
)
func main() {
args := os.Args
argsCount := len(args)
// if no arguments are supplied...
if argsCount == 1 {
// list all entries
cli.EntryListGen()
} else {
// if the first argument is an entry...
if strings.HasPrefix(args[1], "/") {
// store location of target entry
targetLocation := global.TargetLocationFormat(args[1])
// entry reader shortcut (if no other arguments are supplied)
if argsCount == 2 {
cli.EntryReaderDecrypt(targetLocation, true)
// perform other operations on the entry (if other arguments are supplied)
} else if argsCount == 3 || (argsCount == 4 && (args[3] == "show" || args[3] == "-s")) {
if argsCount == 3 { // default to "password" if no field is specified (for copy, edit, and add)
switch args[2] {
case "show", "-s":
cli.EntryReaderDecrypt(targetLocation, false)
case "copy":
err := core.CopyArgument(targetLocation, 0)
if err != nil {
other.PrintError("Failed to copy password to clipboard: "+err.Error(), global.ErrorClipboard)
}
case "edit":
cli.EditEntryField(targetLocation, true, 0)
case "gen":
cli.AddEntry(targetLocation, true, 1)
case "add":
cli.AddEntry(targetLocation, true, 0)
case "shear":
err := syncclient.ShearRemoteFromClient(args[1]) // pass the incomplete path as the server and all clients (reading from the deletions directory) will have a different home directory
if err != nil {
other.PrintError("Failed to shear target: "+err.Error(), back.ErrorWrite)
}
default:
cli.HelpMain()
}
} else { // handle "show" or "-s" argument for gen, edit, and add
switch args[2] {
case "edit":
cli.EditEntryField(targetLocation, false, 0)
case "gen":
cli.AddEntry(targetLocation, false, 1)
case "add":
cli.AddEntry(targetLocation, false, 0)
default:
cli.HelpMain()
}
}
} else if argsCount >= 4 {
switch args[2] {
case "copy":
var field int // indicates which (numbered) field to copy
switch args[3] {
case "password", "-pw":
field = 0
case "username", "-u":
field = 1
case "totp", "-t":
field = 2
case "url", "-l":
field = 3
case "note", "-n":
field = 4
default:
cli.HelpCopy()
}
err := core.CopyArgument(targetLocation, field)
if err != nil {
other.PrintError("Failed to copy field to clipboard: "+err.Error(), global.ErrorClipboard)
}
case "edit":
var field int // indicates which (numbered) field to edit
switch args[3] {
case "password", "-pw":
field = 0
case "username", "-u":
field = 1
case "totp", "-t":
field = 2
case "url", "-l":
field = 3
case "note", "-n":
field = 4
case "rename", "-r":
isAccessible, _ := back.TargetIsFile(targetLocation, true) // error is ignored because dir/file status is irrelevant
if !isAccessible {
other.PrintError("Failed to access location ("+targetLocation+")", back.ErrorTargetNotFound)
}
cli.RenameCli(args[1]) // pass the incomplete path as the server and all clients (reading from the deletions directory) will have a different home directory
default:
cli.HelpEdit()
}
if argsCount == 4 {
cli.EditEntryField(targetLocation, true, field)
} else {
switch args[4] {
case "show", "-s":
cli.EditEntryField(targetLocation, false, field)
default:
cli.EditEntryField(targetLocation, true, field)
}
}
case "gen":
if argsCount == 4 {
switch args[3] {
case "update", "-u":
cli.GenUpdate(targetLocation, true)
default:
cli.HelpGen()
}
} else if args[3] == "update" || args[3] == "-u" {
switch args[4] {
case "show", "-s":
cli.GenUpdate(targetLocation, false)
default:
cli.GenUpdate(targetLocation, true)
}
}
cli.HelpGen()
case "add":
switch args[3] {
case "password", "-pw":
if argsCount == 4 {
cli.AddEntry(targetLocation, true, 0)
} else {
switch args[4] {
case "show", "-s":
cli.AddEntry(targetLocation, false, 0)
default:
cli.AddEntry(targetLocation, true, 0)
}
}
case "note", "-n":
cli.AddEntry(targetLocation, true, 2)
case "folder", "-f":
err := syncclient.AddFolderRemoteFromClient(args[1]) // pass the incomplete path as the server will have a different home directory
if err != nil {
other.PrintError("Failed to add folder: "+err.Error(), back.ErrorWrite)
}
default:
cli.HelpAdd()
}
default:
cli.HelpMain()
}
}
// if the first argument is not an entry...
} else {
switch args[1] {
case "clipclear":
err := core.ClipClearArgument()
if err != nil {
other.PrintError("Failure occurred in clipboard clearing process: "+err.Error(), global.ErrorClipboard)
}
case "startrcwd":
crypt.RCWDArgument()
case "sync":
_, err := syncclient.RunJob(true)
if err != nil {
other.PrintError("Failed to sync entries: "+err.Error(), global.ErrorSyncProcess)
}
case "init":
err := core.LibmuttonInit(front.Input,
[][3]string{{"MUTN", "textEditor", getTextEditorInput()}},
confirmRCWPassword("new"), false, false)
if err != nil {
other.PrintError("Initialization failed: "+err.Error(), 0)
}
case "tweak":
choice := front.InputMenuGen("Action:", []string{"Change device ID", "Change master password/Optimize entries", "Set text editor"})
switch choice {
case 1:
oldDeviceID, err := global.GetCurrentDeviceID()
if err != nil {
other.PrintError("Failed to get current device ID: "+err.Error(), back.ErrorRead)
}
_, _, err = synccycles.DeviceIDGen(oldDeviceID, "")
if err != nil {
other.PrintError("Failed to change device ID: "+err.Error(), global.ErrorSyncProcess)
}
fmt.Println("\nDevice ID changed successfully.")
case 2:
oldPassword := confirmRCWPassword("old")
newPassword := confirmRCWPassword("new")
fmt.Print("\nRe-encrypting entries. Please wait; do not force close this process.\n")
err := core.EntryRefresh(oldPassword, newPassword, false)
if err != nil {
other.PrintError("Re-encryption failed: "+err.Error(), global.ErrorEncryption)
}
fmt.Println("\nRe-encryption complete.")
case 3:
err := cfg.WriteConfig([][3]string{{"MUTN", "textEditor", getTextEditorInput()}}, nil, true)
if err != nil {
other.PrintError("Failed to set text editor: "+err.Error(), back.ErrorWrite)
}
}
case "copy":
cli.HelpCopy()
case "edit":
cli.HelpEdit()
case "gen":
cli.HelpGen()
case "add":
cli.HelpAdd()
case "version":
cli.Version()
default:
cli.HelpMain()
}
}
}
}
// confirmRCWPassword prompts the user for a master password and confirms it
// is typed correctly. Returns the password as a byte slice.
func confirmRCWPassword(lowercasePrefix string) []byte {
for {
// get master password
rcwPass := front.InputHidden(strings.ToUpper(string(lowercasePrefix[0])) + lowercasePrefix[1:] + " master password:")
if !bytes.Equal(rcwPass, front.InputHidden("Confirm "+lowercasePrefix+" master password:")) || len(rcwPass) == 0 {
fmt.Println(back.AnsiError + "Passwords do not match or password is invalid" + back.AnsiReset)
continue
}
return rcwPass
}
}
// getTextEditorInput prompts the user for a text editor input, first falling back to "$EDITOR", then to a default value
func getTextEditorInput() string {
return cmp.Or(front.Input("Text editor (leave blank for $EDITOR, falls back to \""+cli.FallbackEditor+"\"):"), os.Getenv("EDITOR"), cli.FallbackEditor)
}
+36
View File
@@ -0,0 +1,36 @@
#!/bin/sh
# get version number from cli package
cd ..
printf 'package main\nimport (\n"fmt"\n"github.com/rwinkhart/MUTN/src/cli"\n)\nfunc main() {\nfmt.Println(cli.MUTNVersion)\n}' > ./version.go
version=$(go run -ldflags="-s -w" -tags noMarkdown ./version.go)
rm ./version.go
cd ./packaging
# get revision number from user input, fallback to 1 if not provided
if [ -z "$2" ]; then
revision=1
else
revision="$2"
fi
# ensure output directory exists
mkdir -p ./1output
case "$1" in
release-binaries)
. ./resources/release-binaries.sh
create_release_binaries
;;
pkgbuild-git-stable-optimized)
. ./resources/pkgbuild-git-stable-optimized.sh
create_pkgbuild_git_stable_optimized
;;
apkbuild-source-stable-optimized)
. ./resources/apkbuild-source-stable-optimized.sh
create_apkbuild_source_stable_optimized
;;
*)
printf '\nusage: package.sh [target] <revision>\n\ntargets: release-binaries pkgbuild-git-stable-optimized apkbuild-source-stable-optimized\n\n'
;;
esac
@@ -0,0 +1,61 @@
#!/bin/sh
create_apkbuild_source_stable_optimized() {
printf '\nGenerating APKBUILD...\n'
local source="https://github.com/rwinkhart/MUTN/archive/refs/tags/v"$version".tar.gz"
local checksum=$(curl -sL "$source" | sha512sum | cut -d ' ' -f1)
printf "# Maintainer: Randall Winkhart <idgr@tutanota.com>
pkgname=mutn
pkgver="$version"
pkgrel="$((revision-1))"
pkgdesc='A simple, self-hosted, SSH-synchronized password/note manager for the CLI (based on libmutton)'
arch='all'
url='https://github.com/rwinkhart/MUTN'
license='MIT'
depends=''
makedepends='busybox go'
options='!check net'
source=\"\$pkgname-\$pkgver.tar.gz::"$source"\"
build() {
cd \${srcdir}/MUTN-\$pkgver
# compress man page
gzip -kf ./docs/man
# determine microarchitecture feature level
case \$CARCH in
'x86_64')
cpuFlags=\$(grep -E 'flags\s+:\s' /proc/cpuinfo)
if [ ! -z \"\$(echo \"\$cpuFlags\" | grep 'avx512f')\" ]; then
export GOAMD64=v4
elif [ ! -z \"\$(echo \"\$cpuFlags\" | grep 'avx2')\" ]; then
export GOAMD64=v3
elif [ ! -z \"\$(echo \"\$cpuFlags\" | grep 'sse4_2')\" ]; then
export GOAMD64=v2
else
export GOAMD64=v1
fi
;;
# TODO check aarch64 feature level
esac
# compile binary
CGO_ENABLED=1 go build -ldflags=\"-s -w\" -trimpath -tags=stxAll ./mutn.go
}
package() {
cd \${srcdir}/MUTN-\$pkgver
install -Dm755 ./mutn \${pkgdir}/usr/bin/mutn
install -Dm644 ./LICENSE \${pkgdir}/usr/share/licenses/mutn/LICENSE
install -Dm644 ./completions/zsh/_mutn \${pkgdir}/usr/share/zsh/site-functions/_mutn
install -Dm644 ./completions/bash/mutn \${pkgdir}/usr/share/bash-completion/completions/mutn
install -Dm644 ./docs/man.gz \${pkgdir}/usr/share/man/man1/mutn.1.gz
}
sha512sums=\"
$checksum \$pkgname-\$pkgver.tar.gz
\"
" > 1output/APKBUILD
printf '\nAPKBUILD generated\n\n'
}
@@ -0,0 +1,61 @@
#!/bin/sh
create_pkgbuild_git_stable_optimized() {
printf '\nGenerating PKGBUILD...\n'
local source="git+https://github.com/rwinkhart/MUTN.git#tag=v\${pkgver}"
printf "# Maintainer: Randall Winkhart <idgr at tutanota dot com>
pkgname=mutn
pkgver="$version"
pkgrel="$revision"
pkgdesc='A simple, self-hosted, SSH-synchronized password/note manager for the CLI (based on libmutton)'
arch=('x86_64' 'i686' 'i486' 'pentium4' 'aarch64' 'armv7h' 'riscv64')
url='https://github.com/rwinkhart/MUTN'
license=('MIT')
depends=()
makedepends=(go grep gzip)
optdepends=(
'wl-clipboard: Wayland clipboard support'
'xclip: X11 clipboard support'
'bash-completion: Bash completion support'
)
source=(\""$source"\")
sha512sums=(SKIP)
build() {
cd \${srcdir}/MUTN
# compress man page
gzip -kf ./docs/man
# determine microarchitecture feature level
case \$CARCH in
'x86_64')
cpuFlags=\$(grep -E 'flags\s+:\s' /proc/cpuinfo)
if [ ! -z \"\$(grep 'avx512f' <<< \"\$cpuFlags\")\" ]; then
export GOAMD64=v4
elif [ ! -z \"\$(grep 'avx2' <<< \"\$cpuFlags\")\" ]; then
export GOAMD64=v3
elif [ ! -z \"\$(grep 'sse4_2' <<< \"\$cpuFlags\")\" ]; then
export GOAMD64=v2
else
export GOAMD64=v1
fi
;;
# TODO check aarch64 feature level
esac
# compile binary
CGO_ENABLED=1 go build -ldflags=\"-s -w\" -trimpath -tags=stxAll ./mutn.go
}
package() {
cd \${srcdir}/MUTN
install -Dm755 ./mutn \${pkgdir}/usr/bin/mutn
install -Dm644 ./LICENSE \${pkgdir}/usr/share/licenses/mutn/LICENSE
install -Dm644 ./completions/zsh/_mutn \${pkgdir}/usr/share/zsh/site-functions/_mutn
install -Dm644 ./completions/bash/mutn \${pkgdir}/usr/share/bash-completion/completions/mutn
install -Dm644 ./docs/man.gz \${pkgdir}/usr/share/man/man1/mutn.1.gz
}
" > 1output/PKGBUILD
printf '\nPKGBUILD generated\n\n'
}
+18
View File
@@ -0,0 +1,18 @@
#!/bin/sh
# This script generates portable MUTN release binaries for the following platforms:
# - Linux (x86_64_v2)
# - Linux (arm64v8.0)
# - Linux (arm64v8.7+crypto)
# - Windows (x86_64_v2)
# - Windows (arm64v8.7+crypto)
create_release_binaries() {
printf '\nGenerating release binaries...\n'
cd ..
GOOS=linux CGO_ENABLED=0 GOAMD64=v2 go build -o ./packaging/1output/mutn-linux-x86_64_v2 -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go
GOOS=linux GOARCH=arm64 GOARM64=v8.0 CGO_ENABLED=0 go build -o ./packaging/1output/mutn-linux-arm64v8.0 -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go
GOOS=linux GOARCH=arm64 GOARM64=v8.7,crypto CGO_ENABLED=0 go build -o ./packaging/1output/mutn-linux-arm64v8.7+crypto -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go
GOOS=windows CGO_ENABLED=0 GOAMD64=v2 go build -o ./packaging/1output/mutn-windows-x86_64_v2.exe -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go
GOOS=windows GOARCH=arm64 GOARM64=v8.7,crypto CGO_ENABLED=0 go build -o ./packaging/1output/mutn-windows-arm64v8.7+crypto.exe -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go
cd ./packaging
}
-16
View File
@@ -1,16 +0,0 @@
package backend
import (
"os"
)
// global variables used across multiple files
var (
home, _ = os.UserHomeDir()
)
// global constants used across multiple files
const (
AnsiError = "\033[38;5;9m"
AnsiReset = "\033[0m"
)
-14
View File
@@ -1,14 +0,0 @@
//go:build !windows
package backend
// EntryRoot path to libmutton entry directory
var EntryRoot = home + "/.local/share/libmutton"
var ConfigDir = home + "/.config/libmutton"
var ConfigPath = ConfigDir + "/libmutton.ini"
// PathSeparator defines the character used to separate directories in a path (platform-specific)
const (
PathSeparator = "/"
Windows = false // TODO temporary, remove after native sync is implemented
)
-14
View File
@@ -1,14 +0,0 @@
//go:build windows
package backend
// EntryRoot path to libmutton entry directory
var EntryRoot = home + "\\AppData\\Local\\libmutton\\entries"
var ConfigDir = home + "\\AppData\\Local\\libmutton"
var ConfigPath = ConfigDir + "\\libmutton.ini"
// PathSeparator defines the character used to separate directories in a path (platform-specific)
const (
PathSeparator = "\\"
Windows = true // TODO temporary, remove after native sync is implemented
)
-23
View File
@@ -1,23 +0,0 @@
package backend
import (
"fmt"
"os"
)
// AddFolder creates a new directory at targetLocation
func AddFolder(targetLocation string) {
// create the directory specified by targetLocation
err := os.Mkdir(targetLocation, 0700)
if err != nil {
if os.IsExist(err) {
fmt.Println(AnsiError + "Directory already exists" + AnsiReset)
os.Exit(1)
} else {
fmt.Println(AnsiError + "Failed to create directory: " + err.Error() + AnsiReset)
os.Exit(1)
}
}
// TODO If in online mode, create the directory on the server
os.Exit(0)
}
-46
View File
@@ -1,46 +0,0 @@
package backend
import (
"fmt"
"gopkg.in/ini.v1"
"os"
)
// ReadConfig reads the libmutton.ini file and returns a map of the requested values
// requires readMap: a map of section names to key names (indicates requested values)
// returns configMap: a map of key names to values (sections are irrelevant)
func ReadConfig(readKeys []string) []string {
cfg, err := ini.Load(ConfigPath)
if err != nil {
fmt.Println(AnsiError + "Failed to load libmutton.ini" + AnsiReset)
os.Exit(1)
}
var config []string
for _, key := range readKeys {
keyConfig := cfg.Section("LIBMUTTON").Key(key).String()
// ensure specified key has a value
if keyConfig == "" {
fmt.Println(AnsiError + "Failed to find value for key \"" + key + "\" in section \"[LIBMUTTON]\" in libmutton.ini" + AnsiReset)
os.Exit(1)
}
config = append(config, keyConfig)
}
return config
}
// libmuttn.ini layout
// [LIBMUTTON]
// gpgID = <gpg key id>
// textEditor = <editor command>
// onlineMode = <true/false>
// sshError = <true/false>
// netPinEnabled = <true/false>
// remoteUser = <ssh user>
// remoteIP = <ssh ip>
// remotePort = <ssh port>
// identityFile = <path to private key>
-88
View File
@@ -1,88 +0,0 @@
package backend
import (
"bufio"
"fmt"
steamtotp "github.com/fortis/go-steam-totp"
"github.com/pquerna/otp/totp"
"os"
"strings"
"time"
)
// CopyArgument copies a field from an entry to the clipboard
func CopyArgument(targetLocation string, field int, executableName string) {
if isFile, _ := TargetIsFile(targetLocation, true, 2); isFile {
decryptedEntry := DecryptGPG(targetLocation)
var copySubject string // will store data to be copied
// ensure field exists in entry
if len(decryptedEntry) > field {
// ensure field is not empty
if decryptedEntry[field] == "" {
fmt.Println(AnsiError + "Field is empty" + AnsiReset)
os.Exit(1)
}
if field != 5 { // TODO Update field after removed from notes (breaking sshyp entry compatibility)
copySubject = decryptedEntry[field]
} else { // TOTP mode
var secret string // stores secret for TOTP generation
var forSteam bool // indicates whether to generate TOTP in Steam format
if strings.HasPrefix(decryptedEntry[5], "steam@") {
secret = decryptedEntry[5][6:]
forSteam = true
} else {
secret = decryptedEntry[5]
}
for { // keep field copied to clipboard, refresh on 30-second intervals
currentTime := time.Now()
copyField(GenTOTP(secret, currentTime, forSteam), "")
// sleep until next 30-second interval
time.Sleep(time.Duration(30-(currentTime.Second()%30)) * time.Second)
}
}
} else {
fmt.Println(AnsiError + "Field does not exist in entry" + AnsiReset)
os.Exit(1)
}
// copy field to clipboard, launch clipboard clearing process
copyField(copySubject, executableName)
}
}
// ClipClearArgument is called to clear the clipboard after 30 seconds if the contents have not been modified
func ClipClearArgument() {
// read previous clipboard contents from stdin
clipScanner := bufio.NewScanner(os.Stdin)
if clipScanner.Scan() {
oldContents := clipScanner.Text()
clipClear(oldContents)
} else {
os.Exit(0)
}
}
// GenTOTP generates a TOTP token from a secret (supports standard and Steam TOTP)
func GenTOTP(secret string, time time.Time, forSteam bool) string {
var totpToken string
var err error
if forSteam {
totpToken, err = steamtotp.GenerateAuthCode(secret, time)
} else {
totpToken, err = totp.GenerateCode(secret, time)
}
if err != nil {
fmt.Println(AnsiError + "Error generating TOTP code" + AnsiReset)
os.Exit(1)
}
return totpToken
}
-55
View File
@@ -1,55 +0,0 @@
//go:build darwin
package backend
import (
"fmt"
"os"
"os/exec"
"strings"
"time"
)
// TODO MacOS support is entirely untested - I would appreciate feedback on this implementation
// copyField copies a field from an entry to the clipboard
func copyField(copySubject string, executableName string) {
cmd := exec.Command("pbcopy")
writeToStdin(cmd, copySubject)
err := cmd.Run()
if err != nil {
fmt.Println(AnsiError + "Failed to copy to clipboard: " + err.Error() + AnsiReset)
os.Exit(1)
}
// launch clipboard clearing process if executableName is provided
if executableName != "" {
cmd = exec.Command(executableName, "clipclear")
writeToStdin(cmd, copySubject)
err = cmd.Start()
if err != nil {
fmt.Println(AnsiError + "Failed to launch automated clipboard clearing process - does this libmutton implementation support the \"clipclear\" argument?" + AnsiReset)
os.Exit(1)
}
os.Exit(0) // only exit if clipboard clearing process is launched, otherwise assume continuous clipboard refresh
}
}
// clipClear is called in a separate process to clear the clipboard after 30 seconds
func clipClear(oldContents string) {
time.Sleep(30 * time.Second)
cmd := exec.Command("pbpaste")
newContents, _ := cmd.Output()
if oldContents == strings.TrimRight(string(newContents), "\r\n") {
cmd = exec.Command("pbcopy")
writeToStdin(cmd, "")
err := cmd.Run()
if err != nil {
fmt.Println(AnsiError + "Failed to clear clipboard: " + err.Error() + AnsiReset)
os.Exit(1)
}
}
os.Exit(0)
}
-53
View File
@@ -1,53 +0,0 @@
//go:build termux
package backend
import (
"fmt"
"os"
"os/exec"
"strings"
"time"
)
// copyField copies a field from an entry to the clipboard
func copyField(copySubject string, executableName string) {
cmd := exec.Command("termux-clipboard-set")
writeToStdin(cmd, copySubject)
err := cmd.Run()
if err != nil {
fmt.Println(AnsiError + "Failed to copy to clipboard: " + err.Error() + AnsiReset)
os.Exit(1)
}
// launch clipboard clearing process if executableName is provided
if executableName != "" {
cmd = exec.Command(executableName, "clipclear")
writeToStdin(cmd, copySubject)
err = cmd.Start()
if err != nil {
fmt.Println(AnsiError + "Failed to launch automated clipboard clearing process - does this libmutton implementation support the \"clipclear\" argument?" + AnsiReset)
os.Exit(1)
}
os.Exit(0) // only exit if clipboard clearing process is launched, otherwise assume continuous clipboard refresh
}
}
// clipClear is called in a separate process to clear the clipboard after 30 seconds
func clipClear(oldContents string) {
time.Sleep(30 * time.Second)
cmd := exec.Command("termux-clipboard-get")
newContents, _ := cmd.Output()
if oldContents == strings.TrimRight(string(newContents), "\r\n") {
cmd = exec.Command("termux-clipboard-set")
writeToStdin(cmd, "")
err := cmd.Run()
if err != nil {
fmt.Println(AnsiError + "Failed to clear clipboard: " + err.Error() + AnsiReset)
os.Exit(1)
}
}
os.Exit(0)
}
-77
View File
@@ -1,77 +0,0 @@
//go:build !windows && !darwin && !termux
package backend
import (
"fmt"
"os"
"os/exec"
"strings"
"time"
)
// copyField copies a field from an entry to the clipboard
func copyField(copySubject string, executableName string) {
var envSet bool // track whether environment variables are set
var cmd *exec.Cmd
// determine whether to use wl-copy (Wayland) or xclip (X11)
if _, envSet = os.LookupEnv("WAYLAND_DISPLAY"); envSet {
cmd = exec.Command("wl-copy")
} else if _, envSet = os.LookupEnv("DISPLAY"); envSet {
cmd = exec.Command("xclip", "-sel", "c")
} else {
fmt.Println(AnsiError + "Clipboard platform could not be determined - note that the clipboard does not function in a raw TTY" + AnsiReset)
os.Exit(1)
}
writeToStdin(cmd, copySubject)
err := cmd.Run()
if err != nil {
fmt.Println(AnsiError + "Failed to copy to clipboard: " + err.Error() + AnsiReset)
os.Exit(1)
}
// launch clipboard clearing process if executableName is provided
if executableName != "" {
cmd = exec.Command(executableName, "clipclear")
writeToStdin(cmd, copySubject)
err = cmd.Start()
if err != nil {
fmt.Println(AnsiError + "Failed to launch automated clipboard clearing process - does this libmutton implementation support the \"clipclear\" argument?" + AnsiReset)
os.Exit(1)
}
os.Exit(0) // only exit if clipboard clearing process is launched, otherwise assume continuous clipboard refresh
}
}
// clipClear is called in a separate process to clear the clipboard after 30 seconds
func clipClear(oldContents string) {
time.Sleep(30 * time.Second)
var envSet bool // track whether environment variables are set
var platform bool // track clipboard platform, false for Wayland, true for X11
var cmd *exec.Cmd
// determine whether to use wl-copy (Wayland) or xclip (X11)
if _, envSet = os.LookupEnv("WAYLAND_DISPLAY"); envSet {
cmd = exec.Command("wl-paste")
} else if _, envSet = os.LookupEnv("DISPLAY"); envSet {
cmd = exec.Command("xclip", "-o", "-sel", "c")
platform = true
}
newContents, _ := cmd.Output()
if oldContents == strings.TrimRight(string(newContents), "\r\n") {
switch platform {
case false:
cmd = exec.Command("wl-copy", "-c")
case true:
cmd = exec.Command("xclip", "-i", "/dev/null", "-sel", "c")
}
err := cmd.Run()
if err != nil {
fmt.Println(AnsiError + "Failed to clear clipboard: " + err.Error() + AnsiReset)
os.Exit(1)
}
}
os.Exit(0)
}
-51
View File
@@ -1,51 +0,0 @@
//go:build windows
package backend
import (
"fmt"
"os"
"os/exec"
"strings"
"time"
)
// copyField copies a field from an entry to the clipboard
func copyField(copySubject string, executableName string) {
cmd := exec.Command("powershell.exe", "-c", fmt.Sprintf("echo '%s' | Set-Clipboard", strings.ReplaceAll(copySubject, "'", "''")))
err := cmd.Run()
if err != nil {
fmt.Println(AnsiError + "Failed to copy to clipboard: " + err.Error() + AnsiReset)
os.Exit(1)
}
// launch clipboard clearing process if executableName is provided
if executableName != "" {
cmd = exec.Command(executableName, "clipclear")
writeToStdin(cmd, copySubject)
err = cmd.Start()
if err != nil {
fmt.Println(AnsiError + "Failed to launch automated clipboard clearing process - does this libmutton implementation support the \"clipclear\" argument?" + AnsiReset)
os.Exit(1)
}
os.Exit(0) // only exit if clipboard clearing process is launched, otherwise assume continuous clipboard refresh
}
}
// clipClear is called in a separate process to clear the clipboard after 30 seconds
func clipClear(oldContents string) {
time.Sleep(30 * time.Second)
cmd := exec.Command("powershell.exe", "-c", "Get-Clipboard")
newContents, _ := cmd.Output()
if oldContents == strings.TrimRight(string(newContents), "\r\n") {
cmd = exec.Command("powershell.exe", "-c", "Set-Clipboard")
err := cmd.Run()
if err != nil {
fmt.Println(AnsiError + "Failed to clear clipboard: " + err.Error() + AnsiReset)
os.Exit(1)
}
}
os.Exit(0)
}
-49
View File
@@ -1,49 +0,0 @@
package backend
import (
"fmt"
"os"
)
// GetOldEntryData decrypts and returns old entry data (with all required lines present)
func GetOldEntryData(targetLocation string, field int) []string {
// ensure targetLocation exists
TargetIsFile(targetLocation, true, 2)
// read old entry data
unencryptedEntry := DecryptGPG(targetLocation)
// return the old entry data with all required lines present
if field > 0 {
return EnsureSliceLength(unencryptedEntry, field)
} else {
return unencryptedEntry
}
}
// Rename renames oldLocation to newLocation
func Rename(oldLocation string, newLocation string) {
// ensure newLocation does not exist
_, isAccessible := TargetIsFile(newLocation, false, 0)
if isAccessible {
fmt.Println(AnsiError + "\"" + newLocation + "\" already exists" + AnsiReset)
os.Exit(1)
}
// rename oldLocation to newLocation
err := os.Rename(oldLocation, newLocation)
if err != nil {
fmt.Println(AnsiError + "Failed to rename - does the target containing directory exists?" + AnsiReset)
}
// TODO If in online mode, check if oldLocation is a directory and rename it on the server
os.Exit(0)
}
// EnsureSliceLength ensures slice is long enough to contain the specified index
func EnsureSliceLength(slice []string, index int) []string {
for len(slice) <= index {
slice = append(slice, "")
}
return slice
}
-35
View File
@@ -1,35 +0,0 @@
package backend
import (
"fmt"
"os"
"os/exec"
"strings"
)
// TODO GPG support is a temporary feature - it will be replaced with a different encryption scheme in the future
// TODO These functions may continue to exist after that point, but consider them deprecated
// DecryptGPG decrypts a GPG-encrypted file and returns the contents as a slice of (trimmed) strings
func DecryptGPG(targetLocation string) []string {
cmd := exec.Command("gpg", "--pinentry-mode", "loopback", "-q", "-d", targetLocation)
output, err := cmd.Output()
if err != nil {
fmt.Println(AnsiError + "Failed to decrypt \"" + targetLocation + "\" - ensure it is a valid GPG-encrypted file and that you entered your passphrase correctly" + AnsiReset)
os.Exit(1)
}
outputSlice := strings.Split(string(output), "\n")
return outputSlice
}
// EncryptGPG encrypts a slice of strings using GPG and returns the encrypted data as a byte slice
func EncryptGPG(input []string) []byte {
cmd := exec.Command("gpg", "-q", "-r", ReadConfig([]string{"gpgID"})[0], "-e")
writeToStdin(cmd, strings.Join(input, "\n"))
encryptedBytes, err := cmd.Output()
if err != nil {
fmt.Println(AnsiError + "Failed to encrypt data - ensure that your GPG key is valid and that you have a valid GPG ID set in libmutton.ini" + AnsiReset)
os.Exit(1)
}
return encryptedBytes
}
-69
View File
@@ -1,69 +0,0 @@
package backend
import (
"os"
"os/exec"
"strconv"
"strings"
"time"
)
// TempInit ensures libmutton directories exist and writes the libmutton configuration file
func TempInit(configFileMap map[string]string) {
// create EntryRoot and ConfigDir
dirInit()
// remove existing config file
removeFile(ConfigPath)
if configFileMap["textEditor"] == "" {
configFileMap["textEditor"] = textEditorFallback()
}
// create and write config file
configFile, _ := os.OpenFile(ConfigPath, os.O_CREATE|os.O_WRONLY, 0600)
defer configFile.Close()
configFile.WriteString("[LIBMUTTON]\n")
for key, value := range configFileMap {
configFile.WriteString(key + " = " + value + "\n")
}
os.Exit(0)
}
// GpgUIDListGen generates a list of all GPG key IDs on the system and returns them as a slice of strings
func GpgUIDListGen() []string {
cmd := exec.Command("gpg", "-k", "--with-colons")
gpgOutputBytes, _ := cmd.Output()
gpgOutputLines := strings.Split(string(gpgOutputBytes), "\n")
var uidSlice []string
for _, line := range gpgOutputLines {
if strings.HasPrefix(line, "uid") {
uid := strings.Split(line, ":")[9]
uidSlice = append(uidSlice, uid)
}
}
return uidSlice
}
// GpgKeyGen generates a new GPG key and returns the key ID
func GpgKeyGen() string {
gpgGenTempFile := CreateTempFile()
defer os.Remove(gpgGenTempFile.Name())
// create and write gpg-gen file
unixTime := strconv.FormatInt(time.Now().Unix(), 10)
gpgGenTempFile.WriteString(strings.Join([]string{"Key-Type: eddsa", "Key-Curve: ed25519", "Key-Usage: sign", "Subkey-Type: ecdh", "Subkey-Curve: cv25519", "Subkey-Usage: encrypt", "Name-Real: libmutton-" + unixTime, "Name-Comment: gpg-libmutton", "Name-Email: github.com/rwinkhart/libmutton", "Expire-Date: 0"}, "\n"))
// close gpg-gen file
gpgGenTempFile.Close()
// generate GPG key based on gpg-gen file
cmd := exec.Command("gpg", "-q", "--batch", "--generate-key", gpgGenTempFile.Name())
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Stdin = os.Stdin
cmd.Run()
return "libmutton-" + unixTime + " (gpg-libmutton) <github.com/rwinkhart/libmutton>"
}
-37
View File
@@ -1,37 +0,0 @@
//go:build !windows
package backend
import (
"fmt"
"os"
)
const FallbackEditor = "vi" // vi is pre-installed on most UNIX systems
// dirInit creates the libmutton directories
func dirInit() {
// create EntryRoot
err := os.MkdirAll(EntryRoot, 0700)
if err != nil {
fmt.Println(AnsiError + "Failed to create \"" + EntryRoot + "\":" + err.Error() + AnsiReset)
os.Exit(1)
}
// create config directory
err = os.MkdirAll(ConfigDir, 0700)
if err != nil {
fmt.Println(AnsiError + "Failed to create \"" + ConfigDir + "\":" + err.Error() + AnsiReset)
os.Exit(1)
}
}
// textEditorFallback returns the value of the $EDITOR environment variable, or FallbackEditor if it is not set
func textEditorFallback() string {
// ensure textEditor is set
textEditor := os.Getenv("EDITOR")
if textEditor == "" {
textEditor = FallbackEditor
}
return textEditor
}
-25
View File
@@ -1,25 +0,0 @@
//go:build windows
package backend
import (
"fmt"
"os"
)
const FallbackEditor = "nvim" // since there is no pre-installed CLI editor on Windows, default to the most popular one
// dirInit creates the libmutton directories
func dirInit() {
// create EntryRoot (includes config directory on Windows)
err := os.MkdirAll(EntryRoot, 0700)
if err != nil {
fmt.Println(AnsiError + "Failed to create \"" + EntryRoot + "\":" + err.Error() + AnsiReset)
os.Exit(1)
}
}
// textEditorFallback returns FallbackEditor
func textEditorFallback() string {
return FallbackEditor
}
-17
View File
@@ -1,17 +0,0 @@
package backend
import (
"fmt"
"os"
)
func Shear(targetLocation string) {
// TODO If in online mode, remove from server and add to shear list
TargetIsFile(targetLocation, true, 0) // needed because os.RemoveAll does not return an error if target does not exist
err := os.RemoveAll(targetLocation)
if err != nil {
fmt.Println(AnsiError + "Failed to remove target: " + err.Error() + AnsiReset)
os.Exit(1)
}
os.Exit(0)
}
-8
View File
@@ -1,8 +0,0 @@
//go:build !windows
package backend
// TargetLocationFormat returns the target location of an entry formatted for the current platform
func TargetLocationFormat(entryName string) string {
return EntryRoot + PathSeparator + entryName
}
-10
View File
@@ -1,10 +0,0 @@
//go:build windows
package backend
import "strings"
// TargetLocationFormat returns the target location of an entry formatted for the current platform
func TargetLocationFormat(entryName string) string {
return EntryRoot + PathSeparator + strings.ReplaceAll(entryName, "/", PathSeparator)
}
-147
View File
@@ -1,147 +0,0 @@
package backend
import (
"crypto/rand"
"fmt"
"io"
"math"
"math/big"
"os"
"os/exec"
"strings"
)
const extendedCharset = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
// TargetIsFile TargetStatusCheck checks if the targetLocation is a file, directory, or is inaccessible
// failCondition: 0 = fail on inaccessible, 1 = fail on inaccessible/file, 2 = fail on inaccessible/directory
// returns: isFile, isAccessible
func TargetIsFile(targetLocation string, errorOnFail bool, failCondition uint8) (bool, bool) {
targetInfo, err := os.Stat(targetLocation)
if err != nil {
if errorOnFail {
fmt.Println(AnsiError + "Failed to access \"" + targetLocation + "\" - ensure it exists and has the correct permissions" + AnsiReset)
os.Exit(1)
} else {
return false, false
}
}
if targetInfo.IsDir() {
if errorOnFail && failCondition == 2 {
fmt.Println(AnsiError + "\"" + targetLocation + "\" is a directory" + AnsiReset)
os.Exit(1)
}
return false, true
} else {
if errorOnFail && failCondition == 1 {
fmt.Println(AnsiError + "\"" + targetLocation + "\" is a file" + AnsiReset)
os.Exit(1)
}
return true, true
}
}
// WriteEntry writes entryData to an encrypted file at targetLocation
func WriteEntry(targetLocation string, entryData []string) {
encryptedBytes := EncryptGPG(entryData)
err := os.WriteFile(targetLocation, encryptedBytes, 0600)
if err != nil {
fmt.Println(AnsiError + "Failed to write to file: " + err.Error() + AnsiReset)
os.Exit(1)
}
}
// writeToStdin writes a string to a command's stdin
func writeToStdin(cmd *exec.Cmd, input string) {
stdin, _ := cmd.StdinPipe()
go func() {
defer stdin.Close()
io.WriteString(stdin, input)
}()
}
// CreateTempFile creates a temporary file and returns a pointer to it
func CreateTempFile() *os.File {
tempFile, err := os.CreateTemp("", "*.markdown")
if err != nil {
fmt.Println(AnsiError + "Failed to create temporary file: " + err.Error() + AnsiReset)
os.Exit(1)
}
return tempFile
}
// removeFile removes a file at targetLocation and does not error if the file does not exist
func removeFile(targetLocation string) {
// remove existing config file
err := os.Remove(targetLocation)
if err != nil {
// ignore error if file does not exist
if !os.IsNotExist(err) {
fmt.Println(AnsiError + "Failed to remove \"" + targetLocation + "\":" + err.Error() + AnsiReset)
}
}
}
// RemoveTrailingEmptyStrings removes empty strings from the end of a slice
func RemoveTrailingEmptyStrings(slice []string) []string {
for i := len(slice) - 1; i >= 0; i-- {
if slice[i] != "" {
return slice[:i+1]
}
}
return []string{}
}
// StringGen generates a random string of a specified length and complexity
// complexity: minimum percentage of special characters to be returned in the generated string (only impacts complex strings)
func StringGen(length int, complex bool, complexity float64) string {
var actualSpecialChars int // track the number of special characters in the generated string
var minSpecialChars int // track the minimum number of special characters to accept
charset := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" // default character set used for all strings
if complex {
minSpecialChars = int(math.Round(float64(length) * complexity)) // determine minimum number of special characters to accept
charset = charset + extendedCharset
}
// loop until a string of the desired complexity is generated
for {
// generate a random string
result := make([]byte, length)
for i := range result {
val, _ := rand.Int(rand.Reader, big.NewInt(int64(len(charset))))
result[i] = charset[val.Int64()]
}
// return early if the string is not complex
if !complex {
return string(result)
}
// count the number of special characters in the generated string
for _, char := range string(result) {
if strings.ContainsRune(extendedCharset, char) {
actualSpecialChars++
}
}
// return the generated string if it contains enough special characters
if actualSpecialChars >= minSpecialChars {
return string(result)
}
// reset special character counter
fmt.Println("Regenerating string until desired complexity is achieved...")
actualSpecialChars = 0
}
}
// EntryIsNotEmpty iterates through entryData and returns true if any line is not empty
func EntryIsNotEmpty(entryData []string) bool {
for _, line := range entryData {
if line != "" {
return true
}
}
return false
}
+11 -7
View File
@@ -1,19 +1,23 @@
package cli
import (
"github.com/rwinkhart/MUTN/src/backend"
termy "golang.org/x/crypto/ssh/terminal"
"os"
"github.com/rwinkhart/go-boilerplate/front"
"github.com/rwinkhart/libmutton/global"
"golang.org/x/term"
)
// global variables used across multiple files
var (
rootLength = len(backend.EntryRoot)
width, _, _ = termy.GetSize(int(os.Stdout.Fd()))
width, _, _ = term.GetSize(int(os.Stdout.Fd()))
)
// global constants used across multiple files
const (
ansiBold = "\033[1m"
MUTNVersion = "0.3.1" // untagged releases feature a letter suffix corresponding to the eventual release version, e.g "0.2.A" -> "0.2.0", "0.2.B" -> "0.2.1"
ansiBlackOnWhite = "\033[38;5;0;48;5;15m"
)
func init() {
global.GetPassword = front.InputHidden
}
+22 -20
View File
@@ -1,45 +1,47 @@
package cli
import (
"fmt"
"github.com/rwinkhart/MUTN/src/backend"
"os"
"github.com/rwinkhart/go-boilerplate/back"
"github.com/rwinkhart/go-boilerplate/front"
"github.com/rwinkhart/go-boilerplate/other"
"github.com/rwinkhart/libmutton/core"
)
// AddEntry creates a new entry at targetLocation by taking user input via CLI prompts
// entryType: 0 = standard (password), 1 = auto-generated password, 2 = note
func AddEntry(targetLocation string, hidePassword bool, entryType uint8) {
_, isAccessible := backend.TargetIsFile(targetLocation, false, 0)
if isAccessible {
fmt.Println(backend.AnsiError + "Target location already exists" + backend.AnsiReset)
os.Exit(1)
// AddEntry creates a new entry at targetLocation by taking user input via CLI prompts.
// Requires: entryType (0 = standard password entry, 1 = auto-generated password entry, 2 = note-only entry).
func AddEntry(targetLocation string, hideSecrets bool, entryType uint8) {
// ensure targetLocation is valid
_, err := core.EntryAddPrecheck(targetLocation)
if err != nil {
other.PrintError("Failed to add entry: "+err.Error(), back.ErrorWrite)
}
var unencryptedEntry []string
var decryptedEntry []string
if entryType < 2 {
username := input("Username:")
username := front.Input("Username:")
// determine whether to generate the password
var password string
if entryType == 0 {
password = inputHidden("Password:")
password = string(front.InputHidden("Password:"))
} else {
password = backend.StringGen(inputInt("Password length:", -1), inputBinary("Generate a complex (special characters) password?"), 0.2)
password = inputPasswordGen()
}
url := input("URL:")
if inputBinary("Add a note to this entry?") {
totp := string(front.InputHidden("TOTP secret:"))
url := front.Input("URL:")
if front.InputBinary("Add a note to this entry?") {
note, _ := editNote([]string{})
unencryptedEntry = append([]string{password, username, url}, note...)
decryptedEntry = append([]string{password, username, totp, url}, note...)
} else {
unencryptedEntry = []string{password, username, url}
decryptedEntry = []string{password, username, totp, url}
}
} else {
note, _ := editNote([]string{})
unencryptedEntry = append([]string{"", "", ""}, note...)
decryptedEntry = append([]string{"", "", "", ""}, note...)
}
// write and preview the new entry
writeEntryCLI(targetLocation, unencryptedEntry, hidePassword)
writeEntryCLI(targetLocation, decryptedEntry, hideSecrets)
}
+84 -50
View File
@@ -2,100 +2,132 @@ package cli
import (
"bufio"
"fmt"
"github.com/rwinkhart/MUTN/src/backend"
"os"
"os/exec"
"reflect"
"strings"
"github.com/rwinkhart/go-boilerplate/back"
"github.com/rwinkhart/go-boilerplate/front"
"github.com/rwinkhart/go-boilerplate/other"
"github.com/rwinkhart/libmutton/cfg"
"github.com/rwinkhart/libmutton/core"
"github.com/rwinkhart/libmutton/syncclient"
)
// RenameCli renames an entry at oldLocation to a new location (user input)
func RenameCli(oldLocation string) {
// ensure targetLocation exists
backend.TargetIsFile(oldLocation, true, 0)
// RenameCli renames an entry at oldLocationIncomplete to a new location (user input) on both the client and the server.
func RenameCli(oldLocationIncomplete string) {
// prompt user for new location and rename
newLocation := backend.EntryRoot + backend.PathSeparator + input("New location:")
backend.Rename(oldLocation, newLocation)
newLocationIncomplete := front.Input("New location:")
err := syncclient.RenameRemoteFromClient(oldLocationIncomplete, newLocationIncomplete)
if err != nil {
other.PrintError("Failed to rename entry: "+err.Error(), back.ErrorWrite)
}
// exit is done from backend.Rename
// exit is done from sync.RenameRemoteFromClient
}
// EditEntryField edits a field of an entry at targetLocation (user input)
func EditEntryField(targetLocation string, hidePassword bool, field int) {
// EditEntryField edits a field of an entry at targetLocation (user input).
func EditEntryField(targetLocation string, hideSecrets bool, field int) {
// fetch old entry data (with all required lines present)
unencryptedEntry := backend.GetOldEntryData(targetLocation, field)
decryptedEntry, err := core.GetOldEntryData(targetLocation, field)
if err != nil {
other.PrintError("Failed to fetch entry data: "+err.Error(), back.ErrorRead)
}
// edit the field
switch field {
case 0:
unencryptedEntry[field] = inputHidden("Password:")
decryptedEntry[field] = string(front.InputHidden("Password:"))
case 1:
unencryptedEntry[field] = input("Username:")
decryptedEntry[field] = front.Input("Username:")
case 2:
unencryptedEntry[field] = input("URL:")
case 3: // edit notes fields
decryptedEntry[field] = string(front.InputHidden("TOTP secret:"))
case 3:
decryptedEntry[field] = front.Input("URL:")
case 4: // edit notes fields
// store note and non-note data separately
nonNoteData := unencryptedEntry[:3]
noteData := unencryptedEntry[3:]
fieldsMain := decryptedEntry[:4]
fieldsNote := decryptedEntry[4:]
// edit the note
editedNote, noteEdited := editNote(noteData)
editedNote, noteEdited := editNote(fieldsNote)
if !noteEdited { // exit early if the note was not edited
fmt.Println(backend.AnsiError + "Entry is unchanged" + backend.AnsiReset)
os.Exit(1)
other.PrintError("Entry is unchanged", 0)
}
unencryptedEntry = append(nonNoteData, editedNote...)
decryptedEntry = append(fieldsMain, editedNote...)
}
// write and preview the modified entry
writeEntryCLI(targetLocation, unencryptedEntry, hidePassword)
writeEntryCLI(targetLocation, decryptedEntry, hideSecrets)
}
// GenUpdate generates a new password for an entry at targetLocation (user input)
func GenUpdate(targetLocation string, hidePassword bool) {
// GenUpdate generates a new password for an entry at targetLocation (user input).
func GenUpdate(targetLocation string, hideSecrets bool) {
// fetch old entry data
unencryptedEntry := backend.GetOldEntryData(targetLocation, 0)
decryptedEntry, err := core.GetOldEntryData(targetLocation, 0)
if err != nil {
other.PrintError("Failed to fetch entry data: "+err.Error(), back.ErrorRead)
}
// generate a new password
unencryptedEntry[0] = backend.StringGen(inputInt("Password length:", -1), inputBinary("Generate a complex (special characters) password?"), 0.2)
decryptedEntry[0] = inputPasswordGen()
// write and preview the modified entry
writeEntryCLI(targetLocation, unencryptedEntry, hidePassword)
writeEntryCLI(targetLocation, decryptedEntry, hideSecrets)
}
// editNote uses the user-specified text editor to edit an existing note (or create a new one if baseNote is empty)
// returns the edited note and a boolean indicating whether the note was edited
// editNote uses the user-specified text editor to edit an existing note (or create a new one if baseNote is empty).
// Returns the edited note and a boolean indicating whether the note was edited.
func editNote(baseNote []string) ([]string, bool) {
tempFile := backend.CreateTempFile()
defer os.Remove(tempFile.Name())
editor := backend.ReadConfig([]string{"textEditor"})[0]
tempFile, err := back.CreateTempFile()
if err != nil {
other.PrintError("Failed to create temporary note file: "+err.Error(), back.ErrorWrite)
}
defer func(name string) {
_ = os.Remove(name) // error ignored; if the file could be created, it can probably be removed
}(tempFile.Name())
// fetch the user's text editor
editorCfg, err := cfg.ParseConfig([][2]string{{"MUTN", "textEditor"}})
if err != nil {
other.PrintError("Failed to retrieve text editor from libmutton.ini\n\nPlease specify one with \"mutn tweak\"", back.ErrorRead)
}
editor := editorCfg[0]
// write baseNote to tempFile (if it is not empty)
if len(baseNote) > 0 {
baseNoteLen := len(baseNote)
switch baseNoteLen {
case 0: // do not write empty baseNote to file
case 1: // truncate baseNote if its only length is an empty string (do not write to file)
if baseNote[0] == "" {
baseNote = []string{}
baseNoteLen = 0
break
}
fallthrough // if baseNote contained real data, write it to tempFile
default: // write baseNote to tempFile for external editing
for _, line := range baseNote {
_, _ = tempFile.WriteString(line + "\n")
}
}
// close tempFile
tempFile.Close()
// close tempFile to allow it to be modified by the user's text editor
_ = tempFile.Close() // error ignored; if the file could be created, it can probably be closed
// edit the tempFile (note) with the user's text editor
cmd := exec.Command(editor, tempFile.Name())
cmd.Stdout = os.Stdout
cmd.Stdin = os.Stdin
cmd.Stderr = os.Stderr
err := cmd.Run()
err = cmd.Run()
if err != nil {
panic(backend.AnsiError + "Failed to write note with " + editor + backend.AnsiReset)
panic(back.AnsiError + "Failed to write note with " + editor + back.AnsiReset) // panic is used to ensure the tempFile is removed, as per the defer statement
}
// open the tempFile for reading
tempFile, err = os.Open(tempFile.Name())
if err != nil {
panic(backend.AnsiError + "Failed to write note with " + editor + backend.AnsiReset)
panic(back.AnsiError + "Failed to read note written with " + editor + back.AnsiReset) // panic is used to ensure the tempFile is removed, as per the defer statement
}
// read the edited note from the tempFile
@@ -106,20 +138,22 @@ func editNote(baseNote []string) ([]string, bool) {
}
// close tempFile
tempFile.Close()
_ = tempFile.Close() // error ignored; if the file could be opened, it can probably be closed
// remove trailing empty strings from the edited note
note = backend.RemoveTrailingEmptyStrings(note)
note = back.RemoveTrailingEmptyStrings(note)
// trim trailing whitespace from each note line
for i, line := range note {
note[i] = strings.TrimRight(line, " \t\r\n")
}
// clamp trailing whitespace in each note line
core.ClampTrailingWhitespace(note)
// return the edited note if it is different from baseNote
if !reflect.DeepEqual(note, baseNote) {
// return the edited note if:
// it is different from baseNote AND
// [it is not empty (prevent needless writes when adding blank notes) OR
// it has a different length from baseNote (allow removing notes from entries)]
noteLen := len(note)
if !reflect.DeepEqual(note, baseNote) && (noteLen > 0 || baseNoteLen != noteLen) {
return note, true
} else {
return []string{}, false
return nil, false
}
}
+25 -51
View File
@@ -2,31 +2,32 @@ package cli
import (
"fmt"
"github.com/rwinkhart/MUTN/src/backend"
"io/fs"
"os"
"path/filepath"
"strings"
"github.com/rwinkhart/go-boilerplate/back"
"github.com/rwinkhart/go-boilerplate/other"
"github.com/rwinkhart/libmutton/synccommon"
)
// global constants used only in this file
// ANSI color constants used only in this file
const (
ansiAlternateEntryColor = "\033[38;5;8m"
ansiDirectoryHeader = "\033[38;5;7;48;5;8m"
ansiEmptyDirectoryWarning = "\033[38;5;11m"
ansiEmptyDirectoryWarning = "\033[38;5;3m"
)
// calculates and returns the final visual indentation multiplier (needed to adjust indentation for skipped parent directories) - also subtracts "old" text from directory header
// determineIndentation calculates and returns the final visual indentation multiplier (needed to adjust indentation for skipped parent directories); also subtracts "old" text from directory header.
func determineIndentation(skippedDirList []bool, dirList []string, currentDirIndex int) (int, string) {
var subtractor int // tracks how much to subtract from expected indentation multiplier
var lastPrefixIndex int // tracks the index (in both skippedDirList and dirList) of the last displayed parent directory
var trimmedDirectory = dirList[currentDirIndex]
// determine initial indentation multiplier based on PathSeparator occurrences
indent := strings.Count(trimmedDirectory, backend.PathSeparator) - 1 // subtract 1 to avoid indenting root-level directories
// determine initial indentation multiplier based on "/" occurrences
indent := strings.Count(trimmedDirectory, "/") - 1 // subtract 1 to avoid indenting root-level directories
for i, skipped := range skippedDirList[:currentDirIndex] { // checks each skipped directory to determine if it is a parent to the current directory
if strings.HasPrefix(trimmedDirectory, dirList[i]+backend.PathSeparator) { // if the current directory is the child of this iteration's directory...
if strings.HasPrefix(trimmedDirectory, dirList[i]+"/") { // if the current directory is the child of this iteration's directory...
if skipped { // ...and this iteration's directory was skipped...
subtractor++ // increment the subtractor to indicate that the visual indentation should be reduced
} else {
@@ -46,8 +47,8 @@ func determineIndentation(skippedDirList []bool, dirList []string, currentDirInd
return indent, trimmedDirectory
}
// processing for printing file entries (determines color, line wrapping, and prints)
func printFileEntry(entry string, lastSlash int, charCounter int, colorAlternator int8, indent int) (int, int8) {
// printFileEntry handles processing for printing file entries (determines color, wraps lines, and prints).
func printFileEntry(entry string, lastSlash, charCounter, indent int, colorAlternator int8) (int, int8) {
// determine color to print fileEntryName (alternate each time function is run)
var colorCode string
if colorAlternator > 0 {
@@ -72,47 +73,20 @@ func printFileEntry(entry string, lastSlash int, charCounter int, colorAlternato
}
// print fileEntryName to screen
fmt.Printf("%s%s%s ", colorCode, fileEntryName, backend.AnsiReset)
fmt.Printf("%s%s%s ", colorCode, fileEntryName, back.AnsiReset)
return charCounter, colorAlternator
}
// EntryListGen generates and displays full libmutton entry list
// EntryListGen generates and displays the full libmutton entry list.
func EntryListGen() {
// define file/directory containing slices so that they may be accessed by the anonymous WalkDir function
var fileList []string
var dirList []string
// walk entry directory
_ = filepath.WalkDir(backend.EntryRoot,
func(fullPath string, entry fs.DirEntry, err error) error {
// check for errors encountered while walking directory
if err != nil {
if os.IsNotExist(err) {
fmt.Println(backend.AnsiError + "\nThe entry directory does not exist - run \"mutn init\" to create it" + backend.AnsiReset)
} else {
// otherwise, print the source of the error
fmt.Println(backend.AnsiError + "\nAn unexpected error occurred while generating the entry list: " + err.Error() + backend.AnsiReset)
}
os.Exit(1)
}
// trim root path from each path before storing
trimmedPath := fullPath[rootLength:]
// create separate slices for entries and directories
if !entry.IsDir() {
fileList = append(fileList, trimmedPath)
} else {
dirList = append(dirList, trimmedPath)
}
return nil
})
fileList, dirList, err := synccommon.WalkEntryDir()
if err != nil {
other.PrintError("Failed to generate entry list: "+err.Error(), back.ErrorRead)
}
// print header bar w/total entry count
fmt.Print("\n"+ansiBlackOnWhite, len(fileList), " libmutton entries:"+backend.AnsiReset)
fmt.Print("\n"+ansiBlackOnWhite, len(fileList), " libmutton entries:"+back.AnsiReset)
// dirList iteration
dirListLength := len(dirList) // save length for multiple references below
@@ -137,7 +111,7 @@ func EntryListGen() {
// check if next directory is within the current one
if dirListLength > i+1 {
if nextDir := dirList[i+1]; directory == nextDir[:strings.LastIndex(nextDir, backend.PathSeparator)] {
if nextDir := dirList[i+1]; directory == nextDir[:strings.LastIndex(nextDir, "/")] {
containsSubdirectory = true
} else {
containsSubdirectory = false
@@ -151,17 +125,17 @@ func EntryListGen() {
for _, file := range fileList {
// print the current file if it belongs in the current directory - otherwise, break the loop and move on to the next directory
if lastSlash := strings.LastIndex(file, backend.PathSeparator) + 1; file[:lastSlash-1] == directory {
if lastSlash := strings.LastIndex(file, "/") + 1; file[:lastSlash-1] == directory {
// print directory header if this is the first run of the loop
if !containsFiles {
containsFiles = true
skippedDirList[i] = false // the directory header is being printed, indicate that it is not being skipped
indent, vanityDirectory = determineIndentation(skippedDirList, dirList, i) // calculate the final indentation multiplier
printDirectoryHeader(vanityDirectory, indent)
fmt.Printf("\n\n"+strings.Repeat(" ", indent*2)+ansiDirectoryHeader+"%s/"+back.AnsiReset+"\n", vanityDirectory)
}
charCounter, colorAlternator = printFileEntry(file, lastSlash, charCounter, colorAlternator, indent)
charCounter, colorAlternator = printFileEntry(file, lastSlash, charCounter, indent, colorAlternator)
}
}
@@ -170,8 +144,8 @@ func EntryListGen() {
if dirListLength > 1 { // and directories besides the root-level exist... display directory header and empty directory warning
skippedDirList[i] = false // the directory header is being printed, indicate that it is not being skipped
indent, vanityDirectory = determineIndentation(skippedDirList, dirList, i) // calculate the final indentation multiplier
printDirectoryHeader(vanityDirectory, indent)
fmt.Print(strings.Repeat(" ", indent*2) + ansiEmptyDirectoryWarning + "-empty directory-" + backend.AnsiReset)
fmt.Printf("\n\n"+strings.Repeat(" ", indent*2)+ansiDirectoryHeader+"%s/"+back.AnsiReset+"\n", vanityDirectory)
fmt.Print(strings.Repeat(" ", indent*2) + ansiEmptyDirectoryWarning + "-empty directory-" + back.AnsiReset)
} else { // warn if the only thing that exists is the root-level directory
fmt.Print("\n\nNothing's here! For help creating your first entry, run \"mutn help\".")
}
-13
View File
@@ -1,13 +0,0 @@
//go:build !windows
package cli
import (
"fmt"
"github.com/rwinkhart/MUTN/src/backend"
"strings"
)
func printDirectoryHeader(vanityDirectory string, indent int) {
fmt.Printf("\n\n"+strings.Repeat(" ", indent*2)+ansiDirectoryHeader+"%s/"+backend.AnsiReset+"\n", vanityDirectory)
}
-13
View File
@@ -1,13 +0,0 @@
//go:build windows
package cli
import (
"fmt"
"github.com/rwinkhart/MUTN/src/backend"
"strings"
)
func printDirectoryHeader(vanityDirectory string, indent int) {
fmt.Printf("\n\n"+strings.Repeat(" ", indent*2)+ansiDirectoryHeader+"%s/"+backend.AnsiReset+"\n", strings.ReplaceAll(vanityDirectory, backend.PathSeparator, "/"))
}
+54 -30
View File
@@ -5,69 +5,93 @@ import (
"os"
"strings"
"github.com/rwinkhart/MUTN/src/backend"
"github.com/charmbracelet/glamour"
"github.com/rwinkhart/go-boilerplate/back"
"github.com/rwinkhart/go-boilerplate/other"
"github.com/rwinkhart/libmutton/crypt"
"github.com/rwinkhart/libmutton/global"
"github.com/rwinkhart/libmutton/syncclient"
)
const ansiShownPassword = "\033[38;5;10m"
// EntryReader prints the decrypted contents of a libmutton entry in a human-readable format
func EntryReader(decryptedEntry []string, hidePassword bool, sync bool) {
// EntryReader prints the decrypted contents of a libmutton entry in a human-readable format.
func EntryReader(decryptedEntry []string, hideSecrets, syncEnabled bool) {
fmt.Println()
for i := range decryptedEntry {
switch i {
fieldLoop:
for field := range decryptedEntry {
switch field {
case 0:
// if the first field (password) is not empty, print it
if decryptedEntry[0] != "" {
if !hidePassword {
fmt.Print(ansiDirectoryHeader + "Password:" + backend.AnsiReset + "\n" + ansiShownPassword + decryptedEntry[0] + backend.AnsiReset + "\n\n")
if !hideSecrets {
fmt.Print(ansiDirectoryHeader + "Password:" + back.AnsiReset + "\n" + ansiShownPassword + decryptedEntry[0] + back.AnsiReset + "\n\n")
} else {
fmt.Print(ansiDirectoryHeader + "Password:" + backend.AnsiReset + "\n" + ansiEmptyDirectoryWarning + "End command in \"show\" or \"-s\" to view" + backend.AnsiReset + "\n\n")
fmt.Print(ansiDirectoryHeader + "Password:" + back.AnsiReset + "\n" + ansiEmptyDirectoryWarning + "End command in \"show\" or \"-s\" to view" + back.AnsiReset + "\n\n")
}
}
case 1:
// if the second field (username) is not empty, print it
if decryptedEntry[1] != "" {
fmt.Print(ansiDirectoryHeader + "Username:" + backend.AnsiReset + "\n" + decryptedEntry[1] + "\n\n")
fmt.Print(ansiDirectoryHeader + "Username:" + back.AnsiReset + "\n" + decryptedEntry[1] + "\n\n")
}
case 2:
// if the third field (url) is not empty, print it
// if the third field (TOTP secret) is not empty, print it
if decryptedEntry[2] != "" {
fmt.Print(ansiDirectoryHeader + "URL:" + backend.AnsiReset + "\n" + decryptedEntry[2] + "\n\n")
if !hideSecrets {
fmt.Print(ansiDirectoryHeader + "TOTP Secret:" + back.AnsiReset + "\n" + ansiShownPassword + decryptedEntry[2] + back.AnsiReset + "\n\n")
} else {
fmt.Print(ansiDirectoryHeader + "TOTP Secret:" + back.AnsiReset + "\n" + ansiEmptyDirectoryWarning + "End command in \"show\" or \"-s\" to view" + back.AnsiReset + "\n\n")
}
}
case 3:
// print the notes header
fmt.Println(ansiDirectoryHeader + "Notes:" + backend.AnsiReset)
// combine remaining fields into a single string (for markdown rendering)
var markdownNotes []string
for field := 3; field < len(decryptedEntry); field++ {
markdownNotes = append(markdownNotes, decryptedEntry[field])
// if the fourth field (url) is not empty, print it
if decryptedEntry[3] != "" {
fmt.Print(ansiDirectoryHeader + "URL:" + back.AnsiReset + "\n" + decryptedEntry[3] + "\n\n")
}
r, _ := glamour.NewTermRenderer(glamour.WithStylesFromJSONBytes(glamourStyle()), glamour.WithPreservedNewLines(), glamour.WithWordWrap(width))
markdownNotesString, _ := r.Render(strings.Join(markdownNotes, "\n"))
case 4:
// print the notes header
fmt.Println(ansiDirectoryHeader + "Notes:" + back.AnsiReset)
// print markdown-rendered notes
// combine remaining fields into a single string (to support Markdown rendering)
var noteLines []string
for ; field < len(decryptedEntry); field++ {
noteLines = append(noteLines, decryptedEntry[field])
}
// render notes as Markdown
r, _ := glamour.NewTermRenderer(glamour.WithStylesFromJSONBytes(glamourStyle()), glamour.WithPreservedNewLines(), glamour.WithWordWrap(width))
markdownNotesString, _ := r.Render(strings.Join(noteLines, "\n"))
// print the rendered Markdown notes
fmt.Print(markdownNotesString)
// break after all lines have been printed
break
// break after notes have been printed
break fieldLoop
}
}
if sync && !backend.Windows {
SshypSync() // TODO Remove after native sync is implemented
if syncEnabled {
_, err := syncclient.RunJob(false)
if err != nil {
other.PrintError("Failed to sync entries: "+err.Error(), global.ErrorSyncProcess)
}
}
os.Exit(0)
}
// EntryReaderDecrypt is a wrapper for EntryReader that first decrypts a GPG-encrypted file before sending it to EntryReader
func EntryReaderDecrypt(targetLocation string, hidePassword bool, sync bool) {
if isFile, _ := backend.TargetIsFile(targetLocation, true, 2); isFile {
EntryReader(backend.DecryptGPG(targetLocation), hidePassword, sync)
// EntryReaderDecrypt is a wrapper for EntryReader that first decrypts an RCW-wrapped file before sending it to EntryReader.
func EntryReaderDecrypt(targetLocation string, hideSecrets bool) {
_, err := back.TargetIsFile(targetLocation, true)
if err != nil { // if the location does not exist or is a directory...
other.PrintError("Failed to verify target location: "+err.Error(), back.ErrorTargetNotFound)
}
decSlice, err := crypt.DecryptFileToSlice(targetLocation)
if err != nil {
other.PrintError("Failed to decrypt entry: "+err.Error(), global.ErrorDecryption)
}
EntryReader(decSlice, hideSecrets, false) // never sync if decrypting straight to EntryReader, as this means the entry could not have been modified
// do not exit, as this is the job of EntryReader
}
-30
View File
@@ -1,30 +0,0 @@
package cli
import (
"fmt"
"github.com/rwinkhart/MUTN/src/backend"
"os"
)
// TempInitCli initializes the MUTN environment based on user input
func TempInitCli() {
// gpgID
var gpgID string
if inputBinary("Auto-generate GPG key?") {
gpgID = backend.GpgKeyGen()
} else {
// select GPG key from menu
uidSlice := backend.GpgUIDListGen()
gpgIDInt := inputMenuGen("Select GPG key:", uidSlice)
if gpgIDInt == 0 {
fmt.Println(backend.AnsiError + "No GPG keys found - please generate one" + backend.AnsiReset)
os.Exit(1)
}
gpgID = uidSlice[gpgIDInt-1]
}
// textEditor
textEditor := input("Text editor (leave blank for $EDITOR, falls back to \"" + backend.FallbackEditor + "\"):")
backend.TempInit(map[string]string{"textEditor": textEditor, "gpgID": gpgID})
}
+5
View File
@@ -0,0 +1,5 @@
//go:build !windows
package cli
const FallbackEditor = "vi" // vi is pre-installed on most UNIX-like systems
+5
View File
@@ -0,0 +1,5 @@
//go:build windows
package cli
const FallbackEditor = "edit" // "edit" is the Microsoft-developed CLI text editor
+63 -54
View File
@@ -4,46 +4,48 @@ import (
"fmt"
"os"
"github.com/rwinkhart/MUTN/src/backend"
"github.com/rwinkhart/go-boilerplate/back"
"github.com/rwinkhart/libmutton/global"
)
// global constants used only in this file
// ANSI color constants used only in this file
const (
ansiVersionMeat = "\033[38;2;157;0;6m"
ansiVersionOutline = "\033[38;2;131;165;152m"
)
func HelpMain() {
fmt.Print(ansiBold + "\nMUTN | Copyright (c) 2024 Randall Winkhart\n" + backend.AnsiReset + `
fmt.Print(back.AnsiBold + "\nMUTN | Copyright (c) 2024-2025 Randall Winkhart\n" + back.AnsiReset + `
This software exists under the MIT license; you may redistribute it under certain conditions.
This program comes with absolutely no warranty; type "mutn version" for details.
` + ansiBold + "Usage:" + backend.AnsiReset + ` mutn [/<entry name> [argument] [option]] | [argument]
` + back.AnsiBold + "Usage:" + back.AnsiReset + ` mutn [/<entry name> [argument] [option]] | [argument]
` + ansiBold + "Arguments:" + backend.AnsiReset + `
help|-h Bring up this menu
version|-v Display version and license information
` + back.AnsiBold + "Arguments:" + back.AnsiReset + `
help Bring up this menu
version Display version and license information
init Set up MUTN (generates libmutton.ini)
tweak Change configuration options
tweak Make changes to the libmutton configuration
copy Copy details of an entry to your clipboard
edit Edit an existing entry
gen Generate a new password
add Add an entry
add Add a new entry
shear Delete an existing entry
sync Manually sync the entry directory
` + ansiBold + "Options:" + backend.AnsiReset + `
` + back.AnsiBold + "Options:" + back.AnsiReset + `
copy:
password|-pw|<blank> Copy the password of an entry to your clipboard
username|-u Copy the username of an entry to your clipboard
totp|-t Copy the TOTP code of an entry to your clipboard
url|-l Copy the url of an entry to your clipboard
note|-n Copy the note of an entry to your clipboard
password|-pw|<blank> Copy the password in an entry to your clipboard
username|-u Copy the username in an entry to your clipboard
totp|-t Generate and copy the TOTP token for an entry to your clipboard
url|-l Copy the URL in an entry to your clipboard
note|-n Copy the first note line in an entry to your clipboard
edit:
password|-pw|<blank> Change the password of an entry
username|-u Change the username of an entry
url|-l Change the url attached to an entry
note|-n Change the note attached to an entry
password|-pw|<blank> Change the password in an entry
username|-u Change the username in an entry
totp|-t Change the TOTP secret in an entry
url|-l Change the URL in an entry
note|-n Change the note in an entry
rename|-r Rename or relocate an entry
gen:
update|-u Generate a password for an existing entry
@@ -52,17 +54,17 @@ This program comes with absolutely no warranty; type "mutn version" for details.
note|-n Add a note entry
folder|-f Add a new folder for entries
` + ansiBold + "Tip 1:" + backend.AnsiReset + ` You can quickly read an entry with "mutn /<entry name>"
` + ansiBold + "Tip 2:" + backend.AnsiReset + ` Type "mutn" (no arguments/options) to view a list of saved entries
` + ansiBold + "Tip 3:" + backend.AnsiReset + ` Provide "add", "edit", "copy", or "gen" as the only argument to receive more specific help
` + ansiBold + "Tip 4:" + backend.AnsiReset + " Using \"add\", \"edit\", or \"copy\" without specifying an option (field) will default to \"password\"\n\n")
` + back.AnsiBold + "Tip 1:" + back.AnsiReset + ` You can quickly read an entry with "mutn /<entry name>"
` + back.AnsiBold + "Tip 2:" + back.AnsiReset + ` Type "mutn" (no arguments/options) to view a list of saved entries
` + back.AnsiBold + "Tip 3:" + back.AnsiReset + ` Provide "add", "edit", "copy", or "gen" as the only argument to receive more specific help
` + back.AnsiBold + "Tip 4:" + back.AnsiReset + " Using \"add\", \"edit\", or \"copy\" without specifying an option (field) will default to \"password\"\n\n")
os.Exit(0)
}
func HelpAdd() {
fmt.Print(ansiBold + "\nUsage:" + backend.AnsiReset + ` mutn /<entry name> add <option>
fmt.Print(back.AnsiBold + "\nUsage:" + back.AnsiReset + ` mutn /<entry name> add <option>
` + ansiBold + "Options:" + backend.AnsiReset + `
` + back.AnsiBold + "Options:" + back.AnsiReset + `
add:
password|-pw|<blank> Add a password entry
note|-n Add a note entry
@@ -71,44 +73,45 @@ func HelpAdd() {
}
func HelpEdit() {
fmt.Print(ansiBold + "\nUsage:" + backend.AnsiReset + ` mutn /<entry name> edit <option>
fmt.Print(back.AnsiBold + "\nUsage:" + back.AnsiReset + ` mutn /<entry name> edit <option>
` + ansiBold + "Options:" + backend.AnsiReset + `
` + back.AnsiBold + "Options:" + back.AnsiReset + `
edit:
password|-pw|<blank> Change the password of an entry
username|-u Change the username of an entry
url|-l Change the url attached to an entry
note|-n Change the note attached to an entry
password|-pw|<blank> Change the password in an entry
username|-u Change the username in an entry
totp|-t Change the TOTP secret in an entry
url|-l Change the URL in an entry
note|-n Change the note in an entry
rename|-r Rename or relocate an entry` + "\n\n")
os.Exit(0)
}
func HelpCopy() {
fmt.Print(ansiBold + "\nUsage:" + backend.AnsiReset + ` mutn /<entry name> copy <option>
fmt.Print(back.AnsiBold + "\nUsage:" + back.AnsiReset + ` mutn /<entry name> copy <option>
` + ansiBold + "Options:" + backend.AnsiReset + `
` + back.AnsiBold + "Options:" + back.AnsiReset + `
copy:
password|-pw|<blank> Copy the password in an entry to your clipboard
username|-u Copy the username in an entry to your clipboard
totp|-t Copy the TOTP code of an entry to your clipboard
url|-l Copy the url in an entry to your clipboard
totp|-t Generate and copy the TOTP token for an entry to your clipboard
url|-l Copy the URL in an entry to your clipboard
note|-n Copy the first note line in an entry to your clipboard` + "\n\n")
os.Exit(0)
}
func HelpGen() {
fmt.Print(ansiBold + "\nUsage:" + backend.AnsiReset + ` mutn /<entry name> gen [option]
fmt.Print(back.AnsiBold + "\nUsage:" + back.AnsiReset + ` mutn /<entry name> gen [option]
` + ansiBold + "Options:" + backend.AnsiReset + `
` + back.AnsiBold + "Options:" + back.AnsiReset + `
gen:
update|-u Generate a password for an existing entry
` + ansiBold + "Tip:" + backend.AnsiReset + " If no options are provided, a new password entry is generated\n\n")
` + back.AnsiBold + "Tip:" + back.AnsiReset + " If no options are provided, a new password entry is generated\n\n")
os.Exit(0)
}
func Version() {
fmt.Print(ansiBold + "\n MIT License" + backend.AnsiReset + `
func MITLicense() {
fmt.Print(back.AnsiBold + "\n MIT License" + back.AnsiReset + `
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
@@ -132,22 +135,28 @@ ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.` +
"\n\n---------------------------------------------------------" +
"\n\n MUTN is a simple, self-hosted,\n SSH-synchronized password manager based on libmutton\n\n" +
OR OTHER DEALINGS IN THE SOFTWARE.` + "\n\n---------------------------------------------------------")
// do not exit, as this is meant to be followed by other information
}
func Version() {
MITLicense()
fmt.Print("\n\n MUTN is a simple, self-hosted,\n SSH-synchronized password manager based on libmutton\n\n" +
" .. ..\n" +
" /()\\''.''. " + ansiVersionMeat + "♥♥♥♥" + backend.AnsiReset + " .''.''/()\\ _)\n" +
" _. : * " + ansiVersionMeat + "♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥" + backend.AnsiReset + " * : <[◎]|_|=\n" +
" }-}-*] `..'..' " + ansiVersionMeat + "♥♥♥♥♥♥♥♥♥♥♥♥♥" + backend.AnsiReset + " `..'..' |\n" +
" ◎-◎ // \\\\ " + ansiVersionMeat + "♥♥♥♥♥♥♥♥♥" + backend.AnsiReset + " // \\\\ /|\\\n" +
" /()\\''.''. " + ansiVersionMeat + "♥♥♥♥" + back.AnsiReset + " .''.''/()\\ _)\n" +
" _. : * " + ansiVersionMeat + "♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥" + back.AnsiReset + " * : <[◎]|_|=\n" +
" }-}-*] `..'..' " + ansiVersionMeat + "♥♥♥♥♥♥♥♥♥♥♥♥♥" + back.AnsiReset + " `..'..' |\n" +
" ◎-◎ // \\\\ " + ansiVersionMeat + "♥♥♥♥♥♥♥♥♥" + back.AnsiReset + " // \\\\ /|\\\n" +
ansiVersionOutline + "<><><><><><><><><><><><><><>-<><><><><><><><><><><><><><>\n" +
"\\" + ansiBlackOnWhite + " " + backend.AnsiReset + ansiVersionOutline + "/\n" +
"\\" + ansiBlackOnWhite + " MUTN Version 0.1.0 " + backend.AnsiReset + ansiVersionOutline + "/\n" +
"\\" + ansiBlackOnWhite + " The Butchered Update " + backend.AnsiReset + ansiVersionOutline + "/\n" +
"\\" + ansiBlackOnWhite + " " + backend.AnsiReset + ansiVersionOutline + "/\n" +
"\\" + ansiBlackOnWhite + " Copyright (c) 2024 Randall Winkhart " + backend.AnsiReset + ansiVersionOutline + "/\n" +
"\\" + ansiBlackOnWhite + " " + backend.AnsiReset + ansiVersionOutline + "/\n" +
"<><><><><><><><><><><><><><>-<><><><><><><><><><><><><><>\n" + backend.AnsiReset +
"\\" + ansiBlackOnWhite + " " + back.AnsiReset + ansiVersionOutline + "/\n" +
"\\" + ansiBlackOnWhite + " MUTN v" + MUTNVersion + " " + back.AnsiReset + ansiVersionOutline + "/\n" +
"\\" + ansiBlackOnWhite + " The Cryptic Cuts Update " + back.AnsiReset + ansiVersionOutline + "/\n" +
"\\" + ansiBlackOnWhite + " " + back.AnsiReset + ansiVersionOutline + "/\n" +
"\\" + ansiBlackOnWhite + " Built with libmutton v" + global.LibmuttonVersion + " " + back.AnsiReset + ansiVersionOutline + "/\n" +
"\\" + ansiBlackOnWhite + " " + back.AnsiReset + ansiVersionOutline + "/\n" +
"\\" + ansiBlackOnWhite + " Copyright (c) 2024-2025: Randall Winkhart " + back.AnsiReset + ansiVersionOutline + "/\n" +
"\\" + ansiBlackOnWhite + " " + back.AnsiReset + ansiVersionOutline + "/\n" +
"<><><><><><><><><><><><><><>-<><><><><><><><><><><><><><>\n" + back.AnsiReset +
"\n For more information, see:\n\n" +
" https://github.com/rwinkhart/MUTN\n" +
" https://github.com/rwinkhart/libmutton\n\n")
+30 -71
View File
@@ -1,86 +1,45 @@
package cli
import (
"bufio"
"fmt"
"github.com/rwinkhart/MUTN/src/backend"
"golang.org/x/crypto/ssh/terminal"
"os"
"os/exec"
"strings"
"github.com/rwinkhart/go-boilerplate/back"
"github.com/rwinkhart/go-boilerplate/front"
"github.com/rwinkhart/go-boilerplate/other"
"github.com/rwinkhart/libmutton/core"
"github.com/rwinkhart/libmutton/synccycles"
)
// TODO remove after native sync is implemented
func SshypSync() {
cmd := exec.Command("sshyp", "sync")
cmd.Stdout = os.Stdout
cmd.Run()
}
// input prompts the user for input and returns the input as a string
func input(prompt string) string {
fmt.Print("\n" + prompt + " ")
reader := bufio.NewReader(os.Stdin)
userInput, _ := reader.ReadString('\n')
return strings.TrimRight(userInput, "\n\r ") // remove trailing newlines, carriage returns, and spaces
}
// inputHidden prompts the user for input and returns the input as a string, hiding the input from the terminal
func inputHidden(prompt string) string {
fmt.Print("\n" + prompt + " ")
byteInput, _ := terminal.ReadPassword(int(os.Stdin.Fd()))
password := string(byteInput)
// inputPasswordGen prompts the user for password generation parameters and returns a generated password as a string.
func inputPasswordGen() string {
passLength := front.InputInt("Password length:", 1, -1)
fmt.Println()
return password
passCharset := uint8(front.InputMenuGen("Password complexity:", []string{"Simple", "Complex", "Ultra Complex (not compatible with many services)"}))
var complexity float64
switch passCharset {
case 1:
complexity = 0 // simple
// 1 indicates string gen for filenames, but since complexity is 0, only the base charset is used
default:
complexity = 0.2 // (ultra) complex
// 2 and 3 indicate complex and ultra complex charsets, respectively
}
return synccycles.StringGen(passLength, complexity, passCharset)
}
// inputInt prompts the user for input and returns the input as an integer
// a maxValue of 0 will cause the function to return 0, an error - a negative maxValue will disable the maxValue check
func inputInt(prompt string, maxValue int) int {
if maxValue == 0 {
return 0
}
// loop until a valid integer is entered
for {
fmt.Print("\n" + prompt + " ")
var userInput int
_, err := fmt.Scanln(&userInput)
if err == nil && userInput > 0 && (userInput <= maxValue || maxValue < 0) {
return userInput
}
}
}
// inputBinary prompts the user with a yes/no question and returns the response as a boolean
func inputBinary(prompt string) bool {
reader := bufio.NewReader(os.Stdin)
fmt.Print("\n" + prompt + " (y/N) ")
char, _, _ := reader.ReadRune()
if char == 'y' || char == 'Y' {
return true
}
return false
}
// inputMenuGen prompts the user with a menu and returns the user's choice as an integer
func inputMenuGen(prompt string, options []string) int {
for i, option := range options {
fmt.Printf("%d. %s\n", i+1, option)
}
return inputInt(prompt, len(options))
}
// writeEntryCLI writes an entry to targetLocation and previews it (errors if no data is supplied)
func writeEntryCLI(targetLocation string, unencryptedEntry []string, hidePassword bool) {
if backend.EntryIsNotEmpty(unencryptedEntry) {
// writeEntryCLI writes an entry to targetLocation and previews it (errors if no data is supplied).
func writeEntryCLI(targetLocation string, decryptedEntry []string, hideSecrets bool) {
if core.EntryIsNotEmpty(decryptedEntry) {
// write the entry to the target location
backend.WriteEntry(targetLocation, unencryptedEntry)
err := core.WriteEntry(targetLocation, []byte(strings.Join(decryptedEntry, "\n")))
if err != nil {
other.PrintError("Failed to write entry: "+err.Error(), back.ErrorWrite)
}
// preview the entry
fmt.Println(ansiBold + "\nEntry Preview:" + backend.AnsiReset)
EntryReader(unencryptedEntry, hidePassword, true)
fmt.Println(back.AnsiBold + "\nEntry Preview:" + back.AnsiReset)
EntryReader(decryptedEntry, hideSecrets, true)
} else {
fmt.Println(backend.AnsiError + "No data supplied for entry" + backend.AnsiReset)
os.Exit(1)
other.PrintError("No data supplied for entry", back.ErrorTargetNotFound)
}
}
+7
View File
@@ -0,0 +1,7 @@
## Known Bugs - MUTN CLI
- Various Markdown issues resulting from the use of [Glamour](https://github.com/charmbracelet/glamour)
- Note that MUTN is currently using the older Glamour v0.7.0 (or rather, a custom fork of it), as v0.8.0 introduced a [line-wrapping regression](https://github.com/charmbracelet/glamour/issues/331)
- [Odd handling of line breaks](https://github.com/charmbracelet/glamour/issues/84)
- [Broken quotes](https://github.com/charmbracelet/glamour/issues/172) (seems related to line break issue)
- [Extra blank lines after nested list items](https://github.com/charmbracelet/glamour/issues/102)
- [Incorrect wrapping of text in lists](https://github.com/charmbracelet/glamour/issues/56)
+9
View File
@@ -0,0 +1,9 @@
## Building
Official binaries are stripped of debug info for size and built without CGO (except for distribution packages) for portability, as follows:
```
CGO_ENABLED=0 go build -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go
```
Additionally, some custom build tags can be used to create different binaries. The following tags are not used in official builds:
- `wsl`: Allows creating a Linux binary that can interact with the Windows clipboard (for WSL)
- `termux`: Allows creating a Linux binary that can interact with the Termux clipboard (for Android)
+35
View File
@@ -0,0 +1,35 @@
## Shell Completions Troubleshooting
[Shell completions are provided for ZSH, Bash, and PowerShell 7+](https://github.com/rwinkhart/MUTN/tree/main/completions).
### ZSH completions not working?
Make sure your ~/.zshrc contains the following (if sourcing from default completions location, usually `/usr/share/zsh/site-functions/_mutn`):
```shell
autoload -Uz compinit && compinit
```
...and then restart your shell.
***
### Bash completions not working?
Install your distribution's `bash-completion` package or source the completion script manually.
For most environments, manual sourcing means adding the following to your ~/.bashrc:
```shell
source /usr/share/bash-completion/completions/mutn
```
Note that this directory is different on FreeBSD.
FreeBSD:
```shell
source /usr/local/share/bash-completion/completions/mutn
```
...and then restart your shell.
*Please note that Bash completions are slightly more limited than ZSH completions, and as such, new entries will not be auto-completed until the completions script is re-sourced.*
***
### PowerShell completions not working?
Ensure you are using modern PowerShell (7+) as opposed to the built-in Windows PowerShell.
Currently, completions must be manually installed and sourced in your PowerShell profile as such:
```shell
Set-PSReadlineKeyHandler -Key Tab -Function Complete # this line is optional; it makes tab completion function more similarly to Bash/ZSH
. <drive letter>:\path\to\mutn.ps1
```
...and then restart your shell.
+17
View File
@@ -0,0 +1,17 @@
## Installation
MUTN is still in early development and thus no installation packages are officially distributed.
For now, please manually install the binaries from the [latest release](https://github.com/rwinkhart/MUTN/releases) or [compile from source](https://github.com/rwinkhart/MUTN/blob/main/wiki/build.md). All pre-built binaries were compiled with CGO disabled and thus are libc-independent.
Additionally, MUTN is available as a source package ("[mutn](https://aur.archlinux.org/packages/mutn)") on the AUR.
Please note that the server binary (available in [libmutton releases](https://github.com/rwinkhart/libmutton/releases)) must be called "libmuttonserver" in order for clients to successfully reach it.
After placing the binaries in your $PATH, it is highly recommended to also download and correctly place/source the relevant [shell completions scripts](https://github.com/rwinkhart/MUTN/blob/main/wiki/completions.md).
Please see the [usage guide](https://github.com/rwinkhart/MUTN/blob/main/wiki/usage.md) for help getting started.
### Dependencies (required for all installations)
- A text editor (preferably CLI-based) for writing entry notes
- A private key for SSH key-based authentication is required to use MUTN/libmutton in online/synced mode
- Linux: xclip (X11) or wl-clipboard (Wayland) for clipboard support
+27
View File
@@ -0,0 +1,27 @@
## Setup/Usage Tips - MUTN CLI
Most information relevant to the usage of MUTN can be viewed with `mutn help`, in [the man page](https://raw.githubusercontent.com/rwinkhart/MUTN/main/docs/man), and in the demo animation from the README.
Because of this, this wiki page will focus on initial setup as well as some tips that may not be immediately obvious.
### Initial Setup
libmutton operates on a client-server model, and thus sync support requires you to have access to your own server (whether it be a physical home server or a cloud rental) with remote access via SSH.
For security reasons, libmutton deliberately does not support password-based SSH authentication; you must use key-based authentication to connect to your server (password-protected keys are also supported). You are responsible for setting up SSH connectivity on your own.
The libmutton server software is shipped as its own dedicated binary (in [libmutton releases](https://github.com/rwinkhart/libmutton/releases)) and must be installed on the server and configured with `libmuttonserver init`. The server binary _**MUST**_ be in your $PATH and _**MUST**_ be named "libmuttonserver" for clients to successfully reach it.
Once this has been done, you may proceed with the client setup:
1. Install MUTN
2. Run `mutn init` and follow the prompts
3. If you already have entries on the server, sync them using `mutn sync`
4. Optionally, shell completions (Bash, ZSH, and PowerShell 7+) can be [enabled with your shell's respective method](https://github.com/rwinkhart/MUTN/blob/main/wiki/completions.md)
### Tips
#### Operating on Passwords
Any action that operates on the password attached to an entry (copying, editing, adding a new password-focused entry) does not require the user to specify the `password` or `-pw` options. In all cases, `password` is the assumed target when no other option is specified.
#### TOTP Support
See [here](https://github.com/rwinkhart/libmutton/blob/main/wiki/tips.md#totp-support).
#### Granular Help
Argument-specific help can be obtained by running `mutn <argument>` without an entry name or any options. For example, `mutn edit` will display help for the `edit` argument.