Rebranded

This commit is contained in:
qorg11 2022-05-05 20:04:29 +02:00
parent 0987a4cfa3
commit 0d1e07fe51
No known key found for this signature in database
GPG Key ID: 343FC20A4ACA62B9
26 changed files with 94 additions and 294 deletions

View File

@ -1,4 +0,0 @@
install: lainsafecli
cp lainsafecli /usr/bin/
gzip -k doc/lainsafecli.1
cp doc/lainsafecli.1.gz /usr/share/man/man1

View File

@ -1,5 +1,6 @@
# Lainsafe
### simple file upload.
# Sakisafe (formerly lainsafe)
## Simple file upload
## Features
@ -16,19 +17,15 @@
the file
2. There you go.
For more detailed information, look at the
[manpage](https://codeberg.org/qorg11/lainsafe/src/branch/master/doc/lainsafe.md)
# sakisafecli
# clainsafecli
`clainsafecli` is the command line interface for lainsafe (and other
`sakisafecli` is the command line interface for sakisafe (and other
filesharing services)
## usage
`clainsafecli --server=http://server <file>`
`sakisafecli --server=http://server <file>`
(for more info see -h)

View File

@ -1,94 +0,0 @@
.\"Manpage for lainsafe
.TH lainsafe 1
.SH NAME
lainsafe \- Simple file upload
.SH DESCRIPTION
lainsafe is a simple file upload server written in Perl + CGI.
It runs in a Web server (i.e. nginx) with a CGI handler
(i.e. fcgiwrap)
You also have to install the dependencies, in Debian:
.in +4n
.EX
apt install nginx libcgi-pm-perl fcgiwrap
.EE
.SH INSTALLATION
You can use any web server for running lainsafe. However, nginx is
recommended. The following configuration should work for nginx:
.I /etc/nginx/sites-enabled/lainsafe.conf
.in +4n
.EX
server
{
server_name lainsafe.foo.tld;
listen 80;
listen [::]:80;
client_max_body_size 100m; # max size 100MBs, change 10 to 100
# in upload.cgi in line 30
root /var/www/lainsafe;
location ~ \.cgi$ {
gzip off;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_index index.cgi;
fastcgi_param SCRIPT_FILENAME /var/www/lainsafe/$fastcgi_script_name;
}
}
.EE
.PP
The document root will be /var/www/lainsafe (be sure to change it in
.I root
and
.I fastcgi_param SCRIPT_FILENAME if you're going to use another directory
You also have to give the .cgi files +x permissions:
.in +4n
.EX
chmod +x *.cgi
.EE
.PP
And also, create the "files" directory manually, and give it
permissions so the user that is running nginx (usually)
.I www-data
can write on it.
.EX
chown www-data:www-data files
.EE
.SH TROUBLESHOOTING
.SS 502 Bad Gateway
Probably you're missing the
.I CGI
dependence, so install it with CPAN or apt
.in +4n
.EX
cpan -i CGI
apt install libcgi-pm-perl
.EE
.PP
If you still get this problem, run
.in +4n
.EX
perl <file>.cgi
.EE
.PP
so perl can help you debug the problem.
.SS 403 is returned
You probably forgot to give the files execution permissions.

View File

@ -1,79 +0,0 @@
NAME
====
lainsafe - Simple file upload
DESCRIPTION
===========
lainsafe is a simple file upload server written in Perl + CGI.
It runs in a Web server (i.e. nginx) with a CGI handler (i.e. fcgiwrap)
You also have to install the dependencies, in Debian:
apt install nginx libcgi-pm-perl fcgiwrap
INSTALLATION
============
You can use any web server for running lainsafe. However, nginx is
recommended. The following configuration should work for nginx:
*/etc/nginx/sites-enabled/lainsafe.conf*
server
{
server_name lainsafe.foo.tld;
listen 80;
listen [::]:80;
client_max_body_size 100m; # max size 100MBs, change 10 to 100
# in upload.cgi in line 30
root /var/www/lainsafe;
location ~ .cgi$ {
gzip off;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_index index.cgi;
fastcgi_param SCRIPT_FILENAME /var/www/lainsafe/$fastcgi_script_name;
}
}
The document root will be /var/www/lainsafe (be sure to change it in
*root* and *fastcgi_param SCRIPT_FILENAME if you\'re going to use
another directory*
You also have to give the .cgi files +x permissions:
chmod +x *.cgi
And also, create the \"files\" directory manually, and give it
permissions so the user that is running nginx (usually) *www-data* can
write on it.
chown www-data:www-data files
TROUBLESHOOTING
===============
502 Bad Gateway
---------------
Probably you\'re missing the *CGI* dependence, so install it with CPAN
or apt
cpan -i CGI
apt install libcgi-pm-perl
If you still get this problem, run
perl <file>.cgi
so perl can help you debug the problem.
403 is returned
---------------
You probably forgot to give the files execution permissions.

Binary file not shown.

View File

@ -1,80 +0,0 @@
NAME
====
lainsafecli - Command line interface for lainsafe
SYNOPSIS
========
lainsafecli *\[\--tor \| \--i2p\] \[\--server\]* file
DESCRIPTION
===========
*lainsafecli* uploads a file to a given lainsafe server. This server may
be specified with the *\--server* flag. If *\--server* is not given. The
content of the variable *\$DEFAULT_SERVER* will be used instead. This
variable is in the script. In the official packages. this is
https://lainsafe.delegao.moe
OPTIONS
=======
*\--server* Sets the server to use. If it is not given \$DEFAULT_SERVER
will be used instead.
*\--help* Displays a simple help message and exits. This also specify
which server will be used if no *\--server* is given.
*\--tor* Uses tor to upload the file. This requires
*LWP::Protocol::socks* to be installed on your system. You also need to
have tor running at 127.0.0.1:9050 If LWP::Protocol::socks is not
installed, \--tor is ignored, so don\'t try it
*\--i2p* Routes the traffic through I2P. This uses the HTTP proxy (which
is normally in port 4444). So *LWP::Protocol::socks* is not necessary.
*\--get-response* If the server returned an error, \--get-response will
make lainsafecli print the content, so it can help you find out why
lainsafecli isn\'t working!
CONFIGURATION
=============
there are configuration values in *lainsafecli* line 34.
*\$DISPLAY_ASCII* If true (Any number but 0), It will display an ASCII
art if no error returned.
*\$STORE_LINKS* If true, lainsafecli will store the links on a file,
specified by *\$LINKS_FILE*
TROUBLESHOOTING
===============
whatever is not running lainsafe. But works in the browser.
-----------------------------------------------------------
This only happens with https lainsafe instances. To solve that. Make
sure that the module *LWP::UserAgent::https* is installed. You can
install it using *cpan(1)*
HTTP 413 is returned
--------------------
The file you specified is too big for the instance. Try using another
instance. By default lainsafe supports up to 100MBs. But this can be
configured in lainsafe **AND** the web server. If the file exceds
whatever your **server** allows. lainsafe can set another limit. If the
lainsafe limit is less than the server limit. lainsafe will return its
own error message.
AUTHORS
=======
qorg11 \<qorg\@vxempire.xyz\>
LICENSE
=======
GPLv3 or later.

View File

@ -1,19 +1,19 @@
.\"Manpage for lainsafe
.TH clainsafecli 1
.TH sakisafecli 1
.SH NAME
clainsafecli \- File uploader
sakisafecli \- File uploader
.SH DESCRIPTION
clainsafecli is a file uploader. Intended for lainsafe, but also works
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 clainsafecli.c -lcurl -o clainsafecli)
cp clainsafecli ~/.local/bin
(or gcc sakisafecli.c -lcurl -o sakisafecli)
cp sakisafecli ~/.local/bin
.EE
.SH OPTIONS
@ -47,5 +47,5 @@ Forces curl to use IPv4 only.
.B
--silent or -S
tells clainsafecli to be silent. This means, it won't
tells sakisafecli to be silent. This means, it won't
print the progress.

View File

@ -1,6 +1,6 @@
#!/usr/bin/perl
# This file is part of lainsafe.
# 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

View File

@ -1,14 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>lainsafe</title>
<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>lainsafe</h1>
<h1>sakisafe</h1>
<h2>shitless file upload, pastebin and url shorter</h2>
<img src="https://www.lainchan.org/static/lain_is_cute_datass_small.png"/>
<img src="saki.png"/>
<h2>USAGE</h2>
<p>POST a file:</p>
<code>curl -F 'file=@yourfile.png' $SITE_URL</code>

BIN
http/saki.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

View File

@ -1,22 +1,22 @@
#!/usr/bin/perl
# This file is part of lainsafe.
# This file is part of sakisafe.
# lainsafe is free software: you can redistribute it and/or modify
# 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.
# lainsafe is distributed in the hope that it will be useful,
# 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 lainsafe. If not, see <https://www.gnu.org/licenses/>.
# along with sakisafe. If not, see <https://www.gnu.org/licenses/>.
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use Time::HiRes qw(gettimeofday);
my $q = CGI->new;
my $filename = $q->param('file');
@ -75,18 +75,16 @@ if ($filename) {
}
}
if($filename eq "-") {
$filename .= ".txt"; # for pastes
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;

View File

@ -1,7 +1,7 @@
# clainsafecli makefile
# sakisafecli makefile
TARGET = clainsafecli
OBJS = clainsafecli.o funcs.o
TARGET = sakisafecli
OBJS = sakisafecli.o funcs.o
CC = cc
CFLAGSDEF = -MD -std=c11 -Wall -Wextra -lcurl
CFLAGS = -O2 -march=native
@ -17,4 +17,4 @@ $(TARGET): $(OBJS)
.PHONY: clean
clean:
rm -f *.d *.o clainsafecli
rm -f *.d *.o sakisafecli

View File

@ -1,7 +1,7 @@
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include "clainsafecli.h"
#include "sakisafecli.h"
size_t
write_data(void *buffer, size_t size, size_t nmemb,
@ -14,7 +14,7 @@ write_data(void *buffer, size_t size, size_t nmemb,
void
print_usage()
{
printf("USAGE: clainsafecli [--socks-proxy=socks_address|--http_proxy=proxy_address] [-6|-4] [--server] file\n");
printf("USAGE: sakisafecli [--socks-proxy=socks_address|--http_proxy=proxy_address] [-6|-4] [--server] file\n");
return;
}
@ -36,7 +36,7 @@ store_link(const char *path, const char *buf)
void
print_help()
{
printf("--server <server>: specifies the lainsafe server\n%s\n%s\n%s\n%s\n%s\n%s\n%s",
printf("--server <server>: specifies the sakisafe server\n%s\n%s\n%s\n%s\n%s\n%s\n%s",
"-t|--token: Authentication token (https://u.kalli.st)",
"--tor: uses tor.",
"--i2p: uses i2p.",

19
sakisafecli/funcs.d Normal file
View File

@ -0,0 +1,19 @@
funcs.o: funcs.c /usr/include/stdio.h \
/usr/include/bits/libc-header-start.h /usr/include/features.h \
/usr/include/stdc-predef.h /usr/include/sys/cdefs.h \
/usr/include/bits/wordsize.h /usr/include/bits/long-double.h \
/usr/include/gnu/stubs.h /usr/include/gnu/stubs-64.h \
/usr/lib/clang/12.0.1/include/stddef.h \
/usr/lib/clang/12.0.1/include/stdarg.h /usr/include/bits/types.h \
/usr/include/bits/timesize.h /usr/include/bits/typesizes.h \
/usr/include/bits/time64.h /usr/include/bits/types/__fpos_t.h \
/usr/include/bits/types/__mbstate_t.h \
/usr/include/bits/types/__fpos64_t.h /usr/include/bits/types/__FILE.h \
/usr/include/bits/types/FILE.h /usr/include/bits/types/struct_FILE.h \
/usr/include/bits/stdio_lim.h /usr/include/bits/floatn.h \
/usr/include/bits/floatn-common.h /usr/include/bits/stdio.h \
/usr/include/string.h /usr/include/errno.h /usr/include/bits/errno.h \
/usr/include/linux/errno.h /usr/include/asm/errno.h \
/usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \
sakisafecli.h /usr/include/stdlib.h /usr/include/bits/stdlib-bsearch.h \
/usr/include/bits/stdlib-float.h

BIN
sakisafecli/funcs.o Normal file

Binary file not shown.

View File

@ -1,3 +1,4 @@
#pragma once
/* clainsafecli options */
/* Default server you'll upload files to */

BIN
sakisafecli/sakisafecli Executable file

Binary file not shown.

View File

@ -8,7 +8,7 @@
#include <curl/curl.h>
#include "options.h"
#include "clainsafecli.h"
#include "sakisafecli.h"
int
main(int argc, char **argv)
@ -142,7 +142,7 @@ main(int argc, char **argv)
/* File name */
/* TODO: make it iterate on args so you can upload multiple files
* at once (clainsafecli file1 file2 ... filen)
* at once (sakisafecli file1 file2 ... filen)
*/
for(int i = optind; i < argc; i++) {
curl_formadd(&post,

41
sakisafecli/sakisafecli.d Normal file
View File

@ -0,0 +1,41 @@
sakisafecli.o: sakisafecli.c /usr/include/stdio.h \
/usr/include/bits/libc-header-start.h /usr/include/features.h \
/usr/include/stdc-predef.h /usr/include/sys/cdefs.h \
/usr/include/bits/wordsize.h /usr/include/bits/long-double.h \
/usr/include/gnu/stubs.h /usr/include/gnu/stubs-64.h \
/usr/lib/clang/12.0.1/include/stddef.h \
/usr/lib/clang/12.0.1/include/stdarg.h /usr/include/bits/types.h \
/usr/include/bits/timesize.h /usr/include/bits/typesizes.h \
/usr/include/bits/time64.h /usr/include/bits/types/__fpos_t.h \
/usr/include/bits/types/__mbstate_t.h \
/usr/include/bits/types/__fpos64_t.h /usr/include/bits/types/__FILE.h \
/usr/include/bits/types/FILE.h /usr/include/bits/types/struct_FILE.h \
/usr/include/bits/stdio_lim.h /usr/include/bits/floatn.h \
/usr/include/bits/floatn-common.h /usr/include/bits/stdio.h \
/usr/include/string.h /usr/include/stdlib.h \
/usr/include/bits/stdlib-bsearch.h /usr/include/bits/stdlib-float.h \
/usr/lib/clang/12.0.1/include/stdbool.h /usr/include/errno.h \
/usr/include/bits/errno.h /usr/include/linux/errno.h \
/usr/include/asm/errno.h /usr/include/asm-generic/errno.h \
/usr/include/asm-generic/errno-base.h /usr/include/getopt.h \
/usr/include/bits/getopt_core.h /usr/include/bits/getopt_ext.h \
/usr/include/unistd.h /usr/include/bits/posix_opt.h \
/usr/include/bits/confname.h /usr/include/bits/unistd_ext.h \
/usr/include/curl/curl.h /usr/include/curl/curlver.h \
/usr/include/curl/system.h /usr/include/sys/types.h \
/usr/include/bits/types/clockid_t.h /usr/include/bits/types/time_t.h \
/usr/include/bits/types/timer_t.h /usr/include/bits/stdint-intn.h \
/usr/include/sys/socket.h /usr/include/bits/types/struct_iovec.h \
/usr/include/bits/socket.h /usr/include/bits/socket_type.h \
/usr/include/bits/sockaddr.h /usr/include/bits/socket-constants.h \
/usr/lib/clang/12.0.1/include/limits.h /usr/include/limits.h \
/usr/include/time.h /usr/include/bits/time.h \
/usr/include/bits/types/clock_t.h /usr/include/bits/types/struct_tm.h \
/usr/include/bits/types/struct_timespec.h /usr/include/bits/endian.h \
/usr/include/bits/endianness.h /usr/include/sys/time.h \
/usr/include/bits/types/struct_timeval.h /usr/include/sys/select.h \
/usr/include/bits/select.h /usr/include/bits/types/sigset_t.h \
/usr/include/bits/types/__sigset_t.h /usr/include/curl/easy.h \
/usr/include/curl/multi.h /usr/include/curl/urlapi.h \
/usr/include/curl/options.h /usr/include/curl/header.h options.h \
sakisafecli.h

View File

@ -1,3 +1,4 @@
#pragma once
#include <stdlib.h>
size_t

BIN
sakisafecli/sakisafecli.o Normal file

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 419 KiB