Compare commits
75 commits
Author | SHA1 | Date | |
---|---|---|---|
0f29851a37 | |||
77819962cc | |||
838d9da904 | |||
99868f3fe7 | |||
ec299f915f | |||
47065f1c07 | |||
dd26aa599e | |||
74a654ea5c | |||
b7f0e62177 | |||
9c0fcc3528 | |||
6d16b0a97d | |||
b40f3e7001 | |||
c237b9d8c5 | |||
d5da9a9574 | |||
968a288866 | |||
![]() |
47d733b2f4 | ||
12d506219a | |||
72a3b42d36 | |||
![]() |
ac77cbfe4b | ||
338c4c2771 | |||
![]() |
1d53129435 | ||
![]() |
deb4318cd9 | ||
9af44501cc | |||
![]() |
d67de26e90 | ||
82422e6d37 | |||
a804518ef6 | |||
e62bcfa9d8 | |||
5605143ffa | |||
4b06627b0a | |||
4fcd649b0b | |||
dcea6b2a24 | |||
f52dcbb721 | |||
b8dd0be83b | |||
c8f7473690 | |||
92c502b4a6 | |||
5aece18736 | |||
e8f03c430c | |||
2d9e3fc94c | |||
e28e8f54f8 | |||
6d5632ee81 | |||
e361669b87 | |||
80ef5e6ba2 | |||
db06f1cdc4 | |||
7ef35ba9bd | |||
5fbb1f5257 | |||
868ba54822 | |||
84ec3c9bc1 | |||
b39bd3bc5b | |||
955985b825 | |||
9c8749e664 | |||
957b87161c | |||
300f9fe78c | |||
cdb7bdd148 | |||
81e2129dd5 | |||
1f60c083b5 | |||
bfcc3b9d94 | |||
2daedef710 | |||
272f41022b | |||
cf163acb3e | |||
e43df05e80 | |||
64767aa30d | |||
1d71334340 | |||
a4db8e35e3 | |||
7c8ebde582 | |||
3aa6ba02a7 | |||
3cf76d429e | |||
76e713f5b1 | |||
9e0b5bbf08 | |||
2bd36de5e1 | |||
e9ea553fb0 | |||
418fce13bf | |||
f36642ca74 | |||
3945bbcdcb | |||
dbb3038f8f | |||
![]() |
491e309c9d |
31 changed files with 1095 additions and 1096 deletions
19
.github/workflows/c-cpp.yml
vendored
Normal file
19
.github/workflows/c-cpp.yml
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
name: C/C++ CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "master" ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ "master" ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: install dependencies
|
||||||
|
run: sudo apt-get update && sudo apt-get install -y bmake libcurl4-openssl-dev libconfig-dev
|
||||||
|
- name: bmake
|
||||||
|
run: bmake
|
37
.github/workflows/sakisafe_http.yml
vendored
Normal file
37
.github/workflows/sakisafe_http.yml
vendored
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
# This was written by an AI. HA!
|
||||||
|
# I hate writing yaml. I'm glad a computer can do it for me.
|
||||||
|
|
||||||
|
name: Test Mojolicious Application
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
services:
|
||||||
|
web:
|
||||||
|
image: perl:latest
|
||||||
|
ports:
|
||||||
|
- 8080:8080
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: sudo apt-get update && sudo apt-get install -y libmojolicious-perl liblist-moreutils-perl libmojolicious-plugin-renderfile-perl libpath-tiny-perl libmime-types-perl
|
||||||
|
|
||||||
|
- name: Start Sakisafe
|
||||||
|
run: |
|
||||||
|
hypnotoad http/sakisafe.pl
|
||||||
|
|
||||||
|
- name: Test Sakisafe
|
||||||
|
run: |
|
||||||
|
curl --retry 10 --retry-delay 5 --retry-connrefused http://localhost:8080
|
||||||
|
|
||||||
|
# LOLOLOLOLOLOLOLO
|
||||||
|
curl -X POST -F "file=@/etc/passwd" http://localhost:8080
|
||||||
|
- name: Read log entry
|
||||||
|
run: |
|
||||||
|
cat http/sakisafe.log
|
16
.gitignore
vendored
16
.gitignore
vendored
|
@ -1,3 +1,17 @@
|
||||||
sakisafecli
|
|
||||||
*.o
|
*.o
|
||||||
*.d
|
*.d
|
||||||
|
obj/
|
||||||
|
.clangd
|
||||||
|
.depend
|
||||||
|
http/f/*
|
||||||
|
blib/
|
||||||
|
pm_to_blib
|
||||||
|
Makefile
|
||||||
|
Makefile.old
|
||||||
|
MANIFEST*
|
||||||
|
!MANIFEST.SKIP
|
||||||
|
META.*/
|
||||||
|
MYMETA.*
|
||||||
|
pm_to_blib
|
||||||
|
sakisafe.log
|
||||||
|
f/
|
||||||
|
|
674
COPYING
674
COPYING
|
@ -1,674 +0,0 @@
|
||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 29 June 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 General Public License is a free, copyleft license for
|
|
||||||
software and other kinds of works.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
|
||||||
to take away your freedom to share and change the works. By contrast,
|
|
||||||
the GNU General Public License is 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. We, the Free Software Foundation, use the
|
|
||||||
GNU General Public License for most of our software; it applies also to
|
|
||||||
any other work released this way by its authors. You can apply it to
|
|
||||||
your programs, too.
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
To protect your rights, we need to prevent others from denying you
|
|
||||||
these rights or asking you to surrender the rights. Therefore, you have
|
|
||||||
certain responsibilities if you distribute copies of the software, or if
|
|
||||||
you modify it: responsibilities to respect the freedom of others.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
|
||||||
gratis or for a fee, you must pass on to the recipients the same
|
|
||||||
freedoms that you received. You must make sure that they, too, receive
|
|
||||||
or can get the source code. And you must show them these terms so they
|
|
||||||
know their rights.
|
|
||||||
|
|
||||||
Developers that use the GNU GPL protect your rights with two steps:
|
|
||||||
(1) assert copyright on the software, and (2) offer you this License
|
|
||||||
giving you legal permission to copy, distribute and/or modify it.
|
|
||||||
|
|
||||||
For the developers' and authors' protection, the GPL clearly explains
|
|
||||||
that there is no warranty for this free software. For both users' and
|
|
||||||
authors' sake, the GPL requires that modified versions be marked as
|
|
||||||
changed, so that their problems will not be attributed erroneously to
|
|
||||||
authors of previous versions.
|
|
||||||
|
|
||||||
Some devices are designed to deny users access to install or run
|
|
||||||
modified versions of the software inside them, although the manufacturer
|
|
||||||
can do so. This is fundamentally incompatible with the aim of
|
|
||||||
protecting users' freedom to change the software. The systematic
|
|
||||||
pattern of such abuse occurs in the area of products for individuals to
|
|
||||||
use, which is precisely where it is most unacceptable. Therefore, we
|
|
||||||
have designed this version of the GPL to prohibit the practice for those
|
|
||||||
products. If such problems arise substantially in other domains, we
|
|
||||||
stand ready to extend this provision to those domains in future versions
|
|
||||||
of the GPL, as needed to protect the freedom of users.
|
|
||||||
|
|
||||||
Finally, every program is threatened constantly by software patents.
|
|
||||||
States should not allow patents to restrict development and use of
|
|
||||||
software on general-purpose computers, but in those that do, we wish to
|
|
||||||
avoid the special danger that patents applied to a free program could
|
|
||||||
make it effectively proprietary. To prevent this, the GPL assures that
|
|
||||||
patents cannot be used to render the program non-free.
|
|
||||||
|
|
||||||
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 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. Use with the GNU Affero General Public License.
|
|
||||||
|
|
||||||
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 Affero 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 special requirements of the GNU Affero General Public License,
|
|
||||||
section 13, concerning interaction through a network will apply to the
|
|
||||||
combination as such.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU 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 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 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 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 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 General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU 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 the program does terminal interaction, make it output a short
|
|
||||||
notice like this when it starts in an interactive mode:
|
|
||||||
|
|
||||||
<program> Copyright (C) <year> <name of author>
|
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
|
||||||
under certain conditions; type `show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
||||||
parts of the General Public License. Of course, your program's commands
|
|
||||||
might be different; for a GUI interface, you would use an "about box".
|
|
||||||
|
|
||||||
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 GPL, see
|
|
||||||
<https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program
|
|
||||||
into proprietary programs. If your program is a subroutine library, you
|
|
||||||
may consider it more useful to permit linking proprietary applications with
|
|
||||||
the library. If this is what you want to do, use the GNU Lesser General
|
|
||||||
Public License instead of this License. But first, please read
|
|
||||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
|
23
LICENSE
Normal file
23
LICENSE
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
Copyright $CURRENT_YEAR SURAGU Enterprises
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE FREEBSD PROJECT ``AS IS'' AND ANY EXPRESS
|
||||||
|
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||||
|
NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||||
|
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2
Makefile
Normal file
2
Makefile
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
SUBDIR = sakisafecli
|
||||||
|
.include <bsd.prog.mk>
|
131
README.md
131
README.md
|
@ -6,28 +6,132 @@
|
||||||
|
|
||||||
* Written in perl
|
* Written in perl
|
||||||
* Can be used as pastebin
|
* Can be used as pastebin
|
||||||
* Or as a URL shorter
|
* Easy installation (just a simple daemon and use a reverse proxy)
|
||||||
* Runs with CGI
|
* Does not bully Tor users ;)
|
||||||
* Tor access ;)
|
|
||||||
|
|
||||||
## Installation:
|
|
||||||
|
|
||||||
1. Configure your webserver to run CGI
|
# Installation
|
||||||
2. If running nginx, set `client_max_body_size` to the max size of
|
|
||||||
the file
|
|
||||||
2. There you go.
|
|
||||||
|
|
||||||
|
sakisafe is written in Perl, so it is its first dependency. But if you're
|
||||||
|
using a real operating system you should have it by default.
|
||||||
|
|
||||||
|
1. install the dependencies using `cpan`:
|
||||||
|
|
||||||
|
~~~
|
||||||
|
cpan -i Mojolicious::Lite Mojolicious::Routes::Pattern Mojoliciuos::Plugin::RenderFile
|
||||||
|
~~~
|
||||||
|
|
||||||
|
If you're running Debian or FreeBSD you can install the dependencies with
|
||||||
|
your package manager:
|
||||||
|
|
||||||
|
~~~bash
|
||||||
|
apt install libmojolicious-perl libmojolicious-plugin-renderfile-perl liblist-moreutils-perl # Debian, Ubuntu...
|
||||||
|
pkg install p5-Mojolicious p5-List-MoreUtils p5-Path-Tiny # FreeBSD
|
||||||
|
# You'll have to run cpan to install the RenderFile plugin in FreeBSD
|
||||||
|
cpan -Ti Mojolicious::Plugin::Renderfile
|
||||||
|
~~~
|
||||||
|
|
||||||
|
2. Clone the repo and start the daemon:
|
||||||
|
|
||||||
|
~~~
|
||||||
|
git clone https://git.suragu.net/sosa/sakisafe
|
||||||
|
cd sakisafe/http
|
||||||
|
./sakisafe.pl daemon -m production
|
||||||
|
~~~
|
||||||
|
You can also use `hypnotoad` or `morbo` to run the thing:
|
||||||
|
~~~
|
||||||
|
morbo -l http://*:3000 sakisafe.pl.
|
||||||
|
hypnotoad sakisafe.pl # This will daemonize the thing in port 8080.
|
||||||
|
~~~
|
||||||
|
|
||||||
|
2.2. In FreeBSD, you can use the rc script located in
|
||||||
|
http/scripts/sakisafe_bsd to create a sakisafe service. The service is
|
||||||
|
loaded by the user "saki", whose home is `/usr/local/share/sakisafe`:
|
||||||
|
|
||||||
|
~~~bash
|
||||||
|
mkdir -p /usr/local/share/sakisafe
|
||||||
|
cp -r http/* /usr/local/share/sakisafe
|
||||||
|
cp http/init/sakisafe_bsd /usr/local/etc/rc.d
|
||||||
|
touch /var/run/sakisafe.pid
|
||||||
|
chmod 777 /var/run/sakisafe.pid # How to fix this? Please tell me
|
||||||
|
service sakisafe enable
|
||||||
|
service sakisafe start
|
||||||
|
~~~
|
||||||
|
|
||||||
|
Please contribute more init scripts for sakisafe!!! (for systemd,
|
||||||
|
openbsd...)
|
||||||
|
|
||||||
|
2.3. You can also use Docker. I am not a Docker advocate. But apparently
|
||||||
|
running "docker build-x" or something like that just works.
|
||||||
|
|
||||||
|
3. Create a 'f' directory in the directory sakisafe will run with
|
||||||
|
`mkdir f`. Make sure that the user which will run sakisafe.pl can
|
||||||
|
write in that directory.
|
||||||
|
|
||||||
|
By default, sakisafe will bind in 127.0.0.1 port 3000. Because that's
|
||||||
|
the default bind Mojolicious uses.
|
||||||
|
|
||||||
|
4. Create a proxy rule in nginx configuration (If you're using another
|
||||||
|
HTTP server, you're on your own.)
|
||||||
|
|
||||||
|
~~~conf
|
||||||
|
|
||||||
|
server {
|
||||||
|
server_name sakisafe.whatever.tld;
|
||||||
|
listen 443 ssl;
|
||||||
|
|
||||||
|
# ssl configuration here
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr; # Important for logging!
|
||||||
|
proxy_set_header X-Forwarded-for $remote_addr; # Idem
|
||||||
|
proxy_pass http://127.0.0.1:3000$request_uri;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
~~~
|
||||||
|
|
||||||
|
And restart nginx. Going to `sakisafe.whatever.tld` should work.
|
||||||
|
|
||||||
# sakisafecli
|
# sakisafecli
|
||||||
|
|
||||||
`sakisafecli` is the command line interface for sakisafe (and other
|
sakisafecli is a command line interface for sakisafe servers (and
|
||||||
filesharing services)
|
other file upload services). It also supports file uploading via scp
|
||||||
|
(ssh).
|
||||||
|
|
||||||
## usage
|
## Features
|
||||||
|
|
||||||
`sakisafecli --server=http://server <file>`
|
* Written in C so is fast.
|
||||||
|
* HTTP and SCP support (FTP support is planned)
|
||||||
|
* Highly configurable
|
||||||
|
* Lightweight
|
||||||
|
* If using OpenBSD, it will run `pledge()` for security reasons.
|
||||||
|
* As far as I know, runs in any *NIX operating system.
|
||||||
|
|
||||||
(for more info see -h)
|
## Installation
|
||||||
|
|
||||||
|
### Compilation
|
||||||
|
|
||||||
|
Clone the repo and run `make`.
|
||||||
|
|
||||||
|
#### Linux-specific
|
||||||
|
|
||||||
|
Use `bmake` instead of `make`, and you'll also need these deps:
|
||||||
|
|
||||||
|
* `libcurl-devel`
|
||||||
|
* `libconfig-dev`
|
||||||
|
* `libnghttp2-dev`
|
||||||
|
|
||||||
|
### Repositories
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
TODO: Add the thing to Debian repositories ;)
|
||||||
|
|
||||||
|
|
||||||
|
# Contributing
|
||||||
|
|
||||||
|
Just create a pull request in GitHub or send a diff file.
|
||||||
|
|
||||||
# Donate
|
# Donate
|
||||||
|
|
||||||
|
@ -36,3 +140,4 @@ Thanks!
|
||||||
**Bitcoin**: bc1qghl6f27dpgktynpvkrxte2s3gm9pcv8vlwuzum
|
**Bitcoin**: bc1qghl6f27dpgktynpvkrxte2s3gm9pcv8vlwuzum
|
||||||
|
|
||||||
**Monero**: 47QTumjtqJabbo1s9pLDdXeJarLVLfs1AaEcbi1xrEiV852mqcbe5AHLNXTk7tH9MscxcxQDfJQnvH5LpxvfgwSJQZ3zbS6
|
**Monero**: 47QTumjtqJabbo1s9pLDdXeJarLVLfs1AaEcbi1xrEiV852mqcbe5AHLNXTk7tH9MscxcxQDfJQnvH5LpxvfgwSJQZ3zbS6
|
||||||
|
|
||||||
|
|
15
SERVERS.org
15
SERVERS.org
|
@ -1,10 +1,9 @@
|
||||||
* Known lainsafe instances
|
* Known sakisafe instances
|
||||||
|
|
||||||
In this document i'll add all the lainsafe instance i know :)
|
In this document i'll add all the sakisafe instance i know :)
|
||||||
|
|
||||||
- https://lainsafe.delegao.moe
|
Feel free to add more. I do not know about many others.
|
||||||
- https://lainsafe.duckdns.org (don't use it, old lainsafe version
|
|
||||||
and a bit incompatible with lainsafecli)
|
- https://ss.suragu.net
|
||||||
- https://lainsafe.kalli.st
|
- https://files.getimiskon.xyuz
|
||||||
- http://lainsafe.kallist4mcluuxbjnr5p2asdlmdhaos3pcrvhk3fbzmiiiftwg6zncid.onion/ (onion mirror)
|
-
|
||||||
- http://gnaumuq27fagoo24pb2mmf25rdic7lrthq2fsfolgrpzycc2hwga.b32.i2p/
|
|
||||||
|
|
|
@ -1,51 +0,0 @@
|
||||||
.\"Manpage for lainsafe
|
|
||||||
.TH sakisafecli 1
|
|
||||||
.SH NAME
|
|
||||||
sakisafecli \- File uploader
|
|
||||||
|
|
||||||
.SH DESCRIPTION
|
|
||||||
|
|
||||||
sakisafecli is a file uploader. Intended for lainsafe, but also works
|
|
||||||
for 0x0.st, i.kalli.st and probably others.
|
|
||||||
|
|
||||||
.SH INSTALLATION
|
|
||||||
.in +4n
|
|
||||||
.EX
|
|
||||||
make
|
|
||||||
(or gcc sakisafecli.c -lcurl -o sakisafecli)
|
|
||||||
cp sakisafecli ~/.local/bin
|
|
||||||
.EE
|
|
||||||
.SH OPTIONS
|
|
||||||
|
|
||||||
.PP
|
|
||||||
.B
|
|
||||||
--server=<SERVER>
|
|
||||||
Specifies which server to use, can be a lainsafe instance, 0x0.st
|
|
||||||
instance or i.kalli.st. Probably other similar software.
|
|
||||||
|
|
||||||
.B
|
|
||||||
--tor
|
|
||||||
Routes all the traffic on the socks proxy at 127.0.0.1:9050,
|
|
||||||
which is usually tor. This can be edited in the
|
|
||||||
.B options.h
|
|
||||||
file
|
|
||||||
|
|
||||||
.B
|
|
||||||
--i2p
|
|
||||||
Routes all the traffic on the http proxy at 127.0.0.1:4444,
|
|
||||||
which is usually I2P. This can be edited in the
|
|
||||||
.B options.h
|
|
||||||
file
|
|
||||||
|
|
||||||
.B
|
|
||||||
--ipv6 or -6
|
|
||||||
Forces curl to use IPv6 only.
|
|
||||||
|
|
||||||
.B
|
|
||||||
--ipv4 or -4
|
|
||||||
Forces curl to use IPv4 only.
|
|
||||||
|
|
||||||
.B
|
|
||||||
--silent or -S
|
|
||||||
tells sakisafecli to be silent. This means, it won't
|
|
||||||
print the progress.
|
|
14
http/.perltidyrc
Normal file
14
http/.perltidyrc
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
-pbp # Start with Perl Best Practices
|
||||||
|
-w # Show all warnings
|
||||||
|
-iob # Ignore old breakpoints
|
||||||
|
-l=120 # 120 characters per line
|
||||||
|
-mbl=2 # No more than 2 blank lines
|
||||||
|
-i=5 # Indentation is 2 columns
|
||||||
|
-ci=2 # Continuation indentation is 2 columns
|
||||||
|
-vt=0 # Less vertical tightness
|
||||||
|
-pt=2 # High parenthesis tightness
|
||||||
|
-bt=2 # High brace tightness
|
||||||
|
-sbt=2 # High square bracket tightness
|
||||||
|
-wn # Weld nested containers
|
||||||
|
-isbc # Don't indent comments without leading space
|
||||||
|
-nst # Don't output to STDOUT
|
15
http/Dockerfile
Normal file
15
http/Dockerfile
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
FROM perl:latest AS build
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
COPY . /sakisafe
|
||||||
|
COPY ./public /sakisafe/public
|
||||||
|
|
||||||
|
WORKDIR /sakisafe
|
||||||
|
|
||||||
|
RUN perl "Makefile.PL"
|
||||||
|
RUN make install
|
||||||
|
RUN cpan List::MoreUtils Path::Tiny MIME::Types Mojolicious Mojolicious::Plugin::RenderFile Mojolicious::Routes::Pattern
|
||||||
|
|
||||||
|
FROM build
|
||||||
|
CMD ["perl", "sakisafe.pl", "daemon"]
|
17
http/Makefile.PL
Normal file
17
http/Makefile.PL
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
use v5.36;
|
||||||
|
|
||||||
|
use ExtUtils::MakeMaker;
|
||||||
|
|
||||||
|
WriteMakefile(
|
||||||
|
NAME => 'sakisafe',
|
||||||
|
CONFIGURE_REQUIRES => {
|
||||||
|
"Mojolicious" => 0,
|
||||||
|
"List::MoreUtils" => 0,
|
||||||
|
"Term::ANSIColor" => 0,
|
||||||
|
"MIME::Types" => 0,
|
||||||
|
"Path::Tiny" => 0,
|
||||||
|
"Mojolicious::Plugin::RenderFile" => 0,
|
||||||
|
"Mojolicious::Routes::Pattern" => 0
|
||||||
|
},
|
||||||
|
EXE_FILES => ['sakisafe.pl']
|
||||||
|
);
|
1
http/hypnotoad.pid
Normal file
1
http/hypnotoad.pid
Normal file
|
@ -0,0 +1 @@
|
||||||
|
16143
|
|
@ -1,28 +0,0 @@
|
||||||
#!/usr/bin/perl
|
|
||||||
|
|
||||||
# This file is part of sakisafe.
|
|
||||||
# lainsafe is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
|
|
||||||
# lainsafe 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 General Public License for more details.
|
|
||||||
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with lainsafe. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
if ($ENV{REQUEST_METHOD} eq "POST") {
|
|
||||||
do "./upload.cgi";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $SITE_URL = $ENV{REMOTE_ADDR};
|
|
||||||
|
|
||||||
print "Content-type: text/html\n\n";
|
|
||||||
|
|
||||||
open(my $fh, "<index.html");
|
|
||||||
|
|
||||||
print while <$fh>;
|
|
|
@ -1,27 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<title>sakisafe</title>
|
|
||||||
<link rel="stylesheet" type="text/css" href="index.css"/>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>sakisafe</h1>
|
|
||||||
<h2>shitless file upload, pastebin and url shorter</h2>
|
|
||||||
<img src="saki.png"/>
|
|
||||||
<h2>USAGE</h2>
|
|
||||||
<p>POST a file:</p>
|
|
||||||
<code>curl -F 'file=@yourfile.png' $SITE_URL</code>
|
|
||||||
<p>Shorten URL:</p>
|
|
||||||
<code>curl -F 'url=https://example.org' $SITE_URL</code>
|
|
||||||
<p>Post your text directly</p>
|
|
||||||
<code>curl -F 'file=@-' $SITE_URL</code>
|
|
||||||
<div class="left">
|
|
||||||
<h2>Or just upload a file here</h2>
|
|
||||||
<form ENCTYPE='multipart/form-data' method='post' action='upload.cgi'>
|
|
||||||
<input type='file' name='file' size='30'/>
|
|
||||||
<input type='submit' value='upload'/>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
24
http/init/sakisafe_bsd
Normal file
24
http/init/sakisafe_bsd
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
#
|
||||||
|
# Add the following lines to /etc/rc.conf to enable sakisafe:
|
||||||
|
#
|
||||||
|
#sakisafe_enable="YES"
|
||||||
|
|
||||||
|
. /etc/rc.subr
|
||||||
|
|
||||||
|
name="sakisafe"
|
||||||
|
rcvar="sakisafe_enable"
|
||||||
|
|
||||||
|
load_rc_config $name
|
||||||
|
|
||||||
|
: ${sakisafe_user:=saki}
|
||||||
|
: ${sakisafe_group:=saki}
|
||||||
|
: ${sakisafe_enable:=NO}
|
||||||
|
: ${sakisafe_flags:= -P /var/run/sakisafe.pid -f /usr/local/bin/morbo -l http://*:3000 /usr/local/share/sakisafe/sakisafe.pl }
|
||||||
|
: ${sakisafe_chdir:= /usr/local/share/sakisafe }
|
||||||
|
command="/usr/sbin/daemon"
|
||||||
|
command_args="${sakisafe_flags}"
|
||||||
|
pidfile="/var/run/${name}.pid"
|
||||||
|
|
||||||
|
PATH="${PATH}"
|
||||||
|
|
||||||
|
run_rc_command "$1"
|
BIN
http/public/favicon.ico
Normal file
BIN
http/public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
|
@ -1,4 +1,4 @@
|
||||||
p {
|
p, ul, li {
|
||||||
color: white;
|
color: white;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ body {
|
||||||
|
|
||||||
h1, h2 {
|
h1, h2 {
|
||||||
color: #e3e3e3;
|
color: #e3e3e3;
|
||||||
|
font-family: monospace;
|
||||||
}
|
}
|
||||||
.left {
|
.left {
|
||||||
position: absolute;
|
position: absolute;
|
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 107 KiB |
268
http/sakisafe.pl
Executable file
268
http/sakisafe.pl
Executable file
|
@ -0,0 +1,268 @@
|
||||||
|
#!/usr/bin/env perl
|
||||||
|
# This file is part of sakisafe.
|
||||||
|
|
||||||
|
use if $^O eq "openbsd", OpenBSD::Pledge, qw(pledge);
|
||||||
|
use Mojolicious::Lite -signatures;
|
||||||
|
use Mojolicious::Routes::Pattern;
|
||||||
|
use Mojo::Log;
|
||||||
|
use Time::HiRes;
|
||||||
|
use List::MoreUtils qw(uniq);
|
||||||
|
use Carp;
|
||||||
|
use Term::ANSIColor;
|
||||||
|
use English;
|
||||||
|
use MIME::Types;
|
||||||
|
use Path::Tiny;
|
||||||
|
use warnings;
|
||||||
|
use experimental 'signatures';
|
||||||
|
use feature 'say';
|
||||||
|
plugin 'RenderFile';
|
||||||
|
|
||||||
|
# OpenBSD promises.
|
||||||
|
pledge("stdio prot_exec cpath rpath wpath inet flock fattr")
|
||||||
|
if $^O eq "openbsd";
|
||||||
|
|
||||||
|
# INSTANCE CONFIGURATION
|
||||||
|
our $name = "sakisafe";
|
||||||
|
our $version = "2.6.0";
|
||||||
|
# Domain and port, for output link
|
||||||
|
our $domain = "XXXXXXXXXXX";
|
||||||
|
our $port = 443;
|
||||||
|
# Contact info
|
||||||
|
# Change this with whatever you want
|
||||||
|
our $contact_info = 'email: saki@sakisafe.lol';
|
||||||
|
|
||||||
|
# 1 GiBs
|
||||||
|
|
||||||
|
my $MAX_SIZE = 1024 * 1024 * 1000;
|
||||||
|
|
||||||
|
my @BANNED = eval { path('banned.txt')->slurp_utf8 }
|
||||||
|
or qw(); # Add banned IP addresses here
|
||||||
|
my @BANNED_EXTS = eval { path('banned_exts.txt')->slurp_utf8 }
|
||||||
|
or qw(); # Add forbidden files extensions here
|
||||||
|
my $dirname;
|
||||||
|
my $link;
|
||||||
|
|
||||||
|
mkdir "f";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Mojo logger
|
||||||
|
my $log = Mojo::Log->new(path => 'sakisafe.log', level => 'trace');
|
||||||
|
$log->color(1);
|
||||||
|
|
||||||
|
# Forward logs to STDERR or STDOUT while also writing to the `sakisafe.log` file.
|
||||||
|
$log->on(message => sub ($l, $level, @lines) {
|
||||||
|
my $time = time;
|
||||||
|
my ($s, $m, $h, $day, $month, $year) = localtime time;
|
||||||
|
$time = sprintf('%04d-%02d-%02d %02d:%02d:%08.5f', $year + 1900, $month + 1, $day, $h, $m,
|
||||||
|
"$s." . ((split '.', $time)[1] // 0));
|
||||||
|
my $log_to_print = '[' . $time . '] ' . '[' . $level . '] ' . join(' ', @lines);
|
||||||
|
if ($level eq 'trace' || $level eq 'info') {
|
||||||
|
say $log_to_print;
|
||||||
|
} else {
|
||||||
|
print \*STDERR, $log_to_print . "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
# Function to handle file uploads
|
||||||
|
|
||||||
|
sub handle_file {
|
||||||
|
my $c = shift;
|
||||||
|
my $filedata = $c->param("file");
|
||||||
|
if ( $filedata->size > $MAX_SIZE ) {
|
||||||
|
return $c->render(
|
||||||
|
text => "Max upload size: $MAX_SIZE",
|
||||||
|
status => 400
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( List::MoreUtils::any { /$c->req->headers->header('X-Forwarded-For')/ } uniq @BANNED ) {
|
||||||
|
$c->render(
|
||||||
|
text =>
|
||||||
|
"Hi! Seems like the server admin added your IP address to the banned IP array."
|
||||||
|
. "As the developer of sakisafe, I can't do anything.",
|
||||||
|
status => 403
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Generate random string for the directory
|
||||||
|
my @chars = ( '0' .. '9', 'a' .. 'Z' );
|
||||||
|
$dirname .= $chars[ rand @chars ] for 1 .. 5;
|
||||||
|
my $filename = $filedata->filename;
|
||||||
|
my ($ext) = $filename =~ /(\.[^.]+)$/;
|
||||||
|
if ( List::MoreUtils::any { /$ext/ } uniq @BANNED_EXTS ) {
|
||||||
|
$c->render( text => "You cannot this filetype.\n", status => 415 );
|
||||||
|
$log->info("Attempt to upload by banned extension: " . $c->req->headers->header('X-Forwarded-For'));
|
||||||
|
say $ext;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->req->headers->header('X-Forwarded-For')
|
||||||
|
unless mkdir( "f/" . $dirname );
|
||||||
|
|
||||||
|
$filename .= ".txt" if $filename eq "-";
|
||||||
|
|
||||||
|
# TODO: get whether the server is http or https
|
||||||
|
# There's a CGI ENV variable for that.
|
||||||
|
my $host = $c->req->url->to_abs->host;
|
||||||
|
my $ua = $c->req->headers->user_agent;
|
||||||
|
$filedata->move_to( "f/" . $dirname . "/" . $filename );
|
||||||
|
$link = "http://$host/f/$dirname/$filename";
|
||||||
|
$c->stash( link => $link, host => $host, dirname => $dirname );
|
||||||
|
|
||||||
|
$c->res->headers->header( 'Location' => "$link" . $filename );
|
||||||
|
|
||||||
|
# Only give the link to curl, html template for others.
|
||||||
|
|
||||||
|
if ( $ua =~ m/curl/ || $ua eq "" ) {
|
||||||
|
$c->render(
|
||||||
|
text => $link . "\n",
|
||||||
|
status => 201,
|
||||||
|
);
|
||||||
|
$dirname = "";
|
||||||
|
} else {
|
||||||
|
$c->render(
|
||||||
|
template => 'file',
|
||||||
|
status => 201,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$log->info($c->req->headers->header('X-Forwarded-For') . " " . $dirname . "/" . $filename );
|
||||||
|
$dirname = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to log uploaded files
|
||||||
|
|
||||||
|
get '/' => sub ($c) {
|
||||||
|
$c->stash(name => $name, contact_info => $contact_info, version => $version);
|
||||||
|
$c->render(template => 'index');
|
||||||
|
};
|
||||||
|
post '/' => sub ($c) { handle_file($c) };
|
||||||
|
|
||||||
|
# Allow files to be downloaded.
|
||||||
|
|
||||||
|
get '/f/:dir/#name' => sub ($c) {
|
||||||
|
my $dir = $c->param("dir");
|
||||||
|
my $file = $c->param("name");
|
||||||
|
my $ext = $file;
|
||||||
|
$ext =~ s/.*\.//;
|
||||||
|
my $path = "f/" . $dir . "/" . $file;
|
||||||
|
|
||||||
|
#carp "sakisafe warning: could not get file: $ERRNO" unless
|
||||||
|
$c->render( text => "file not found", status => 404 ) unless -e $path;
|
||||||
|
$c->render_file(
|
||||||
|
filepath => $path,
|
||||||
|
format => $ext,
|
||||||
|
content_disposition => 'inline'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
app->log($log);
|
||||||
|
app->max_request_size( 1024 * 1024 * 100 );
|
||||||
|
|
||||||
|
post '/upload' => sub ($c) { handle_file($c) };
|
||||||
|
|
||||||
|
app->start;
|
||||||
|
|
||||||
|
# Index template
|
||||||
|
|
||||||
|
# By default Mojolicious gets the "directory root" from the "public"
|
||||||
|
# directory, so the css and the favicon from the "public" directory,
|
||||||
|
# in the root of this repo.
|
||||||
|
|
||||||
|
# Not sure why I have to do this filthy hack, could not get Mojolicious
|
||||||
|
# to get the template here. So a TODO is to fix this.
|
||||||
|
|
||||||
|
__DATA__
|
||||||
|
|
||||||
|
@@ file.html.ep
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>sakisafe</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="index.css"/>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<center>
|
||||||
|
<h1>sakisafe</h1>
|
||||||
|
<h2>shitless file upload, pastebin and url shorter</h2>
|
||||||
|
<img src="saki.png"/>
|
||||||
|
<h2>LINK</h2>
|
||||||
|
<code><%= $link %></code>
|
||||||
|
</center>
|
||||||
|
<p>Running sakisafe 2.6.0</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
@@ index.html.ep
|
||||||
|
% layout 'index', name => $name, contact_info => $contact_info, version => $version;
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>sakisafe</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="index.css"/>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<center>
|
||||||
|
<h1>sakisafe</h1>
|
||||||
|
<h2>shitless file upload, pastebin and url shorter</h2>
|
||||||
|
<img src="saki.png"/>
|
||||||
|
<h2>USAGE</h2>
|
||||||
|
<p>POST a file:</p>
|
||||||
|
<code>curl -F 'file=@yourfile.png' https://<%= $c->req->url->to_abs->host; %></code>
|
||||||
|
<p>Post your text directly</p>
|
||||||
|
<code>curl -F 'file=@-' https://<%= $c->req->url->to_abs->host; %></code><br/>
|
||||||
|
<a href="https://git.suragu.net/svragv/sakisafe">Git repository</a>
|
||||||
|
</center>
|
||||||
|
|
||||||
|
<h2>FAQ</h2>
|
||||||
|
<p>(No one has ever asked these questions)</p>
|
||||||
|
<p><b>How long are the files stored?</b> Until the heat death of the universe</b></p>
|
||||||
|
<p><b>Do you log IP addresses?</b> Yes. Blame the people uploading illegal stuff to this</p>
|
||||||
|
<p><b>Do you log all the requests?</b> Nah. Only file uploads are logged.</p>
|
||||||
|
<p><b>Can you delete a file I uploaded?</b><p>That depends on the instance administrator</b></p>
|
||||||
|
<h2>Instance info</h2>
|
||||||
|
<ul>
|
||||||
|
<li>Name: <%= $name %></li>
|
||||||
|
<li>Contact info: <%= $contact_info%>
|
||||||
|
</ul>
|
||||||
|
<p>Running sakisafe <%=$version%></p>
|
||||||
|
<div class="left">
|
||||||
|
<h2>Or just upload a file here</h2>
|
||||||
|
<form ENCTYPE='multipart/form-data' method='post' action='/upload'>
|
||||||
|
<input type='file' name='file' size='30'/>
|
||||||
|
<input type='submit' value='upload'/>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
__END__
|
||||||
|
|
||||||
|
|
||||||
|
=pod
|
||||||
|
|
||||||
|
=head1 sakisafe
|
||||||
|
|
||||||
|
sakisafe is a web application using the Mojolicious framework which
|
||||||
|
allow users to simply upload and share files.
|
||||||
|
|
||||||
|
=head2 synopsis
|
||||||
|
|
||||||
|
C<./sakisafe.pl daemon -m production>
|
||||||
|
|
||||||
|
This will start sakisafe in port 3000. Which should be proxied with
|
||||||
|
nginx or any reverse proxy software.
|
||||||
|
|
||||||
|
=head2 license
|
||||||
|
|
||||||
|
The Unlicense.
|
||||||
|
|
||||||
|
=head2 author
|
||||||
|
|
||||||
|
Raoul Vaughn
|
||||||
|
|
||||||
|
=cut
|
108
http/upload.cgi
108
http/upload.cgi
|
@ -1,108 +0,0 @@
|
||||||
#!/usr/bin/perl
|
|
||||||
# This file is part of sakisafe.
|
|
||||||
|
|
||||||
# sakisafe is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
|
|
||||||
# sakisafe 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 General Public License for more details.
|
|
||||||
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with sakisafe. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
use CGI;
|
|
||||||
use CGI::Carp qw(fatalsToBrowser);
|
|
||||||
|
|
||||||
my $q = CGI->new;
|
|
||||||
|
|
||||||
my $filename = $q->param('file');
|
|
||||||
my $url = $q->param('url');
|
|
||||||
|
|
||||||
my $upload_dir = "files/";
|
|
||||||
|
|
||||||
$size = $ENV{CONTENT_LENGTH};
|
|
||||||
|
|
||||||
# Configuration
|
|
||||||
|
|
||||||
our $MAX_SIZE = 1024*1024*100; # Change for your size
|
|
||||||
our $MAX_SIZE_MB = $MAX_SIZE / 1024 / 1024; # Don't change this
|
|
||||||
|
|
||||||
our @not_allowed_extensions = qw(sh out exe);
|
|
||||||
|
|
||||||
print $q->header();
|
|
||||||
|
|
||||||
# do something better
|
|
||||||
if ($url ne "") {
|
|
||||||
goto url_shorter;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($filename eq "" || $ENV{REQUEST_METHOD} eq "GET") {
|
|
||||||
print("What are you looking for?");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($filename) {
|
|
||||||
if ($size > $MAX_SIZE) {
|
|
||||||
print("Max size for a file is $MAX_SIZE_MB MBs");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
my @chars = ("A"..."z","a"..."z");
|
|
||||||
my $dirname;
|
|
||||||
my $extension = $filename;
|
|
||||||
|
|
||||||
$dirname .= $chars[rand @chars] for 1..8;
|
|
||||||
$extension =~ s/.*\.//;
|
|
||||||
$filename .= ".notcgi" if $extension eq "cgi";
|
|
||||||
|
|
||||||
mkdir("$upload_dir/$dirname");
|
|
||||||
my $upload_filehandle = $q->upload("file");
|
|
||||||
|
|
||||||
# onion urls will be http
|
|
||||||
my $prot = length $ENV{HTTPS} ? "https" : "http";
|
|
||||||
|
|
||||||
my $allowed_extension = 1;
|
|
||||||
|
|
||||||
foreach (@not_allowed_extensions) {
|
|
||||||
if ($filename =~ /\.$_$/i) {
|
|
||||||
$allowed_extension = 0;
|
|
||||||
last;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
if ($filename eq "-") {
|
|
||||||
$filename .= ".txt"; # for pastes
|
|
||||||
}
|
|
||||||
if ($allowed_extension) {
|
|
||||||
|
|
||||||
open(FILE,">$upload_dir/$dirname/$filename");
|
|
||||||
binmode(FILE);
|
|
||||||
while (<$upload_filehandle>) {
|
|
||||||
print FILE;
|
|
||||||
}
|
|
||||||
close FILE;
|
|
||||||
$filename =~ s/ /%20/g;
|
|
||||||
|
|
||||||
print $prot. "://" . $ENV{HTTP_HOST} . "/$upload_dir$dirname/$filename" . "\n";
|
|
||||||
} else {
|
|
||||||
print "The file extension .$extension is not allowed in this instance.";
|
|
||||||
}
|
|
||||||
exit;
|
|
||||||
} elsif ($url != "" && !$filename) {
|
|
||||||
url_shorter:
|
|
||||||
my $template = "<meta http-equiv=\"Refresh\" content=\"0; url='$url'\"/>";
|
|
||||||
my @chars = ("A"..."z","a"..."z",1..9);
|
|
||||||
my $dirname;
|
|
||||||
$dirname .= $chars[rand @chars] for 1..4;
|
|
||||||
mkdir($dirname);
|
|
||||||
open(my $fh, ">$dirname/index.html");
|
|
||||||
print $fh $template;
|
|
||||||
my $prot = length $ENV{HTTPS} ? "https" : "http";
|
|
||||||
print $prot. "://" . $ENV{HTTP_HOST} . "/$dirname" . "\n";
|
|
||||||
exit;
|
|
||||||
}
|
|
|
@ -1,24 +1,18 @@
|
||||||
# sakisafecli makefile
|
PROG += sakisafecli
|
||||||
|
SRCS += funcs.c sakisafecli.c config.c
|
||||||
|
MAN += sakisafecli.1 sakisafeclirc.5
|
||||||
|
LDADD += -lpthread -lcurl -lconfig -L/usr/local/lib -fPIC
|
||||||
|
PREFIX = /usr/local
|
||||||
|
|
||||||
TARGET = sakisafecli
|
# Use libbsd features if wanted
|
||||||
OBJS = sakisafecli.o funcs.o
|
use-libbsd ?= no
|
||||||
CC = cc
|
.if ${use-libbsd} == "yes"
|
||||||
CFLAGSDEF += -MD -std=c11 -Wall -Wextra -lcurl -lconfig
|
CFLAGS += -Duse_libbsd
|
||||||
CFLAGS += -O2 -ggdb
|
LDADD += -lbsd
|
||||||
|
.endif
|
||||||
|
|
||||||
all: $(TARGET)
|
BINMODE = 755
|
||||||
|
BINDIR = $(PREFIX)/bin
|
||||||
|
MANDIR = $(PREFIX)/man/man
|
||||||
|
|
||||||
$(TARGET): $(OBJS)
|
.include <bsd.prog.mk>
|
||||||
$(CC) $(CFLAGS) $(CFLAGSDEF) $(OBJS) -o $(TARGET)
|
|
||||||
|
|
||||||
%.o: %.c
|
|
||||||
$(CC) -c $(CFLAGS) $(CFLAGSDEF) $< -o $@
|
|
||||||
|
|
||||||
-include *.d
|
|
||||||
|
|
||||||
install: all
|
|
||||||
@cp sakisafecli /usr/local/bin/
|
|
||||||
|
|
||||||
.PHONY: clean install
|
|
||||||
clean:
|
|
||||||
rm -f *.d *.o sakisafecli
|
|
||||||
|
|
69
sakisafecli/config.c
Normal file
69
sakisafecli/config.c
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
#include <libconfig.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "options.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
void
|
||||||
|
print_config()
|
||||||
|
{
|
||||||
|
puts("Current configuration:");
|
||||||
|
printf("Server: %s\n", server);
|
||||||
|
if(socks_proxy_flag)
|
||||||
|
printf("Socks proxy url: %s", socks_proxy_url);
|
||||||
|
if(http_proxy_flag)
|
||||||
|
printf("HTTP proxy url: %s", http_proxy_url);
|
||||||
|
if(silent_flag)
|
||||||
|
puts("Silent: true");
|
||||||
|
else
|
||||||
|
puts("Silent: false");
|
||||||
|
if(ipv6_flag)
|
||||||
|
printf("Force IPv6: true\n");
|
||||||
|
else
|
||||||
|
printf("Force IPv6: false\n");
|
||||||
|
if(ipv4_flag)
|
||||||
|
printf("Force IPv4: true\n");
|
||||||
|
else
|
||||||
|
printf("Force IPv4: false\n");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
config_t runtime_config;
|
||||||
|
void
|
||||||
|
parse_config_file(FILE *config)
|
||||||
|
{
|
||||||
|
|
||||||
|
config_init(&runtime_config);
|
||||||
|
config_read(&runtime_config, config);
|
||||||
|
config_setting_t *cur;
|
||||||
|
cur = config_lookup(&runtime_config, "server");
|
||||||
|
|
||||||
|
if(config != NULL) {
|
||||||
|
if(cur != NULL)
|
||||||
|
server = (char *)config_setting_get_string(cur);
|
||||||
|
cur = config_lookup(&runtime_config, "socks_proxy");
|
||||||
|
if(cur != NULL)
|
||||||
|
socks_proxy_url = (char *)config_setting_get_string(cur);
|
||||||
|
cur = config_lookup(&runtime_config, "http_proxy");
|
||||||
|
if(cur != NULL)
|
||||||
|
http_proxy_url = (char *)config_setting_get_string(cur);
|
||||||
|
cur = config_lookup(&runtime_config, "use_socks_proxy");
|
||||||
|
if(cur != NULL)
|
||||||
|
socks_proxy_flag = config_setting_get_bool(cur);
|
||||||
|
cur = config_lookup(&runtime_config, "use_http_proxy");
|
||||||
|
if(cur != NULL)
|
||||||
|
http_proxy_flag = config_setting_get_bool(cur);
|
||||||
|
cur = config_lookup(&runtime_config, "silent");
|
||||||
|
if(cur != NULL)
|
||||||
|
silent_flag = config_setting_get_bool(cur);
|
||||||
|
cur = config_lookup(&runtime_config, "force_ipv6");
|
||||||
|
if(cur != NULL)
|
||||||
|
ipv6_flag = config_setting_get_bool(cur);
|
||||||
|
cur = config_lookup(&runtime_config, "force_ipv4");
|
||||||
|
if(cur != NULL)
|
||||||
|
ipv4_flag = config_setting_get_bool(cur);
|
||||||
|
cur = config_lookup(&runtime_config, "key");
|
||||||
|
if(cur != NULL)
|
||||||
|
ssh_key_path = (char *)config_setting_get_string(cur);
|
||||||
|
}
|
||||||
|
}
|
30
sakisafecli/config.h
Normal file
30
sakisafecli/config.h
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
#pragma once
|
||||||
|
#include <curl/curl.h>
|
||||||
|
#include <libconfig.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* Parse the config file */
|
||||||
|
void
|
||||||
|
parse_config_file(FILE *config);
|
||||||
|
|
||||||
|
/* Print the current settings */
|
||||||
|
void
|
||||||
|
print_config();
|
||||||
|
|
||||||
|
/* Internal variables */
|
||||||
|
|
||||||
|
extern CURL *easy_handle;
|
||||||
|
|
||||||
|
extern char *buffer;
|
||||||
|
/* Config variables */
|
||||||
|
|
||||||
|
extern bool ipv6_flag, ipv4_flag, http_proxy_flag,
|
||||||
|
socks_proxy_flag, silent_flag, paste_flag;
|
||||||
|
|
||||||
|
extern char *http_proxy_url, *socks_proxy_url;
|
||||||
|
extern char *ssh_key_path;
|
||||||
|
|
||||||
|
extern char *server;
|
||||||
|
extern const char *path;
|
||||||
|
|
|
@ -1,12 +1,17 @@
|
||||||
|
#include <curl/system.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <libconfig.h>
|
#include <libconfig.h>
|
||||||
|
#include <curl/curl.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <getopt.h>
|
||||||
#include "sakisafecli.h"
|
#include "sakisafecli.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
write_data(void *buffer, size_t size, size_t nmemb,
|
write_data(void *buffer, size_t size, size_t nmemb, void *userp)
|
||||||
void *userp)
|
|
||||||
{
|
{
|
||||||
memcpy(userp, buffer, nmemb * size);
|
memcpy(userp, buffer, nmemb * size);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -15,51 +20,133 @@ write_data(void *buffer, size_t size, size_t nmemb,
|
||||||
void
|
void
|
||||||
print_usage()
|
print_usage()
|
||||||
{
|
{
|
||||||
printf("USAGE: sakisafecli [--socks-proxy=socks_address|--http_proxy=proxy_address] [-6|-4] [--server] file\n");
|
printf("USAGE: sakisafecli [-p socks proxy|-P http proxy] [-x] [-s] "
|
||||||
|
"[-6|-4] [--server] FILE\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
store_link(const char *path, const char *buf)
|
|
||||||
{
|
|
||||||
FILE *fp = fopen(path,"a+");
|
|
||||||
if(fp == NULL) {
|
|
||||||
fprintf(stderr,"Error opening file %i: %s\n",errno,
|
|
||||||
strerror(errno));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
fwrite(buf,strlen(buf),1,fp);
|
|
||||||
fputc('\n',fp);
|
|
||||||
fclose(fp);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
print_help()
|
print_help()
|
||||||
{
|
{
|
||||||
printf("--server <server>: specifies the sakisafe server\n%s\n%s\n%s\n%s\n%s\n%s\n%s",
|
printf("-s|--server: specifies the sakisafe "
|
||||||
|
"server\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s",
|
||||||
"-t|--token: Authentication token (https://u.kalli.st)",
|
"-t|--token: Authentication token (https://u.kalli.st)",
|
||||||
"--tor: uses tor.",
|
"-P|--http-proxy: http proxy to use e.g. http://127.0.0.1:4444",
|
||||||
"--i2p: uses i2p.",
|
"-p|--socks-proxy: SOCK proxy to use e.g. 127.0.0.1:9050",
|
||||||
"-6|--ipv6: uses IPv6 only.",
|
"-6|--ipv6: uses IPv6 only",
|
||||||
"-4|--ipv6: uses IPv4 only.",
|
"-4|--ipv6: uses IPv4 only",
|
||||||
"--silent: doesn't print progress.",
|
"-S|--silent: doesn't print progress",
|
||||||
"--help: print this message.\n");
|
"-x|--paste: read file from stdin",
|
||||||
|
"-C: print current settings",
|
||||||
|
"-h|--help: print this message.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
size_t
|
||||||
progress(void *clientp,
|
progress(void *clientp,
|
||||||
double dltotal,
|
curl_off_t dltotal,
|
||||||
double dlnow,
|
curl_off_t dlnow,
|
||||||
double ultotal,
|
curl_off_t ultotal,
|
||||||
double ulnow)
|
curl_off_t ulnow)
|
||||||
{
|
{
|
||||||
/* So I don't get a warning */
|
/* I don't know why the fuck I have to do this */
|
||||||
dltotal += 1;
|
if(ultotal == 0) {
|
||||||
dlnow += 1;
|
ultotal++;
|
||||||
printf("\r%0.f uploaded of %0.f (\E[32;1m%0.f%%\E[30;0m)",ulnow,ultotal,
|
}
|
||||||
|
printf("\r%li uploaded of %li (\033[32;1m%li%%\033[30;0m)",
|
||||||
|
ulnow,
|
||||||
|
ultotal,
|
||||||
ulnow * 100 / ultotal);
|
ulnow * 100 / ultotal);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int
|
||||||
|
get_protocol(char *server)
|
||||||
|
{
|
||||||
|
if(strstr(server, "http://") != NULL || strstr(server, "https://"))
|
||||||
|
return CURLPROTO_HTTP;
|
||||||
|
else if(strstr(server, "scp://") != NULL)
|
||||||
|
return CURLPROTO_SCP;
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
void
|
||||||
|
die(const char *msg)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "%i: %s", errno, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
init_sakisafe_options()
|
||||||
|
{
|
||||||
|
ipv6_flag = http_proxy_flag,
|
||||||
|
socks_proxy_flag = paste_flag = silent_flag = false;
|
||||||
|
|
||||||
|
ipv4_flag = true;
|
||||||
|
|
||||||
|
ssh_key_path = NULL;
|
||||||
|
server = "https://meth.cat";
|
||||||
|
path = ".cache/sakisafelinks";
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
upload_file_http(int argc, char **argv)
|
||||||
|
{
|
||||||
|
|
||||||
|
curl_mime *mime;
|
||||||
|
mime = curl_mime_init(easy_handle);
|
||||||
|
|
||||||
|
curl_easy_setopt(easy_handle, CURLOPT_MIMEPOST, mime);
|
||||||
|
if(!mime) {
|
||||||
|
fprintf(stderr, "Error initializing curl_mime\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
curl_mimepart *file_data;
|
||||||
|
file_data = curl_mime_addpart(mime);
|
||||||
|
char *filename = argv[optind - 1];
|
||||||
|
/* Get file from stdin */
|
||||||
|
if(paste_flag)
|
||||||
|
filename = "/dev/stdin";
|
||||||
|
curl_mime_filedata(file_data, filename);
|
||||||
|
curl_mime_name(file_data, "file");
|
||||||
|
if(paste_flag)
|
||||||
|
curl_mime_filename(file_data, "-");
|
||||||
|
curl_easy_perform(easy_handle);
|
||||||
|
if(!silent_flag)
|
||||||
|
putchar('\n');
|
||||||
|
puts(buffer);
|
||||||
|
curl_mime_free(mime);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
upload_file_scp(int argc, char **argv)
|
||||||
|
{
|
||||||
|
curl_easy_setopt(easy_handle, CURLOPT_SSH_PRIVATE_KEYFILE, ssh_key_path);
|
||||||
|
|
||||||
|
char path[256];
|
||||||
|
char *filename = argv[optind];
|
||||||
|
|
||||||
|
curl_easy_setopt(easy_handle, CURLOPT_UPLOAD, true);
|
||||||
|
FILE *fp = fopen(filename, "r");
|
||||||
|
if(fp == NULL) {
|
||||||
|
fprintf(stderr, "%s", strerror(errno));
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct stat st;
|
||||||
|
stat(argv[optind], &st);
|
||||||
|
snprintf(path, 256, "%s/%s", server, filename);
|
||||||
|
curl_easy_setopt(easy_handle, CURLOPT_READDATA, fp);
|
||||||
|
curl_easy_setopt(
|
||||||
|
easy_handle, CURLOPT_INFILESIZE_LARGE, (curl_off_t)st.st_size);
|
||||||
|
|
||||||
|
int ret = curl_easy_perform(easy_handle);
|
||||||
|
putchar('\n');
|
||||||
|
if(ret != 0) {
|
||||||
|
fprintf(stderr, "%i: %s\n", ret, curl_easy_strerror(ret));
|
||||||
|
}
|
||||||
|
fclose(fp);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
39
sakisafecli/funcs.h
Normal file
39
sakisafecli/funcs.h
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
#pragma once
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
/* Function used from curl to write data to a buffer */
|
||||||
|
size_t
|
||||||
|
write_data(void *buffer, size_t size, size_t nmemb, void *userp);
|
||||||
|
|
||||||
|
/* Print usage message (when nothing is given to sakisafecli) */
|
||||||
|
void
|
||||||
|
print_usage();
|
||||||
|
|
||||||
|
/* Print help message (-h) */
|
||||||
|
void
|
||||||
|
print_help();
|
||||||
|
|
||||||
|
/* Function used to display progress when uploading a file */
|
||||||
|
|
||||||
|
void
|
||||||
|
progress(
|
||||||
|
void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);
|
||||||
|
|
||||||
|
/* Print config */
|
||||||
|
void
|
||||||
|
print_config();
|
||||||
|
|
||||||
|
int
|
||||||
|
init_sakisafe_options();
|
||||||
|
|
||||||
|
int
|
||||||
|
get_protocol(char *server);
|
||||||
|
|
||||||
|
int
|
||||||
|
die(char *msg);
|
||||||
|
|
||||||
|
int
|
||||||
|
upload_file_http(int argc, char **argv);
|
||||||
|
|
||||||
|
int
|
||||||
|
upload_file_scp(int argc, char **argv);
|
|
@ -1,8 +1,11 @@
|
||||||
#pragma once
|
#ifndef OPTIONS_H
|
||||||
|
#define OPTIONS_H
|
||||||
|
|
||||||
|
#include <libconfig.h>
|
||||||
/* clainsafecli options */
|
/* clainsafecli options */
|
||||||
|
|
||||||
/* Default server you'll upload files to */
|
/* Default server you'll upload files to */
|
||||||
char *server = "https://lainsafe.kalli.st";
|
extern char *server;
|
||||||
|
|
||||||
/* proxy urls, socks and http. in that order, by default they're
|
/* proxy urls, socks and http. in that order, by default they're
|
||||||
* configured to be used for tor and i2p, but if you have another
|
* configured to be used for tor and i2p, but if you have another
|
||||||
|
@ -11,7 +14,18 @@ char *server = "https://lainsafe.kalli.st";
|
||||||
|
|
||||||
/* Enable "history" files and where to store that file */
|
/* Enable "history" files and where to store that file */
|
||||||
|
|
||||||
char history_file_path[256];
|
extern char history_file_path[256];
|
||||||
const int enable_links_history = 1;
|
extern const int enable_links_history;
|
||||||
const char *path = ".cache/lainsafelinks";
|
extern const char *path;
|
||||||
|
|
||||||
|
/* Config file variables */
|
||||||
|
extern char *socks_proxy_url, *http_proxy_url;
|
||||||
|
|
||||||
|
extern bool socks_proxy_flag;
|
||||||
|
extern bool http_proxy_flag;
|
||||||
|
extern bool ipv6_flag;
|
||||||
|
extern bool ipv4_flag;
|
||||||
|
extern bool silent_flag;
|
||||||
|
extern char *ssh_key_path;
|
||||||
|
extern config_t runtime_config;
|
||||||
|
#endif /* OPTIONS_H */
|
||||||
|
|
61
sakisafecli/sakisafecli.1
Normal file
61
sakisafecli/sakisafecli.1
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
.Dd $Mdocdate$
|
||||||
|
.Dt sakisafecli 1
|
||||||
|
.Os
|
||||||
|
.Sh sakisafecli
|
||||||
|
.Nm sakisafecli
|
||||||
|
.Nd file uploader
|
||||||
|
|
||||||
|
.Sh SYPNOSIS
|
||||||
|
|
||||||
|
sakisafecli [https]://sakisafe.tld FILE
|
||||||
|
|
||||||
|
.Sh DESCRIPTION
|
||||||
|
sakisafecli is a file uploader. Intended for sakisafe, but also works
|
||||||
|
for 0x0.st, 0xff.i2p, i.kalli.st and probably others. It also supports
|
||||||
|
transfer via scp.
|
||||||
|
.Sh OPTIONS
|
||||||
|
|
||||||
|
.Sy --http_proxy
|
||||||
|
Use an HTTP Proxy to make the request to the server.
|
||||||
|
|
||||||
|
.Sy --socks_proxy
|
||||||
|
Use a SOCKS Proxy to make the request to the server.
|
||||||
|
|
||||||
|
.Sy --server
|
||||||
|
Specify which server to use to upload the given file.
|
||||||
|
|
||||||
|
.Sy -4
|
||||||
|
Force an IPv4 connection.
|
||||||
|
|
||||||
|
.Sy -6
|
||||||
|
Force an IPv6 connection.
|
||||||
|
|
||||||
|
.Sy -x
|
||||||
|
Paste mode. Reads from stdin and publish the given content to the
|
||||||
|
server.
|
||||||
|
|
||||||
|
.Sy -C
|
||||||
|
Print the current settings.
|
||||||
|
|
||||||
|
.Sy --key
|
||||||
|
path to the private SSH key to use. Only useful when using the
|
||||||
|
.Sy scp://
|
||||||
|
protocol.
|
||||||
|
|
||||||
|
.Sh BUGS
|
||||||
|
Of course.
|
||||||
|
.Sh HISTORY
|
||||||
|
|
||||||
|
First commit to
|
||||||
|
.Sy lainsafe
|
||||||
|
was made in 2020-04-19.
|
||||||
|
.Sy clainsafecli
|
||||||
|
first commit was made in 2021-02-01.
|
||||||
|
.Sy clainsafecli
|
||||||
|
was rebranded to
|
||||||
|
.Sy sakisafecli
|
||||||
|
in 2022-05-05
|
||||||
|
.Sh AUTHORS
|
||||||
|
Raoul Vaughn <chief_keef at riseup dot net>
|
||||||
|
.Sh SEE ALSO
|
||||||
|
sakisafeclirc(5)
|
|
@ -3,35 +3,50 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <errno.h>
|
#include <err.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#ifdef use_libbsd
|
||||||
|
#include <bsd/string.h>
|
||||||
|
#endif
|
||||||
|
#include "curl/easy.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
#include "config.h"
|
||||||
|
#include "funcs.h"
|
||||||
#include "sakisafecli.h"
|
#include "sakisafecli.h"
|
||||||
|
|
||||||
/* Config variables */
|
CURL *easy_handle;
|
||||||
char *socks_proxy_url, *http_proxy_url;
|
|
||||||
|
char *buffer;
|
||||||
|
/* Config variables */
|
||||||
|
|
||||||
|
bool ipv6_flag, ipv4_flag, http_proxy_flag,
|
||||||
|
socks_proxy_flag, silent_flag, paste_flag;
|
||||||
|
|
||||||
|
char *http_proxy_url, *socks_proxy_url;
|
||||||
|
char *ssh_key_path;
|
||||||
|
|
||||||
|
char *server;
|
||||||
|
const char *path;
|
||||||
|
|
||||||
bool socks_proxy_flag = false, http_proxy_flag = false;
|
|
||||||
bool ipv6_flag = false, ipv4_flag = false;
|
|
||||||
bool silent_flag = false;
|
|
||||||
config_t runtime_config;
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct curl_httppost *post = NULL;
|
#ifdef __OpenBSD__
|
||||||
struct curl_httppost *last = NULL;
|
if(pledge("stdio rpath cpath inet dns unveil tmppath", "") == -1) {
|
||||||
|
err(1, "pledge");
|
||||||
|
_exit(-1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
char *token = NULL;
|
buffer = (char *)calloc(1024, sizeof(char));
|
||||||
char *form_key = "file";
|
|
||||||
|
|
||||||
char *buffer = (char *)calloc(1024, sizeof(char));
|
|
||||||
|
|
||||||
if(buffer == NULL) {
|
if(buffer == NULL) {
|
||||||
fprintf(stderr, "Error allocating memory!\n");
|
fprintf(stderr, "Error allocating memory for buffer!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
char config_location[512];
|
char config_location[512];
|
||||||
|
@ -45,43 +60,51 @@ main(int argc, char **argv)
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(use_libbsd)
|
||||||
|
strlcpy(config_location, sakisafeclirc_env, 512);
|
||||||
|
#else /* Linux sucks! */
|
||||||
strncpy(config_location, sakisafeclirc_env, 512);
|
strncpy(config_location, sakisafeclirc_env, 512);
|
||||||
|
#endif
|
||||||
FILE *fp = fopen(config_location, "r");
|
FILE *fp = fopen(config_location, "r");
|
||||||
if(fp != NULL) {
|
if(fp != NULL) {
|
||||||
parse_config_file(fp);
|
parse_config_file(fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* libcurl initialization */
|
||||||
|
|
||||||
CURL *easy_handle = curl_easy_init();
|
easy_handle = curl_easy_init();
|
||||||
|
|
||||||
if(!easy_handle) {
|
if(!easy_handle) {
|
||||||
fprintf(stderr, "Error initializing libcurl\n");
|
fprintf(stderr, "Error initializing libcurl\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(argc == optind) {
|
if(argc == optind) {
|
||||||
print_usage();
|
print_usage();
|
||||||
free(buffer);
|
free(buffer);
|
||||||
curl_easy_cleanup(easy_handle);
|
curl_easy_cleanup(easy_handle);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
init_sakisafe_options();
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
static struct option long_options[] = {
|
static struct option long_options[] = {
|
||||||
{ "server", required_argument, 0, 's' },
|
{ "server", required_argument, 0, 's' },
|
||||||
{ "help", no_argument, 0, 'h' },
|
{ "help", no_argument, 0, 'h' },
|
||||||
{ "socks-proxy", required_argument, 0, 'p' },
|
{ "socks-proxy", required_argument, 0, 'p' },
|
||||||
{ "token", required_argument, 0, 'T' },
|
|
||||||
{ "http-proxy", required_argument, 0, 'P' },
|
{ "http-proxy", required_argument, 0, 'P' },
|
||||||
{ "silent", no_argument, 0, 'S' },
|
{ "silent", no_argument, 0, 'S' },
|
||||||
{ "ipv4", no_argument, 0, '4' },
|
{ "ipv4", no_argument, 0, '4' },
|
||||||
{ "ipv6", no_argument, 0, '6' },
|
{ "ipv6", no_argument, 0, '6' },
|
||||||
|
{ "paste", no_argument, 0, 'x' },
|
||||||
|
{ "key", required_argument, 0, 'k' },
|
||||||
{ 0, 0, 0, 0 }
|
{ 0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
int c = 0;
|
int c = 0;
|
||||||
while((c = getopt_long(
|
while(
|
||||||
argc, argv, "46hT:p:P:Ss:", long_options, &option_index)) !=
|
(c = getopt_long(
|
||||||
|
argc, argv, "46hT:p:P:Ss:xCk:", long_options, &option_index)) !=
|
||||||
-1) {
|
-1) {
|
||||||
switch(c) {
|
switch(c) {
|
||||||
case 's':
|
case 's':
|
||||||
|
@ -104,19 +127,27 @@ main(int argc, char **argv)
|
||||||
case 'S':
|
case 'S':
|
||||||
silent_flag = true;
|
silent_flag = true;
|
||||||
break;
|
break;
|
||||||
case 'T':
|
|
||||||
token = optarg;
|
|
||||||
break;
|
|
||||||
case '4':
|
case '4':
|
||||||
ipv4_flag = true;
|
ipv4_flag = true;
|
||||||
break;
|
break;
|
||||||
case '6':
|
case '6':
|
||||||
ipv6_flag = true;
|
ipv6_flag = true;
|
||||||
break;
|
break;
|
||||||
|
case 'x':
|
||||||
|
/* We don't want the progress bar in this case */
|
||||||
|
silent_flag = true;
|
||||||
|
paste_flag = true;
|
||||||
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
print_usage();
|
print_usage();
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
|
case 'C':
|
||||||
|
print_config();
|
||||||
|
return 0;
|
||||||
|
case 'k':
|
||||||
|
ssh_key_path = optarg;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
print_usage();
|
print_usage();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -124,15 +155,23 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(access(argv[optind], F_OK)) {
|
if(access(argv[optind], F_OK) && !paste_flag) {
|
||||||
fprintf(stderr, "Error opening file\n");
|
fprintf(stderr, "Error opening file: %s\n", strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* curl options */
|
/* curl options */
|
||||||
curl_easy_setopt(easy_handle, CURLOPT_WRITEFUNCTION, write_data);
|
if(curl_easy_setopt(easy_handle, CURLOPT_USERAGENT, "curl") != 0)
|
||||||
curl_easy_setopt(easy_handle, CURLOPT_WRITEDATA, buffer);
|
die("Error setting CURLOPT_USERAGENT");
|
||||||
curl_easy_setopt(easy_handle, CURLOPT_URL, server);
|
if(curl_easy_setopt(easy_handle, CURLOPT_WRITEFUNCTION, write_data) != 0)
|
||||||
|
die("Error setting CURLOPT_WRITEFUNCTION");
|
||||||
|
if(curl_easy_setopt(easy_handle, CURLOPT_WRITEDATA, buffer) != 0)
|
||||||
|
die("error setting CURLOPT_WRITEDATA");
|
||||||
|
|
||||||
|
if(curl_easy_setopt(easy_handle, CURLOPT_URL, server) != 0)
|
||||||
|
die("error setting CURLOPT_URL");
|
||||||
|
|
||||||
|
int protocol = get_protocol(server);
|
||||||
|
|
||||||
/* Proxy options */
|
/* Proxy options */
|
||||||
|
|
||||||
|
@ -143,7 +182,7 @@ main(int argc, char **argv)
|
||||||
curl_easy_setopt(easy_handle, CURLOPT_PROXY, socks_proxy_url);
|
curl_easy_setopt(easy_handle, CURLOPT_PROXY, socks_proxy_url);
|
||||||
curl_easy_setopt(
|
curl_easy_setopt(
|
||||||
easy_handle, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5_HOSTNAME);
|
easy_handle, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5_HOSTNAME);
|
||||||
} else if(http_proxy_flag) {
|
} else if(http_proxy_flag && protocol == CURLPROTO_HTTP) {
|
||||||
curl_easy_setopt(easy_handle, CURLOPT_PROXY, http_proxy_url);
|
curl_easy_setopt(easy_handle, CURLOPT_PROXY, http_proxy_url);
|
||||||
curl_easy_setopt(easy_handle, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
|
curl_easy_setopt(easy_handle, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
|
||||||
}
|
}
|
||||||
|
@ -158,7 +197,12 @@ main(int argc, char **argv)
|
||||||
curl_easy_setopt(
|
curl_easy_setopt(
|
||||||
easy_handle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_WHATEVER);
|
easy_handle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_WHATEVER);
|
||||||
|
|
||||||
/* Form parameters */
|
/* Common options for both HTTP and SCP transfers */
|
||||||
|
|
||||||
|
curl_easy_setopt(easy_handle, CURLOPT_NOPROGRESS, silent_flag);
|
||||||
|
struct progress mem;
|
||||||
|
curl_easy_setopt(easy_handle, CURLOPT_XFERINFODATA, &mem);
|
||||||
|
curl_easy_setopt(easy_handle, CURLOPT_XFERINFOFUNCTION, progress);
|
||||||
|
|
||||||
/* File name */
|
/* File name */
|
||||||
|
|
||||||
|
@ -166,94 +210,22 @@ main(int argc, char **argv)
|
||||||
* at once (sakisafecli file1 file2 ... filen)
|
* at once (sakisafecli file1 file2 ... filen)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(strstr(server, "concealed.world")) {
|
/* Process HTTP uploads */
|
||||||
form_key = "upload";
|
|
||||||
|
if(protocol == CURLPROTO_HTTP) {
|
||||||
|
upload_file_http(argc, argv);
|
||||||
}
|
}
|
||||||
puts(form_key);
|
/* Process SCP uploads */
|
||||||
|
else if(protocol == CURLPROTO_SCP) {
|
||||||
for(int i = optind; i < argc; i++) {
|
upload_file_scp(argc, argv);
|
||||||
curl_formadd(&post,
|
} else {
|
||||||
&last,
|
puts("Unsupported protocol");
|
||||||
CURLFORM_COPYNAME,
|
return -1;
|
||||||
form_key,
|
|
||||||
CURLFORM_FILE,
|
|
||||||
argv[i],
|
|
||||||
CURLFORM_END);
|
|
||||||
/* Actual file content */
|
|
||||||
curl_formadd(&post,
|
|
||||||
&last,
|
|
||||||
CURLFORM_COPYNAME,
|
|
||||||
form_key,
|
|
||||||
CURLFORM_COPYCONTENTS,
|
|
||||||
argv[i],
|
|
||||||
CURLFORM_END);
|
|
||||||
if(token)
|
|
||||||
curl_formadd(&post,
|
|
||||||
&last,
|
|
||||||
CURLFORM_COPYNAME,
|
|
||||||
"token",
|
|
||||||
CURLFORM_COPYCONTENTS,
|
|
||||||
token,
|
|
||||||
CURLFORM_END);
|
|
||||||
|
|
||||||
curl_easy_setopt(easy_handle, CURLOPT_NOPROGRESS, silent_flag);
|
|
||||||
curl_easy_setopt(easy_handle, CURLOPT_PROGRESSFUNCTION, progress);
|
|
||||||
|
|
||||||
curl_easy_setopt(easy_handle, CURLOPT_HTTPPOST, post);
|
|
||||||
|
|
||||||
curl_easy_perform(easy_handle);
|
|
||||||
|
|
||||||
if(!silent_flag)
|
|
||||||
putchar('\n');
|
|
||||||
|
|
||||||
printf("%s", buffer);
|
|
||||||
}
|
}
|
||||||
curl_formfree(post);
|
|
||||||
curl_easy_cleanup(easy_handle);
|
curl_easy_cleanup(easy_handle);
|
||||||
|
|
||||||
/* Store link if needed */
|
|
||||||
|
|
||||||
if(enable_links_history) {
|
|
||||||
snprintf(history_file_path, 256, "%s/%s", getenv("HOME"), path);
|
|
||||||
store_link(history_file_path, buffer);
|
|
||||||
}
|
|
||||||
free(buffer);
|
|
||||||
config_destroy(&runtime_config);
|
config_destroy(&runtime_config);
|
||||||
|
free(buffer);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
parse_config_file(FILE *config)
|
|
||||||
{
|
|
||||||
config_init(&runtime_config);
|
|
||||||
config_read(&runtime_config, config);
|
|
||||||
config_setting_t *cur;
|
|
||||||
cur = config_lookup(&runtime_config, "server");
|
|
||||||
if(config != NULL) {
|
|
||||||
if(cur != NULL)
|
|
||||||
server = (char *)config_setting_get_string(cur);
|
|
||||||
cur = config_lookup(&runtime_config, "socks_proxy");
|
|
||||||
if(cur != NULL)
|
|
||||||
socks_proxy_url = (char *)config_setting_get_string(cur);
|
|
||||||
cur = config_lookup(&runtime_config, "http_proxy");
|
|
||||||
if(cur != NULL)
|
|
||||||
http_proxy_url = (char *)config_setting_get_string(cur);
|
|
||||||
cur = config_lookup(&runtime_config, "use_socks_proxy");
|
|
||||||
if(cur != NULL)
|
|
||||||
socks_proxy_flag = config_setting_get_bool(cur);
|
|
||||||
cur = config_lookup(&runtime_config, "use_http_proxy");
|
|
||||||
|
|
||||||
if(cur != NULL)
|
|
||||||
http_proxy_flag = config_setting_get_bool(cur);
|
|
||||||
|
|
||||||
cur = config_lookup(&runtime_config, "silent");
|
|
||||||
if(cur != NULL)
|
|
||||||
silent_flag = config_setting_get_bool(cur);
|
|
||||||
cur = config_lookup(&runtime_config, "force_ipv6");
|
|
||||||
if(cur != NULL)
|
|
||||||
ipv6_flag = config_setting_get_bool(cur);
|
|
||||||
cur = config_lookup(&runtime_config, "force_ipv4");
|
|
||||||
if(cur != NULL)
|
|
||||||
ipv4_flag = config_setting_get_bool(cur);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,6 +1,14 @@
|
||||||
#pragma once
|
#ifndef SAKISAFECLI_H
|
||||||
|
#define SAKISAFECLI_H
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <curl/curl.h>
|
||||||
|
|
||||||
|
struct progress
|
||||||
|
{
|
||||||
|
char *_private;
|
||||||
|
size_t size;
|
||||||
|
};
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
write_data(void *buffer, size_t size, size_t nmemb, void *userp);
|
write_data(void *buffer, size_t size, size_t nmemb, void *userp);
|
||||||
|
@ -14,9 +22,10 @@ store_link(const char *path, const char *buf);
|
||||||
void
|
void
|
||||||
print_help();
|
print_help();
|
||||||
|
|
||||||
void
|
|
||||||
progress(
|
|
||||||
void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
parse_config_file(FILE *config);
|
parse_config_file(FILE *config);
|
||||||
|
int
|
||||||
|
get_protocol(char *server);
|
||||||
|
|
||||||
|
#endif /* SAKISAFECLI_H */
|
||||||
|
|
73
sakisafecli/sakisafeclirc.5
Normal file
73
sakisafecli/sakisafeclirc.5
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
.Dd $Mdocdate$
|
||||||
|
.Dt sakisafeclirc 5
|
||||||
|
.Os
|
||||||
|
.Sh sakisafeclirc
|
||||||
|
.Nm sakisafeclirc
|
||||||
|
.Nd sakisafecli runtime configuration
|
||||||
|
.Sh DESCRIPTION
|
||||||
|
The sakisafecli(1) utility supports a configuration file. Which is by
|
||||||
|
default in $HOME/.sakisafeclirc. This configuration file allows to
|
||||||
|
change the default behaviour of sakisafecli(1) Lines that begin with
|
||||||
|
.Sy #
|
||||||
|
are ignored.
|
||||||
|
|
||||||
|
The files uses a simple
|
||||||
|
.Sy key=value
|
||||||
|
format. This are the possible keys:
|
||||||
|
|
||||||
|
.Sy server (string)
|
||||||
|
Specify the server to upload the file.
|
||||||
|
|
||||||
|
.Sy http_proxy (string)
|
||||||
|
Specify the HTTP proxy address.
|
||||||
|
|
||||||
|
.Sy socks_proxy (string)
|
||||||
|
Specify the SOCKS proxy address.
|
||||||
|
|
||||||
|
.Sy use_socks_sproxy (boolean)
|
||||||
|
Specify whether to use or not the SOCKS Proxy specified with
|
||||||
|
.Sy socks_proxy
|
||||||
|
|
||||||
|
.Sy use_http_proxy (boolean)
|
||||||
|
Specify whether to use or not the HTTP proxy specified with
|
||||||
|
.Sy http_proxy
|
||||||
|
|
||||||
|
.Sy force_ipv6 (boolean)
|
||||||
|
Force an IPv6 connection. Cannot be used with
|
||||||
|
.Sy force_ipv4
|
||||||
|
|
||||||
|
.Sy force_ipv4 (boolean)
|
||||||
|
Force an IPv4 connection. Cannot be used with
|
||||||
|
.Sy force_ipv6
|
||||||
|
|
||||||
|
.Sy key
|
||||||
|
Path to the private ssh key used to connect to a server using the
|
||||||
|
.Sy scp
|
||||||
|
protocol.
|
||||||
|
|
||||||
|
.Sh FILES
|
||||||
|
|
||||||
|
.Bl -tag -width $HOME/.sakisafeclirc -compact
|
||||||
|
.It Pa $HOME/.sakisafeclirc
|
||||||
|
configuration file.
|
||||||
|
|
||||||
|
.Sh EXAMPLE
|
||||||
|
|
||||||
|
This example sets the default server to
|
||||||
|
.Em https://ls.qorg11.net. Forcing
|
||||||
|
.Em IPv6 connection
|
||||||
|
and with the
|
||||||
|
.Em socks_proxy
|
||||||
|
127.0.0.1:9050
|
||||||
|
|
||||||
|
.Bd -literal -offset indent;
|
||||||
|
server="https://ss.suragu.net"
|
||||||
|
socks_proxy="127.0.0.1:9050"
|
||||||
|
force_ipv4=true
|
||||||
|
use_socks_proxy=true
|
||||||
|
.Ed
|
||||||
|
.Sh AUTHORS
|
||||||
|
Raoul Vaughn <chief_keef at riseup dot net>
|
||||||
|
.Sh SEE ALSO
|
||||||
|
sakisafecli(1)
|
||||||
|
|
Loading…
Add table
Reference in a new issue