mirror of
https://github.com/rwinkhart/MUTN.git
synced 2026-08-28 12:56:30 -04:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
95c743a3f8 | ||
|
|
fcfc1a5f96 | ||
|
|
28bd098c2a | ||
|
|
b49d8995d6 | ||
|
|
14140f6574 | ||
|
|
4ef9cb0c80 | ||
|
|
22117579db | ||
|
|
a04b1b2eb9 | ||
|
|
b7a470116a | ||
|
|
2904c76ffb | ||
|
|
596129d37d | ||
|
|
fe9d91d299 | ||
|
|
eb73fbc8e1 | ||
|
|
410f826b8c | ||
|
|
c7ed0eec5c | ||
|
|
3a1ca0b68d | ||
|
|
35192fa568 | ||
|
|
83aa4ee497 | ||
|
|
3b6db54dd7 | ||
|
|
5b196faf03 | ||
|
|
530fde8f11 | ||
|
|
85fddc0382 | ||
|
|
fb0626c5a0 | ||
|
|
df5f10d188 | ||
|
|
1bf72332df | ||
|
|
424d587e65 | ||
|
|
e81bfa935a | ||
|
|
4917149299 | ||
|
|
2ae4fe19e8 | ||
|
|
0fc0a2cfc0 | ||
|
|
f0cdd217d9 | ||
|
|
9a6d6fe98d | ||
|
|
c6310582c5 | ||
|
|
cbf625b2d3 | ||
|
|
32adbe0b66 | ||
|
|
a0c1b09d32 | ||
|
|
d3ba55987b | ||
|
|
bfec617f46 | ||
|
|
c4e474304a | ||
|
|
70eba7cec3 | ||
|
|
97ba7da6e4 | ||
|
|
abb2b65c69 | ||
|
|
897301343e | ||
|
|
be1f602770 | ||
|
|
42bed109d6 | ||
|
|
e056dcf4ba | ||
|
|
98308782a9 | ||
|
|
10d5dea6c3 | ||
|
|
b3f4b2b000 | ||
|
|
7e935c2875 | ||
|
|
6075f6defd | ||
|
|
ed5f6a0054 | ||
|
|
7072831f20 | ||
|
|
637002bc42 | ||
|
|
2ab833b91f | ||
|
|
ff6f5da824 | ||
|
|
cb6cde9e8e | ||
|
|
32557391db | ||
|
|
7ad081b78a | ||
|
|
1fa014abc0 | ||
|
|
ccea9c73a7 | ||
|
|
356d1eab4e | ||
|
|
a9cf524cfa | ||
|
|
43d87a5b46 | ||
|
|
f25c68cea3 | ||
|
|
4844620ed1 | ||
|
|
dbcd71b5ca | ||
|
|
ce53ee39c3 | ||
|
|
02adfef817 | ||
|
|
f3d06429ca | ||
|
|
3bac84dc0c | ||
|
|
4f9c57d6da | ||
|
|
97a9c0a921 | ||
|
|
71666578f6 | ||
|
|
4b7bfdc013 | ||
|
|
d6ee612c68 | ||
|
|
18a8668acf | ||
|
|
1127e96863 | ||
|
|
50f514ece4 | ||
|
|
b4f0a4e896 | ||
|
|
b03d751618 | ||
|
|
6cf01e0d3c | ||
|
|
3fcd20b1ca | ||
|
|
1f44d0b5f3 | ||
|
|
ea34f644f3 | ||
|
|
ae7bebc461 | ||
|
|
f3c0836eba | ||
|
|
54cbe098d7 | ||
|
|
54fea00b9d | ||
|
|
833eaa9926 | ||
|
|
67bf6e42b9 | ||
|
|
637e718199 | ||
|
|
71f3a8d71f | ||
|
|
70e9ce34fc | ||
|
|
c7fee92ca4 | ||
|
|
dc4ecaecd8 | ||
|
|
912520ff1e | ||
|
|
17d0e8bfcd | ||
|
|
524b30cf1f | ||
|
|
9242b6caa0 | ||
|
|
df33a5b149 | ||
|
|
513ed74833 | ||
|
|
a0ac99ff3c | ||
|
|
d55ad76098 | ||
|
|
2a175d0c69 | ||
|
|
c7635a1ef0 | ||
|
|
774b761d25 | ||
|
|
193d577477 | ||
|
|
578aa60b76 | ||
|
|
8571faee94 | ||
|
|
1ca55b8ac6 | ||
|
|
77726e9af3 | ||
|
|
309ef84803 | ||
|
|
0faf2dc732 | ||
|
|
56e8dc613a | ||
|
|
278c2c1fe4 | ||
|
|
6b120930d0 | ||
|
|
170a3e807f | ||
|
|
8a7d41df04 | ||
|
|
6587bda17b | ||
|
|
3a03fae9ee | ||
|
|
5e83178046 | ||
|
|
f86c2d8153 | ||
|
|
3acaa607e4 | ||
|
|
d4360c06ba | ||
|
|
2cf786b2d7 | ||
|
|
b784fd8bd7 | ||
|
|
7d272f77ca | ||
|
|
424aa61c46 | ||
|
|
bff179e881 | ||
|
|
65b622d465 | ||
|
|
b7bfdbf62f | ||
|
|
1e2f1dea7e | ||
|
|
5d83e912ac | ||
|
|
b11e8bbcf2 | ||
|
|
d07a4cc398 | ||
|
|
67420b0713 | ||
|
|
ff10d843ad | ||
|
|
0392cf6fea | ||
|
|
804fc29087 | ||
|
|
d29da29018 | ||
|
|
7c5c2105f9 | ||
|
|
b4919f0e82 | ||
|
|
0ee803dc78 | ||
|
|
ed9e9a3af8 | ||
|
|
2668b2951c | ||
|
|
4e131d2870 | ||
|
|
498ecd9a50 | ||
|
|
8f98f1b61c | ||
|
|
ad7524f544 | ||
|
|
0687ce0954 | ||
|
|
ca14abbae9 | ||
|
|
3171d1c1cd | ||
|
|
c1a415e5b0 | ||
|
|
56eaec02c6 | ||
|
|
e4de8f930b | ||
|
|
26a5898e15 | ||
|
|
dd0d1ffe55 | ||
|
|
ff9092bc9f | ||
|
|
279384ee4a | ||
|
|
7e5823c35e | ||
|
|
80e4148b9b | ||
|
|
02fb625230 | ||
|
|
fb984f4514 | ||
|
|
148212b276 | ||
|
|
5cee48d412 | ||
|
|
c7735d32be | ||
|
|
2252be1463 | ||
|
|
edf1a4cd9a | ||
|
|
82b4fbee64 | ||
|
|
404f24d361 | ||
|
|
f83bdb9bdb | ||
|
|
f35d1b3741 | ||
|
|
a0ca7803f1 | ||
|
|
431082f711 | ||
|
|
652ef48dd5 | ||
|
|
b01e5bded4 | ||
|
|
31bc17cb0d | ||
|
|
5a12eaf4cf | ||
|
|
7d17af9b61 | ||
|
|
c6ee5fff06 | ||
|
|
aa1098d472 | ||
|
|
148ee53073 | ||
|
|
408cff1a79 | ||
|
|
22758460ab | ||
|
|
3a90bef48a | ||
|
|
300516c3cd | ||
|
|
9f1955eb82 | ||
|
|
609ef9bd8c | ||
|
|
1e1a26b098 | ||
|
|
22fcad2fed | ||
|
|
b1f3a9eeec | ||
|
|
d6443c1966 | ||
|
|
56ffe7e36f | ||
|
|
14b3d7bd45 | ||
|
|
11644b37ff | ||
|
|
1580227007 | ||
|
|
85067fef40 | ||
|
|
8704ba6972 | ||
|
|
dfe917a4ff | ||
|
|
24b899a83a | ||
|
|
6fecf5a686 | ||
|
|
0e6210f1af | ||
|
|
207a4762b6 | ||
|
|
0f65cd31cb | ||
|
|
988724bac6 | ||
|
|
9802b7498b | ||
|
|
00e0a70ee6 | ||
|
|
7a17df4aa3 | ||
|
|
3d621f5e38 | ||
|
|
4bd44e7b44 | ||
|
|
b17a3ae372 | ||
|
|
51313eb307 | ||
|
|
0afcdbb29b | ||
|
|
cefb91f1f6 | ||
|
|
fc2a6ab22f | ||
|
|
7d5bd76489 | ||
|
|
adcc05f3f4 | ||
|
|
ba89fbeab6 | ||
|
|
fa6d5bc78a | ||
|
|
86b152875e | ||
|
|
e61beb3f94 | ||
|
|
b26a29dd3d | ||
|
|
9f5cf7fd1e | ||
|
|
2012e332f3 | ||
|
|
00ec6417af | ||
|
|
e54fef3d74 | ||
|
|
fc48c1dd21 | ||
|
|
2d55d10d17 | ||
|
|
c2618088c6 | ||
|
|
08689a4013 | ||
|
|
cb5dc659f2 | ||
|
|
b4848b6db6 | ||
|
|
c279711120 | ||
|
|
4092b4f737 | ||
|
|
e31878bd7d | ||
|
|
6b4891a59f | ||
|
|
29c9fb812c | ||
|
|
274aa4fcce | ||
|
|
ed56b26cad | ||
|
|
d3d9b2f764 | ||
|
|
5affff5def | ||
|
|
9e7b6aa61d | ||
|
|
cd78442257 | ||
|
|
95eff67340 | ||
|
|
88b2bb51a3 | ||
|
|
6e4453c773 | ||
|
|
af6600de80 | ||
|
|
c20c8bc349 |
+3
-5
@@ -1,8 +1,6 @@
|
||||
/mutn
|
||||
/mutn.exe
|
||||
/MUTN
|
||||
/MUTN.exe
|
||||
/main
|
||||
/main.exe
|
||||
/libmuttonserver
|
||||
/libmuttonserver.exe
|
||||
/version.go
|
||||
1output
|
||||
output
|
||||
|
||||
@@ -1,667 +1,21 @@
|
||||
MUTN
|
||||
Copyright (c) 2024-2025 Randall Winkhart
|
||||
|
||||
MUTN is licensed under the AGPL 3.0 due to its usage of
|
||||
a custom fork of https://github.com/jessp01/gohighlight.
|
||||
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
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.
|
||||
|
||||
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/>.
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 Randall Winkhart
|
||||
|
||||
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:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
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.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
---
|
||||
Pronounced as: "mutton", "muh·tn"
|
||||
|
||||
MUTN is a simple, self-hosted, SSH-synchronized password and note manager based on [libmutton](https://github.com/rwinkhart/libmutton). It is the successor to [sshyp](https://github.com/rwinkhart/sshyp).
|
||||
MUTN is a simple, self-hosted, SSH-synchronized password and note manager based on libmutton. It is the successor to [sshyp](https://github.com/rwinkhart/sshyp).
|
||||
|
||||
> [!WARNING]
|
||||
>It is your responsibility to assess the security and stability of MUTN and to ensure it meets your needs before using it.
|
||||
@@ -16,28 +16,31 @@ MUTN is a simple, self-hosted, SSH-synchronized password and note manager based
|
||||
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.
|
||||
|
||||
# Installation/Building
|
||||
See the [installation guide](https://github.com/rwinkhart/MUTN/blob/main/wiki/install.md).
|
||||
|
||||
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).
|
||||
See the [installation guide](https://github.com/rwinkhart/MUTN/blob/main/wiki/MUTN/install.md).
|
||||
|
||||
# Roadmap
|
||||
### Release v0.4.0
|
||||
- [ ] Switch to fully compliant Markdown (do not preserve new lines)
|
||||
- [ ] Switch to alternative Markdown renderer (minimark or BEAN)
|
||||
### Release v0.5.0
|
||||
- [ ] libmutton v0.5.0
|
||||
- [ ] Implement "netpin" (quick-unlock)
|
||||
- [ ] Password aging support
|
||||
#### Release v0.2.1
|
||||
- [ ] Only run getSSHClient once to prevent being asked for keyfile password multiple times
|
||||
- [ ] After this, handle all errors in client.go
|
||||
- [ ] Ensure all config files and entry files are created with 0600 permissions
|
||||
- [ ] Add fail-specific error codes
|
||||
- [ ] Split into separate repos
|
||||
1. libmutton
|
||||
2. libmutton-server
|
||||
3. MUTN
|
||||
#### Release v0.3.0
|
||||
- [ ] Replace Glamour with a more minimal Markdown renderer (likely custom)
|
||||
#### Release v0.4.0
|
||||
- [ ] Swap to native (cascade) encryption (custom)
|
||||
- [ ] Implement "netpin" (quick-unlock) with new encryption
|
||||
#### Release v0.5.0
|
||||
- [ ] Password aging support
|
||||
- [ ] Append UNIX timestamp to entry names
|
||||
- [ ] Add yellow/red dot indicators to entry list readout for when passwords should be changed
|
||||
### Release v1.0.0 - Distribution packages
|
||||
#### Release v0.6.0
|
||||
- [ ] Re-implement init menu
|
||||
- [ ] Implement tweak menu
|
||||
- [ ] Add refresh/re-encrypt functionality
|
||||
#### 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
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
gofmt -l -w -s ./src/cli/*.go ./src/backend/*.go ./mutn.go ./libmuttonserver.go
|
||||
git commit -am "$1"
|
||||
git push
|
||||
@@ -1,58 +1,9 @@
|
||||
$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 {
|
||||
function cliMUTNEntryCompleter {
|
||||
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
|
||||
if ($IsWindows) {
|
||||
$entryRoot = (Resolve-Path '~\AppData\Local\libmutton\entries').Path
|
||||
@@ -61,27 +12,18 @@ function cliMUTN-entryCompleter {
|
||||
}
|
||||
try {
|
||||
$trimmedPaths = If (Test-Path $entryRoot) {
|
||||
(Get-ChildItem -Path $entryRoot -Recurse -File).FullName.Substring($entryRoot.Length) -replace '\\', '/'
|
||||
(Get-ChildItem -Path $entryRoot -Recurse -File).FullName.Substring($entryRoot.Length) -replace '\\', '/' -replace ' ', [char]0x259d
|
||||
}
|
||||
} 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 {
|
||||
function cliMUTNOptionCompleter {
|
||||
param ($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters)
|
||||
|
||||
$possibleValues = @{
|
||||
@@ -104,7 +46,7 @@ function mutn {
|
||||
[CmdletBinding()]
|
||||
param (
|
||||
[Parameter(Position = 0)]
|
||||
[ArgumentCompleter({ cliMUTN-entryCompleter @args })]
|
||||
[ArgumentCompleter({ cliMUTNEntryCompleter @args })]
|
||||
[string]$entry,
|
||||
|
||||
[Parameter(Position = 1)]
|
||||
@@ -112,18 +54,13 @@ function mutn {
|
||||
[string]$argument,
|
||||
|
||||
[Parameter(Position = 2, ValueFromRemainingArguments=$true)]
|
||||
[ArgumentCompleter({ cliMUTN-optionCompleter @args })]
|
||||
[ArgumentCompleter({ cliMUTNOptionCompleter @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()
|
||||
Invoke-Expression -Command ('mutn.exe ' + ($entry -replace ' ', '` ' -replace [char]0x259d, '` '), $argument, $option).Trim()
|
||||
} else {
|
||||
Invoke-Expression -Command ($global:MUTNExecutablePath + ' ' + $escapedEntry, $argument, $option).Trim()
|
||||
Invoke-Expression -Command ($MUTNExecutablePath + ' ' + ($entry -replace ' ', '` ' -replace [char]0x259d, '` '), $argument, $option).Trim()
|
||||
}
|
||||
}
|
||||
|
||||
cliMUTN-loadSpaceIndices
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.TH MUTN 1 "23 November 2025" "v0.3.1" "MUTN man page"
|
||||
.TH MUTN 1 "06 August 2024" "v0.2.0" "MUTN man page"
|
||||
|
||||
.SH NAME
|
||||
\fBmutn\fR - Simple, self-hosted, SSH-synchronized password and note management based on libmutton. It is the successor to sshyp.
|
||||
@@ -47,7 +47,6 @@ Manually synchronizing entries with the server:
|
||||
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
|
||||
@@ -145,22 +144,8 @@ Once this has been done, you may proceed with the client setup:
|
||||
|
||||
...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 EXIT CODES
|
||||
TBD
|
||||
|
||||
.SH AUTHOR
|
||||
Randall Winkhart (https://github.com/rwinkhart)
|
||||
|
||||
@@ -1,111 +1,4 @@
|
||||
**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
|
||||
|
||||
---
|
||||
**WARNING: AS MUTN HAS NOT YET REACHED v1.0.0, [BREAKING CHANGES](https://github.com/rwinkhart/MUTN/blob/main/wiki/libmutton/breaking.md) IN FUTURE UPDATES ARE PLANNED**
|
||||
|
||||
**MUTN v0.2.0**
|
||||
August 06, 2024
|
||||
@@ -162,11 +55,11 @@ Compared to v0.1.0, this version adds fully native SSH synchronization with self
|
||||
- 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).
|
||||
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. Please see the [install guide](https://github.com/rwinkhart/MUTN/blob/main/wiki/MUTN/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).
|
||||
It is highly recommended to also install the relevant [shell completions](https://github.com/rwinkhart/MUTN/blob/main/wiki/MUTN/completions.md).
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
**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
|
||||
@@ -1,19 +1,23 @@
|
||||
module github.com/rwinkhart/MUTN
|
||||
|
||||
go 1.25.4
|
||||
go 1.22.6
|
||||
|
||||
require (
|
||||
github.com/charmbracelet/glamour v0.7.0
|
||||
github.com/rwinkhart/go-boilerplate v0.1.1-0.20251110055016-10ee4f91fcb6
|
||||
github.com/rwinkhart/libmutton v0.4.4
|
||||
golang.org/x/term v0.37.0
|
||||
github.com/fortis/go-steam-totp v0.0.0-20171114202746-18e928674727
|
||||
github.com/pkg/sftp v1.13.6
|
||||
github.com/pquerna/otp v1.4.1-0.20231130234153-3357de7c0481
|
||||
golang.org/x/crypto v0.26.0
|
||||
golang.org/x/term v0.23.0
|
||||
gopkg.in/ini.v1 v1.67.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/Microsoft/go-winio v0.6.2 // indirect
|
||||
github.com/alecthomas/chroma/v2 v2.14.0 // indirect
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
||||
github.com/aymerick/douceur v0.2.0 // indirect
|
||||
github.com/boombuler/barcode v1.1.0 // indirect
|
||||
github.com/boombuler/barcode v1.0.2 // indirect
|
||||
github.com/dlclark/regexp2 v1.11.4 // indirect
|
||||
github.com/gorilla/css v1.0.1 // indirect
|
||||
github.com/kr/fs v0.1.0 // indirect
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
||||
@@ -21,29 +25,12 @@ require (
|
||||
github.com/mattn/go-runewidth v0.0.16 // indirect
|
||||
github.com/microcosm-cc/bluemonday v1.0.27 // indirect
|
||||
github.com/muesli/reflow v0.3.0 // indirect
|
||||
github.com/muesli/termenv v0.16.0 // indirect
|
||||
github.com/muesli/termenv v0.15.2 // 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/rwinkhart/go-highlite v0.1.1 // indirect
|
||||
github.com/rwinkhart/peercred-mini v0.1.2 // indirect
|
||||
github.com/rwinkhart/rcw v0.2.4 // indirect
|
||||
github.com/yuin/goldmark v1.7.13 // indirect
|
||||
github.com/yuin/goldmark-emoji v1.0.6 // indirect
|
||||
golang.design/x/clipboard v0.7.1 // indirect
|
||||
golang.org/x/crypto v0.45.0 // indirect
|
||||
golang.org/x/exp/shiny v0.0.0-20251017212417-90e834f514db // indirect
|
||||
golang.org/x/image v0.32.0 // indirect
|
||||
golang.org/x/mobile v0.0.0-20251021151156-188f512ec823 // indirect
|
||||
golang.org/x/net v0.47.0 // indirect
|
||||
golang.org/x/sys v0.38.0 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
github.com/stretchr/testify v1.8.4 // indirect
|
||||
github.com/yuin/goldmark v1.7.4 // indirect
|
||||
github.com/yuin/goldmark-emoji v1.0.3 // indirect
|
||||
golang.org/x/net v0.28.0 // indirect
|
||||
golang.org/x/sys v0.23.0 // indirect
|
||||
)
|
||||
|
||||
replace golang.org/x/sys => github.com/rwinkhart/sys v0.38.0
|
||||
|
||||
replace github.com/Microsoft/go-winio => github.com/rwinkhart/go-winio v0.1.0
|
||||
|
||||
replace github.com/charmbracelet/glamour => github.com/rwinkhart/glamour-temp-MUTN v0.7.2
|
||||
|
||||
@@ -1,15 +1,29 @@
|
||||
github.com/alecthomas/assert/v2 v2.7.0 h1:QtqSACNS3tF7oasA8CU6A6sXZSBDqnm7RfpLl9bZqbE=
|
||||
github.com/alecthomas/assert/v2 v2.7.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
|
||||
github.com/alecthomas/chroma/v2 v2.14.0 h1:R3+wzpnUArGcQz7fCETQBzO5n9IMNi13iIs46aU4V9E=
|
||||
github.com/alecthomas/chroma/v2 v2.14.0/go.mod h1:QolEbTfmUHIMVpBqxeDnNBj2uoeI4EbYP4i6n68SG4I=
|
||||
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.1.0 h1:ChaYjBR63fr4LFyGn8E8nt7dBSt3MiU3zMOZqFvVkHo=
|
||||
github.com/boombuler/barcode v1.1.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
|
||||
github.com/boombuler/barcode v1.0.2 h1:79yrbttoZrLGkL/oOI8hBrUKucwOL0oOjUgEguGMcJ4=
|
||||
github.com/boombuler/barcode v1.0.2/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/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.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo=
|
||||
github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
|
||||
github.com/fortis/go-steam-totp v0.0.0-20171114202746-18e928674727 h1:1RkPJqfzrncAuh9xgoslr9OplZskm+VRA9lkucHPQZ4=
|
||||
github.com/fortis/go-steam-totp v0.0.0-20171114202746-18e928674727/go.mod h1:wRAWHbTlpt0C4kwnKoa42L2Phrv6uIq+c50P2uKpb7I=
|
||||
github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8=
|
||||
github.com/gorilla/css v1.0.1/go.mod h1:BvnYkspnSzMmwRK+b8/xgNPLiIuNZr6vbZBTPQ2A3b0=
|
||||
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
|
||||
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
|
||||
github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8=
|
||||
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
|
||||
@@ -24,63 +38,72 @@ github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwX
|
||||
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.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc=
|
||||
github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk=
|
||||
github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo=
|
||||
github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8=
|
||||
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/pkg/sftp v1.13.6 h1:JFZT4XbOU7l77xGSpOdW+pwIMqP044IyjXX6FGyEKFo=
|
||||
github.com/pkg/sftp v1.13.6/go.mod h1:tz1ryNURKu77RL+GuCzmoJYxQczL3wLNNpPWagdg4Qk=
|
||||
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.5.0 h1:NMMR+WrmaqXU4EzdGJEE1aUUI0AMRzsp96fFFWNPwxs=
|
||||
github.com/pquerna/otp v1.5.0/go.mod h1:dkJfzwRKNiegxyNb54X/3fLwhCynbMspSyWKnvi1AEg=
|
||||
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/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
||||
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||
github.com/rwinkhart/glamour-temp-MUTN v0.7.2 h1:/CBexwkGdL8HuZjO7M0zzjGHaHCr9/r4XTOtUJa+pPE=
|
||||
github.com/rwinkhart/glamour-temp-MUTN v0.7.2/go.mod h1:DN/eJaNQ5h7dgxzfmWFo7By+b82CKEUdNaY6z4R4v3c=
|
||||
github.com/rwinkhart/go-boilerplate v0.1.1-0.20251110055016-10ee4f91fcb6 h1:tGGtw5Wr4laDrU7Ooe95g4E+O6c+oY18atamcMPaMY8=
|
||||
github.com/rwinkhart/go-boilerplate v0.1.1-0.20251110055016-10ee4f91fcb6/go.mod h1:cnzIF45I0FCOvE4YIB+26pLCUx2kWyY2llKYZruNaRY=
|
||||
github.com/rwinkhart/go-highlite v0.1.1 h1:9TxbRhYVfD/3YaEgNk1BtEiZ0t8/5mxDUZqNMXHodT0=
|
||||
github.com/rwinkhart/go-highlite v0.1.1/go.mod h1:mWLMtCWcyV0BG4NeyPyAUGMjPvI0ds6vXmUq89QwBFA=
|
||||
github.com/rwinkhart/go-winio v0.1.0 h1:b72agLW+dETGmhR3VbcbwnStfgKfc5AfgJOXBJDkaHg=
|
||||
github.com/rwinkhart/go-winio v0.1.0/go.mod h1:ZWa7ssZJT30CCDGJ7fk/2SBTq9BIQrrVjrcss0UW2s0=
|
||||
github.com/rwinkhart/libmutton v0.4.4 h1:tUGU0JLf0aQ0YQy+1RSzOy5yujfpJ4b3iXuxAhUjhzE=
|
||||
github.com/rwinkhart/libmutton v0.4.4/go.mod h1:2GV6ILW7dawIGvBoOcV0K3Uw7llc0ZWFRYcV+kM9K8g=
|
||||
github.com/rwinkhart/peercred-mini v0.1.2 h1:4cGWDbv0whvLeVvbUdx84V/9p+2fS+DEXgrA1KxlRFo=
|
||||
github.com/rwinkhart/peercred-mini v0.1.2/go.mod h1:LLHG7YshHEpbpJJP+Il9nx2dnGj5O3VGE32rWmflj0c=
|
||||
github.com/rwinkhart/rcw v0.2.4 h1:FrRSsl+ui1WLmDwqjLSROtFPKqSeGLEfF2SPENt4qP0=
|
||||
github.com/rwinkhart/rcw v0.2.4/go.mod h1:nhW4RAHvEjW2QcOlqEdWqRQOFJLjoOGSPkSRZlMjU3s=
|
||||
github.com/rwinkhart/sys v0.38.0 h1:V1PGKcUutWtD3+VdHvyvfGtPy7PDXzKHNM1IzVq1ysY=
|
||||
github.com/rwinkhart/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/yuin/goldmark v1.7.13 h1:GPddIs617DnBLFFVJFgpo1aBfe/4xcvMc3SB5t/D0pA=
|
||||
github.com/yuin/goldmark v1.7.13/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg=
|
||||
github.com/yuin/goldmark-emoji v1.0.6 h1:QWfF2FYaXwL74tfGOW5izeiZepUDroDJfWubQI9HTHs=
|
||||
github.com/yuin/goldmark-emoji v1.0.6/go.mod h1:ukxJDKFpdFb5x0a5HqbdlcKtebh086iJpI31LTKmWuA=
|
||||
golang.design/x/clipboard v0.7.1 h1:OEG3CmcYRBNnRwpDp7+uWLiZi3hrMRJpE9JkkkYtz2c=
|
||||
golang.design/x/clipboard v0.7.1/go.mod h1:i5SiIqj0wLFw9P/1D7vfILFK0KHMk7ydE72HRrUIgkg=
|
||||
golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q=
|
||||
golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4=
|
||||
golang.org/x/exp/shiny v0.0.0-20251017212417-90e834f514db h1:NmsmaSkEAq6A8r0Q78WxD0IygJNCs6J3uYDgNuPkXYM=
|
||||
golang.org/x/exp/shiny v0.0.0-20251017212417-90e834f514db/go.mod h1:QMAAUorQ8fzCK0C6mr4X4XV9BEp7Al6+jlejJvfYKw4=
|
||||
golang.org/x/image v0.32.0 h1:6lZQWq75h7L5IWNk0r+SCpUJ6tUVd3v4ZHnbRKLkUDQ=
|
||||
golang.org/x/image v0.32.0/go.mod h1:/R37rrQmKXtO6tYXAjtDLwQgFLHmhW+V6ayXlxzP2Pc=
|
||||
golang.org/x/mobile v0.0.0-20251021151156-188f512ec823 h1:M0DtBf/UvJoTH+tk6tgHT2NVxNEJCYhVu1g/xeD+GEk=
|
||||
golang.org/x/mobile v0.0.0-20251021151156-188f512ec823/go.mod h1:3QSlP0AtP6HPTLbsxfgfefGN76jpIB9yBsMqB8UY37I=
|
||||
golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY=
|
||||
golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU=
|
||||
golang.org/x/term v0.37.0 h1:8EGAD0qCmHYZg6J17DvsMy9/wJ7/D/4pV/wfnld5lTU=
|
||||
golang.org/x/term v0.37.0/go.mod h1:5pB4lxRNYYVZuTLmy8oR2BH8dflOR+IbTYFD8fi3254=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
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.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
|
||||
github.com/yuin/goldmark v1.7.4 h1:BDXOHExt+A7gwPCJgPIIq7ENvceR7we7rOS9TNoLZeg=
|
||||
github.com/yuin/goldmark v1.7.4/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
|
||||
github.com/yuin/goldmark-emoji v1.0.3 h1:aLRkLHOuBR2czCY4R8olwMjID+tENfhyFDMCRhbIQY4=
|
||||
github.com/yuin/goldmark-emoji v1.0.3/go.mod h1:tTkZEbwu5wkPmgTcitqddVxY9osFZiavD+r4AzQrh1U=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
|
||||
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
|
||||
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
|
||||
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
|
||||
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM=
|
||||
golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU=
|
||||
golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
|
||||
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/rwinkhart/MUTN/src/backend"
|
||||
"github.com/rwinkhart/MUTN/src/cli"
|
||||
"github.com/rwinkhart/MUTN/src/sync"
|
||||
)
|
||||
|
||||
func main() {
|
||||
args := os.Args
|
||||
if len(args) < 2 {
|
||||
helpServer()
|
||||
}
|
||||
|
||||
// check if stdin was provided
|
||||
stdinInfo, _ := os.Stdin.Stat()
|
||||
stdinPresent := stdinInfo.Mode()&os.ModeNamedPipe != 0
|
||||
|
||||
var stdin []string
|
||||
if stdinPresent {
|
||||
// read stdin, appending each line to the stdin slice
|
||||
scanner := bufio.NewScanner(os.Stdin)
|
||||
for scanner.Scan() {
|
||||
stdin = append(stdin, scanner.Text())
|
||||
}
|
||||
}
|
||||
|
||||
switch args[1] {
|
||||
case "fetch":
|
||||
// print all information needed for syncing to stdout for interpretation by the client
|
||||
// stdin[0] is expected to be the device ID
|
||||
sync.GetRemoteDataFromServer(stdin[0])
|
||||
case "rename":
|
||||
// move an entry to a new location before using fallthrough to add its previous iteration to the deletions directory
|
||||
// stdin[0] is evaluated after fallthrough
|
||||
// stdin[1] is expected to be the OLD incomplete target location with FSPath representing path separators - always pass in UNIX format
|
||||
// stdin[2] is expected to be the NEW incomplete target location with FSPath representing path separators - always pass in UNIX format
|
||||
sync.RenameLocal(strings.ReplaceAll(stdin[1], sync.FSPath, "/"), strings.ReplaceAll(stdin[2], sync.FSPath, "/"), true)
|
||||
fallthrough // fallthrough to add the old entry to the deletions directory
|
||||
case "shear":
|
||||
// shear an entry from the server and add it to the deletions directory
|
||||
// stdin[0] is expected to be the device ID
|
||||
// stdin[1] is expected to be the incomplete target location with FSPath representing path separators - always pass in UNIX format
|
||||
sync.ShearLocal(strings.ReplaceAll(stdin[1], sync.FSPath, "/"), stdin[0])
|
||||
case "addfolder":
|
||||
// add a new folder to the server
|
||||
// stdin[0] is expected to be the incomplete target location with FSPath representing path separators - always pass in UNIX format
|
||||
sync.AddFolderLocal(strings.ReplaceAll(stdin[0], sync.FSPath, "/"))
|
||||
case "register":
|
||||
// register a new device ID
|
||||
// stdin[0] is expected to be the device ID
|
||||
_, _ = os.Create(backend.ConfigDir + backend.PathSeparator + "devices" + backend.PathSeparator + stdin[0]) // error ignored; failure unlikely to occur if init was successful; "register" is not a user-facing argument and thus the error would not be visible
|
||||
// print EntryRoot and bool indicating OS type to stdout for client to store in config
|
||||
fmt.Print(backend.EntryRoot + sync.FSSpace + strconv.FormatBool(backend.IsWindows))
|
||||
case "init":
|
||||
// create the necessary directories for libmuttonserver to function
|
||||
backend.DirInit(false)
|
||||
_ = os.MkdirAll(backend.ConfigDir+backend.PathSeparator+"deletions", 0700) // error ignored; failure would have occurred by this point in backend.DirInit
|
||||
fmt.Println("libmuttonserver directories initialized")
|
||||
case "version":
|
||||
versionServer()
|
||||
default:
|
||||
helpServer()
|
||||
}
|
||||
}
|
||||
|
||||
func helpServer() {
|
||||
fmt.Print(cli.AnsiBold + "\nlibmuttonserver | Copyright (c) 2024 Randall Winkhart\n" + backend.AnsiReset + `
|
||||
This software exists under the MIT license; you may redistribute it under certain conditions.
|
||||
This program comes with absolutely no warranty; type "libmuttonserver version" for details.
|
||||
|
||||
` + cli.AnsiBold + "Usage:" + backend.AnsiReset + ` libmuttonserver <argument>
|
||||
|
||||
` + cli.AnsiBold + "Arguments (user):" + backend.AnsiReset + `
|
||||
help Bring up this menu
|
||||
version Display version and license information
|
||||
init Create the necessary directories for libmuttonserver to function` + "\n\n")
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
func versionServer() {
|
||||
cli.MITLicense()
|
||||
fmt.Print(cli.AnsiBold + "\n\n libmuttonserver" + backend.AnsiReset + " Version " + backend.LibmuttonVersion + `
|
||||
|
||||
Copyright (c) 2024 Randall Winkhart` + "\n\n")
|
||||
}
|
||||
@@ -1,22 +1,13 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"cmp"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/rwinkhart/MUTN/src/backend"
|
||||
"github.com/rwinkhart/MUTN/src/cli"
|
||||
"github.com/rwinkhart/go-boilerplate/back"
|
||||
"github.com/rwinkhart/go-boilerplate/front"
|
||||
"github.com/rwinkhart/go-boilerplate/other"
|
||||
"github.com/rwinkhart/libmutton/cfg"
|
||||
"github.com/rwinkhart/libmutton/core"
|
||||
"github.com/rwinkhart/libmutton/crypt"
|
||||
"github.com/rwinkhart/libmutton/global"
|
||||
"github.com/rwinkhart/libmutton/syncclient"
|
||||
"github.com/rwinkhart/libmutton/synccycles"
|
||||
"github.com/rwinkhart/MUTN/src/sync"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -34,7 +25,7 @@ func main() {
|
||||
if strings.HasPrefix(args[1], "/") {
|
||||
|
||||
// store location of target entry
|
||||
targetLocation := global.TargetLocationFormat(args[1])
|
||||
targetLocation := backend.TargetLocationFormat(args[1])
|
||||
|
||||
// entry reader shortcut (if no other arguments are supplied)
|
||||
if argsCount == 2 {
|
||||
@@ -47,10 +38,7 @@ func main() {
|
||||
case "show", "-s":
|
||||
cli.EntryReaderDecrypt(targetLocation, false)
|
||||
case "copy":
|
||||
err := core.CopyArgument(targetLocation, 0)
|
||||
if err != nil {
|
||||
other.PrintError("Failed to copy password to clipboard: "+err.Error(), global.ErrorClipboard)
|
||||
}
|
||||
backend.CopyArgument(args[0], targetLocation, 0)
|
||||
case "edit":
|
||||
cli.EditEntryField(targetLocation, true, 0)
|
||||
case "gen":
|
||||
@@ -58,10 +46,7 @@ func main() {
|
||||
case "add":
|
||||
cli.AddEntry(targetLocation, true, 0)
|
||||
case "shear":
|
||||
err := syncclient.ShearRemoteFromClient(args[1]) // pass the incomplete path as the server and all clients (reading from the deletions directory) will have a different home directory
|
||||
if err != nil {
|
||||
other.PrintError("Failed to shear target: "+err.Error(), back.ErrorWrite)
|
||||
}
|
||||
sync.ShearRemoteFromClient(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.HelpMain()
|
||||
}
|
||||
@@ -97,10 +82,7 @@ func main() {
|
||||
default:
|
||||
cli.HelpCopy()
|
||||
}
|
||||
err := core.CopyArgument(targetLocation, field)
|
||||
if err != nil {
|
||||
other.PrintError("Failed to copy field to clipboard: "+err.Error(), global.ErrorClipboard)
|
||||
}
|
||||
backend.CopyArgument(args[0], targetLocation, field)
|
||||
case "edit":
|
||||
var field int // indicates which (numbered) field to edit
|
||||
switch args[3] {
|
||||
@@ -115,11 +97,8 @@ func main() {
|
||||
case "note", "-n":
|
||||
field = 4
|
||||
case "rename", "-r":
|
||||
isAccessible, _ := back.TargetIsFile(targetLocation, true) // error is ignored because dir/file status is irrelevant
|
||||
if !isAccessible {
|
||||
other.PrintError("Failed to access location ("+targetLocation+")", back.ErrorTargetNotFound)
|
||||
}
|
||||
cli.RenameCli(args[1]) // pass the incomplete path as the server and all clients (reading from the deletions directory) will have a different home directory
|
||||
backend.TargetIsFile(targetLocation, true, 0) // ensure location exists before prompting for new location
|
||||
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()
|
||||
}
|
||||
@@ -166,10 +145,7 @@ func main() {
|
||||
case "note", "-n":
|
||||
cli.AddEntry(targetLocation, true, 2)
|
||||
case "folder", "-f":
|
||||
err := syncclient.AddFolderRemoteFromClient(args[1]) // pass the incomplete path as the server will have a different home directory
|
||||
if err != nil {
|
||||
other.PrintError("Failed to add folder: "+err.Error(), back.ErrorWrite)
|
||||
}
|
||||
sync.AddFolderRemoteFromClient(args[1]) // pass the incomplete path as the server will have a different home directory
|
||||
default:
|
||||
cli.HelpAdd()
|
||||
}
|
||||
@@ -182,52 +158,14 @@ func main() {
|
||||
} else {
|
||||
switch args[1] {
|
||||
case "clipclear":
|
||||
err := core.ClipClearArgument()
|
||||
if err != nil {
|
||||
other.PrintError("Failure occurred in clipboard clearing process: "+err.Error(), global.ErrorClipboard)
|
||||
}
|
||||
case "startrcwd":
|
||||
crypt.RCWDArgument()
|
||||
backend.ClipClearArgument()
|
||||
case "sync":
|
||||
_, err := syncclient.RunJob(true)
|
||||
if err != nil {
|
||||
other.PrintError("Failed to sync entries: "+err.Error(), global.ErrorSyncProcess)
|
||||
}
|
||||
sync.RunJob(true)
|
||||
case "init":
|
||||
err := core.LibmuttonInit(front.Input,
|
||||
[][3]string{{"MUTN", "textEditor", getTextEditorInput()}},
|
||||
confirmRCWPassword("new"), false, false)
|
||||
if err != nil {
|
||||
other.PrintError("Initialization failed: "+err.Error(), 0)
|
||||
}
|
||||
cli.TempInitCli()
|
||||
case "tweak":
|
||||
choice := front.InputMenuGen("Action:", []string{"Change device ID", "Change master password/Optimize entries", "Set text editor"})
|
||||
switch choice {
|
||||
case 1:
|
||||
oldDeviceID, err := global.GetCurrentDeviceID()
|
||||
if err != nil {
|
||||
other.PrintError("Failed to get current device ID: "+err.Error(), back.ErrorRead)
|
||||
}
|
||||
_, _, err = synccycles.DeviceIDGen(oldDeviceID, "")
|
||||
if err != nil {
|
||||
other.PrintError("Failed to change device ID: "+err.Error(), global.ErrorSyncProcess)
|
||||
}
|
||||
fmt.Println("\nDevice ID changed successfully.")
|
||||
case 2:
|
||||
oldPassword := confirmRCWPassword("old")
|
||||
newPassword := confirmRCWPassword("new")
|
||||
fmt.Print("\nRe-encrypting entries. Please wait; do not force close this process.\n")
|
||||
err := core.EntryRefresh(oldPassword, newPassword, false)
|
||||
if err != nil {
|
||||
other.PrintError("Re-encryption failed: "+err.Error(), global.ErrorEncryption)
|
||||
}
|
||||
fmt.Println("\nRe-encryption complete.")
|
||||
case 3:
|
||||
err := cfg.WriteConfig([][3]string{{"MUTN", "textEditor", getTextEditorInput()}}, nil, true)
|
||||
if err != nil {
|
||||
other.PrintError("Failed to set text editor: "+err.Error(), back.ErrorWrite)
|
||||
}
|
||||
}
|
||||
fmt.Println(backend.AnsiError + "\"tweak\" is not yet implemented" + backend.AnsiReset)
|
||||
os.Exit(0)
|
||||
case "copy":
|
||||
cli.HelpCopy()
|
||||
case "edit":
|
||||
@@ -244,22 +182,3 @@ func main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// confirmRCWPassword prompts the user for a master password and confirms it
|
||||
// is typed correctly. Returns the password as a byte slice.
|
||||
func confirmRCWPassword(lowercasePrefix string) []byte {
|
||||
for {
|
||||
// get master password
|
||||
rcwPass := front.InputHidden(strings.ToUpper(string(lowercasePrefix[0])) + lowercasePrefix[1:] + " master password:")
|
||||
if !bytes.Equal(rcwPass, front.InputHidden("Confirm "+lowercasePrefix+" master password:")) || len(rcwPass) == 0 {
|
||||
fmt.Println(back.AnsiError + "Passwords do not match or password is invalid" + back.AnsiReset)
|
||||
continue
|
||||
}
|
||||
return rcwPass
|
||||
}
|
||||
}
|
||||
|
||||
// getTextEditorInput prompts the user for a text editor input, first falling back to "$EDITOR", then to a default value
|
||||
func getTextEditorInput() string {
|
||||
return cmp.Or(front.Input("Text editor (leave blank for $EDITOR, falls back to \""+cli.FallbackEditor+"\"):"), os.Getenv("EDITOR"), cli.FallbackEditor)
|
||||
}
|
||||
|
||||
+8
-16
@@ -1,9 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
# get version number from cli package
|
||||
# get version number from LibmuttonVersion
|
||||
cd ..
|
||||
printf 'package main\nimport (\n"fmt"\n"github.com/rwinkhart/MUTN/src/cli"\n)\nfunc main() {\nfmt.Println(cli.MUTNVersion)\n}' > ./version.go
|
||||
version=$(go run -ldflags="-s -w" -tags noMarkdown ./version.go)
|
||||
printf 'package main\nimport (\n"fmt"\n"github.com/rwinkhart/MUTN/src/backend"\n)\nfunc main() {\nfmt.Println(backend.LibmuttonVersion)\n}' > ./version.go
|
||||
version=$(go run ./version.go)
|
||||
rm ./version.go
|
||||
cd ./packaging
|
||||
|
||||
@@ -15,22 +15,14 @@ else
|
||||
fi
|
||||
|
||||
# ensure output directory exists
|
||||
mkdir -p ./1output
|
||||
mkdir -p ./output
|
||||
|
||||
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
|
||||
pkgbuild-git-stable)
|
||||
. ./pkgbuild-git-stable.sh
|
||||
create_pkgbuild_git_stable
|
||||
;;
|
||||
*)
|
||||
printf '\nusage: package.sh [target] <revision>\n\ntargets: release-binaries pkgbuild-git-stable-optimized apkbuild-source-stable-optimized\n\n'
|
||||
printf '\nusage: package.sh [target] <revision>\n\ntargets: pkgbuild-git-stable\n\n'
|
||||
;;
|
||||
esac
|
||||
|
||||
+11
-18
@@ -1,18 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
create_pkgbuild_git_stable_optimized() {
|
||||
printf '\nGenerating PKGBUILD...\n'
|
||||
create_pkgbuild_git_stable() {
|
||||
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)'
|
||||
pkgdesc='A simple, self-hosted, SSH-synchronized password/note manager based on libmutton'
|
||||
arch=('x86_64' 'i686' 'i486' 'pentium4' 'aarch64' 'armv7h' 'riscv64')
|
||||
url='https://github.com/rwinkhart/MUTN'
|
||||
license=('MIT')
|
||||
depends=()
|
||||
makedepends=(go grep gzip)
|
||||
makedepends=(go util-linux)
|
||||
optdepends=(
|
||||
'wl-clipboard: Wayland clipboard support'
|
||||
'xclip: X11 clipboard support'
|
||||
@@ -22,20 +21,15 @@ 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
|
||||
lscpuOutput=\$(lscpu | grep Flags)
|
||||
if [ -z \"\$(echo \$lscpuOutput | grep avx512f)\" ]; then
|
||||
export GOAMD64=v4
|
||||
elif [ ! -z \"\$(grep 'avx2' <<< \"\$cpuFlags\")\" ]; then
|
||||
elif [ -z \"\$(echo \$lscpuOutput | grep avx2)\" ]; then
|
||||
export GOAMD64=v3
|
||||
elif [ ! -z \"\$(grep 'sse4_2' <<< \"\$cpuFlags\")\" ]; then
|
||||
elif [ -z \"\$(echo \$lscpuOutput | grep sse4_2)\" ]; then
|
||||
export GOAMD64=v2
|
||||
else
|
||||
export GOAMD64=v1
|
||||
@@ -44,8 +38,8 @@ build() {
|
||||
# TODO check aarch64 feature level
|
||||
esac
|
||||
|
||||
# compile binary
|
||||
CGO_ENABLED=1 go build -ldflags=\"-s -w\" -trimpath -tags=stxAll ./mutn.go
|
||||
cd \${srcdir}/MUTN
|
||||
CGO_ENABLED=1 go build -ldflags=\"-s -w\" -trimpath ./mutn.go
|
||||
}
|
||||
|
||||
package() {
|
||||
@@ -54,8 +48,7 @@ package() {
|
||||
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
|
||||
" > output/PKGBUILD
|
||||
printf '\nPKGBUILD generated\n\n'
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
create_apkbuild_source_stable_optimized() {
|
||||
printf '\nGenerating APKBUILD...\n'
|
||||
local source="https://github.com/rwinkhart/MUTN/archive/refs/tags/v"$version".tar.gz"
|
||||
local checksum=$(curl -sL "$source" | sha512sum | cut -d ' ' -f1)
|
||||
printf "# Maintainer: Randall Winkhart <idgr@tutanota.com>
|
||||
pkgname=mutn
|
||||
pkgver="$version"
|
||||
pkgrel="$((revision-1))"
|
||||
pkgdesc='A simple, self-hosted, SSH-synchronized password/note manager for the CLI (based on libmutton)'
|
||||
arch='all'
|
||||
url='https://github.com/rwinkhart/MUTN'
|
||||
license='MIT'
|
||||
depends=''
|
||||
makedepends='busybox go'
|
||||
options='!check net'
|
||||
source=\"\$pkgname-\$pkgver.tar.gz::"$source"\"
|
||||
|
||||
build() {
|
||||
cd \${srcdir}/MUTN-\$pkgver
|
||||
|
||||
# compress man page
|
||||
gzip -kf ./docs/man
|
||||
|
||||
# determine microarchitecture feature level
|
||||
case \$CARCH in
|
||||
'x86_64')
|
||||
cpuFlags=\$(grep -E 'flags\s+:\s' /proc/cpuinfo)
|
||||
if [ ! -z \"\$(echo \"\$cpuFlags\" | grep 'avx512f')\" ]; then
|
||||
export GOAMD64=v4
|
||||
elif [ ! -z \"\$(echo \"\$cpuFlags\" | grep 'avx2')\" ]; then
|
||||
export GOAMD64=v3
|
||||
elif [ ! -z \"\$(echo \"\$cpuFlags\" | grep 'sse4_2')\" ]; then
|
||||
export GOAMD64=v2
|
||||
else
|
||||
export GOAMD64=v1
|
||||
fi
|
||||
;;
|
||||
# TODO check aarch64 feature level
|
||||
esac
|
||||
|
||||
# compile binary
|
||||
CGO_ENABLED=1 go build -ldflags=\"-s -w\" -trimpath -tags=stxAll ./mutn.go
|
||||
}
|
||||
|
||||
package() {
|
||||
cd \${srcdir}/MUTN-\$pkgver
|
||||
install -Dm755 ./mutn \${pkgdir}/usr/bin/mutn
|
||||
install -Dm644 ./LICENSE \${pkgdir}/usr/share/licenses/mutn/LICENSE
|
||||
install -Dm644 ./completions/zsh/_mutn \${pkgdir}/usr/share/zsh/site-functions/_mutn
|
||||
install -Dm644 ./completions/bash/mutn \${pkgdir}/usr/share/bash-completion/completions/mutn
|
||||
install -Dm644 ./docs/man.gz \${pkgdir}/usr/share/man/man1/mutn.1.gz
|
||||
}
|
||||
|
||||
sha512sums=\"
|
||||
$checksum \$pkgname-\$pkgver.tar.gz
|
||||
\"
|
||||
" > 1output/APKBUILD
|
||||
printf '\nAPKBUILD generated\n\n'
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/bin/sh
|
||||
# This script generates portable MUTN release binaries for the following platforms:
|
||||
# - Linux (x86_64_v2)
|
||||
# - Linux (arm64v8.0)
|
||||
# - Linux (arm64v8.7+crypto)
|
||||
# - Windows (x86_64_v2)
|
||||
# - Windows (arm64v8.7+crypto)
|
||||
|
||||
create_release_binaries() {
|
||||
printf '\nGenerating release binaries...\n'
|
||||
cd ..
|
||||
GOOS=linux CGO_ENABLED=0 GOAMD64=v2 go build -o ./packaging/1output/mutn-linux-x86_64_v2 -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go
|
||||
GOOS=linux GOARCH=arm64 GOARM64=v8.0 CGO_ENABLED=0 go build -o ./packaging/1output/mutn-linux-arm64v8.0 -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go
|
||||
GOOS=linux GOARCH=arm64 GOARM64=v8.7,crypto CGO_ENABLED=0 go build -o ./packaging/1output/mutn-linux-arm64v8.7+crypto -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go
|
||||
GOOS=windows CGO_ENABLED=0 GOAMD64=v2 go build -o ./packaging/1output/mutn-windows-x86_64_v2.exe -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go
|
||||
GOOS=windows GOARCH=arm64 GOARM64=v8.7,crypto CGO_ENABLED=0 go build -o ./packaging/1output/mutn-windows-arm64v8.7+crypto.exe -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go
|
||||
cd ./packaging
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
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"
|
||||
LibmuttonVersion = "0.2.0" // untagged releases feature a letter suffix corresponding to the eventual release version, e.g "0.2.A" -> "0.2.0", "0.2.B" -> "0.2.1"
|
||||
)
|
||||
@@ -0,0 +1,20 @@
|
||||
//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 = "/"
|
||||
IsWindows = false
|
||||
)
|
||||
|
||||
// enableVirtualTerminalProcessing is a dummy function on UNIX-like systems (only needed on Windows)
|
||||
// TODO remove after migration off of GPG, as pinentry is responsible for disabling ANSI escape sequence interpretation
|
||||
func enableVirtualTerminalProcessing() {
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
//go:build windows
|
||||
|
||||
package backend
|
||||
|
||||
import (
|
||||
"os"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// EntryRoot path to libmutton entry directory
|
||||
var EntryRoot = Home + "\\AppData\\Local\\libmutton\\entries"
|
||||
var ConfigDir = Home + "\\AppData\\Local\\libmutton\\config"
|
||||
var ConfigPath = ConfigDir + "\\libmutton.ini"
|
||||
|
||||
// PathSeparator defines the character used to separate directories in a path (platform-specific)
|
||||
const (
|
||||
PathSeparator = "\\"
|
||||
IsWindows = true
|
||||
)
|
||||
|
||||
// enableVirtualTerminalProcessing ensures ANSI escape sequences are interpreted properly on Windows
|
||||
// TODO remove after migration off of GPG, as pinentry is responsible for disabling ANSI escape sequence interpretation
|
||||
func enableVirtualTerminalProcessing() {
|
||||
stdout := syscall.Handle(os.Stdout.Fd())
|
||||
|
||||
var originalMode uint32
|
||||
syscall.GetConsoleMode(stdout, &originalMode)
|
||||
originalMode |= 0x0004
|
||||
|
||||
syscall.MustLoadDLL("kernel32").MustFindProc("SetConsoleMode").Call(uintptr(stdout), uintptr(originalMode))
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package backend
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"gopkg.in/ini.v1"
|
||||
)
|
||||
|
||||
// loadConfig loads the libmutton.ini file and returns the configuration
|
||||
// utility function for ParseConfig and WriteConfig, do not call directly
|
||||
func loadConfig() *ini.File {
|
||||
cfg, err := ini.Load(ConfigPath)
|
||||
if err != nil {
|
||||
fmt.Println(AnsiError + "Failed to load libmutton.ini: " + err.Error() + AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
return cfg
|
||||
}
|
||||
|
||||
// ParseConfig reads the libmutton.ini file and returns a slice of values for the specified keys
|
||||
// requires requestedValues: a slice of arrays (length 2) each containing a section and a key name
|
||||
// requires missingValueError: an error message to display if a key is missing a value, set to "" for auto-generated or "0" to exit/return silently with code 0
|
||||
// returns config: a slice of values for the specified keys
|
||||
func ParseConfig(valuesRequested [][2]string, missingValueError string) []string {
|
||||
cfg := loadConfig()
|
||||
|
||||
var config []string
|
||||
|
||||
for _, pair := range valuesRequested {
|
||||
value := cfg.Section(pair[0]).Key(pair[1]).String()
|
||||
|
||||
// ensure specified key has a value
|
||||
if value == "" {
|
||||
switch missingValueError {
|
||||
case "":
|
||||
fmt.Println(AnsiError + "Failed to find value for key \"" + pair[1] + "\" in section \"[" + pair[0] + "]\" in libmutton.ini" + AnsiReset)
|
||||
case "0":
|
||||
Exit(0)
|
||||
default:
|
||||
fmt.Println(AnsiError + missingValueError + AnsiReset)
|
||||
}
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
config = append(config, value)
|
||||
}
|
||||
|
||||
return config
|
||||
}
|
||||
|
||||
// WriteConfig writes the provided key-value pairs under the specified section headers in the libmutton.ini file
|
||||
// requires valuesToWrite: a slice of arrays (length 3) each containing a section, a key name, and a value
|
||||
func WriteConfig(valuesToWrite [][3]string, append bool) {
|
||||
var cfg *ini.File
|
||||
|
||||
if append {
|
||||
// load existing ini file
|
||||
cfg = loadConfig()
|
||||
} else {
|
||||
// create empty ini container
|
||||
cfg = ini.Empty()
|
||||
}
|
||||
|
||||
// set all specified key-value pairs in their respective sections
|
||||
var section *ini.Section
|
||||
for _, trio := range valuesToWrite {
|
||||
if cfg.Section(trio[0]) == nil {
|
||||
// create and aquire section if it doesn't exist
|
||||
section, _ = cfg.NewSection(trio[0])
|
||||
} else {
|
||||
// acquire existing section
|
||||
section = cfg.Section(trio[0])
|
||||
}
|
||||
|
||||
// set key-value pair
|
||||
section.Key(trio[1]).SetValue(trio[2])
|
||||
}
|
||||
|
||||
// save to libmutton.ini
|
||||
err := cfg.SaveTo(ConfigPath)
|
||||
if err != nil {
|
||||
fmt.Println(AnsiError + "Failed to save libmutton.ini: " + err.Error() + AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package backend
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
steamtotp "github.com/fortis/go-steam-totp"
|
||||
"github.com/pquerna/otp/totp"
|
||||
)
|
||||
|
||||
// CopyArgument copies a field from an entry to the clipboard
|
||||
func CopyArgument(executableName, targetLocation string, field int) {
|
||||
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 != 2 {
|
||||
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[2], "steam@") {
|
||||
secret = decryptedEntry[2][6:]
|
||||
forSteam = true
|
||||
} else {
|
||||
secret = decryptedEntry[2]
|
||||
}
|
||||
|
||||
fmt.Println("TOTP code has been copied to the clipboard - your clipboard will be kept up to date with the current code until this process is closed")
|
||||
|
||||
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(executableName, copySubject)
|
||||
}
|
||||
}
|
||||
|
||||
// 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) // use os.Exit instead of backend.Exit, as this function runs out of a background subprocess that is invisible to the user (will never appear in GUI/TUI environment)
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
//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(executableName, copySubject 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)
|
||||
}
|
||||
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, err := cmd.Output()
|
||||
if err != nil {
|
||||
fmt.Println(AnsiError + "Failed to read clipboard contents: " + err.Error() + AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
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) // use os.Exit instead of backend.Exit, as this function runs out of a background subprocess that is invisible to the user (will never appear in GUI/TUI environment)
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
//go:build linux && termux
|
||||
|
||||
package backend
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// copyField copies a field from an entry to the clipboard
|
||||
func copyField(executableName, copySubject 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)
|
||||
}
|
||||
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, err := cmd.Output()
|
||||
if err != nil {
|
||||
fmt.Println(AnsiError + "Failed to read clipboard contents: " + err.Error() + AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
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) // use os.Exit instead of backend.Exit, as this function runs out of a background subprocess that is invisible to the user (will never appear in GUI/TUI environment)
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
//go:build !windows && !darwin && !termux && !wsl
|
||||
|
||||
package backend
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// copyField copies a field from an entry to the clipboard
|
||||
func copyField(executableName, copySubject 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)
|
||||
}
|
||||
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)
|
||||
|
||||
// determine clipboard tool to use (wl-clipboard VS xclip)
|
||||
var envSet bool
|
||||
var cmdClear, cmdPaste *exec.Cmd
|
||||
if _, envSet = os.LookupEnv("WAYLAND_DISPLAY"); envSet {
|
||||
cmdClear = exec.Command("wl-copy", "-c")
|
||||
cmdPaste = exec.Command("wl-paste")
|
||||
} else if _, envSet = os.LookupEnv("DISPLAY"); envSet {
|
||||
cmdClear = exec.Command("xclip", "-i", "/dev/null", "-sel", "c")
|
||||
cmdPaste = exec.Command("xclip", "-o", "-sel", "c")
|
||||
} else {
|
||||
fmt.Println(AnsiError + "Clipboard platform could not be determined - neither $WAYLAND_DISPLAY nor $DISPLAY are set" + AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// read current clipboard contents
|
||||
newContents, err := cmdPaste.Output()
|
||||
if err != nil {
|
||||
fmt.Println(AnsiError + "Failed to read clipboard contents: " + err.Error() + AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// clear clipboard if contents have not been modified
|
||||
if oldContents == strings.TrimRight(string(newContents), "\r\n") {
|
||||
err = cmdClear.Run()
|
||||
if err != nil {
|
||||
fmt.Println(AnsiError + "Failed to clear clipboard: " + err.Error() + AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
os.Exit(0) // use os.Exit instead of backend.Exit, as this function runs out of a background subprocess that is invisible to the user (will never appear in GUI/TUI environment)
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
//go:build windows || (linux && wsl)
|
||||
|
||||
package backend
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// copyField copies a field from an entry to the clipboard
|
||||
func copyField(executableName, copySubject 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)
|
||||
}
|
||||
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, err := cmd.Output()
|
||||
if err != nil {
|
||||
fmt.Println(AnsiError + "Failed to read clipboard contents: " + err.Error() + AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
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) // use os.Exit instead of backend.Exit, as this function runs out of a background subprocess that is invisible to the user (will never appear in GUI/TUI environment)
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package backend
|
||||
|
||||
// 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
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
//go:build !returnOnExit
|
||||
|
||||
package backend
|
||||
|
||||
import "os"
|
||||
|
||||
func Exit(code int) {
|
||||
os.Exit(code)
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
//go:build returnOnExit
|
||||
|
||||
package backend
|
||||
|
||||
func Exit(code int) {
|
||||
return code
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
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
|
||||
|
||||
// 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()
|
||||
|
||||
// ensure ANSI escape sequences are interpreted properly on Windows
|
||||
enableVirtualTerminalProcessing()
|
||||
|
||||
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", ParseConfig([][2]string{{"LIBMUTTON", "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
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package backend
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 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 func(name string) {
|
||||
_ = os.Remove(name) // error ignored; if the file could be created, it can probably be removed
|
||||
}(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")) // error ignored; if the file could be created, it can probably be written to
|
||||
|
||||
// close gpg-gen file
|
||||
_ = gpgGenTempFile.Close() // error ignored; if the file could be created, it can probably be closed
|
||||
|
||||
// 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
|
||||
err := cmd.Run()
|
||||
if err != nil {
|
||||
fmt.Println(AnsiError + "Failed to generate GPG key: " + err.Error() + AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
return "libmutton-" + unixTime + " (gpg-libmutton) <github.com/rwinkhart/libmutton>"
|
||||
}
|
||||
|
||||
// DirInit creates the libmutton directories
|
||||
func DirInit(preserveOldConfigDir bool) {
|
||||
// create EntryRoot
|
||||
err := os.MkdirAll(EntryRoot, 0700)
|
||||
if err != nil {
|
||||
fmt.Println(AnsiError + "Failed to create \"" + EntryRoot + "\":" + err.Error() + AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// remove existing config directory (if it exists and not in append mode)
|
||||
if !preserveOldConfigDir {
|
||||
_, isAccessible := TargetIsFile(ConfigDir, false, 1)
|
||||
if isAccessible {
|
||||
err = os.RemoveAll(ConfigDir)
|
||||
if err != nil {
|
||||
fmt.Println(AnsiError + "Failed to remove existing config directory: " + err.Error() + AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// create config directory w/devices subdirectory
|
||||
err = os.MkdirAll(ConfigDir+PathSeparator+"devices", 0700)
|
||||
if err != nil {
|
||||
fmt.Println(AnsiError + "Failed to create \"" + ConfigDir + "\":" + err.Error() + AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
//go:build !windows
|
||||
|
||||
package backend
|
||||
|
||||
// TargetLocationFormat returns the full location of an entry (given the name) formatted for the current platform
|
||||
func TargetLocationFormat(targetLocationIncomplete string) string {
|
||||
return EntryRoot + targetLocationIncomplete
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//go:build windows
|
||||
|
||||
package backend
|
||||
|
||||
import "strings"
|
||||
|
||||
// TargetLocationFormat returns the full location of an entry (given the name) formatted for the current platform
|
||||
func TargetLocationFormat(targetLocationIncomplete string) string {
|
||||
return EntryRoot + strings.ReplaceAll(targetLocationIncomplete, "/", PathSeparator)
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
package backend
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
"math/big"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// 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, verifyEntryDoesNotExist bool) {
|
||||
if verifyEntryDoesNotExist {
|
||||
_, isAccessible := TargetIsFile(targetLocation, false, 0)
|
||||
if isAccessible {
|
||||
fmt.Println(AnsiError + "Target location already exists" + AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
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, err := cmd.StdinPipe()
|
||||
if err != nil {
|
||||
fmt.Println(AnsiError + "Failed to access stdin for system command: " + err.Error() + AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
go func() {
|
||||
defer func(stdin io.WriteCloser) {
|
||||
_ = stdin.Close() // error ignored; if stdin could be accessed, it can probably be closed
|
||||
}(stdin)
|
||||
_, _ = 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
|
||||
}
|
||||
|
||||
// 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
|
||||
// safeForFileName: if true, the generated string will only contain special characters that are safe for file names (only impacts complex strings)
|
||||
// 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, safeForFileName bool) 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
|
||||
var extendedCharset string // additions to character set used for complex strings
|
||||
|
||||
charset := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" // default character set used for all strings
|
||||
const extendedCharsetFiles = "!#$%&'()+,-.;=@[]^_`{}~" // additional special characters for complex strings (safe in file names)
|
||||
const extendedCharsetPassword = "\"*:><?/\\|" // additional special characters for complex strings (NOT safe in file names)
|
||||
if complex {
|
||||
minSpecialChars = int(math.Round(float64(length) * complexity)) // determine minimum number of special characters to accept
|
||||
if !safeForFileName {
|
||||
extendedCharset = extendedCharsetFiles + extendedCharsetPassword
|
||||
} else {
|
||||
extendedCharset = extendedCharsetFiles
|
||||
}
|
||||
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
|
||||
}
|
||||
+3
-8
@@ -3,21 +3,16 @@ package cli
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/rwinkhart/go-boilerplate/front"
|
||||
"github.com/rwinkhart/libmutton/global"
|
||||
"golang.org/x/term"
|
||||
)
|
||||
|
||||
// global variables used across multiple files
|
||||
var (
|
||||
width, _, _ = term.GetSize(int(os.Stdout.Fd()))
|
||||
)
|
||||
|
||||
// global constants used across multiple files
|
||||
const (
|
||||
MUTNVersion = "0.3.1" // untagged releases feature a letter suffix corresponding to the eventual release version, e.g "0.2.A" -> "0.2.0", "0.2.B" -> "0.2.1"
|
||||
|
||||
AnsiBold = "\033[1m"
|
||||
ansiBlackOnWhite = "\033[38;5;0;48;5;15m"
|
||||
)
|
||||
|
||||
func init() {
|
||||
global.GetPassword = front.InputHidden
|
||||
}
|
||||
|
||||
+26
-21
@@ -1,47 +1,52 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"github.com/rwinkhart/go-boilerplate/back"
|
||||
"github.com/rwinkhart/go-boilerplate/front"
|
||||
"github.com/rwinkhart/go-boilerplate/other"
|
||||
"github.com/rwinkhart/libmutton/core"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/rwinkhart/MUTN/src/backend"
|
||||
)
|
||||
|
||||
// AddEntry creates a new entry at targetLocation by taking user input via CLI prompts.
|
||||
// Requires: entryType (0 = standard password entry, 1 = auto-generated password entry, 2 = note-only entry).
|
||||
// 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, hideSecrets bool, entryType uint8) {
|
||||
// ensure targetLocation is valid
|
||||
_, err := core.EntryAddPrecheck(targetLocation)
|
||||
if err != nil {
|
||||
other.PrintError("Failed to add entry: "+err.Error(), back.ErrorWrite)
|
||||
// ensure target location does not already exist
|
||||
_, isAccessible := backend.TargetIsFile(targetLocation, false, 0)
|
||||
if isAccessible {
|
||||
fmt.Println(backend.AnsiError + "Target location already exists" + backend.AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
var decryptedEntry []string
|
||||
// ensure target containing directory exists and is a directory (not a file)
|
||||
backend.TargetIsFile(targetLocation[:strings.LastIndex(targetLocation, "/")], true, 1)
|
||||
|
||||
var unencryptedEntry []string
|
||||
|
||||
if entryType < 2 {
|
||||
username := front.Input("Username:")
|
||||
username := input("Username:")
|
||||
|
||||
// determine whether to generate the password
|
||||
var password string
|
||||
if entryType == 0 {
|
||||
password = string(front.InputHidden("Password:"))
|
||||
password = inputHidden("Password:")
|
||||
} else {
|
||||
password = inputPasswordGen()
|
||||
password = backend.StringGen(inputInt("Password length:", -1), inputBinary("Generate a complex (special characters) password?"), 0.2, false)
|
||||
}
|
||||
|
||||
totp := string(front.InputHidden("TOTP secret:"))
|
||||
url := front.Input("URL:")
|
||||
if front.InputBinary("Add a note to this entry?") {
|
||||
totp := inputHidden("TOTP secret:")
|
||||
url := input("URL:")
|
||||
if inputBinary("Add a note to this entry?") {
|
||||
note, _ := editNote([]string{})
|
||||
decryptedEntry = append([]string{password, username, totp, url}, note...)
|
||||
unencryptedEntry = append([]string{password, username, totp, url}, note...)
|
||||
} else {
|
||||
decryptedEntry = []string{password, username, totp, url}
|
||||
unencryptedEntry = []string{password, username, totp, url}
|
||||
}
|
||||
} else {
|
||||
note, _ := editNote([]string{})
|
||||
decryptedEntry = append([]string{"", "", "", ""}, note...)
|
||||
unencryptedEntry = append([]string{"", "", "", ""}, note...)
|
||||
}
|
||||
|
||||
// write and preview the new entry
|
||||
writeEntryCLI(targetLocation, decryptedEntry, hideSecrets)
|
||||
writeEntryCLI(targetLocation, unencryptedEntry, hideSecrets, false)
|
||||
}
|
||||
|
||||
+40
-69
@@ -2,110 +2,83 @@ package cli
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/rwinkhart/go-boilerplate/back"
|
||||
"github.com/rwinkhart/go-boilerplate/front"
|
||||
"github.com/rwinkhart/go-boilerplate/other"
|
||||
"github.com/rwinkhart/libmutton/cfg"
|
||||
"github.com/rwinkhart/libmutton/core"
|
||||
"github.com/rwinkhart/libmutton/syncclient"
|
||||
"github.com/rwinkhart/MUTN/src/backend"
|
||||
"github.com/rwinkhart/MUTN/src/sync"
|
||||
)
|
||||
|
||||
// RenameCli renames an entry at oldLocationIncomplete to a new location (user input) on both the client and the server.
|
||||
// RenameCli renames an entry at oldLocationIncomplete to a new location (user input) on both the client and the server
|
||||
func RenameCli(oldLocationIncomplete string) {
|
||||
// prompt user for new location and rename
|
||||
newLocationIncomplete := front.Input("New location:")
|
||||
err := syncclient.RenameRemoteFromClient(oldLocationIncomplete, newLocationIncomplete)
|
||||
if err != nil {
|
||||
other.PrintError("Failed to rename entry: "+err.Error(), back.ErrorWrite)
|
||||
}
|
||||
newLocationIncomplete := input("New location:")
|
||||
sync.RenameRemoteFromClient(oldLocationIncomplete, newLocationIncomplete)
|
||||
|
||||
// exit is done from sync.RenameRemoteFromClient
|
||||
}
|
||||
|
||||
// EditEntryField edits a field of an entry at targetLocation (user input).
|
||||
// EditEntryField edits a field of an entry at targetLocation (user input)
|
||||
func EditEntryField(targetLocation string, hideSecrets bool, field int) {
|
||||
// fetch old entry data (with all required lines present)
|
||||
decryptedEntry, err := core.GetOldEntryData(targetLocation, field)
|
||||
if err != nil {
|
||||
other.PrintError("Failed to fetch entry data: "+err.Error(), back.ErrorRead)
|
||||
}
|
||||
unencryptedEntry := backend.GetOldEntryData(targetLocation, field)
|
||||
|
||||
// edit the field
|
||||
switch field {
|
||||
case 0:
|
||||
decryptedEntry[field] = string(front.InputHidden("Password:"))
|
||||
unencryptedEntry[field] = inputHidden("Password:")
|
||||
case 1:
|
||||
decryptedEntry[field] = front.Input("Username:")
|
||||
unencryptedEntry[field] = input("Username:")
|
||||
case 2:
|
||||
decryptedEntry[field] = string(front.InputHidden("TOTP secret:"))
|
||||
unencryptedEntry[field] = inputHidden("TOTP secret:")
|
||||
case 3:
|
||||
decryptedEntry[field] = front.Input("URL:")
|
||||
unencryptedEntry[field] = input("URL:")
|
||||
case 4: // edit notes fields
|
||||
// store note and non-note data separately
|
||||
fieldsMain := decryptedEntry[:4]
|
||||
fieldsNote := decryptedEntry[4:]
|
||||
nonNoteData := unencryptedEntry[:4]
|
||||
noteData := unencryptedEntry[4:]
|
||||
|
||||
// edit the note
|
||||
editedNote, noteEdited := editNote(fieldsNote)
|
||||
editedNote, noteEdited := editNote(noteData)
|
||||
if !noteEdited { // exit early if the note was not edited
|
||||
other.PrintError("Entry is unchanged", 0)
|
||||
fmt.Println(backend.AnsiError + "Entry is unchanged" + backend.AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
decryptedEntry = append(fieldsMain, editedNote...)
|
||||
unencryptedEntry = append(nonNoteData, editedNote...)
|
||||
}
|
||||
|
||||
// write and preview the modified entry
|
||||
writeEntryCLI(targetLocation, decryptedEntry, hideSecrets)
|
||||
writeEntryCLI(targetLocation, unencryptedEntry, hideSecrets, false)
|
||||
}
|
||||
|
||||
// GenUpdate generates a new password for an entry at targetLocation (user input).
|
||||
// GenUpdate generates a new password for an entry at targetLocation (user input)
|
||||
func GenUpdate(targetLocation string, hideSecrets bool) {
|
||||
// fetch old entry data
|
||||
decryptedEntry, err := core.GetOldEntryData(targetLocation, 0)
|
||||
if err != nil {
|
||||
other.PrintError("Failed to fetch entry data: "+err.Error(), back.ErrorRead)
|
||||
}
|
||||
unencryptedEntry := backend.GetOldEntryData(targetLocation, 0)
|
||||
|
||||
// generate a new password
|
||||
decryptedEntry[0] = inputPasswordGen()
|
||||
unencryptedEntry[0] = backend.StringGen(inputInt("Password length:", -1), inputBinary("Generate a complex (special characters) password?"), 0.2, false)
|
||||
|
||||
// write and preview the modified entry
|
||||
writeEntryCLI(targetLocation, decryptedEntry, hideSecrets)
|
||||
writeEntryCLI(targetLocation, unencryptedEntry, hideSecrets, false)
|
||||
}
|
||||
|
||||
// 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, err := back.CreateTempFile()
|
||||
if err != nil {
|
||||
other.PrintError("Failed to create temporary note file: "+err.Error(), back.ErrorWrite)
|
||||
}
|
||||
tempFile := backend.CreateTempFile()
|
||||
defer func(name string) {
|
||||
_ = os.Remove(name) // error ignored; if the file could be created, it can probably be removed
|
||||
}(tempFile.Name())
|
||||
|
||||
// fetch the user's text editor
|
||||
editorCfg, err := cfg.ParseConfig([][2]string{{"MUTN", "textEditor"}})
|
||||
if err != nil {
|
||||
other.PrintError("Failed to retrieve text editor from libmutton.ini\n\nPlease specify one with \"mutn tweak\"", back.ErrorRead)
|
||||
}
|
||||
editor := editorCfg[0]
|
||||
editor := backend.ParseConfig([][2]string{{"MUTN", "textEditor"}}, "")[0]
|
||||
|
||||
// write baseNote to tempFile (if it is not empty)
|
||||
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
|
||||
if len(baseNote) > 0 {
|
||||
for _, line := range baseNote {
|
||||
_, _ = tempFile.WriteString(line + "\n")
|
||||
}
|
||||
@@ -119,15 +92,15 @@ func editNote(baseNote []string) ([]string, bool) {
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stdin = os.Stdin
|
||||
cmd.Stderr = os.Stderr
|
||||
err = cmd.Run()
|
||||
err := cmd.Run()
|
||||
if 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
|
||||
panic(backend.AnsiError + "Failed to write note with " + editor + backend.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(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
|
||||
panic(backend.AnsiError + "Failed to read note written with " + editor + backend.AnsiReset) // panic is used to ensure the tempFile is removed, as per the defer statement
|
||||
}
|
||||
|
||||
// read the edited note from the tempFile
|
||||
@@ -141,19 +114,17 @@ func editNote(baseNote []string) ([]string, bool) {
|
||||
_ = tempFile.Close() // error ignored; if the file could be opened, it can probably be closed
|
||||
|
||||
// remove trailing empty strings from the edited note
|
||||
note = back.RemoveTrailingEmptyStrings(note)
|
||||
note = backend.RemoveTrailingEmptyStrings(note)
|
||||
|
||||
// clamp trailing whitespace in each note line
|
||||
core.ClampTrailingWhitespace(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 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 the edited note if it is different from baseNote
|
||||
if !reflect.DeepEqual(note, baseNote) {
|
||||
return note, true
|
||||
} else {
|
||||
return nil, false
|
||||
return []string{}, false
|
||||
}
|
||||
}
|
||||
|
||||
+13
-18
@@ -2,22 +2,20 @@ package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/rwinkhart/MUTN/src/backend"
|
||||
"github.com/rwinkhart/MUTN/src/sync"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/rwinkhart/go-boilerplate/back"
|
||||
"github.com/rwinkhart/go-boilerplate/other"
|
||||
"github.com/rwinkhart/libmutton/synccommon"
|
||||
)
|
||||
|
||||
// ANSI color constants used only in this file
|
||||
// global constants used only in this file
|
||||
const (
|
||||
ansiAlternateEntryColor = "\033[38;5;8m"
|
||||
ansiDirectoryHeader = "\033[38;5;7;48;5;8m"
|
||||
ansiEmptyDirectoryWarning = "\033[38;5;3m"
|
||||
ansiEmptyDirectoryWarning = "\033[38;5;11m"
|
||||
)
|
||||
|
||||
// determineIndentation calculates and returns the final visual indentation multiplier (needed to adjust indentation for skipped parent directories); also subtracts "old" text from directory header.
|
||||
// calculates and returns the final visual indentation multiplier (needed to adjust indentation for skipped parent directories) - also subtracts "old" text from directory header
|
||||
func determineIndentation(skippedDirList []bool, dirList []string, currentDirIndex int) (int, string) {
|
||||
var subtractor int // tracks how much to subtract from expected indentation multiplier
|
||||
var lastPrefixIndex int // tracks the index (in both skippedDirList and dirList) of the last displayed parent directory
|
||||
@@ -47,7 +45,7 @@ func determineIndentation(skippedDirList []bool, dirList []string, currentDirInd
|
||||
return indent, trimmedDirectory
|
||||
}
|
||||
|
||||
// printFileEntry handles processing for printing file entries (determines color, wraps lines, and prints).
|
||||
// processing for printing file entries (determines color, line wrapping, and prints)
|
||||
func printFileEntry(entry string, lastSlash, charCounter, indent int, colorAlternator int8) (int, int8) {
|
||||
// determine color to print fileEntryName (alternate each time function is run)
|
||||
var colorCode string
|
||||
@@ -73,20 +71,17 @@ func printFileEntry(entry string, lastSlash, charCounter, indent int, colorAlter
|
||||
}
|
||||
|
||||
// print fileEntryName to screen
|
||||
fmt.Printf("%s%s%s ", colorCode, fileEntryName, back.AnsiReset)
|
||||
fmt.Printf("%s%s%s ", colorCode, fileEntryName, backend.AnsiReset)
|
||||
|
||||
return charCounter, colorAlternator
|
||||
}
|
||||
|
||||
// EntryListGen generates and displays the full libmutton entry list.
|
||||
// EntryListGen generates and displays full libmutton entry list
|
||||
func EntryListGen() {
|
||||
fileList, dirList, err := synccommon.WalkEntryDir()
|
||||
if err != nil {
|
||||
other.PrintError("Failed to generate entry list: "+err.Error(), back.ErrorRead)
|
||||
}
|
||||
fileList, dirList := sync.WalkEntryDir()
|
||||
|
||||
// print header bar w/total entry count
|
||||
fmt.Print("\n"+ansiBlackOnWhite, len(fileList), " libmutton entries:"+back.AnsiReset)
|
||||
fmt.Print("\n"+ansiBlackOnWhite, len(fileList), " libmutton entries:"+backend.AnsiReset)
|
||||
|
||||
// dirList iteration
|
||||
dirListLength := len(dirList) // save length for multiple references below
|
||||
@@ -132,7 +127,7 @@ func EntryListGen() {
|
||||
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
|
||||
fmt.Printf("\n\n"+strings.Repeat(" ", indent*2)+ansiDirectoryHeader+"%s/"+back.AnsiReset+"\n", vanityDirectory)
|
||||
fmt.Printf("\n\n"+strings.Repeat(" ", indent*2)+ansiDirectoryHeader+"%s/"+backend.AnsiReset+"\n", vanityDirectory)
|
||||
}
|
||||
|
||||
charCounter, colorAlternator = printFileEntry(file, lastSlash, charCounter, indent, colorAlternator)
|
||||
@@ -144,8 +139,8 @@ func EntryListGen() {
|
||||
if dirListLength > 1 { // and directories besides the root-level exist... display directory header and empty directory warning
|
||||
skippedDirList[i] = false // the directory header is being printed, indicate that it is not being skipped
|
||||
indent, vanityDirectory = determineIndentation(skippedDirList, dirList, i) // calculate the final indentation multiplier
|
||||
fmt.Printf("\n\n"+strings.Repeat(" ", indent*2)+ansiDirectoryHeader+"%s/"+back.AnsiReset+"\n", vanityDirectory)
|
||||
fmt.Print(strings.Repeat(" ", indent*2) + ansiEmptyDirectoryWarning + "-empty directory-" + back.AnsiReset)
|
||||
fmt.Printf("\n\n"+strings.Repeat(" ", indent*2)+ansiDirectoryHeader+"%s/"+backend.AnsiReset+"\n", vanityDirectory)
|
||||
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\".")
|
||||
}
|
||||
|
||||
+20
-37
@@ -5,93 +5,76 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/charmbracelet/glamour"
|
||||
"github.com/rwinkhart/go-boilerplate/back"
|
||||
"github.com/rwinkhart/go-boilerplate/other"
|
||||
"github.com/rwinkhart/libmutton/crypt"
|
||||
"github.com/rwinkhart/libmutton/global"
|
||||
"github.com/rwinkhart/libmutton/syncclient"
|
||||
"github.com/rwinkhart/MUTN/src/backend"
|
||||
"github.com/rwinkhart/MUTN/src/sync"
|
||||
)
|
||||
|
||||
const ansiShownPassword = "\033[38;5;10m"
|
||||
|
||||
// EntryReader prints the decrypted contents of a libmutton entry in a human-readable format.
|
||||
// EntryReader prints the decrypted contents of a libmutton entry in a human-readable format
|
||||
func EntryReader(decryptedEntry []string, hideSecrets, syncEnabled bool) {
|
||||
fmt.Println()
|
||||
|
||||
fieldLoop:
|
||||
for field := range decryptedEntry {
|
||||
switch field {
|
||||
case 0:
|
||||
// if the first field (password) is not empty, print it
|
||||
if decryptedEntry[0] != "" {
|
||||
if !hideSecrets {
|
||||
fmt.Print(ansiDirectoryHeader + "Password:" + back.AnsiReset + "\n" + ansiShownPassword + decryptedEntry[0] + back.AnsiReset + "\n\n")
|
||||
fmt.Print(ansiDirectoryHeader + "Password:" + backend.AnsiReset + "\n" + ansiShownPassword + decryptedEntry[0] + backend.AnsiReset + "\n\n")
|
||||
} else {
|
||||
fmt.Print(ansiDirectoryHeader + "Password:" + back.AnsiReset + "\n" + ansiEmptyDirectoryWarning + "End command in \"show\" or \"-s\" to view" + back.AnsiReset + "\n\n")
|
||||
fmt.Print(ansiDirectoryHeader + "Password:" + backend.AnsiReset + "\n" + ansiEmptyDirectoryWarning + "End command in \"show\" or \"-s\" to view" + backend.AnsiReset + "\n\n")
|
||||
}
|
||||
}
|
||||
case 1:
|
||||
// if the second field (username) is not empty, print it
|
||||
if decryptedEntry[1] != "" {
|
||||
fmt.Print(ansiDirectoryHeader + "Username:" + back.AnsiReset + "\n" + decryptedEntry[1] + "\n\n")
|
||||
fmt.Print(ansiDirectoryHeader + "Username:" + backend.AnsiReset + "\n" + decryptedEntry[1] + "\n\n")
|
||||
}
|
||||
case 2:
|
||||
// if the third field (TOTP secret) is not empty, print it
|
||||
if decryptedEntry[2] != "" {
|
||||
if !hideSecrets {
|
||||
fmt.Print(ansiDirectoryHeader + "TOTP Secret:" + back.AnsiReset + "\n" + ansiShownPassword + decryptedEntry[2] + back.AnsiReset + "\n\n")
|
||||
fmt.Print(ansiDirectoryHeader + "TOTP Secret:" + backend.AnsiReset + "\n" + ansiShownPassword + decryptedEntry[2] + backend.AnsiReset + "\n\n")
|
||||
} else {
|
||||
fmt.Print(ansiDirectoryHeader + "TOTP Secret:" + back.AnsiReset + "\n" + ansiEmptyDirectoryWarning + "End command in \"show\" or \"-s\" to view" + back.AnsiReset + "\n\n")
|
||||
fmt.Print(ansiDirectoryHeader + "TOTP Secret:" + backend.AnsiReset + "\n" + ansiEmptyDirectoryWarning + "End command in \"show\" or \"-s\" to view" + backend.AnsiReset + "\n\n")
|
||||
}
|
||||
}
|
||||
case 3:
|
||||
// if the fourth field (url) is not empty, print it
|
||||
if decryptedEntry[3] != "" {
|
||||
fmt.Print(ansiDirectoryHeader + "URL:" + back.AnsiReset + "\n" + decryptedEntry[3] + "\n\n")
|
||||
fmt.Print(ansiDirectoryHeader + "URL:" + backend.AnsiReset + "\n" + decryptedEntry[3] + "\n\n")
|
||||
}
|
||||
case 4:
|
||||
// print the notes header
|
||||
fmt.Println(ansiDirectoryHeader + "Notes:" + back.AnsiReset)
|
||||
fmt.Println(ansiDirectoryHeader + "Notes:" + backend.AnsiReset)
|
||||
|
||||
// combine remaining fields into a single string (to support Markdown rendering)
|
||||
var noteLines []string
|
||||
var notesSlice []string
|
||||
for ; field < len(decryptedEntry); field++ {
|
||||
noteLines = append(noteLines, decryptedEntry[field])
|
||||
notesSlice = append(notesSlice, decryptedEntry[field])
|
||||
}
|
||||
joinedString := strings.Join(notesSlice, "\n")
|
||||
|
||||
// render notes as Markdown
|
||||
r, _ := glamour.NewTermRenderer(glamour.WithStylesFromJSONBytes(glamourStyle()), glamour.WithPreservedNewLines(), glamour.WithWordWrap(width))
|
||||
markdownNotesString, _ := r.Render(strings.Join(noteLines, "\n"))
|
||||
|
||||
// print the rendered Markdown notes
|
||||
fmt.Print(markdownNotesString)
|
||||
// print notes to stdout
|
||||
renderNote(&joinedString)
|
||||
|
||||
// break after notes have been printed
|
||||
break fieldLoop
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if syncEnabled {
|
||||
_, err := syncclient.RunJob(false)
|
||||
if err != nil {
|
||||
other.PrintError("Failed to sync entries: "+err.Error(), global.ErrorSyncProcess)
|
||||
}
|
||||
sync.RunJob(false)
|
||||
}
|
||||
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
// EntryReaderDecrypt is a wrapper for EntryReader that first decrypts an RCW-wrapped file before sending it to EntryReader.
|
||||
// EntryReaderDecrypt is a wrapper for EntryReader that first decrypts a GPG-encrypted file before sending it to EntryReader
|
||||
func EntryReaderDecrypt(targetLocation string, hideSecrets bool) {
|
||||
_, err := back.TargetIsFile(targetLocation, true)
|
||||
if err != nil { // if the location does not exist or is a directory...
|
||||
other.PrintError("Failed to verify target location: "+err.Error(), back.ErrorTargetNotFound)
|
||||
if isFile, _ := backend.TargetIsFile(targetLocation, true, 2); isFile {
|
||||
EntryReader(backend.DecryptGPG(targetLocation), hideSecrets, false) // never sync if decrypting straight to EntryReader, as this means the entry could not have been modified
|
||||
}
|
||||
decSlice, err := crypt.DecryptFileToSlice(targetLocation)
|
||||
if err != nil {
|
||||
other.PrintError("Failed to decrypt entry: "+err.Error(), global.ErrorDecryption)
|
||||
}
|
||||
EntryReader(decSlice, hideSecrets, false) // never sync if decrypting straight to EntryReader, as this means the entry could not have been modified
|
||||
// do not exit, as this is the job of EntryReader
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
//go:build !noMarkdown
|
||||
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/charmbracelet/glamour"
|
||||
)
|
||||
|
||||
// renderNote renders the notes section of an entry (in Markdown) to stdout
|
||||
func renderNote(note *string) {
|
||||
r, _ := glamour.NewTermRenderer(glamour.WithStylesFromJSONBytes(glamourStyle()), glamour.WithPreservedNewLines(), glamour.WithWordWrap(width))
|
||||
markdownNotesString, _ := r.Render(*note)
|
||||
|
||||
// print markdown-rendered notes
|
||||
fmt.Print(markdownNotesString)
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//go:build noMarkdown
|
||||
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// renderNote prints the notes section of an entry to stdout (when Markdown rendering is disabled)
|
||||
func renderNote(note *string) {
|
||||
fmt.Print("\n" + *note + "\n\n")
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"cmp"
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/rwinkhart/MUTN/src/backend"
|
||||
"github.com/rwinkhart/MUTN/src/sync"
|
||||
)
|
||||
|
||||
// TempInitCli initializes the MUTN environment based on user input (will be replaced with a TUI menu)
|
||||
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 := cmp.Or(input("Text editor (leave blank for $EDITOR, falls back to \""+fallbackEditor+"\"):"), os.Getenv("EDITOR"), fallbackEditor)
|
||||
|
||||
// SSH info
|
||||
configSSH := inputBinary("Configure SSH settings (for synchronization)?")
|
||||
if configSSH {
|
||||
// necessary SSH info
|
||||
fmt.Println(AnsiBold + "\nNote:" + backend.AnsiReset + " Only key-based authentication is supported (keys may optionally be passphrase-protected).\nThe remote server must already be in your ~" + backend.PathSeparator + ".ssh" + backend.PathSeparator + "known_hosts file.")
|
||||
sshUser := input("Remote SSH username:")
|
||||
sshPort := input("Remote SSH port:")
|
||||
sshIP := input("Remote SSH IP/domain:")
|
||||
|
||||
// prompt for and ensure existence of SSH identity file
|
||||
var sshKey string
|
||||
var sshKeyIsFile bool
|
||||
for !sshKeyIsFile {
|
||||
fallbackSSHKey := backend.Home + backend.PathSeparator + ".ssh" + backend.PathSeparator + "id_ed25519"
|
||||
sshKey = cmp.Or(expandPathWithHome(input("SSH private identity file path (falls back to \""+fallbackSSHKey+"\"):")), fallbackSSHKey)
|
||||
sshKeyIsFile, _ = backend.TargetIsFile(sshKey, false, 0)
|
||||
if !sshKeyIsFile {
|
||||
fmt.Println(backend.AnsiError + "SSH identity file not found: " + sshKey + backend.AnsiReset)
|
||||
}
|
||||
}
|
||||
|
||||
sshKeyProtected := inputBinary("Is the identity file password-protected?")
|
||||
|
||||
// initialize libmutton directories
|
||||
backend.DirInit(false)
|
||||
|
||||
// write config file (temporarily assigns sshEntryRoot and sshIsWindows to null to pass initial device ID registration)
|
||||
backend.WriteConfig([][3]string{{"MUTN", "textEditor", textEditor}, {"LIBMUTTON", "gpgID", gpgID}, {"LIBMUTTON", "sshUser", sshUser}, {"LIBMUTTON", "sshIP", sshIP}, {"LIBMUTTON", "sshPort", sshPort}, {"LIBMUTTON", "sshKey", sshKey}, {"LIBMUTTON", "sshKeyProtected", strconv.FormatBool(sshKeyProtected)}, {"LIBMUTTON", "sshEntryRoot", "null"}, {"LIBMUTTON", "sshIsWindows", "null"}}, false)
|
||||
|
||||
// generate and register device ID
|
||||
sshEntryRoot, sshIsWindows := sync.DeviceIDGen()
|
||||
|
||||
// update config file with sshEntryRoot and sshIsWindows
|
||||
backend.WriteConfig([][3]string{{"LIBMUTTON", "sshEntryRoot", sshEntryRoot}, {"LIBMUTTON", "sshIsWindows", sshIsWindows}}, true)
|
||||
} else {
|
||||
// initialize libmutton directories
|
||||
backend.DirInit(false)
|
||||
|
||||
// write config file
|
||||
backend.WriteConfig([][3]string{{"MUTN", "textEditor", textEditor}, {"LIBMUTTON", "gpgID", gpgID}}, false)
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -2,4 +2,4 @@
|
||||
|
||||
package cli
|
||||
|
||||
const FallbackEditor = "vi" // vi is pre-installed on most UNIX-like systems
|
||||
const fallbackEditor = "vi" // vi is pre-installed on most UNIX-like systems
|
||||
|
||||
+1
-1
@@ -2,4 +2,4 @@
|
||||
|
||||
package cli
|
||||
|
||||
const FallbackEditor = "edit" // "edit" is the Microsoft-developed CLI text editor
|
||||
const fallbackEditor = "nvim" // since there is no pre-installed CLI editor on Windows, default to the most popular one
|
||||
|
||||
+31
-35
@@ -4,28 +4,26 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/rwinkhart/go-boilerplate/back"
|
||||
"github.com/rwinkhart/libmutton/global"
|
||||
"github.com/rwinkhart/MUTN/src/backend"
|
||||
)
|
||||
|
||||
// ANSI color constants used only in this file
|
||||
// global 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(back.AnsiBold + "\nMUTN | Copyright (c) 2024-2025 Randall Winkhart\n" + back.AnsiReset + `
|
||||
fmt.Print(AnsiBold + "\nMUTN | Copyright (c) 2024 Randall Winkhart\n" + backend.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.
|
||||
|
||||
` + back.AnsiBold + "Usage:" + back.AnsiReset + ` mutn [/<entry name> [argument] [option]] | [argument]
|
||||
` + AnsiBold + "Usage:" + backend.AnsiReset + ` mutn [/<entry name> [argument] [option]] | [argument]
|
||||
|
||||
` + back.AnsiBold + "Arguments:" + back.AnsiReset + `
|
||||
` + AnsiBold + "Arguments:" + backend.AnsiReset + `
|
||||
help Bring up this 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
|
||||
@@ -33,7 +31,7 @@ This program comes with absolutely no warranty; type "mutn version" for details.
|
||||
shear Delete an existing entry
|
||||
sync Manually sync the entry directory
|
||||
|
||||
` + back.AnsiBold + "Options:" + back.AnsiReset + `
|
||||
` + AnsiBold + "Options:" + backend.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
|
||||
@@ -54,17 +52,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
|
||||
|
||||
` + back.AnsiBold + "Tip 1:" + back.AnsiReset + ` You can quickly read an entry with "mutn /<entry name>"
|
||||
` + back.AnsiBold + "Tip 2:" + back.AnsiReset + ` Type "mutn" (no arguments/options) to view a list of saved entries
|
||||
` + back.AnsiBold + "Tip 3:" + back.AnsiReset + ` Provide "add", "edit", "copy", or "gen" as the only argument to receive more specific help
|
||||
` + back.AnsiBold + "Tip 4:" + back.AnsiReset + " Using \"add\", \"edit\", or \"copy\" without specifying an option (field) will default to \"password\"\n\n")
|
||||
` + 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")
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
func HelpAdd() {
|
||||
fmt.Print(back.AnsiBold + "\nUsage:" + back.AnsiReset + ` mutn /<entry name> add <option>
|
||||
fmt.Print(AnsiBold + "\nUsage:" + backend.AnsiReset + ` mutn /<entry name> add <option>
|
||||
|
||||
` + back.AnsiBold + "Options:" + back.AnsiReset + `
|
||||
` + AnsiBold + "Options:" + backend.AnsiReset + `
|
||||
add:
|
||||
password|-pw|<blank> Add a password entry
|
||||
note|-n Add a note entry
|
||||
@@ -73,9 +71,9 @@ func HelpAdd() {
|
||||
}
|
||||
|
||||
func HelpEdit() {
|
||||
fmt.Print(back.AnsiBold + "\nUsage:" + back.AnsiReset + ` mutn /<entry name> edit <option>
|
||||
fmt.Print(AnsiBold + "\nUsage:" + backend.AnsiReset + ` mutn /<entry name> edit <option>
|
||||
|
||||
` + back.AnsiBold + "Options:" + back.AnsiReset + `
|
||||
` + AnsiBold + "Options:" + backend.AnsiReset + `
|
||||
edit:
|
||||
password|-pw|<blank> Change the password in an entry
|
||||
username|-u Change the username in an entry
|
||||
@@ -87,9 +85,9 @@ func HelpEdit() {
|
||||
}
|
||||
|
||||
func HelpCopy() {
|
||||
fmt.Print(back.AnsiBold + "\nUsage:" + back.AnsiReset + ` mutn /<entry name> copy <option>
|
||||
fmt.Print(AnsiBold + "\nUsage:" + backend.AnsiReset + ` mutn /<entry name> copy <option>
|
||||
|
||||
` + back.AnsiBold + "Options:" + back.AnsiReset + `
|
||||
` + AnsiBold + "Options:" + backend.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
|
||||
@@ -100,18 +98,18 @@ func HelpCopy() {
|
||||
}
|
||||
|
||||
func HelpGen() {
|
||||
fmt.Print(back.AnsiBold + "\nUsage:" + back.AnsiReset + ` mutn /<entry name> gen [option]
|
||||
fmt.Print(AnsiBold + "\nUsage:" + backend.AnsiReset + ` mutn /<entry name> gen [option]
|
||||
|
||||
` + back.AnsiBold + "Options:" + back.AnsiReset + `
|
||||
` + AnsiBold + "Options:" + backend.AnsiReset + `
|
||||
gen:
|
||||
update|-u Generate a password for an existing entry
|
||||
|
||||
` + back.AnsiBold + "Tip:" + back.AnsiReset + " If no options are provided, a new password entry is generated\n\n")
|
||||
` + AnsiBold + "Tip:" + backend.AnsiReset + " If no options are provided, a new password entry is generated\n\n")
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
func MITLicense() {
|
||||
fmt.Print(back.AnsiBold + "\n MIT License" + back.AnsiReset + `
|
||||
fmt.Print(AnsiBold + "\n MIT License" + backend.AnsiReset + `
|
||||
|
||||
Permission is hereby granted, free of charge, to any
|
||||
person obtaining a copy of this software and associated
|
||||
@@ -143,20 +141,18 @@ 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 + "♥♥♥♥" + back.AnsiReset + " .''.''/()\\ _)\n" +
|
||||
" _. : * " + ansiVersionMeat + "♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥" + back.AnsiReset + " * : <[◎]|_|=\n" +
|
||||
" }-}-*] `..'..' " + ansiVersionMeat + "♥♥♥♥♥♥♥♥♥♥♥♥♥" + back.AnsiReset + " `..'..' |\n" +
|
||||
" ◎-◎ // \\\\ " + ansiVersionMeat + "♥♥♥♥♥♥♥♥♥" + back.AnsiReset + " // \\\\ /|\\\n" +
|
||||
" /()\\''.''. " + ansiVersionMeat + "♥♥♥♥" + backend.AnsiReset + " .''.''/()\\ _)\n" +
|
||||
" _. : * " + ansiVersionMeat + "♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥" + backend.AnsiReset + " * : <[◎]|_|=\n" +
|
||||
" }-}-*] `..'..' " + ansiVersionMeat + "♥♥♥♥♥♥♥♥♥♥♥♥♥" + backend.AnsiReset + " `..'..' |\n" +
|
||||
" ◎-◎ // \\\\ " + ansiVersionMeat + "♥♥♥♥♥♥♥♥♥" + backend.AnsiReset + " // \\\\ /|\\\n" +
|
||||
ansiVersionOutline + "<><><><><><><><><><><><><><>-<><><><><><><><><><><><><><>\n" +
|
||||
"\\" + ansiBlackOnWhite + " " + back.AnsiReset + ansiVersionOutline + "/\n" +
|
||||
"\\" + ansiBlackOnWhite + " MUTN v" + MUTNVersion + " " + back.AnsiReset + ansiVersionOutline + "/\n" +
|
||||
"\\" + ansiBlackOnWhite + " The Cryptic Cuts Update " + back.AnsiReset + ansiVersionOutline + "/\n" +
|
||||
"\\" + ansiBlackOnWhite + " " + back.AnsiReset + ansiVersionOutline + "/\n" +
|
||||
"\\" + ansiBlackOnWhite + " Built with libmutton v" + global.LibmuttonVersion + " " + back.AnsiReset + ansiVersionOutline + "/\n" +
|
||||
"\\" + ansiBlackOnWhite + " " + back.AnsiReset + ansiVersionOutline + "/\n" +
|
||||
"\\" + ansiBlackOnWhite + " Copyright (c) 2024-2025: Randall Winkhart " + back.AnsiReset + ansiVersionOutline + "/\n" +
|
||||
"\\" + ansiBlackOnWhite + " " + back.AnsiReset + ansiVersionOutline + "/\n" +
|
||||
"<><><><><><><><><><><><><><>-<><><><><><><><><><><><><><>\n" + back.AnsiReset +
|
||||
"\\" + ansiBlackOnWhite + " " + backend.AnsiReset + ansiVersionOutline + "/\n" +
|
||||
"\\" + ansiBlackOnWhite + " MUTN Version " + backend.LibmuttonVersion + " " + backend.AnsiReset + ansiVersionOutline + "/\n" +
|
||||
"\\" + ansiBlackOnWhite + " The Tripe Transmission 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 +
|
||||
"\n For more information, see:\n\n" +
|
||||
" https://github.com/rwinkhart/MUTN\n" +
|
||||
" https://github.com/rwinkhart/libmutton\n\n")
|
||||
|
||||
+71
-32
@@ -1,45 +1,84 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/rwinkhart/go-boilerplate/back"
|
||||
"github.com/rwinkhart/go-boilerplate/front"
|
||||
"github.com/rwinkhart/go-boilerplate/other"
|
||||
"github.com/rwinkhart/libmutton/core"
|
||||
"github.com/rwinkhart/libmutton/synccycles"
|
||||
"github.com/rwinkhart/MUTN/src/backend"
|
||||
"golang.org/x/crypto/ssh/terminal"
|
||||
)
|
||||
|
||||
// inputPasswordGen prompts the user for password generation parameters and returns a generated password as a string.
|
||||
func inputPasswordGen() string {
|
||||
passLength := front.InputInt("Password length:", 1, -1)
|
||||
fmt.Println()
|
||||
passCharset := uint8(front.InputMenuGen("Password complexity:", []string{"Simple", "Complex", "Ultra Complex (not compatible with many services)"}))
|
||||
var complexity float64
|
||||
switch passCharset {
|
||||
case 1:
|
||||
complexity = 0 // simple
|
||||
// 1 indicates string gen for filenames, but since complexity is 0, only the base charset is used
|
||||
default:
|
||||
complexity = 0.2 // (ultra) complex
|
||||
// 2 and 3 indicate complex and ultra complex charsets, respectively
|
||||
}
|
||||
return synccycles.StringGen(passLength, complexity, passCharset)
|
||||
// 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
|
||||
}
|
||||
|
||||
// writeEntryCLI writes an entry to targetLocation and previews it (errors if no data is supplied).
|
||||
func writeEntryCLI(targetLocation string, decryptedEntry []string, hideSecrets bool) {
|
||||
if core.EntryIsNotEmpty(decryptedEntry) {
|
||||
// write the entry to the target location
|
||||
err := core.WriteEntry(targetLocation, []byte(strings.Join(decryptedEntry, "\n")))
|
||||
if err != nil {
|
||||
other.PrintError("Failed to write entry: "+err.Error(), back.ErrorWrite)
|
||||
// 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)
|
||||
fmt.Println()
|
||||
return password
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
// preview the entry
|
||||
fmt.Println(back.AnsiBold + "\nEntry Preview:" + back.AnsiReset)
|
||||
EntryReader(decryptedEntry, hideSecrets, true)
|
||||
} else {
|
||||
other.PrintError("No data supplied for entry", back.ErrorTargetNotFound)
|
||||
}
|
||||
}
|
||||
|
||||
// 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, hideSecrets, verifyEntryDoesNotExist bool) {
|
||||
if backend.EntryIsNotEmpty(unencryptedEntry) {
|
||||
// write the entry to the target location
|
||||
backend.WriteEntry(targetLocation, unencryptedEntry, verifyEntryDoesNotExist)
|
||||
// preview the entry
|
||||
fmt.Println(AnsiBold + "\nEntry Preview:" + backend.AnsiReset)
|
||||
EntryReader(unencryptedEntry, hideSecrets, true)
|
||||
} else {
|
||||
fmt.Println(backend.AnsiError + "No data supplied for entry" + backend.AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
// expandPathWithHome, given a path (as a string) containing "~", returns the path with "~" expanded to the user's home directory
|
||||
func expandPathWithHome(path string) string {
|
||||
return strings.Replace(path, "~", backend.Home, 1)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package sync
|
||||
|
||||
import "github.com/rwinkhart/MUTN/src/backend"
|
||||
|
||||
// define field separator constants
|
||||
const (
|
||||
FSSpace = "\u259d" // ▝ space/list separator
|
||||
FSPath = "\u259e" // ▞ path separator
|
||||
FSMisc = "\u259f" // ▟ misc. field separator (if \u259d is already used)
|
||||
)
|
||||
|
||||
// rootLength stores length of backend.EntryRoot string
|
||||
var rootLength = len(backend.EntryRoot)
|
||||
@@ -0,0 +1,477 @@
|
||||
package sync
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/sftp"
|
||||
"github.com/rwinkhart/MUTN/src/backend"
|
||||
"golang.org/x/crypto/ssh"
|
||||
"golang.org/x/crypto/ssh/knownhosts"
|
||||
)
|
||||
|
||||
// global constants used only in this file
|
||||
const (
|
||||
ansiDelete = "\033[38;5;1m"
|
||||
ansiDownload = "\033[38;5;2m"
|
||||
ansiUpload = "\033[38;5;4m"
|
||||
)
|
||||
|
||||
// getSSHClient returns an SSH client connection to the server (also returns the remote EntryRoot as a string and the server's OS as a bool - IsWindows)
|
||||
// only supports key-based authentication (passphrases are supported for CLI-based implementations)
|
||||
func getSSHClient(manualSync bool) (*ssh.Client, string, bool) {
|
||||
// get SSH config info, exit if not configured (displaying an error if the sync job was called manually)
|
||||
var sshUserConfig []string
|
||||
var missingValueError string
|
||||
if manualSync {
|
||||
missingValueError = joinErrorWithEXE("SSH settings not configured - run \"", " init\" to configure")
|
||||
} else {
|
||||
missingValueError = "0"
|
||||
}
|
||||
sshUserConfig = backend.ParseConfig([][2]string{{"LIBMUTTON", "sshUser"}, {"LIBMUTTON", "sshIP"}, {"LIBMUTTON", "sshPort"}, {"LIBMUTTON", "sshKey"}, {"LIBMUTTON", "sshKeyProtected"}, {"LIBMUTTON", "sshEntryRoot"}, {"LIBMUTTON", "sshIsWindows"}}, missingValueError)
|
||||
|
||||
var user, ip, port, keyFile, keyFileProtected, entryRoot string
|
||||
var isWindows bool
|
||||
for i, key := range sshUserConfig {
|
||||
switch i {
|
||||
case 0:
|
||||
user = key
|
||||
case 1:
|
||||
ip = key
|
||||
case 2:
|
||||
port = key
|
||||
case 3:
|
||||
keyFile = key
|
||||
case 4:
|
||||
keyFileProtected = key
|
||||
case 5:
|
||||
entryRoot = key
|
||||
case 6:
|
||||
isWindows, _ = strconv.ParseBool(key)
|
||||
}
|
||||
}
|
||||
|
||||
// read private key
|
||||
key, err := os.ReadFile(keyFile)
|
||||
if err != nil {
|
||||
fmt.Println(backend.AnsiError+"Sync failed - unable to read private key file:", keyFile+backend.AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// parse private key
|
||||
var parsedKey ssh.Signer
|
||||
if keyFileProtected != "true" {
|
||||
parsedKey, err = ssh.ParsePrivateKey(key)
|
||||
} else {
|
||||
parsedKey, err = ssh.ParsePrivateKeyWithPassphrase(key, inputKeyFilePassphrase())
|
||||
}
|
||||
if err != nil {
|
||||
fmt.Println(backend.AnsiError+"Sync failed - Unable to parse private key:", keyFile+backend.AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// read known hosts file
|
||||
hostKeyCallback, err := knownhosts.New(backend.Home + backend.PathSeparator + ".ssh" + backend.PathSeparator + "known_hosts")
|
||||
if err != nil {
|
||||
fmt.Println(backend.AnsiError + "Sync failed - Unable to read known hosts file:" + err.Error() + backend.AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// configure SSH client
|
||||
sshConfig := &ssh.ClientConfig{
|
||||
User: user,
|
||||
Auth: []ssh.AuthMethod{
|
||||
ssh.PublicKeys(parsedKey),
|
||||
},
|
||||
HostKeyCallback: hostKeyCallback,
|
||||
}
|
||||
|
||||
// connect to SSH server
|
||||
sshClient, err := ssh.Dial("tcp", ip+":"+port, sshConfig)
|
||||
if err != nil {
|
||||
fmt.Println(backend.AnsiError+"Sync failed - Unable to connect to remote server:", err.Error()+backend.AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
return sshClient, entryRoot, isWindows
|
||||
}
|
||||
|
||||
// GetSSHOutput runs a command over SSH and returns the output as a string
|
||||
// TODO run getSSHClient() only ONCE (from RunJob) - this saves re-creating the client AND prevents prompting for keyfile passphrase multiple times
|
||||
func GetSSHOutput(cmd, stdin string, manualSync bool) string {
|
||||
sshClient, _, _ := getSSHClient(manualSync)
|
||||
defer sshClient.Close()
|
||||
|
||||
// create a session
|
||||
sshSession, err := sshClient.NewSession()
|
||||
if err != nil {
|
||||
fmt.Println(backend.AnsiError+"Sync failed - Unable to establish SSH session:", err.Error()+backend.AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// provide stdin data for session
|
||||
sshSession.Stdin = strings.NewReader(stdin)
|
||||
|
||||
// run the provided command
|
||||
var output []byte
|
||||
output, err = sshSession.CombinedOutput(cmd)
|
||||
if err != nil {
|
||||
fmt.Println(backend.AnsiError+"Sync failed - Unable to run SSH command:", err.Error()+backend.AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// convert the output to a string and remove leading/trailing whitespace
|
||||
outputString := string(output)
|
||||
outputString = strings.TrimSpace(outputString)
|
||||
|
||||
return outputString
|
||||
}
|
||||
|
||||
// getRemoteDataFromClient returns a map of remote entries to their modification times, a list of remote folders, a list of queued deletions, and the current server+client times as UNIX timestamps
|
||||
func getRemoteDataFromClient(manualSync bool) (map[string]int64, []string, []string, int64, int64) {
|
||||
// get remote output over SSH
|
||||
clientDeviceID, _ := os.ReadDir(backend.ConfigDir + backend.PathSeparator + "devices")
|
||||
if len(clientDeviceID) == 0 {
|
||||
if manualSync {
|
||||
fmt.Println(joinErrorWithEXE("Sync failed - No device ID found; run \"", " init\" to generate a device ID"))
|
||||
os.Exit(1)
|
||||
} else {
|
||||
backend.Exit(0) // exit silently if the sync job was called automatically, as the user may just be in offline mode
|
||||
}
|
||||
}
|
||||
clientTime := time.Now().Unix() // get client time now to avoid accuracy issues caused by unpredictable sync time
|
||||
output := GetSSHOutput("libmuttonserver fetch", clientDeviceID[0].Name(), manualSync)
|
||||
|
||||
// split output into slice based on occurrences of FSSpace
|
||||
outputSlice := strings.Split(output, FSSpace)
|
||||
|
||||
// parse output/re-form lists
|
||||
if len(outputSlice) != 5 { // ensure information from server is complete
|
||||
fmt.Println(backend.AnsiError + "Sync failed - Unable to fetch remote data; server returned an unexpected response" + backend.AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
serverTime, _ := strconv.ParseInt(outputSlice[0], 10, 64)
|
||||
entries := strings.Split(outputSlice[1], FSMisc)[1:]
|
||||
modsStrings := strings.Split(outputSlice[2], FSMisc)[1:]
|
||||
folders := strings.Split(outputSlice[3], FSMisc)[1:]
|
||||
deletions := strings.Split(outputSlice[4], FSMisc)[1:]
|
||||
|
||||
// convert the mod times to int64
|
||||
var mods []int64
|
||||
for _, modString := range modsStrings {
|
||||
mod, _ := strconv.ParseInt(modString, 10, 64)
|
||||
mods = append(mods, mod)
|
||||
}
|
||||
|
||||
// map remote entries to their modification times
|
||||
entryModMap := make(map[string]int64)
|
||||
for i, entry := range entries {
|
||||
entryModMap[entry] = mods[i]
|
||||
}
|
||||
|
||||
return entryModMap, folders, deletions, serverTime, clientTime
|
||||
}
|
||||
|
||||
// getLocalData returns a map of local entries to their modification times
|
||||
func getLocalData() map[string]int64 {
|
||||
// get a list of all entries
|
||||
entries, _ := WalkEntryDir()
|
||||
|
||||
// get a list of all entry modification times
|
||||
modList := getModTimes(entries)
|
||||
|
||||
// map the entries to their modification times
|
||||
entryModMap := make(map[string]int64)
|
||||
for i, entry := range entries {
|
||||
entryModMap[entry] = modList[i]
|
||||
}
|
||||
|
||||
// return the lists
|
||||
return entryModMap
|
||||
}
|
||||
|
||||
// targetLocationFormatSFTP formats the target location to match the remote server's entry directory and path separator
|
||||
func targetLocationFormatSFTP(targetName, serverEntryRoot string, serverIsWindows bool) string {
|
||||
if !serverIsWindows {
|
||||
return serverEntryRoot + targetName
|
||||
} else {
|
||||
return serverEntryRoot + strings.ReplaceAll(targetName, "/", "\\")
|
||||
}
|
||||
}
|
||||
|
||||
// sftpSync takes two slices of entries (one for downloads and one for uploads) and syncs them between the client and server using SFTP
|
||||
func sftpSync(downloadList, uploadList []string, manualSync bool) {
|
||||
// establish an SSH connection for transfers
|
||||
sshClient, sshEntryRoot, sshIsWindows := getSSHClient(manualSync)
|
||||
defer sshClient.Close()
|
||||
|
||||
// create an SFTP client
|
||||
sftpClient, err := sftp.NewClient(sshClient)
|
||||
if err != nil {
|
||||
fmt.Println(backend.AnsiError+"Sync failed - Unable to establish SFTP session:", err.Error()+backend.AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
defer sftpClient.Close()
|
||||
|
||||
// iterate over the download list
|
||||
var filesTransferred bool
|
||||
for _, entryName := range downloadList {
|
||||
filesTransferred = true // set a flag to indicate that files have been downloaded (used to determine whether to print a gap between download and upload messages)
|
||||
|
||||
fmt.Println("Downloading " + ansiDownload + entryName + backend.AnsiReset)
|
||||
|
||||
// store path to remote entry
|
||||
remoteEntryFullPath := targetLocationFormatSFTP(entryName, sshEntryRoot, sshIsWindows)
|
||||
|
||||
// save modification time of remote file
|
||||
var fileInfo os.FileInfo
|
||||
fileInfo, err = sftpClient.Stat(remoteEntryFullPath)
|
||||
if err != nil {
|
||||
fmt.Println(backend.AnsiError+"Sync failed - Unable to get remote file info (mod time):", err.Error()+backend.AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
modTime := fileInfo.ModTime()
|
||||
|
||||
// open remote file
|
||||
var remoteFile *sftp.File
|
||||
remoteFile, err = sftpClient.Open(remoteEntryFullPath)
|
||||
if err != nil {
|
||||
fmt.Println(backend.AnsiError+"Sync failed - Unable to open remote file:", err.Error()+backend.AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// store path to local entry
|
||||
localEntryFullPath := backend.TargetLocationFormat(entryName)
|
||||
|
||||
// create local file
|
||||
var localFile *os.File
|
||||
localFile, err = os.Create(localEntryFullPath)
|
||||
if err != nil {
|
||||
fmt.Println(backend.AnsiError+"Sync failed - Unable to create local file:", err.Error()+backend.AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// download the file
|
||||
_, err = remoteFile.WriteTo(localFile)
|
||||
if err != nil {
|
||||
fmt.Println(backend.AnsiError+"Sync failed - Unable to download remote file:", err.Error()+backend.AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// close the files
|
||||
remoteFile.Close()
|
||||
localFile.Close()
|
||||
|
||||
// set the modification time of the local file to match the value saved from the remote file (from before the download)
|
||||
err = os.Chtimes(localEntryFullPath, time.Now(), modTime)
|
||||
}
|
||||
|
||||
if filesTransferred {
|
||||
fmt.Println() // add a gap between download and upload messages
|
||||
}
|
||||
|
||||
// iterate over the upload list
|
||||
filesTransferred = false
|
||||
for _, entryName := range uploadList {
|
||||
filesTransferred = true // set a flag to indicate that files have been uploaded (used to determine whether to print a gap between upload and sync complete messages)
|
||||
|
||||
fmt.Println("Uploading " + ansiUpload + entryName + backend.AnsiReset)
|
||||
|
||||
// store path to local entry
|
||||
localEntryFullPath := backend.TargetLocationFormat(entryName)
|
||||
|
||||
// save modification time of local file
|
||||
var fileInfo os.FileInfo
|
||||
fileInfo, err = os.Stat(localEntryFullPath)
|
||||
if err != nil {
|
||||
fmt.Println(backend.AnsiError+"Sync failed - Unable to get local file info (mod time):", err.Error()+backend.AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
modTime := fileInfo.ModTime()
|
||||
|
||||
// open local file
|
||||
var localFile *os.File
|
||||
localFile, err = os.Open(localEntryFullPath)
|
||||
if err != nil {
|
||||
fmt.Println(backend.AnsiError+"Sync failed - Unable to open local file:", err.Error()+backend.AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// store path to remote entry
|
||||
remoteEntryFullPath := targetLocationFormatSFTP(entryName, sshEntryRoot, sshIsWindows)
|
||||
|
||||
// create remote file
|
||||
var remoteFile *sftp.File
|
||||
remoteFile, err = sftpClient.Create(remoteEntryFullPath)
|
||||
if err != nil {
|
||||
fmt.Println(backend.AnsiError+"Sync failed - Unable to create remote file ("+remoteEntryFullPath+"):", err.Error()+backend.AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// upload the file
|
||||
_, err = localFile.WriteTo(remoteFile)
|
||||
if err != nil {
|
||||
fmt.Println(backend.AnsiError+"Sync failed - Unable to upload local file:", err.Error()+backend.AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// close the files
|
||||
localFile.Close()
|
||||
remoteFile.Close()
|
||||
|
||||
// set the modification time of the remote file to match the value saved from the local file (from before the upload)
|
||||
err = sftpClient.Chtimes(remoteEntryFullPath, time.Now(), modTime)
|
||||
}
|
||||
|
||||
if filesTransferred {
|
||||
fmt.Println() // add a gap between upload and sync complete messages
|
||||
}
|
||||
}
|
||||
|
||||
// syncLists determines which entries need to be downloaded and uploaded for synchronizations and calls sftpSync with this information
|
||||
// using maps means that syncing will be done in an arbitrary order, but it is a worthy tradeoff for speed and simplicity
|
||||
func syncLists(localEntryModMap, remoteEntryModMap map[string]int64, manualSync bool, serverTime int64, clientTime int64) {
|
||||
// initialize slices to store entries that need to be downloaded or uploaded
|
||||
var downloadList, uploadList []string
|
||||
|
||||
// ensure client and server times are synchronized
|
||||
var timeSynced = true
|
||||
timeDiff := serverTime - clientTime
|
||||
if timeDiff < -45 || timeDiff > 45 {
|
||||
timeSynced = false
|
||||
fmt.Print(backend.AnsiError + "Client and server clocks are out of sync.\n\nPlease ensure both clocks are correct before attempting to sync again.\n\nA dry sync output will be printed below (if any operations would have been performed). It is strongly recommended to review it and manually update the modification times as applicable to ensure the correct version of each entry is kept.\n\nIf the client's clock is at fault, update the modification times of any entries pending upload, even if the correct (upload) operation is being performed on them. Failure to do so could result in entries being uploaded to the server with the incorrect modification times (could result in data loss).\n\n" + backend.AnsiReset)
|
||||
}
|
||||
|
||||
// iterate over client entries
|
||||
for entry, localModTime := range localEntryModMap {
|
||||
// check if the entry is present in the server map
|
||||
if remoteModTime, present := remoteEntryModMap[entry]; present {
|
||||
// entry exists on both client and server, compare mod times
|
||||
if remoteModTime > localModTime {
|
||||
fmt.Println(ansiDownload+entry+backend.AnsiReset, "is newer on server, adding to download list")
|
||||
downloadList = append(downloadList, entry)
|
||||
} else if remoteModTime < localModTime {
|
||||
fmt.Println(ansiUpload+entry+backend.AnsiReset, "is newer on client, adding to upload list")
|
||||
uploadList = append(uploadList, entry)
|
||||
}
|
||||
// remove entry from remoteEntryModMap (process of elimination)
|
||||
delete(remoteEntryModMap, entry)
|
||||
} else {
|
||||
fmt.Println(ansiUpload+entry+backend.AnsiReset, "does not exist on server, adding to upload list")
|
||||
uploadList = append(uploadList, entry)
|
||||
}
|
||||
}
|
||||
|
||||
// iterate over remaining entries in remoteEntryModMap
|
||||
for entry := range remoteEntryModMap {
|
||||
fmt.Println(ansiDownload+entry+backend.AnsiReset, "does not exist on client, adding to download list")
|
||||
downloadList = append(downloadList, entry)
|
||||
}
|
||||
|
||||
// call sftpSync with the download and upload lists
|
||||
if timeSynced && (max(len(downloadList), len(uploadList)) > 0) { // only call sftpSync if there are entries to download or upload
|
||||
fmt.Println() // add a gap between list-add messages and the actual sync messages from sftpSync
|
||||
sftpSync(downloadList, uploadList, manualSync)
|
||||
} else if !timeSynced {
|
||||
// do not call sftpSync if the client and server times are out of sync
|
||||
backend.Exit(1)
|
||||
}
|
||||
|
||||
fmt.Println("Client is synchronized with server")
|
||||
}
|
||||
|
||||
// deletionSync removes entries from the client that have been deleted on the server (multi-client deletion)
|
||||
func deletionSync(deletions []string) {
|
||||
var filesDeleted bool
|
||||
for _, deletion := range deletions {
|
||||
filesDeleted = true // set a flag to indicate that files have been deleted (used to determine whether to print a gap between deletion and other messages)
|
||||
fmt.Println(ansiDelete+deletion+backend.AnsiReset, "has been sheared, removing locally (if it exists)")
|
||||
os.RemoveAll(backend.TargetLocationFormat(deletion))
|
||||
}
|
||||
|
||||
if filesDeleted {
|
||||
fmt.Println() // add a gap between deletion and other messages
|
||||
}
|
||||
}
|
||||
|
||||
// ShearRemoteFromClient removes the target file or directory from the local system and calls the server to remove it remotely and add it to the deletions list
|
||||
// can safely be called in offline mode, as well, so this is the intended interface for shearing (ShearLocal should only be used directly by the server binary)
|
||||
func ShearRemoteFromClient(targetLocationIncomplete string) {
|
||||
deviceID := ShearLocal(targetLocationIncomplete, "") // remove the target from the local system and get the device ID of the client
|
||||
|
||||
if deviceID != "" { // ensure a device ID exists (online mode)
|
||||
// call the server to remotely shear the target and add it to the deletions list
|
||||
GetSSHOutput("libmuttonserver shear", deviceID+"\n"+
|
||||
strings.ReplaceAll(targetLocationIncomplete, backend.PathSeparator, FSPath), false)
|
||||
}
|
||||
|
||||
backend.Exit(0) // sync is not required after shearing since the target has already been removed from the local system
|
||||
}
|
||||
|
||||
// RenameRemoteFromClient renames oldLocationIncomplete to newLocationIncomplete on the local system and calls the server to perform the rename remotely and add the old target to the deletions list
|
||||
// can safely be called in offline mode, as well, so this is the intended interface for renaming (RenameLocal should only be used directly by the server binary)
|
||||
func RenameRemoteFromClient(oldLocationIncomplete, newLocationIncomplete string) {
|
||||
RenameLocal(oldLocationIncomplete, newLocationIncomplete, false) // move the target on the local system
|
||||
|
||||
deviceIDList := genDeviceIDList()
|
||||
if len(*deviceIDList) > 0 { // ensure a device ID exists (online mode)
|
||||
// call the server to move the target on the remote system and add the old target to the deletions list
|
||||
GetSSHOutput("libmuttonserver rename",
|
||||
(*deviceIDList)[0].Name()+"\n"+
|
||||
strings.ReplaceAll(oldLocationIncomplete, backend.PathSeparator, FSPath)+"\n"+
|
||||
strings.ReplaceAll(newLocationIncomplete, backend.PathSeparator, FSPath), false)
|
||||
}
|
||||
|
||||
backend.Exit(0)
|
||||
}
|
||||
|
||||
// AddFolderRemoteFromClient creates a new entry-containing directory on the local system and calls the server to create the folder remotely
|
||||
// can safely be called in offline mode, as well, so this is the intended interface for adding folders (AddFolderLocal should only be used directly by the server binary)
|
||||
func AddFolderRemoteFromClient(targetLocationIncomplete string) {
|
||||
AddFolderLocal(targetLocationIncomplete) // add the folder on the local system
|
||||
GetSSHOutput("libmuttonserver addfolder", strings.ReplaceAll(targetLocationIncomplete, backend.PathSeparator, FSPath), false) // call the server to create the folder remotely
|
||||
|
||||
backend.Exit(0)
|
||||
}
|
||||
|
||||
// folderSync creates folders on the client (from the given list of folder names)
|
||||
func folderSync(folders []string) {
|
||||
for _, folder := range folders {
|
||||
// store the full local path of the folder
|
||||
folderFullPath := backend.TargetLocationFormat(folder)
|
||||
|
||||
// check if folder already exists
|
||||
isFile, isAccessible := backend.TargetIsFile(folderFullPath, false, 1)
|
||||
|
||||
if !isFile && !isAccessible {
|
||||
os.MkdirAll(folderFullPath, 0700)
|
||||
} else if isFile {
|
||||
fmt.Println(backend.AnsiError + "Sync failed - Failed to create folder \"" + folder + "\" - a file with the same name already exists" + backend.AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// RunJob runs the SSH sync job
|
||||
func RunJob(manualSync bool) {
|
||||
// fetch remote lists
|
||||
remoteEntryModMap, remoteFolders, deletions, serverTime, clientTime := getRemoteDataFromClient(manualSync)
|
||||
|
||||
// sync folders
|
||||
folderSync(remoteFolders)
|
||||
|
||||
// sync deletions
|
||||
deletionSync(deletions)
|
||||
|
||||
// fetch local lists
|
||||
localEntryModMap := getLocalData()
|
||||
|
||||
// sync new and updated entries
|
||||
syncLists(localEntryModMap, remoteEntryModMap, manualSync, serverTime, clientTime)
|
||||
|
||||
// exit program after successful sync
|
||||
backend.Exit(0)
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package sync
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/rwinkhart/MUTN/src/backend"
|
||||
)
|
||||
|
||||
// getModTimes returns a list of all entry modification times
|
||||
func getModTimes(entryList []string) []int64 {
|
||||
var modList []int64
|
||||
for _, file := range entryList {
|
||||
modTime, _ := os.Stat(backend.TargetLocationFormat(file))
|
||||
modList = append(modList, modTime.ModTime().Unix())
|
||||
}
|
||||
|
||||
return modList
|
||||
}
|
||||
|
||||
// genDeviceIDList returns a pointer to a slice of all registered device IDs
|
||||
func genDeviceIDList() *[]fs.DirEntry {
|
||||
// create a slice of all registered devices
|
||||
deviceIDList, err := os.ReadDir(backend.ConfigDir + backend.PathSeparator + "devices")
|
||||
if err != nil {
|
||||
fmt.Println(backend.AnsiError + "Failed to read the devices directory: " + err.Error() + backend.AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
return &deviceIDList
|
||||
}
|
||||
|
||||
// ShearLocal removes the target file or directory from the local system
|
||||
// returns: deviceID (on client), for use in ShearRemoteFromClient
|
||||
// if the local system is a server, it will also add the target to the deletions list for all clients (except the requesting client)
|
||||
// this function should only be used directly by the server binary
|
||||
func ShearLocal(targetLocationIncomplete, clientDeviceID string) string {
|
||||
// determine if running on a server
|
||||
var onServer bool
|
||||
if clientDeviceID != "" {
|
||||
onServer = true
|
||||
}
|
||||
|
||||
deviceIDList := genDeviceIDList()
|
||||
|
||||
// add the sheared target (incomplete, vanity) to the deletions list (if running on a server)
|
||||
if onServer {
|
||||
for _, device := range *deviceIDList {
|
||||
if device.Name() != clientDeviceID {
|
||||
_, err := os.Create(backend.ConfigDir + backend.PathSeparator + "deletions" + backend.PathSeparator + device.Name() + FSSpace + strings.ReplaceAll(targetLocationIncomplete, "/", FSPath))
|
||||
if err != nil {
|
||||
// do not print error as there is currently no way of seeing server-side errors
|
||||
// failure to add the target to the deletions list will exit the program and result in a client re-uploading the target (non-critical)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// get the full targetLocation path and remove the target
|
||||
targetLocationComplete := backend.TargetLocationFormat(targetLocationIncomplete)
|
||||
if !onServer { // error if target does not exist on client, needed because os.RemoveAll does not return an error if target does not exist
|
||||
backend.TargetIsFile(targetLocationComplete, true, 0)
|
||||
}
|
||||
err := os.RemoveAll(targetLocationComplete)
|
||||
if err != nil {
|
||||
fmt.Println(backend.AnsiError + "Failed to remove local target: " + err.Error() + backend.AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if !onServer && len(*deviceIDList) > 0 { // return the device ID if running on the client and a device ID exists (online mode)
|
||||
return (*deviceIDList)[0].Name()
|
||||
}
|
||||
return ""
|
||||
|
||||
// do not exit program, as this function is used as part of ShearRemoteFromClient
|
||||
}
|
||||
|
||||
// RenameLocal renames oldLocationIncomplete to newLocationIncomplete on the local system
|
||||
// this function should only be used directly by the server binary
|
||||
func RenameLocal(oldLocationIncomplete, newLocationIncomplete string, verifyOldLocationExists bool) {
|
||||
// get full paths for both locations
|
||||
oldLocation := backend.TargetLocationFormat(oldLocationIncomplete)
|
||||
newLocation := backend.TargetLocationFormat(newLocationIncomplete)
|
||||
|
||||
if verifyOldLocationExists {
|
||||
backend.TargetIsFile(oldLocation, true, 0)
|
||||
}
|
||||
|
||||
// ensure newLocation does not exist
|
||||
_, isAccessible := backend.TargetIsFile(newLocation, false, 0)
|
||||
if isAccessible {
|
||||
fmt.Println(backend.AnsiError + "\"" + newLocation + "\" already exists" + backend.AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// rename oldLocation to newLocation
|
||||
err := os.Rename(oldLocation, newLocation)
|
||||
if err != nil {
|
||||
fmt.Println(backend.AnsiError + "Failed to rename - does the target containing directory exist?" + backend.AnsiReset)
|
||||
}
|
||||
|
||||
// do not exit program, as this function is used as part of RenameRemoteFromClient
|
||||
}
|
||||
|
||||
// AddFolderLocal creates a new entry-containing directory on the local system
|
||||
// this function should only be used directly by the server binary
|
||||
func AddFolderLocal(targetLocationIncomplete string) {
|
||||
// get the full targetLocation path and create the target
|
||||
targetLocationComplete := backend.TargetLocationFormat(targetLocationIncomplete)
|
||||
err := os.Mkdir(targetLocationComplete, 0700)
|
||||
if err != nil {
|
||||
if os.IsExist(err) {
|
||||
fmt.Println(backend.AnsiError + "Directory already exists" + backend.AnsiReset)
|
||||
os.Exit(1)
|
||||
} else {
|
||||
fmt.Println(backend.AnsiError + "Failed to create directory: " + err.Error() + backend.AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
// do not exit program, as this function is used as part of AddFolderRemoteFromClient
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
//go:build !windows
|
||||
|
||||
package sync
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/rwinkhart/MUTN/src/backend"
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// WalkEntryDir walks the entry directory and returns lists of all files and directories found (two separate lists)
|
||||
// regardless of platform, all paths are stored with forward slashes (UNIX-style)
|
||||
func WalkEntryDir() ([]string, []string) {
|
||||
// define file/directory containing slices so that they may be accessed by the anonymous WalkDir function
|
||||
var fileList []string
|
||||
var dirList []string
|
||||
|
||||
// walk entry directory
|
||||
_ = filepath.WalkDir(backend.EntryRoot,
|
||||
func(fullPath string, entry fs.DirEntry, err error) error {
|
||||
|
||||
// check for errors encountered while walking directory
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
fmt.Println(backend.AnsiError+"The entry directory does not exist - run \""+os.Args[0], "init"+"\" to create it"+backend.AnsiReset)
|
||||
} else {
|
||||
// otherwise, print the source of the error
|
||||
fmt.Println(backend.AnsiError + "An 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:]
|
||||
|
||||
// append the path to the appropriate slice
|
||||
if !entry.IsDir() {
|
||||
fileList = append(fileList, trimmedPath)
|
||||
} else {
|
||||
dirList = append(dirList, trimmedPath)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
return fileList, dirList
|
||||
}
|
||||
|
||||
// joinErrorWithEXE joins and returns the two strings it is provided (in error format) with the executable name inserted between them
|
||||
func joinErrorWithEXE(firstHalf, secondHalf string) string {
|
||||
return backend.AnsiError + firstHalf + os.Args[0] + secondHalf + backend.AnsiReset
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
//go:build windows
|
||||
|
||||
package sync
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/rwinkhart/MUTN/src/backend"
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// WalkEntryDir walks the entry directory and returns lists of all files and directories found (two separate lists)
|
||||
// regardless of platform, all paths are stored with forward slashes (UNIX-style)
|
||||
func WalkEntryDir() ([]string, []string) {
|
||||
// define file/directory containing slices so that they may be accessed by the anonymous WalkDir function
|
||||
var fileList []string
|
||||
var dirList []string
|
||||
|
||||
// walk entry directory
|
||||
_ = filepath.WalkDir(backend.EntryRoot,
|
||||
func(fullPath string, entry fs.DirEntry, err error) error {
|
||||
|
||||
// check for errors encountered while walking directory
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
fmt.Println(joinErrorWithEXE("The entry directory does not exist - run \"", " init"+"\" to create it"))
|
||||
} else {
|
||||
// otherwise, print the source of the error
|
||||
fmt.Println(backend.AnsiError + "An unexpected error occurred while generating the entry list: " + err.Error() + backend.AnsiReset)
|
||||
}
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// trim root path from each path before storing and replace backslashes with forward slashes
|
||||
trimmedPath := strings.ReplaceAll(fullPath[rootLength:], "\\", "/")
|
||||
|
||||
// append the path to the appropriate slice
|
||||
if !entry.IsDir() {
|
||||
fileList = append(fileList, trimmedPath)
|
||||
} else {
|
||||
dirList = append(dirList, trimmedPath)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
return fileList, dirList
|
||||
}
|
||||
|
||||
// joinErrorWithEXE joins and returns the two strings it is provided (in error format) with the executable name inserted between them
|
||||
func joinErrorWithEXE(firstHalf, secondHalf string) string {
|
||||
return backend.AnsiError + firstHalf + os.Args[0][strings.LastIndex(os.Args[0], "\\")+1:] + secondHalf + backend.AnsiReset
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package sync
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/rwinkhart/MUTN/src/backend"
|
||||
)
|
||||
|
||||
// DeviceIDGen generates a new client device ID and registers it with the server
|
||||
// device IDs are only needed for online synchronization
|
||||
// device IDs are guaranteed unique as the current UNIX time is appended to them
|
||||
// returns the remote EntryRoot and OS type (OS type is a bool: backend.IsWindows)
|
||||
func DeviceIDGen() (string, string) {
|
||||
deviceIDPrefix, _ := os.Hostname()
|
||||
deviceIDSuffix := backend.StringGen(rand.Intn(32)+48, true, 0.2, true) + "-" + strconv.FormatInt(time.Now().Unix(), 10)
|
||||
deviceID := deviceIDPrefix + "-" + deviceIDSuffix
|
||||
_, err := os.Create(backend.ConfigDir + backend.PathSeparator + "devices" + backend.PathSeparator + deviceID) // TODO remove existing device ID file if it exists (from both client and server)
|
||||
if err != nil {
|
||||
fmt.Println(backend.AnsiError + "Failed to create local device ID file: " + err.Error() + backend.AnsiReset)
|
||||
}
|
||||
|
||||
// register device ID with server and fetch remote EntryRoot and OS type
|
||||
//manualSync is true so the user is alerted if device ID registration fails
|
||||
sshEntryRootSSHIsWindows := strings.Split(GetSSHOutput("libmuttonserver register", deviceID, true), FSSpace)
|
||||
|
||||
return sshEntryRootSSHIsWindows[0], sshEntryRootSSHIsWindows[1]
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package sync
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"golang.org/x/crypto/ssh/terminal"
|
||||
"os"
|
||||
)
|
||||
|
||||
// inputKeyFilePassphrase prompts the user for a passphrase for an SSH key file
|
||||
// TODO support non-CLI implementations
|
||||
func inputKeyFilePassphrase() []byte {
|
||||
fmt.Print("\nEnter passphrase for your SSH keyfile: ")
|
||||
passphrase, _ := terminal.ReadPassword(int(os.Stdin.Fd()))
|
||||
fmt.Println()
|
||||
return passphrase
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package sync
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/rwinkhart/MUTN/src/backend"
|
||||
)
|
||||
|
||||
// GetRemoteDataFromServer prints to stdout the remote entries, mod times, folders, and deletions
|
||||
// lists in output are separated by FSSpace
|
||||
// output is meant to be captured over SSH for interpretation by the client
|
||||
func GetRemoteDataFromServer(clientDeviceID string) {
|
||||
entryList, dirList := WalkEntryDir()
|
||||
modList := getModTimes(entryList)
|
||||
deletionsList, err := os.ReadDir(backend.ConfigDir + backend.PathSeparator + "deletions")
|
||||
if err != nil {
|
||||
fmt.Println(backend.AnsiError + "Failed to read the deletions directory: " + err.Error() + backend.AnsiReset)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// print the current UNIX timestamp to stdout
|
||||
fmt.Print(time.Now().Unix())
|
||||
|
||||
// print the lists to stdout
|
||||
// entry list
|
||||
fmt.Print(FSSpace)
|
||||
for _, entry := range entryList {
|
||||
fmt.Print(FSMisc + entry)
|
||||
}
|
||||
|
||||
// modification time list
|
||||
fmt.Print(FSSpace)
|
||||
for _, mod := range modList {
|
||||
fmt.Print(FSMisc)
|
||||
fmt.Print(mod)
|
||||
}
|
||||
|
||||
// directory/folder list
|
||||
fmt.Print(FSSpace)
|
||||
for _, dir := range dirList {
|
||||
fmt.Print(FSMisc + dir)
|
||||
}
|
||||
|
||||
// deletions list
|
||||
fmt.Print(FSSpace)
|
||||
for _, deletion := range deletionsList {
|
||||
// print deletion if it is relevant to the current client device
|
||||
affectedIDTargetLocationIncomplete := strings.Split(deletion.Name(), FSSpace)
|
||||
if affectedIDTargetLocationIncomplete[0] == clientDeviceID {
|
||||
fmt.Print(FSMisc + strings.ReplaceAll(affectedIDTargetLocationIncomplete[1], FSPath, "/"))
|
||||
|
||||
// assume successful client deletion and remove deletions file (if assumption is somehow false, worst case scenario is that the client will re-upload the deleted entry)
|
||||
_ = os.Remove(backend.ConfigDir + backend.PathSeparator + "deletions" + backend.PathSeparator + deletion.Name()) // error ignored; function not run from a user-facing argument and thus the error would not be visible
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
## 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)
|
||||
- Note that MUTN is currently using the older Glamour v0.7.0, 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)
|
||||
- [Excessive binary size and increased program startup time](https://github.com/charmbracelet/glamour/issues/288)
|
||||
@@ -1,9 +1,13 @@
|
||||
## Building
|
||||
This repository is currently home to both the MUTN client and the general libmutton server software.
|
||||
|
||||
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
|
||||
CGO_ENABLED=0 go build -ldflags="-s -w" -trimpath ./mutn.go
|
||||
CGO_ENABLED=0 go build -ldflags="-s -w" -trimpath ./libmuttonserver.go
|
||||
```
|
||||
|
||||
Additionally, some custom build tags can be used to create different binaries. The following tags are not used in official builds:
|
||||
- `noMarkdown`: Creates a binary without Markdown support (much smaller binary size and faster launch time)
|
||||
- `wsl`: Allows creating a Linux binary that can interact with the Windows clipboard (for WSL)
|
||||
- `termux`: Allows creating a Linux binary that can interact with the Termux clipboard (for Android)
|
||||
@@ -0,0 +1,8 @@
|
||||
## Installation
|
||||
MUTN is still in early development and thus no installation packages are officially distributed.
|
||||
|
||||
For now, please [compile from source](https://github.com/rwinkhart/MUTN/blob/main/wiki/MUTN/build.md).
|
||||
|
||||
After compiling and 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/MUTN/completions.md).
|
||||
|
||||
Please see the [usage guide](https://github.com/rwinkhart/MUTN/blob/main/wiki/MUTN/usage.md) for help getting started.
|
||||
@@ -8,20 +8,17 @@ libmutton operates on a client-server model, and thus sync support requires you
|
||||
|
||||
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.
|
||||
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](https://github.com/rwinkhart/MUTN/blob/main/wiki/completions.md)
|
||||
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/MUTN/completions.md)
|
||||
|
||||
### Tips
|
||||
#### Operating on Passwords
|
||||
Any action that operates on the password attached to an entry (copying, editing, adding a new password-focused entry) does not require the user to specify the `password` or `-pw` options. In all cases, `password` is the assumed target when no other option is specified.
|
||||
|
||||
#### TOTP Support
|
||||
See [here](https://github.com/rwinkhart/libmutton/blob/main/wiki/tips.md#totp-support).
|
||||
|
||||
#### Granular Help
|
||||
Argument-specific help can be obtained by running `mutn <argument>` without an entry name or any options. For example, `mutn edit` will display help for the `edit` argument.
|
||||
@@ -1,17 +0,0 @@
|
||||
## Installation
|
||||
MUTN is still in early development and thus no installation packages are officially distributed.
|
||||
|
||||
For now, please manually install the binaries from the [latest release](https://github.com/rwinkhart/MUTN/releases) or [compile from source](https://github.com/rwinkhart/MUTN/blob/main/wiki/build.md). All pre-built binaries were compiled with CGO disabled and thus are libc-independent.
|
||||
|
||||
Additionally, MUTN is available as a source package ("[mutn](https://aur.archlinux.org/packages/mutn)") on the AUR.
|
||||
|
||||
Please note that the server binary (available in [libmutton releases](https://github.com/rwinkhart/libmutton/releases)) must be called "libmuttonserver" in order for clients to successfully reach it.
|
||||
|
||||
After placing the binaries in your $PATH, it is highly recommended to also download and correctly place/source the relevant [shell completions scripts](https://github.com/rwinkhart/MUTN/blob/main/wiki/completions.md).
|
||||
|
||||
Please see the [usage guide](https://github.com/rwinkhart/MUTN/blob/main/wiki/usage.md) for help getting started.
|
||||
|
||||
### Dependencies (required for all installations)
|
||||
- A text editor (preferably CLI-based) for writing entry notes
|
||||
- A private key for SSH key-based authentication is required to use MUTN/libmutton in online/synced mode
|
||||
- Linux: xclip (X11) or wl-clipboard (Wayland) for clipboard support
|
||||
@@ -0,0 +1,10 @@
|
||||
## Planned Breaking Changes
|
||||
Leading up to the v1.0.0 release, breaking changes are both expected and planned. These changes are expected to require manual intervention from the end-user, and thus MUTN/libmutton should not be used prior to v1.0.0 if this is not acceptable.
|
||||
|
||||
These changes include, but may expand beyond the following:
|
||||
|
||||
- Migration to Go-native encryption (no reliance on GnuPG)
|
||||
- Will be based on symmetrical encryption
|
||||
- Will eventually allow combining multiple common encryption algorithms (cascading encryption)
|
||||
- Password aging data will be stored for each entry (to remind the user when it is time to change passwords)
|
||||
- Will be included in entry names or in external file (to prevent needing to decrypt entries to access this information)
|
||||
@@ -0,0 +1,7 @@
|
||||
## Known Bugs - libmutton
|
||||
- On Windows, GPG is sometimes (seems unpredictable) incredibly slow to start (often after a reboot), leading to many operations seemingly hanging
|
||||
- **This will be addressed** in the migration off of GPG that will take place before v1.0.0
|
||||
- If a client is reconfigured to use a new device ID, the old one will remain present on the server. This will not cause any immediate issues, however it will lead to the server creating unnecessary deletions files for the old device ID. Currently, it is recommended to manually delete the old device ID from the server's "devices" directory.
|
||||
- **This will be addressed** in v0.2.1
|
||||
- Using a password-protected SSH identity file will prompt for the key's password multiple times when syncing
|
||||
- **This will be addressed** in v0.2.1
|
||||
@@ -0,0 +1,11 @@
|
||||
## Clipboard Troubleshooting + Clipboard Manager Rant
|
||||
### Clipboard managers can break libmutton-based password managers
|
||||
***
|
||||
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. I noticed it with KDE Klipper, which is what prompted me to create this wiki page. **Clipboard managers should not be enabled by default in any environment** or distribution due to their **potential security implications**.
|
||||
### Termux cannot clear the clipboard from the background
|
||||
***
|
||||
If using libmutton on Termux (Android), the clipboard may not successfully be cleared after the 30 second timeout period if Termux is not actively in the foreground when the sleep timer expires. This is an unfortunate side-effect of running on Android and cannot be easily fixed. Due to Termux being at the bottom of the platform support priority list, I will not be investing time into working around this.
|
||||
@@ -0,0 +1,49 @@
|
||||
## Developer Guide (for third-party libmutton-based clients)
|
||||
**Important Notice**: libmutton is in early development and is currently a moving target to develop off of. Feel free to jump in early, but greater change stability will be met with release v1.0.0. Check [here](https://github.com/rwinkhart/MUTN/blob/main/wiki/libmutton/breaking.md) for planned breaking changes.
|
||||
|
||||
libmutton was designed to be usable as a library for building other compatible password managers off of. [MUTN](https://github.com/rwinkhart/MUTN) is the official reference CLI password manager, however libmutton can be implemented in many other unique ways.
|
||||
|
||||
All functionality in the `backend` and `sync` packages are designed to be used in other implementations.
|
||||
|
||||
If any functionality in these two packages proves to be difficult to implement in a third-party client, please open an issue so that it can be addressed.
|
||||
|
||||
## Build Tags
|
||||
Custom build tags can (and sometimes must) be used to achieve desired results.
|
||||
|
||||
These are as follows:
|
||||
- `returnOnExit`: If making an interactive interface (GUI/TUI/interactive CLI), you probably need to use this build tag. Without it, your entire program will exit after any given operation is completed. This behavior is only desired for non-interactive CLI implementations, such as MUTN. Currently, errors will result in the program exiting **even with this build tag**. This may be changed in the future (under evaluation).
|
||||
- `wsl`: Allows creating a Linux binary that can interact with the Windows clipboard (for WSL)
|
||||
- `termux`: Allows creating a Linux binary that can interact with the Termux clipboard (for Android)
|
||||
|
||||
## Required Arguments
|
||||
libmutton-based password manager clients should accept at least one specific required argument, as well as another recommended one:
|
||||
- `clipclear`: This argument is required for correct functionality. In order to clear the clipboard on a timer, libmutton-based password managers call another instance of their executable with the `clipclear` argument (e.g. `mutn clipclear`) with the intended clipboard contents provided via STDIN. If after 30 seconds the clipboard contents have not changed, they are cleared. Please accept a `clipclear` argument that is processed before the launch of any interactive interface. All this argument needs to do is call `backend.ClipClearArgument()`.
|
||||
- `init`: This argument is optional, but recommended for CLI interfaces. Some error messages request the user to use the `init` argument to fix configuration issues. If the argument does not exist, this may confuse the user.
|
||||
|
||||
## Configuration
|
||||
libmutton-based password manager clients should all share the same INI configuration file.
|
||||
|
||||
On UNIX-like systems, this is located at `~/.config/libmutton/libmutton.ini`. On Windows, it is located at `~\AppData\Local\libmutton\config\libmutton.ini`.
|
||||
|
||||
### Base `libmutton.ini` Layout
|
||||
The current base layout of `libmutton.ini` will change leading up to release v1.0.0. As of right now, the specification is as follows:
|
||||
```
|
||||
[LIBMUTTON]
|
||||
gpgID = <gpg key id>
|
||||
sshUser = <remote user>
|
||||
sshIP = <remote ip>
|
||||
sshPort = <remote ssh port>
|
||||
sshKey = <ssh private key identity file path>
|
||||
sshKeyProtected = <true/false>
|
||||
sshEntryRoot = <remote entry root>
|
||||
sshIsWindows = <true/false>
|
||||
```
|
||||
If creating a third-party client that requires extra configuration to be stored, please use the same file and create a new INI section for your application-specific configuration, e.g.:
|
||||
```
|
||||
[THIRD-PARTY-CLIENT-NAME]
|
||||
configKey = <value>
|
||||
```
|
||||
This ensures that a user can use multiple client applications with the same configuration while avoiding conflicts.
|
||||
|
||||
# Relevant Bugs Affecting Third-Party Implementations
|
||||
- Password-protected SSH identity files currently only prompt for password entry in the CLI, and thus they are not yet supported in GUI/TUI implementations
|
||||
@@ -0,0 +1,8 @@
|
||||
## Migrating From Other Password Managers
|
||||
**Important Notice**: The libmutton entry format is not final and has two [breaking changes planned prior to release v1.0.0](https://github.com/rwinkhart/MUTN/blob/main/wiki/libmutton/breaking.md). This guide will be updated accordingly.
|
||||
### pass
|
||||
libmutton-based password managers *currently* use GnuPG encryption and an entry format similar to that of [pass](https://www.passwordstore.org/). Because of this, any entries in `pass` format can simply be dropped into `~/.local/share/libmutton`.
|
||||
### sshyp
|
||||
sshyp, though also `pass`-compatible, makes some changes to the entry format that take effect once the entry has been imported. The changes made by sshyp are not compatible with libmutton, and as such sshyp entries must be converted before they can be used. A script for doing that has been created and is available in the sshyp extension store. Simply run `sshyp tweak`, go to the "extension management" menu, and download the "export-to-libmutton" extension. After doing this, the `sshyp export` command can be used to export entries in libmutton format.
|
||||
### Other
|
||||
The formats for many other password managers can be converted to the `pass` format with community scripts. Some of these scripts are listed [here](https://www.passwordstore.org/#migration). Once converted, entries can be dropped into `~/.local/share/libmutton`.
|
||||
@@ -0,0 +1,24 @@
|
||||
## MUTN Wiki
|
||||
### MUTN-specific Information
|
||||
[Installation](https://github.com/rwinkhart/MUTN/blob/main/wiki/MUTN/install.md)
|
||||
|
||||
[Building](https://github.com/rwinkhart/MUTN/blob/main/wiki/MUTN/build.md)
|
||||
|
||||
[Setup/Usage](https://github.com/rwinkhart/MUTN/blob/main/wiki/MUTN/usage.md)
|
||||
|
||||
[Shell Completions Troubleshooting](https://github.com/rwinkhart/MUTN/blob/main/wiki/MUTN/completions.md)
|
||||
|
||||
[Known Bugs](https://github.com/rwinkhart/MUTN/blob/main/wiki/MUTN/bugs.md)
|
||||
|
||||
---
|
||||
|
||||
### libmutton Information (will likely be moved to libmutton repository in the future)
|
||||
[Planned Breaking Changes](https://github.com/rwinkhart/MUTN/blob/main/wiki/libmutton/breaking.md)
|
||||
|
||||
[Migrating From Other Password Managers](https://github.com/rwinkhart/MUTN/blob/main/wiki/libmutton/migration.md)
|
||||
|
||||
[Clipboard Troubleshooting](https://github.com/rwinkhart/MUTN/blob/main/wiki/libmutton/clipboard.md)
|
||||
|
||||
[Developer Guide](https://github.com/rwinkhart/MUTN/blob/main/wiki/libmutton/developers.md)
|
||||
|
||||
[Known Bugs](https://github.com/rwinkhart/MUTN/blob/main/wiki/libmutton/bugs.md)
|
||||
Reference in New Issue
Block a user