mirror of
https://github.com/rwinkhart/MUTN.git
synced 2026-08-28 04:46:41 -04:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7fa262cb5e | ||
|
|
a8de1ce0a6 | ||
|
|
6b77e717cf | ||
|
|
d3166421b1 | ||
|
|
230ed74bcf | ||
|
|
ff9ea4640f | ||
|
|
8d88f9c7fd | ||
|
|
b6e53451f1 | ||
|
|
b148dbf8bf | ||
|
|
18fb930a94 | ||
|
|
70ac2ad8ee | ||
|
|
d6d9a56532 | ||
|
|
966f340ddd | ||
|
|
f4abb4cc7e | ||
|
|
538d043656 | ||
|
|
926eb1f176 | ||
|
|
8e59d81fff | ||
|
|
1afbce9b1b | ||
|
|
8f9aa7eef3 | ||
|
|
5f02e41c05 | ||
|
|
0211941a48 | ||
|
|
0dfaf20fec | ||
|
|
32364717dc | ||
|
|
9af456590c | ||
|
|
441730e0e0 | ||
|
|
25f2013d62 | ||
|
|
cac35e1d25 | ||
|
|
88c60cc036 | ||
|
|
aaf69eb590 | ||
|
|
12167b1eed | ||
|
|
48ecf7cf83 | ||
|
|
fb70b38dc3 | ||
|
|
19dd1fd685 | ||
|
|
7016a8a130 | ||
|
|
8112496006 | ||
|
|
b26c2ce17c | ||
|
|
23c6d2e354 | ||
|
|
63fb511649 | ||
|
|
4c4f025d5b | ||
|
|
1a9de90f89 | ||
|
|
300c433909 | ||
|
|
bbd42728d0 | ||
|
|
55cd9b99da | ||
|
|
6478957372 | ||
|
|
b58461b9c4 | ||
|
|
a75416a679 | ||
|
|
fc1e3b11fc | ||
|
|
107a6f4f12 | ||
|
|
39a3460779 | ||
|
|
60d6961ff4 | ||
|
|
13aa507788 | ||
|
|
c1c9565511 | ||
|
|
41b4c4b6ca | ||
|
|
bc35766de5 | ||
|
|
3cb0bdce59 | ||
|
|
bfb6372c29 | ||
|
|
32f9dd45fa | ||
|
|
25aaeb74a3 | ||
|
|
d8842138ea | ||
|
|
a7a92e78b5 | ||
|
|
49d23b365d | ||
|
|
2712fecf68 | ||
|
|
45c03f0fe4 | ||
|
|
97d49fdba1 | ||
|
|
52628dba0a | ||
|
|
d2b2dcf7cf | ||
|
|
0895dcba8a | ||
|
|
b942867692 | ||
|
|
bdaaf0906c | ||
|
|
9201e3857c | ||
|
|
511204d17a | ||
|
|
9ee2f7ae0f | ||
|
|
499c9cdd40 | ||
|
|
1488c7d536 | ||
|
|
05f95a4c0c | ||
|
|
59cb9ac0d1 | ||
|
|
eda08ad9b6 | ||
|
|
1370f5cd80 | ||
|
|
5af8caf680 | ||
|
|
2ab8eac7a4 | ||
|
|
9cd248eb8b | ||
|
|
cc3416a89c | ||
|
|
a0cde0aff0 | ||
|
|
b1853dd763 | ||
|
|
85584da807 | ||
|
|
72755e91b5 | ||
|
|
310c935d2d | ||
|
|
392af55b4c | ||
|
|
2f9d5df285 | ||
|
|
d15e71a88f | ||
|
|
5acb7e47bf | ||
|
|
2def48e58b | ||
|
|
7ed199cba1 | ||
|
|
1ed4b8d4dc | ||
|
|
74926a2577 | ||
|
|
54a7d51efa | ||
|
|
2f34fc2c0c | ||
|
|
752b9d616a | ||
|
|
6504bdc8a6 | ||
|
|
1180112967 | ||
|
|
a144b2769d | ||
|
|
b366d1e13e | ||
|
|
34136633d9 | ||
|
|
8166bfcfbe | ||
|
|
63c663ab36 | ||
|
|
fab4bd8d37 | ||
|
|
c6ea3b0136 | ||
|
|
a0d75aad20 | ||
|
|
0a622765cc | ||
|
|
e2d79d4ce3 | ||
|
|
d323f2f75a | ||
|
|
4556e38e32 | ||
|
|
edc2ef25de | ||
|
|
f21041a38d | ||
|
|
0c57bd5764 | ||
|
|
dd8464ecd9 | ||
|
|
38ddc32656 | ||
|
|
27e6972d82 | ||
|
|
118ffc2adb | ||
|
|
d1d88c2e69 | ||
|
|
cb1b010e0a | ||
|
|
6210c9cd31 | ||
|
|
6d557a77c2 | ||
|
|
4933da4c37 | ||
|
|
0e056822ef | ||
|
|
c323899bf8 | ||
|
|
cfb4a2ad51 | ||
|
|
dda33755b3 | ||
|
|
544261a461 | ||
|
|
77014cf5e3 | ||
|
|
750029a491 | ||
|
|
380c49bd00 | ||
|
|
33b8704f0c | ||
|
|
f96b60d3ef | ||
|
|
13422e12c4 | ||
|
|
880d633da0 | ||
|
|
cbf9035969 | ||
|
|
a5d93d4527 | ||
|
|
0c62a84195 | ||
|
|
8c1b986e20 | ||
|
|
a44bef1db9 | ||
|
|
9cc4965ed8 | ||
|
|
b68b2a8931 | ||
|
|
888b1ca80d | ||
|
|
498fe20d95 | ||
|
|
35df3b078f | ||
|
|
113883f40a | ||
|
|
73346b15cb | ||
|
|
66ea87aa11 | ||
|
|
369aab5074 | ||
|
|
d8a239237c | ||
|
|
39bc3bc442 | ||
|
|
58dde7ed5d | ||
|
|
a23ae4a4b9 | ||
|
|
57378c521a | ||
|
|
3480fd8fdb | ||
|
|
bb127860c3 | ||
|
|
68ea24fc15 | ||
|
|
db7e95d4af | ||
|
|
871897b6ce | ||
|
|
c80f875623 | ||
|
|
3e2a2839c5 | ||
|
|
fe412daa8d | ||
|
|
e59cdaa88e | ||
|
|
72da94d682 | ||
|
|
ffe220fa9b | ||
|
|
0494143318 | ||
|
|
322877d273 | ||
|
|
15e9f77f59 | ||
|
|
4785634454 | ||
|
|
b839dc2772 | ||
|
|
6b04d7367e | ||
|
|
4b82738048 | ||
|
|
cdb2c949f0 | ||
|
|
79d1713080 | ||
|
|
d659291a2f | ||
|
|
9077501d66 | ||
|
|
07d2c5fd04 | ||
|
|
cdf554179a | ||
|
|
ba197006a5 | ||
|
|
19bccf1464 | ||
|
|
1e5c0feaba | ||
|
|
c9b87dd121 | ||
|
|
4daa031c0e | ||
|
|
e6edc7c336 | ||
|
|
d46a2eddfc | ||
|
|
5d32636816 | ||
|
|
f7555f35ec | ||
|
|
fa93b53aba | ||
|
|
0a56130d94 | ||
|
|
c6734dd283 | ||
|
|
66e9511eec | ||
|
|
3535368424 | ||
|
|
3c896b492c | ||
|
|
54d5d8bd0e | ||
|
|
82b1e31e5b | ||
|
|
0ebc404db2 | ||
|
|
08e8a64d29 | ||
|
|
b9ac59fb67 | ||
|
|
9614ffc513 | ||
|
|
20c70bac9e | ||
|
|
48576ced29 | ||
|
|
e3aabfb7e4 | ||
|
|
d749452943 | ||
|
|
a6abd6c04e | ||
|
|
565f869da1 | ||
|
|
995e2bd982 | ||
|
|
37f5883893 | ||
|
|
4b16bb9d22 | ||
|
|
964b6ea589 | ||
|
|
b757cdc30d | ||
|
|
6511ac6b6a | ||
|
|
71b5dc75cf | ||
|
|
6dc26859e9 | ||
|
|
295b126d3a | ||
|
|
1ec966b396 | ||
|
|
4bec8d3e83 | ||
|
|
e49a7d8f0a | ||
|
|
b2ba8b84d9 | ||
|
|
6aaa9611ac | ||
|
|
7ab46f7402 | ||
|
|
182b50cd27 | ||
|
|
423ea8a81b | ||
|
|
7dd313add0 | ||
|
|
29d7f4d655 | ||
|
|
b0d6c6121b | ||
|
|
7ff5e5abfd | ||
|
|
7abad339af | ||
|
|
7c29bde27a | ||
|
|
c7a2b4fb95 | ||
|
|
4d735d220b | ||
|
|
ca160adabc | ||
|
|
f5c5a28545 | ||
|
|
665d4d4cb1 | ||
|
|
bc51f20d41 | ||
|
|
1230c8a437 | ||
|
|
5ecd7142b3 | ||
|
|
8c1eaf3d65 | ||
|
|
66995c3c06 | ||
|
|
d8fa62f1ad | ||
|
|
da044ca59a | ||
|
|
a703c6b2ac | ||
|
|
854bd906f0 | ||
|
|
ddb2f257f3 | ||
|
|
f18a023bb7 | ||
|
|
bb67446653 | ||
|
|
043a17de59 | ||
|
|
102d2a8ee6 | ||
|
|
7ab5e67256 | ||
|
|
e4b9ca6c34 | ||
|
|
570e257f08 | ||
|
|
db5f3ec7f4 | ||
|
|
93d7670508 | ||
|
|
f33eb3d480 | ||
|
|
d124080813 | ||
|
|
995fcac0ab | ||
|
|
3be77fe1ac | ||
|
|
9eefcb7c47 | ||
|
|
8b2b7ac7ff | ||
|
|
426f91bda0 | ||
|
|
468a28a036 | ||
|
|
e3ebcf0db4 | ||
|
|
513fdd6f2e | ||
|
|
58facd2ad0 | ||
|
|
d85abd6b37 | ||
|
|
1b27121c26 | ||
|
|
6b0ad509f5 | ||
|
|
09eec99fe1 | ||
|
|
13352ec2b4 | ||
|
|
34a01f3688 | ||
|
|
3e37ae8173 | ||
|
|
ad7e90c43e | ||
|
|
074e74b622 | ||
|
|
8c5109e904 | ||
|
|
dce483909b | ||
|
|
115e0a3e0f | ||
|
|
5be819e9db | ||
|
|
aed342c42f | ||
|
|
9af89d5c85 | ||
|
|
782f03e276 | ||
|
|
f3d747a5af | ||
|
|
4882dec678 | ||
|
|
6a345d2206 | ||
|
|
7d91dc5e75 | ||
|
|
81a4fca89d | ||
|
|
05a15260fd | ||
|
|
4394020dd2 | ||
|
|
f8bf12677f | ||
|
|
8e1987f250 | ||
|
|
5fc2ef81bc | ||
|
|
cd61d3ada3 | ||
|
|
d552f03de1 | ||
|
|
834b37abda | ||
|
|
8fcb8958ce | ||
|
|
27c70e84c8 | ||
|
|
276da8222f | ||
|
|
7fc1c46018 | ||
|
|
93a1a2209c | ||
|
|
865490927b | ||
|
|
8f315fe587 | ||
|
|
7d5c960fcb | ||
|
|
80f1e27507 | ||
|
|
c0d141a02e | ||
|
|
b208ea415a | ||
|
|
e729953cab | ||
|
|
5bc0ff96c0 | ||
|
|
349fd807b5 | ||
|
|
1982a5c0d6 | ||
|
|
844b726343 | ||
|
|
e269b304cd | ||
|
|
9606bf6af6 | ||
|
|
f58c789c60 | ||
|
|
b09a1c8132 | ||
|
|
e822bd89dc | ||
|
|
3ed3424adc | ||
|
|
1ffd375950 | ||
|
|
775d7e605b | ||
|
|
61ca2fffa9 | ||
|
|
cdf1b0863e | ||
|
|
e7b3a21cf7 | ||
|
|
b5cb7f02e1 | ||
|
|
3c6eed63ba | ||
|
|
0b9d854a90 | ||
|
|
4ccae3e5a8 | ||
|
|
53e0799a4a |
+6
-1
@@ -1 +1,6 @@
|
||||
*
|
||||
/*.exe*
|
||||
/mutn
|
||||
/MUTN
|
||||
/main
|
||||
/version.go
|
||||
1output
|
||||
|
||||
@@ -1,21 +1,667 @@
|
||||
MIT License
|
||||
MUTN
|
||||
Copyright (c) 2024-2026 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/>.
|
||||
|
||||
@@ -1,46 +1,37 @@
|
||||
# MUTN Password Manager
|
||||

|
||||
---
|
||||
Pronounced as: "mutton", "muh·tn"
|
||||
|
||||
MUTN is a simple, self-hosted, SSH-synchronized password manager based on libmutton.
|
||||
MUTN is a simple, self-hosted, vertically integrated, SSH-synchronized password manager. It is based on and is the reference implementation of [libmutton](https://github.com/rwinkhart/libmutton).
|
||||
|
||||
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
|
||||

|
||||
|
||||
# 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.5.0
|
||||
- Switch to alternative Markdown renderer (minimark or BEAN)
|
||||
### 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
|
||||
|
||||
@@ -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" )
|
||||
@@ -28,10 +28,10 @@ _mutnCompletions() {
|
||||
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "password note folder" -- "$cur" )
|
||||
;;
|
||||
copy )
|
||||
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "password username totp url note" -- "$cur" )
|
||||
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "password username totp url note menu" -- "$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" )
|
||||
@@ -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', 'menu')
|
||||
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
|
||||
@@ -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,menu}
|
||||
;;
|
||||
edit )
|
||||
compadd {password,username,totp,url,note,rename}
|
||||
;;
|
||||
gen )
|
||||
compadd update
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,168 @@
|
||||
.TH MUTN 1 "17 February 2026" "v0.4.0" "MUTN man page"
|
||||
|
||||
.SH NAME
|
||||
\fBmutn\fR - Simple, self-hosted, SSH-synchronized password and note management based on libmutton.
|
||||
|
||||
.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
|
||||
menu|-m Open interactive menu to copy any combination of fields
|
||||
|
||||
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. Using "add", "edit", or "copy" without specifying an option (field) will default to "password"
|
||||
|
||||
3. Various changes can be made to the configuration and stored entries from the "mutn tweak" menu
|
||||
|
||||
4. Type "mutn" (no arguments) to view a list of saved entries w/colored markers indicating the ages of stored passwords
|
||||
|
||||
.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
|
||||
5. If importing passwords from another password manager, you may desire to use the "Age all entries" option from the "mutn tweak" menu to add initial age tracking data to the imported passwords
|
||||
|
||||
.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)
|
||||
@@ -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.**
|
||||
@@ -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
|
||||
@@ -0,0 +1,31 @@
|
||||
**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.4.0**
|
||||
Built with libmutton v0.5.0
|
||||
February 17, 2026
|
||||
|
||||
# The "Hardy Herd" Update
|
||||
This release adds password age-tracking support, a new interactive copy menu, and features many under-the-hood (breaking) changes.
|
||||
|
||||
## libmutton-derived Changes
|
||||
- **PLEASE** read [libmutton's release notes](https://github.com/rwinkhart/libmutton/releases/tag/v0.5.0), as they detail severe breaking changes. You **NEED** to update your `libmuttonserver` and run `mutn init` after this update!
|
||||
|
||||
## Features
|
||||
- (41b4c4b6ca2f5a74899e87c6d520df7b140671b3) (c1c95655114a689daf80d2410e19ba35b670b1b1) (107a6f4f1250de8f94d87c192d58cc47bef80c1f) (fc1e3b11fc810a79cc0673b6edf96d4753c0300c) (a75416a6792559179e39497cb033407f18c00620) (b58461b9c458795278f050ff10e91a2d05c21745) (b26c2ce17c0491890de03dc131717d557876a3e4) (8112496006c7d48dd4a8f21a9eea51eadc30f732) (12167b1eeddb49e8f5e62f788dc1da6265706f68) (aaf69eb590af4dc37013102dcff79ef115b9f809) (cac35e1d25b7a9a4bd7263406f642834418f6b76) Add new interactive copy menu
|
||||
- This menu aims to reduce the number of times the user is decrypting each entry
|
||||
- (1a9de90f890f133e6ab8f298241fe3a6237ba4c8) (7016a8a1309b06c63b9dd63fb126103d4cab6ccc) Password age tracking (from libmutton)
|
||||
- The `tweak` menu now allows adding age data to old (existing) entries
|
||||
- (926eb1f1766f28a69e194c74758c300f233856fb) Option to verify entries (integrity) in `tweak` menu
|
||||
|
||||
## Changes
|
||||
- (f4abb4cc7e5f303f68358fcdda659056422ebeb3) MUTN no longer preserves new lines in Markdown notes (more compliant)
|
||||
|
||||
## Dependencies (direct/replaced)
|
||||
- Dropped (libmutton)
|
||||
- golang.design/x/clipboard
|
||||
- gopkg.in/ini.v1
|
||||
- Bumped
|
||||
- Go: v1.25.4 => 1.26.0
|
||||
- github.com/rwinkhart/go-boilerplate: v0.1.0 => v0.3.1
|
||||
- github.com/rwinkhart/libmutton: v0.4.4 => v0.5.0
|
||||
- golang.org/x/term: v0.36.0 => v0.40.0
|
||||
@@ -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()
|
||||
}
|
||||
@@ -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
|
||||
@@ -1,34 +1,45 @@
|
||||
module github.com/rwinkhart/MUTN
|
||||
|
||||
go 1.22.2
|
||||
go 1.26.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.3.2-0.20260530010204-f70ff83e1ea1
|
||||
github.com/rwinkhart/libmutton v0.5.1-0.20260529233337-726153b9be84
|
||||
golang.org/x/term v0.43.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/clipperhouse/uax29/v2 v2.7.0 // indirect
|
||||
github.com/gorilla/css v1.0.1 // 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/kr/fs v0.1.0 // indirect
|
||||
github.com/lucasb-eyer/go-colorful v1.4.0 // indirect
|
||||
github.com/mattn/go-isatty v0.0.22 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.24 // 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.5 // indirect
|
||||
github.com/rwinkhart/rcw v0.3.1 // indirect
|
||||
github.com/yuin/goldmark v1.8.2 // indirect
|
||||
github.com/yuin/goldmark-emoji v1.0.6 // indirect
|
||||
golang.org/x/crypto v0.52.0 // indirect
|
||||
golang.org/x/net v0.55.0 // indirect
|
||||
golang.org/x/sys v0.45.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
)
|
||||
|
||||
replace golang.org/x/sys => github.com/rwinkhart/sys v0.45.0
|
||||
|
||||
replace github.com/Microsoft/go-winio => github.com/rwinkhart/go-winio v0.1.1
|
||||
|
||||
replace github.com/charmbracelet/glamour => github.com/rwinkhart/glamour-temp-MUTN v0.7.2
|
||||
|
||||
@@ -1,72 +1,78 @@
|
||||
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/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJv2v7Vk=
|
||||
github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM=
|
||||
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/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/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.4.0 h1:UtrWVfLdarDgc44HcS7pYloGHJUjHV/4FwW4TvVgFr4=
|
||||
github.com/lucasb-eyer/go-colorful v1.4.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
||||
github.com/mattn/go-isatty v0.0.22 h1:j8l17JJ9i6VGPUFUYoTUKPSgKe/83EYU2zBC7YNKMw4=
|
||||
github.com/mattn/go-isatty v0.0.22/go.mod h1:ZXfXG4SQHsB/w3ZeOYbR0PrPwLy+n6xiMrJlRFqopa4=
|
||||
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.24 h1:cpokDiIn0MGnhdHwuWnJBITySJ20QyNGnY2kR/ay2DU=
|
||||
github.com/mattn/go-runewidth v0.0.24/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
|
||||
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.3.2-0.20260530010204-f70ff83e1ea1 h1:qZA/GmgDHUQavxOFUHoZUX+q7T20a/4ptpjn8kz6tlk=
|
||||
github.com/rwinkhart/go-boilerplate v0.3.2-0.20260530010204-f70ff83e1ea1/go.mod h1:xqejLI6vJc5k9HzrnJC2We5E1Ae570GP9dNp9GaY6co=
|
||||
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.1 h1:kAJKiqneR7cUR01Wn5/doAAV4kOGTEGPug4oinXc5N4=
|
||||
github.com/rwinkhart/go-winio v0.1.1/go.mod h1:ZWa7ssZJT30CCDGJ7fk/2SBTq9BIQrrVjrcss0UW2s0=
|
||||
github.com/rwinkhart/libmutton v0.5.1-0.20260529233337-726153b9be84 h1:UQmK0fhaiXh/gPv7Wj4ZoUcWLelI3MwhMWw2ThJDW6I=
|
||||
github.com/rwinkhart/libmutton v0.5.1-0.20260529233337-726153b9be84/go.mod h1:l2w6vnhRC+ra7/d4qoZ0nDil7qwvH7YCjRWBjrk9LYg=
|
||||
github.com/rwinkhart/peercred-mini v0.1.5 h1:9sBR0ascteCJfzfhv7Gq/juqu7OOU+AphiEIG1+LcWA=
|
||||
github.com/rwinkhart/peercred-mini v0.1.5/go.mod h1:C73IeDteQwsKp1+PDdUBj4FC6dTziAJNbQsVDZSWE+M=
|
||||
github.com/rwinkhart/rcw v0.3.1 h1:qmozfcoEm71ttA8YSoH96y42Z2sFhCvY45GGtFPWVhg=
|
||||
github.com/rwinkhart/rcw v0.3.1/go.mod h1:TreA2OUl64v2UprL4xpXdDM7w8lJNzQ544rUIl8omtI=
|
||||
github.com/rwinkhart/sys v0.45.0 h1:HXZL0SuyToqKkvakaUuRAdH8sPUHelfO6q4PQRpL26Q=
|
||||
github.com/rwinkhart/sys v0.45.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||
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=
|
||||
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
|
||||
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
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.8.2 h1:kEGpgqJXdgbkhcOgBxkC0X0PmoPG1ZyoZ117rDVp4zE=
|
||||
github.com/yuin/goldmark v1.8.2/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.org/x/crypto v0.52.0 h1:RMs7fP2rXdep0CftQlK8Uf+kibLm7qkCcradZWYz988=
|
||||
golang.org/x/crypto v0.52.0/go.mod h1:1QgfPxDqh0T2M/elOJtp9RvuR95kVjir0e6/BvEmGbc=
|
||||
golang.org/x/net v0.55.0 h1:bcvxaJn3e1U6InsFWt1JUq1aSjnRxLzT2rtD2KfkDF8=
|
||||
golang.org/x/net v0.55.0/go.mod h1:L5U2KuzuOe1lY7Z+aWVIKK6qEeJXnXV9yzGA+WCHJww=
|
||||
golang.org/x/term v0.43.0 h1:S4RLU2sB31O/NCl+zFN9Aru9A/Cq2aqKpTZJ6B+DwT4=
|
||||
golang.org/x/term v0.43.0/go.mod h1:lrhlHNdQJHO+1qVYiHfFKVuVioJIheAc3fBSMFYEIsk=
|
||||
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/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=
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,289 @@
|
||||
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/age"
|
||||
"github.com/rwinkhart/libmutton/clip"
|
||||
"github.com/rwinkhart/libmutton/config"
|
||||
"github.com/rwinkhart/libmutton/core"
|
||||
"github.com/rwinkhart/libmutton/crypt"
|
||||
"github.com/rwinkhart/libmutton/global"
|
||||
"github.com/rwinkhart/libmutton/syncclient"
|
||||
)
|
||||
|
||||
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 realPath of target entry
|
||||
realPath := global.GetRealPath(args[1])
|
||||
|
||||
// entry reader shortcut (if no other arguments are supplied)
|
||||
if argsCount == 2 {
|
||||
cli.EntryReaderDecrypt(realPath, 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(realPath, false)
|
||||
case "copy":
|
||||
if err := clip.CopyShortcut(realPath, 0, nil); err != nil {
|
||||
other.PrintError("Failed to copy password to clipboard: "+err.Error(), global.ErrorClipboard)
|
||||
}
|
||||
case "edit":
|
||||
cli.EditEntryField(realPath, 0)
|
||||
case "gen":
|
||||
cli.AddEntry(realPath, 1)
|
||||
case "add":
|
||||
cli.AddEntry(realPath, 0)
|
||||
case "shear":
|
||||
if err := syncclient.ShearRemote(args[1], false); 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(realPath, 0)
|
||||
case "gen":
|
||||
cli.AddEntry(realPath, 1)
|
||||
case "add":
|
||||
cli.AddEntry(realPath, 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
|
||||
case "menu", "-m":
|
||||
cli.CopyMenu(args[1], nil, nil)
|
||||
default:
|
||||
cli.HelpCopy()
|
||||
}
|
||||
if err := clip.CopyShortcut(realPath, field, nil); 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(realPath, true) // error is ignored because dir/file status is irrelevant
|
||||
if !isAccessible {
|
||||
other.PrintError("Failed to access location ("+realPath+")", 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(realPath, field)
|
||||
} else {
|
||||
switch args[4] {
|
||||
case "show", "-s":
|
||||
cli.EditEntryField(realPath, field)
|
||||
default:
|
||||
cli.EditEntryField(realPath, field)
|
||||
}
|
||||
}
|
||||
case "gen":
|
||||
if argsCount == 4 {
|
||||
switch args[3] {
|
||||
case "update", "-u":
|
||||
cli.GenUpdate(realPath)
|
||||
default:
|
||||
cli.HelpGen()
|
||||
}
|
||||
} else if args[3] == "update" || args[3] == "-u" {
|
||||
switch args[4] {
|
||||
case "show", "-s":
|
||||
cli.GenUpdate(realPath)
|
||||
default:
|
||||
cli.GenUpdate(realPath)
|
||||
}
|
||||
}
|
||||
cli.HelpGen()
|
||||
case "add":
|
||||
switch args[3] {
|
||||
case "password", "-pw":
|
||||
if argsCount == 4 {
|
||||
cli.AddEntry(realPath, 0)
|
||||
} else {
|
||||
switch args[4] {
|
||||
case "show", "-s":
|
||||
cli.AddEntry(realPath, 0)
|
||||
default:
|
||||
cli.AddEntry(realPath, 0)
|
||||
}
|
||||
}
|
||||
case "note", "-n":
|
||||
cli.AddEntry(realPath, 2)
|
||||
case "folder", "-f":
|
||||
if err := syncclient.AddFolderRemote(args[1]); 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":
|
||||
if err := clip.ClearArgument(); err != nil {
|
||||
other.PrintError("Failure occurred in clipboard clearing process: "+err.Error(), global.ErrorClipboard)
|
||||
}
|
||||
case "startrcwd":
|
||||
crypt.RCWDArgument()
|
||||
case "sync":
|
||||
_, err := syncclient.RunJob()
|
||||
if err != nil {
|
||||
other.PrintError("Failed to sync entries: "+err.Error(), global.ErrorSyncProcess)
|
||||
}
|
||||
case "init":
|
||||
err := core.LibmuttonInit(
|
||||
front.Input,
|
||||
confirmRCWPassword("new"),
|
||||
front.InputBinary("Preserve existing config directory?"),
|
||||
false,
|
||||
"",
|
||||
map[string]any{"mutnTextEditor": getTextEditorInput()},
|
||||
)
|
||||
if err != nil {
|
||||
other.PrintError("Initialization failed: "+err.Error(), 0)
|
||||
}
|
||||
case "tweak":
|
||||
choice := front.InputMenuGen("Action:", []string{"Set text editor", "Change device ID", "Age all entries", "Verify all entries", "Change master password/Optimize entries"})
|
||||
switch choice {
|
||||
case 1:
|
||||
newCfg := &config.CfgT{}
|
||||
newClientSpecificCfg := map[string]any{"mutnTextEditor": getTextEditorInput()}
|
||||
newCfg.ClientSpecific = &newClientSpecificCfg
|
||||
if err := config.Write(newCfg, true); err != nil {
|
||||
other.PrintError("Failed to set text editor: "+err.Error(), back.ErrorWrite)
|
||||
}
|
||||
case 2:
|
||||
oldDeviceID, err := global.GetCurrentDeviceID()
|
||||
if err != nil {
|
||||
other.PrintError("Failed to get current device ID: "+err.Error(), back.ErrorRead)
|
||||
}
|
||||
_, _, _, err = syncclient.GenDeviceID(oldDeviceID, "")
|
||||
if err != nil {
|
||||
other.PrintError("Failed to change device ID: "+err.Error(), global.ErrorSyncProcess)
|
||||
}
|
||||
fmt.Println("\nDevice ID changed successfully.")
|
||||
case 3:
|
||||
forceReage := front.InputBinary("Re-age aged entries?")
|
||||
fmt.Println("Aging entries; please wait - do not terminate this process")
|
||||
if err := age.AllPasswordEntries(forceReage, nil); err != nil {
|
||||
other.PrintError("Failed to age entries: "+err.Error(), 1)
|
||||
}
|
||||
case 4:
|
||||
verifyEntries(front.InputSecret("RCW Password:"))
|
||||
case 5:
|
||||
oldPassword := confirmRCWPassword("old")
|
||||
newPassword := confirmRCWPassword("new")
|
||||
fmt.Print("Re-encrypting entries; please wait - do not terminate this process.\n\n")
|
||||
if err := core.EntryRefresh(oldPassword, newPassword, false); err != nil {
|
||||
other.PrintError("Re-encryption failed: "+err.Error(), global.ErrorEncryption)
|
||||
}
|
||||
if front.InputBinary("\nRe-encryption complete. Verify new entries (recommended)?") {
|
||||
verifyEntries(newPassword)
|
||||
}
|
||||
}
|
||||
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.InputSecret(strings.ToUpper(string(lowercasePrefix[0])) + lowercasePrefix[1:] + " master password:")
|
||||
if !bytes.Equal(rcwPass, front.InputSecret("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)
|
||||
}
|
||||
|
||||
// verifyEntries attempts to verify all entries using the provided RCW password.
|
||||
func verifyEntries(rcwPassword []byte) {
|
||||
fmt.Println("Verification in progress; please wait - do not terminate this process...")
|
||||
err := core.VerifyEntries(rcwPassword)
|
||||
if err != nil {
|
||||
other.PrintError("Verification failed: "+err.Error(), global.ErrorDecryption)
|
||||
}
|
||||
fmt.Println("Verification successful")
|
||||
}
|
||||
Executable
+36
@@ -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" ./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='AGPL-3.0-only'
|
||||
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=0 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=('AGPL-3.0-only')
|
||||
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=0 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'
|
||||
}
|
||||
@@ -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 CGO_ENABLED=0 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 CGO_ENABLED=0 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 CGO_ENABLED=0 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
|
||||
}
|
||||
@@ -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"
|
||||
)
|
||||
@@ -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
|
||||
)
|
||||
@@ -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
|
||||
)
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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>
|
||||
@@ -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
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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>"
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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
@@ -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.4.0" // untagged releases feature a letter suffix corresponding to the eventual release version, e.g "0.B.0" -> "0.2.0", "0.2.A" -> "0.2.1"
|
||||
|
||||
ansiBlackOnWhite = "\033[38;5;0;48;5;15m"
|
||||
)
|
||||
|
||||
func init() {
|
||||
global.GetPassword = front.InputSecret
|
||||
}
|
||||
|
||||
+27
-21
@@ -1,45 +1,51 @@
|
||||
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 realPath by taking user input via CLI prompts.
|
||||
// Requires: entryType (0 = standard password entry, 1 = auto-generated password entry, 2 = note-only entry).
|
||||
func AddEntry(realPath string, entryType uint8) {
|
||||
// ensure realPath is valid
|
||||
_, err := core.EntryAddPrecheck(realPath)
|
||||
if err != nil {
|
||||
other.PrintError("Failed to add entry: "+err.Error(), back.ErrorWrite)
|
||||
}
|
||||
|
||||
var unencryptedEntry []string
|
||||
var decSlice []string
|
||||
|
||||
var password []byte
|
||||
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 = front.InputSecret("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.InputSecret("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...)
|
||||
decSlice = append([]string{string(password), username, totp, url}, note...)
|
||||
} else {
|
||||
unencryptedEntry = []string{password, username, url}
|
||||
decSlice = []string{string(password), username, totp, url}
|
||||
}
|
||||
} else {
|
||||
note, _ := editNote([]string{})
|
||||
unencryptedEntry = append([]string{"", "", ""}, note...)
|
||||
decSlice = append([]string{"", "", "", ""}, note...)
|
||||
}
|
||||
|
||||
// write and preview the new entry
|
||||
writeEntryCLI(targetLocation, unencryptedEntry, hidePassword)
|
||||
if password != nil {
|
||||
writeEntryCLI(realPath, decSlice, true, nil)
|
||||
} else {
|
||||
writeEntryCLI(realPath, decSlice, false, nil)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/rwinkhart/go-boilerplate/back"
|
||||
"github.com/rwinkhart/go-boilerplate/front"
|
||||
"github.com/rwinkhart/go-boilerplate/other"
|
||||
"github.com/rwinkhart/libmutton/clip"
|
||||
"github.com/rwinkhart/libmutton/crypt"
|
||||
"github.com/rwinkhart/libmutton/global"
|
||||
"github.com/rwinkhart/libmutton/syncclient"
|
||||
)
|
||||
|
||||
// CopyMenu decrypts an entry and allows the user to interactively copy
|
||||
// fields without having to re-decrypt each time. decSlice can be left nil
|
||||
// to decrypt the entry specified by vanityPath. If the entry was provided
|
||||
// decrypted, CopyMenu assumes it was edited and triggers a sync.
|
||||
func CopyMenu(vanityPath string, decSlice []string, oldPassword []byte) {
|
||||
realPath := global.GetRealPath(vanityPath)
|
||||
var err error
|
||||
if decSlice == nil {
|
||||
// decrypt entry
|
||||
decSlice, err = crypt.DecryptFileToSlice(realPath, nil)
|
||||
if err != nil {
|
||||
other.PrintError("Failed to decrypt entry: "+err.Error(), global.ErrorDecryption)
|
||||
}
|
||||
} else {
|
||||
fmt.Print("\n")
|
||||
_, err := syncclient.RunJob()
|
||||
if err != nil {
|
||||
other.PrintError("Failed to sync on copy menu entry: "+err.Error(), global.ErrorSyncProcess)
|
||||
}
|
||||
}
|
||||
|
||||
// determine populated fields in entry
|
||||
var allStrings = [5]string{"Username", "Password", "TOTP Code", "URL", "Note (first line)"}
|
||||
var allIndices = [5]int{1, 0, 2, 3, 4}
|
||||
var allRunes = [5]rune{'u', 'p', 't', 'l', 'n'}
|
||||
var fieldStrings []string
|
||||
var fieldRunes []rune
|
||||
for i := range allIndices {
|
||||
if len(decSlice) > allIndices[i] && decSlice[allIndices[i]] != "" {
|
||||
fieldStrings = append(fieldStrings, allStrings[i])
|
||||
fieldRunes = append(fieldRunes, allRunes[i])
|
||||
if allIndices[i] == 0 && oldPassword != nil {
|
||||
fieldStrings = append(fieldStrings, "Old Password")
|
||||
fieldRunes = append(fieldRunes, 'b')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if notes are included, preview them
|
||||
if len(decSlice) > 4 {
|
||||
EntryReader(vanityPath, append([]string{"", "", "", ""}, decSlice[4:]...), true)
|
||||
if len(fieldStrings) < 1 { // if notes are the only thing included, exit
|
||||
fmt.Printf("\r%sNo copyable fields present, exiting copy menu...%s\n", back.AnsiWarning, back.AnsiReset)
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
||||
|
||||
// set up signal handling for ctrl+c to clear clipboard
|
||||
sigChan := make(chan os.Signal, 1)
|
||||
signal.Notify(sigChan, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
|
||||
go func() {
|
||||
<-sigChan
|
||||
if err = clip.ClearProcess(nil); err != nil {
|
||||
other.PrintError("Failed to clear clipboard on exit: "+err.Error(), global.ErrorClipboard)
|
||||
}
|
||||
os.Exit(0)
|
||||
}()
|
||||
|
||||
// set up timer to close copy menu if an item is
|
||||
// not selected (useful to avoid extra user input
|
||||
// when the copy menu is displayed automatically
|
||||
// and is not desired)
|
||||
const timeoutSeconds uint8 = 5
|
||||
selectedChan := make(chan bool, 1)
|
||||
go func() {
|
||||
for i := uint8(1); i <= timeoutSeconds; i++ {
|
||||
select {
|
||||
case <-selectedChan:
|
||||
return
|
||||
case <-time.After(1 * time.Second):
|
||||
if i == timeoutSeconds {
|
||||
fmt.Printf("\r%sNo field selected, exiting copy menu...%s\n", back.AnsiWarning, back.AnsiReset)
|
||||
os.Exit(0)
|
||||
}
|
||||
fmt.Printf("\rField to copy (exiting in %d seconds): ", timeoutSeconds-i)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
// copy selected field to clipboard
|
||||
var runesToIndices = map[rune]int{'u': 1, 'p': 0, 't': 2, 'l': 3, 'n': 4}
|
||||
var selectedField rune
|
||||
for {
|
||||
fmt.Println()
|
||||
if selectedField != 0 {
|
||||
selectedField = front.InputMenuGenWithRuneInputs("Field to copy:", fieldStrings, fieldRunes)
|
||||
} else {
|
||||
selectedField = front.InputMenuGenWithRuneInputs("Field to copy (exiting in 5 seconds):", fieldStrings, fieldRunes)
|
||||
selectedChan <- true
|
||||
}
|
||||
|
||||
switch selectedField {
|
||||
case 'b': // old password
|
||||
if err = clip.CopyBytes(false, oldPassword); err != nil {
|
||||
other.PrintError("Failed to copy old password to clipboard: "+err.Error(), global.ErrorClipboard)
|
||||
}
|
||||
case 't': // TOTP
|
||||
fmt.Println(back.AnsiWarning + "[Starting]" + back.AnsiReset + " TOTP clipboard refresher")
|
||||
errorChan := make(chan error, 1)
|
||||
done := make(chan bool)
|
||||
go clip.TOTPCopier(decSlice[2], errorChan, done)
|
||||
// block until first successful copy
|
||||
if err = <-errorChan; err != nil {
|
||||
other.PrintError("Failed to copy TOTP token: "+err.Error(), global.ErrorClipboard)
|
||||
}
|
||||
// block until the user sends "q"
|
||||
for {
|
||||
input := front.Input("Service will run until 'q' is entered:")
|
||||
if input == "q" {
|
||||
break
|
||||
}
|
||||
}
|
||||
close(done)
|
||||
fmt.Println(back.AnsiBlue + "[Stopped]" + back.AnsiReset + " TOTP clipboard refresher")
|
||||
case 'n': // notes
|
||||
decSlice[4] = strings.TrimRight(decSlice[4], " ")
|
||||
fallthrough
|
||||
default:
|
||||
if err = clip.CopyBytes(false, []byte(decSlice[runesToIndices[selectedField]])); err != nil {
|
||||
other.PrintError("Failed to copy field to clipboard: "+err.Error(), global.ErrorClipboard)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+97
-55
@@ -2,100 +2,147 @@ 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/config"
|
||||
"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(oldVanityPath string) {
|
||||
// prompt user for new location and rename
|
||||
newLocation := backend.EntryRoot + backend.PathSeparator + input("New location:")
|
||||
backend.Rename(oldLocation, newLocation)
|
||||
newVanityPath := front.Input("New location:")
|
||||
if err := syncclient.RenameRemote(oldVanityPath, newVanityPath); err != nil {
|
||||
other.PrintError("Failed to rename entry: "+err.Error(), back.ErrorWrite)
|
||||
}
|
||||
|
||||
// exit is done from backend.Rename
|
||||
// exit is done from sync.RenameRemote
|
||||
}
|
||||
|
||||
// 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 realPath (user input).
|
||||
func EditEntryField(realPath string, field int) {
|
||||
// fetch old entry data (with all required lines present)
|
||||
unencryptedEntry := backend.GetOldEntryData(targetLocation, field)
|
||||
decSlice, err := core.GetOldEntryData(realPath, field, nil)
|
||||
if err != nil {
|
||||
other.PrintError("Failed to fetch entry data: "+err.Error(), back.ErrorRead)
|
||||
}
|
||||
|
||||
// edit the field
|
||||
var oldPassword []byte
|
||||
switch field {
|
||||
case 0:
|
||||
unencryptedEntry[field] = inputHidden("Password:")
|
||||
if decSlice[0] != "" {
|
||||
oldPassword = []byte(decSlice[0])
|
||||
}
|
||||
decSlice[field] = string(front.InputSecret("Password:"))
|
||||
case 1:
|
||||
unencryptedEntry[field] = input("Username:")
|
||||
decSlice[field] = front.Input("Username:")
|
||||
case 2:
|
||||
unencryptedEntry[field] = input("URL:")
|
||||
case 3: // edit notes fields
|
||||
decSlice[field] = string(front.InputSecret("TOTP secret:"))
|
||||
case 3:
|
||||
decSlice[field] = front.Input("URL:")
|
||||
case 4: // edit notes fields
|
||||
// store note and non-note data separately
|
||||
nonNoteData := unencryptedEntry[:3]
|
||||
noteData := unencryptedEntry[3:]
|
||||
fieldsMain := decSlice[:4]
|
||||
fieldsNote := decSlice[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...)
|
||||
decSlice = append(fieldsMain, editedNote...)
|
||||
}
|
||||
|
||||
// write and preview the modified entry
|
||||
writeEntryCLI(targetLocation, unencryptedEntry, hidePassword)
|
||||
if field == 0 {
|
||||
writeEntryCLI(realPath, decSlice, true, oldPassword)
|
||||
} else {
|
||||
writeEntryCLI(realPath, decSlice, false, oldPassword)
|
||||
}
|
||||
}
|
||||
|
||||
// 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 realPath (user input).
|
||||
func GenUpdate(realPath string) {
|
||||
// fetch old entry data
|
||||
unencryptedEntry := backend.GetOldEntryData(targetLocation, 0)
|
||||
decSlice, err := core.GetOldEntryData(realPath, 0, nil)
|
||||
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)
|
||||
var oldPassword []byte
|
||||
if decSlice[0] != "" {
|
||||
oldPassword = []byte(decSlice[0])
|
||||
}
|
||||
decSlice[0] = string(inputPasswordGen())
|
||||
|
||||
// write and preview the modified entry
|
||||
writeEntryCLI(targetLocation, unencryptedEntry, hidePassword)
|
||||
writeEntryCLI(realPath, decSlice, true, oldPassword)
|
||||
}
|
||||
|
||||
// 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
|
||||
cfg, err := config.Load()
|
||||
if err != nil {
|
||||
other.PrintError("Failed to load libmuttoncfg.json: "+err.Error(), back.ErrorRead)
|
||||
}
|
||||
var editor string
|
||||
if value, exists := (*cfg.ClientSpecific)["mutnTextEditor"]; !exists {
|
||||
other.PrintError("Failed to retrieve text editor from libmuttoncfg.json\n\nPlease specify one with \"mutn tweak\"", back.ErrorRead)
|
||||
} else {
|
||||
editor = value.(string)
|
||||
}
|
||||
|
||||
// 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()
|
||||
if err != nil {
|
||||
panic(backend.AnsiError + "Failed to write note with " + editor + backend.AnsiReset)
|
||||
if err = cmd.Run(); err != nil {
|
||||
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 +153,15 @@ 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)
|
||||
|
||||
// trim trailing whitespace from each note line
|
||||
for i, line := range note {
|
||||
note[i] = strings.TrimRight(line, " \t\r\n")
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
+136
-141
@@ -2,185 +2,180 @@ package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/rwinkhart/MUTN/src/backend"
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/rwinkhart/go-boilerplate/back"
|
||||
"github.com/rwinkhart/go-boilerplate/other"
|
||||
"github.com/rwinkhart/libmutton/age"
|
||||
"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"
|
||||
ansiAlternateEntryColor = "\033[38;5;8m"
|
||||
ansiDirectoryHeader = "\033[38;5;7;48;5;8m"
|
||||
)
|
||||
|
||||
// calculates and returns the final visual indentation multiplier (needed to adjust indentation for skipped parent directories) - also subtracts "old" text from directory header
|
||||
func writeIndent(sb *strings.Builder, indent int) { sb.WriteString(strings.Repeat(" ", indent*2)) }
|
||||
|
||||
// determineIndentation calculates the final visual indentation multiplier (adjusts for skipped parents)
|
||||
// and trims the parent directory name from the directory header (if applicable).
|
||||
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]
|
||||
trimmed := dirList[currentDirIndex]
|
||||
indent := strings.Count(trimmed, "/") - 1 // avoid indenting root-level dirs
|
||||
|
||||
// determine initial indentation multiplier based on PathSeparator occurrences
|
||||
indent := strings.Count(trimmedDirectory, backend.PathSeparator) - 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 skipped { // ...and this iteration's directory was skipped...
|
||||
subtractor++ // increment the subtractor to indicate that the visual indentation should be reduced
|
||||
subtractor, lastPrefixIndex := 0, 0
|
||||
for i, skipped := range skippedDirList[:currentDirIndex] {
|
||||
if strings.HasPrefix(trimmed, dirList[i]+"/") {
|
||||
if skipped {
|
||||
subtractor++
|
||||
} else {
|
||||
lastPrefixIndex = i
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
indent = indent - subtractor // calculates final visual indentation multiplier
|
||||
|
||||
if indent < 0 { // disallow negative indentation multipliers
|
||||
indent = 0
|
||||
} else if indent > 0 { // trim the most recently displayed parent directory from the directory header to avoid displaying redundant information
|
||||
trimmedDirectory = strings.Replace(trimmedDirectory, dirList[lastPrefixIndex], "", 1)
|
||||
if indent -= subtractor; indent < 0 {
|
||||
return 0, trimmed
|
||||
}
|
||||
|
||||
return indent, trimmedDirectory
|
||||
if indent > 0 {
|
||||
trimmed = strings.TrimPrefix(trimmed, dirList[lastPrefixIndex])
|
||||
}
|
||||
return indent, trimmed
|
||||
}
|
||||
|
||||
// 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) {
|
||||
// determine color to print fileEntryName (alternate each time function is run)
|
||||
var colorCode string
|
||||
if colorAlternator > 0 {
|
||||
colorCode = ""
|
||||
} else {
|
||||
// printFileEntry handles processing for printing file entries (determines color, adds aging indicator, wraps lines, and prints).
|
||||
func printFileEntry(sb *strings.Builder, entry string, lastSlash int, charCounter *int, indent int, colorAlternator int8, agingTimestamp *int64) int8 {
|
||||
colorCode := ""
|
||||
if colorAlternator <= 0 {
|
||||
colorCode = ansiAlternateEntryColor
|
||||
}
|
||||
colorAlternator = -colorAlternator
|
||||
|
||||
// trim the containing directory from the entry to determine fileEntryName
|
||||
fileEntryName := entry[lastSlash:]
|
||||
|
||||
if charCounter == 0 { // indent first line of entries for each directory header
|
||||
fmt.Print(strings.Repeat(" ", indent*2))
|
||||
agingDot := ""
|
||||
switch age.TranslateAgeTimestamp(agingTimestamp) {
|
||||
case 1:
|
||||
agingDot = back.AnsiGreen + "⁍" + back.AnsiReset
|
||||
case 2:
|
||||
agingDot = back.AnsiWarning + "⁍" + back.AnsiReset
|
||||
case 3:
|
||||
agingDot = back.AnsiError + "⁍" + back.AnsiReset
|
||||
}
|
||||
|
||||
// determine whether to wrap to a new line (+1 is to account for trailing spaces)
|
||||
charCounter += len(fileEntryName) + 1
|
||||
if indentation := indent * 2; charCounter+(indentation) >= width {
|
||||
charCounter = len(fileEntryName) + 1
|
||||
fmt.Print("\n" + strings.Repeat(" ", indentation)) // indent each line
|
||||
name := entry[lastSlash:]
|
||||
if *charCounter == 0 {
|
||||
writeIndent(sb, indent)
|
||||
}
|
||||
|
||||
// print fileEntryName to screen
|
||||
fmt.Printf("%s%s%s ", colorCode, fileEntryName, backend.AnsiReset)
|
||||
// wrap if needed; +1 accounts for trailing space, +1 more if aging dot is present
|
||||
inc := len(name) + 1
|
||||
if agingDot != "" {
|
||||
inc++
|
||||
}
|
||||
if *charCounter += inc; *charCounter+indent*2 >= width {
|
||||
*charCounter = len(name) + 1
|
||||
if agingDot != "" {
|
||||
*charCounter++
|
||||
}
|
||||
sb.WriteString("\n")
|
||||
writeIndent(sb, indent)
|
||||
}
|
||||
|
||||
return charCounter, colorAlternator
|
||||
sb.WriteString(agingDot)
|
||||
sb.WriteString(colorCode)
|
||||
sb.WriteString(name)
|
||||
sb.WriteString(back.AnsiReset)
|
||||
sb.WriteString(" ")
|
||||
return 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
|
||||
_, dirList, err := synccommon.WalkEntryDir()
|
||||
if err != nil {
|
||||
other.PrintError("Failed to generate entry list: "+err.Error(), back.ErrorRead)
|
||||
}
|
||||
entryMap, err := synccommon.GetAllEntryData()
|
||||
if err != nil {
|
||||
other.PrintError("Failed to retrieve entry aging data: "+err.Error(), back.ErrorRead)
|
||||
}
|
||||
|
||||
// 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
|
||||
})
|
||||
var sb strings.Builder
|
||||
|
||||
// print header bar w/total entry count
|
||||
fmt.Print("\n"+ansiBlackOnWhite, len(fileList), " libmutton entries:"+backend.AnsiReset)
|
||||
sb.WriteString("\n")
|
||||
sb.WriteString(ansiBlackOnWhite)
|
||||
_, _ = fmt.Fprint(&sb, len(entryMap))
|
||||
sb.WriteString(" libmutton entries:")
|
||||
sb.WriteString(back.AnsiReset)
|
||||
|
||||
// dirList iteration
|
||||
dirListLength := len(dirList) // save length for multiple references below
|
||||
var skippedDirList = make([]bool, dirListLength) // stores whether each directory was skipped during printout (later used to determine appropriate visual indentation)
|
||||
charCounter := 0 // track whether to line-wrap based on character count in line
|
||||
var colorAlternator int8 = 1 // track alternating colors for each printed entry name
|
||||
var containsSubdirectory bool // indicates whether the current directory contains a subdirectory
|
||||
var indent int // visual indentation multiplier
|
||||
var vanityDirectory string // directory header printed to end-user - visual only, not used in any processing
|
||||
for i, directory := range dirList {
|
||||
|
||||
// reset formatting variables for new directory
|
||||
charCounter = 0
|
||||
colorAlternator = 1
|
||||
|
||||
// default to assuming this directory will be skipped (unless it is the root)
|
||||
if i == 0 {
|
||||
skippedDirList[i] = false
|
||||
} else {
|
||||
skippedDirList[i] = true
|
||||
entriesByDir := make(map[string][]string, len(dirList))
|
||||
for vanityPath := range entryMap {
|
||||
if lastSlash := strings.LastIndex(vanityPath, "/"); lastSlash >= 0 {
|
||||
entriesByDir[vanityPath[:lastSlash]] = append(entriesByDir[vanityPath[:lastSlash]], vanityPath)
|
||||
}
|
||||
}
|
||||
for _, entries := range entriesByDir {
|
||||
sort.Strings(entries)
|
||||
}
|
||||
|
||||
// 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)] {
|
||||
containsSubdirectory = true
|
||||
} else {
|
||||
containsSubdirectory = false
|
||||
}
|
||||
} else {
|
||||
containsSubdirectory = false
|
||||
}
|
||||
|
||||
// fileList iteration
|
||||
containsFiles := false // indicates whether the current directory contains files (entries)
|
||||
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 {
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
charCounter, colorAlternator = printFileEntry(file, lastSlash, charCounter, colorAlternator, indent)
|
||||
}
|
||||
}
|
||||
|
||||
if !containsFiles { // if the current directory contains no files...
|
||||
if !containsSubdirectory { // nor does it contain any subdirectories...
|
||||
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)
|
||||
} 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\".")
|
||||
}
|
||||
}
|
||||
// precompute whether each directory contains subdirectories;
|
||||
// handle root-level child dirs by treating "" as their parent.
|
||||
hasChildDir := make(map[string]bool, len(dirList))
|
||||
for _, d := range dirList {
|
||||
switch parentEnd := strings.LastIndex(d, "/"); {
|
||||
case parentEnd > 0:
|
||||
hasChildDir[d[:parentEnd]] = true
|
||||
case parentEnd == -1:
|
||||
hasChildDir[""] = true
|
||||
}
|
||||
}
|
||||
|
||||
// print trailing new lines for proper spacing after entry list is complete
|
||||
fmt.Print("\n\n")
|
||||
dirListLength := len(dirList)
|
||||
skippedDirList := make([]bool, dirListLength)
|
||||
charCounter := 0
|
||||
var colorAlternator int8 = 1
|
||||
|
||||
printDirHeader := func(i int) int {
|
||||
skippedDirList[i] = false
|
||||
indent, vanityDirectory := determineIndentation(skippedDirList, dirList, i)
|
||||
sb.WriteString("\n\n")
|
||||
writeIndent(&sb, indent)
|
||||
sb.WriteString(ansiDirectoryHeader)
|
||||
sb.WriteString(vanityDirectory)
|
||||
sb.WriteString("/" + back.AnsiReset + "\n")
|
||||
return indent
|
||||
}
|
||||
|
||||
for i, directory := range dirList {
|
||||
charCounter, colorAlternator = 0, 1
|
||||
skippedDirList[i] = i != 0
|
||||
|
||||
if entries := entriesByDir[directory]; len(entries) > 0 {
|
||||
indent := printDirHeader(i)
|
||||
for _, vanityPath := range entries {
|
||||
lastSlash := strings.LastIndex(vanityPath, "/") + 1
|
||||
colorAlternator = printFileEntry(&sb, vanityPath, lastSlash, &charCounter, indent, colorAlternator, entryMap[vanityPath].AgeTimestamp)
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
if hasChildDir[directory] {
|
||||
continue
|
||||
}
|
||||
|
||||
if dirListLength > 1 {
|
||||
indent := printDirHeader(i)
|
||||
writeIndent(&sb, indent)
|
||||
sb.WriteString(back.AnsiWarning + "-empty directory-" + back.AnsiReset)
|
||||
continue
|
||||
}
|
||||
|
||||
sb.WriteString("\n\nNothing's here! For help creating your first entry, run \"mutn help\".")
|
||||
}
|
||||
|
||||
sb.WriteString("\n\n")
|
||||
fmt.Print(sb.String())
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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, "/"))
|
||||
}
|
||||
+47
-40
@@ -2,72 +2,79 @@ package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"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"
|
||||
)
|
||||
|
||||
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) {
|
||||
fmt.Println()
|
||||
// EntryReader prints the decrypted contents of a libmutton entry in a human-readable format.
|
||||
func EntryReader(vanityPath string, decSlice []string, hideSecrets bool) {
|
||||
fmt.Print("\n" + back.AnsiBold + vanityPath + back.AnsiReset + "\n\n")
|
||||
|
||||
for i := range decryptedEntry {
|
||||
switch i {
|
||||
fieldLoop:
|
||||
for field := range decSlice {
|
||||
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 decSlice[0] != "" {
|
||||
if !hideSecrets {
|
||||
fmt.Print(ansiDirectoryHeader + "Password:" + back.AnsiReset + "\n" + ansiShownPassword + decSlice[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" + back.AnsiWarning + "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")
|
||||
if decSlice[1] != "" {
|
||||
fmt.Print(ansiDirectoryHeader + "Username:" + back.AnsiReset + "\n" + decSlice[1] + "\n\n")
|
||||
}
|
||||
case 2:
|
||||
// if the third field (url) is not empty, print it
|
||||
if decryptedEntry[2] != "" {
|
||||
fmt.Print(ansiDirectoryHeader + "URL:" + backend.AnsiReset + "\n" + decryptedEntry[2] + "\n\n")
|
||||
// if the third field (TOTP secret) is not empty, print it
|
||||
if decSlice[2] != "" {
|
||||
if !hideSecrets {
|
||||
fmt.Print(ansiDirectoryHeader + "TOTP Secret:" + back.AnsiReset + "\n" + ansiShownPassword + decSlice[2] + back.AnsiReset + "\n\n")
|
||||
} else {
|
||||
fmt.Print(ansiDirectoryHeader + "TOTP Secret:" + back.AnsiReset + "\n" + back.AnsiWarning + "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 decSlice[3] != "" {
|
||||
fmt.Print(ansiDirectoryHeader + "URL:" + back.AnsiReset + "\n" + decSlice[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
|
||||
// render notes as Markdown
|
||||
r, _ := glamour.NewTermRenderer(glamour.WithStylesFromJSONBytes(glamourStyle()), glamour.WithWordWrap(width))
|
||||
markdownNotesString, _ := r.Render(strings.Join(decSlice[4:], "\n"))
|
||||
_ = r.Close()
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
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(realPath string, hideSecrets bool) {
|
||||
_, err := back.TargetIsFile(realPath, 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)
|
||||
}
|
||||
// do not exit, as this is the job of EntryReader
|
||||
decSlice, err := crypt.DecryptFileToSlice(realPath, nil)
|
||||
if err != nil {
|
||||
other.PrintError("Failed to decrypt entry: "+err.Error(), global.ErrorDecryption)
|
||||
}
|
||||
EntryReader(global.GetVanityPath(realPath), decSlice, hideSecrets)
|
||||
}
|
||||
|
||||
@@ -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})
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
//go:build !windows
|
||||
|
||||
package cli
|
||||
|
||||
const FallbackEditor = "vi" // vi is pre-installed on most UNIX-like systems
|
||||
@@ -0,0 +1,5 @@
|
||||
//go:build windows
|
||||
|
||||
package cli
|
||||
|
||||
const FallbackEditor = "edit" // "edit" is the Microsoft-developed CLI text editor
|
||||
+66
-55
@@ -4,46 +4,49 @@ 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-2026 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
|
||||
menu|-m Open interactive menu to copy any combination of fields
|
||||
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 +55,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 + ` Using "add", "edit", or "copy" without specifying an option (field) will default to "password"
|
||||
` + back.AnsiBold + "Tip 3:" + back.AnsiReset + ` Various changes can be made to the configuration and stored entries from the "mutn tweak" menu
|
||||
` + back.AnsiBold + "Tip 4:" + back.AnsiReset + " Type \"mutn\" (no arguments) to view a list of saved entries w/colored markers indicating the ages of stored passwords\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 +74,46 @@ 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
|
||||
note|-n Copy the first note line in an entry to your clipboard` + "\n\n")
|
||||
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
|
||||
menu|-m Open interactive menu to copy any combination of fields` + "\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 +137,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 \"Hardy Herd\" 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-2026: 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")
|
||||
|
||||
+27
-72
@@ -1,86 +1,41 @@
|
||||
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/go-boilerplate/security"
|
||||
"github.com/rwinkhart/libmutton/core"
|
||||
)
|
||||
|
||||
// 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() []byte {
|
||||
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 security.BytesGen(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
|
||||
// writeEntryCLI writes decSlice to realPath and previews it (errors if no data is supplied).
|
||||
func writeEntryCLI(realPath string, decSlice []string, passwordIsNew bool, oldPassword []byte) {
|
||||
if core.EntryIsNotEmpty(decSlice) {
|
||||
if err := core.WriteEntry(realPath, decSlice, passwordIsNew, nil); err != nil {
|
||||
other.PrintError("Failed to write entry: "+err.Error(), back.ErrorWrite)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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) {
|
||||
// write the entry to the target location
|
||||
backend.WriteEntry(targetLocation, unencryptedEntry)
|
||||
// preview the entry
|
||||
fmt.Println(ansiBold + "\nEntry Preview:" + backend.AnsiReset)
|
||||
EntryReader(unencryptedEntry, hidePassword, true)
|
||||
CopyMenu("", decSlice, oldPassword)
|
||||
} else {
|
||||
fmt.Println(backend.AnsiError + "No data supplied for entry" + backend.AnsiReset)
|
||||
os.Exit(1)
|
||||
other.PrintError("No data supplied for entry", back.ErrorTargetNotFound)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
@@ -0,0 +1,8 @@
|
||||
## 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)
|
||||
@@ -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.
|
||||
@@ -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/BSD: xclip (X11) or wl-clipboard (Wayland) for clipboard support
|
||||
@@ -0,0 +1,28 @@
|
||||
## 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)
|
||||
5. Optionally, [import passwords](https://github.com/rwinkhart/libmutton/blob/main/wiki/migration.md) from another password manager. After doing this, you may desire to use the "Age all entries" option from the `mutn tweak` menu to add initial age tracking data to the imported passwords
|
||||
|
||||
### 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.
|
||||
Reference in New Issue
Block a user