diff --git a/Makefile b/Makefile deleted file mode 100644 index 35ecabe..0000000 --- a/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -install: lainsafecli - cp lainsafecli /usr/bin/ - gzip -k doc/lainsafecli.1 - cp doc/lainsafecli.1.gz /usr/share/man/man1 diff --git a/README.md b/README.md index 7ed6d4e..171f419 100644 --- a/README.md +++ b/README.md @@ -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 ` +`sakisafecli --server=http://server ` (for more info see -h) diff --git a/doc/lainsafe.1 b/doc/lainsafe.1 deleted file mode 100644 index 96d0a8c..0000000 --- a/doc/lainsafe.1 +++ /dev/null @@ -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 .cgi -.EE -.PP -so perl can help you debug the problem. - -.SS 403 is returned - -You probably forgot to give the files execution permissions. diff --git a/doc/lainsafe.md b/doc/lainsafe.md deleted file mode 100644 index 087fb6a..0000000 --- a/doc/lainsafe.md +++ /dev/null @@ -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 .cgi - -so perl can help you debug the problem. - -403 is returned ---------------- - -You probably forgot to give the files execution permissions. diff --git a/doc/lainsafecli.1.gz b/doc/lainsafecli.1.gz deleted file mode 100644 index 0a8294c..0000000 Binary files a/doc/lainsafecli.1.gz and /dev/null differ diff --git a/doc/lainsafecli.md b/doc/lainsafecli.md deleted file mode 100644 index 949c9ef..0000000 --- a/doc/lainsafecli.md +++ /dev/null @@ -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 \ - -LICENSE -======= - -GPLv3 or later. diff --git a/doc/clainsafecli.1 b/doc/sakisafecli.1 similarity index 73% rename from doc/clainsafecli.1 rename to doc/sakisafecli.1 index c2d55d8..5934c98 100644 --- a/doc/clainsafecli.1 +++ b/doc/sakisafecli.1 @@ -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. diff --git a/http/index.cgi b/http/index.cgi index ef676c8..101acf3 100755 --- a/http/index.cgi +++ b/http/index.cgi @@ -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 diff --git a/http/index.html b/http/index.html index d23bd87..b2d576d 100644 --- a/http/index.html +++ b/http/index.html @@ -1,14 +1,14 @@ - lainsafe + sakisafe -

lainsafe

+

sakisafe

shitless file upload, pastebin and url shorter

- +

USAGE

POST a file:

curl -F 'file=@yourfile.png' $SITE_URL diff --git a/http/saki.png b/http/saki.png new file mode 100644 index 0000000..4227487 Binary files /dev/null and b/http/saki.png differ diff --git a/http/upload.cgi b/http/upload.cgi index 636eba4..83e13bc 100755 --- a/http/upload.cgi +++ b/http/upload.cgi @@ -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 . +# along with sakisafe. If not, see . 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; diff --git a/clainsafecli/.clang-format b/sakisafecli/.clang-format similarity index 100% rename from clainsafecli/.clang-format rename to sakisafecli/.clang-format diff --git a/clainsafecli/Makefile b/sakisafecli/Makefile similarity index 69% rename from clainsafecli/Makefile rename to sakisafecli/Makefile index 8f6951b..1b3a469 100644 --- a/clainsafecli/Makefile +++ b/sakisafecli/Makefile @@ -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 diff --git a/clainsafecli/funcs.c b/sakisafecli/funcs.c similarity index 83% rename from clainsafecli/funcs.c rename to sakisafecli/funcs.c index acaa966..cdf4e74 100644 --- a/clainsafecli/funcs.c +++ b/sakisafecli/funcs.c @@ -1,7 +1,7 @@ #include #include #include -#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 : specifies the lainsafe server\n%s\n%s\n%s\n%s\n%s\n%s\n%s", + printf("--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.", diff --git a/sakisafecli/funcs.d b/sakisafecli/funcs.d new file mode 100644 index 0000000..af6738b --- /dev/null +++ b/sakisafecli/funcs.d @@ -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 diff --git a/sakisafecli/funcs.o b/sakisafecli/funcs.o new file mode 100644 index 0000000..e08a13a Binary files /dev/null and b/sakisafecli/funcs.o differ diff --git a/clainsafecli/options.h b/sakisafecli/options.h similarity index 97% rename from clainsafecli/options.h rename to sakisafecli/options.h index b54c42c..b20d64a 100644 --- a/clainsafecli/options.h +++ b/sakisafecli/options.h @@ -1,3 +1,4 @@ +#pragma once /* clainsafecli options */ /* Default server you'll upload files to */ diff --git a/sakisafecli/sakisafecli b/sakisafecli/sakisafecli new file mode 100755 index 0000000..039383a Binary files /dev/null and b/sakisafecli/sakisafecli differ diff --git a/clainsafecli/clainsafecli.c b/sakisafecli/sakisafecli.c similarity index 98% rename from clainsafecli/clainsafecli.c rename to sakisafecli/sakisafecli.c index a8aa9f8..45e65be 100644 --- a/clainsafecli/clainsafecli.c +++ b/sakisafecli/sakisafecli.c @@ -8,7 +8,7 @@ #include #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, diff --git a/sakisafecli/sakisafecli.d b/sakisafecli/sakisafecli.d new file mode 100644 index 0000000..06d6f8e --- /dev/null +++ b/sakisafecli/sakisafecli.d @@ -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 diff --git a/clainsafecli/clainsafecli.h b/sakisafecli/sakisafecli.h similarity index 95% rename from clainsafecli/clainsafecli.h rename to sakisafecli/sakisafecli.h index 8944f7c..cd93f6c 100644 --- a/clainsafecli/clainsafecli.h +++ b/sakisafecli/sakisafecli.h @@ -1,3 +1,4 @@ +#pragma once #include size_t diff --git a/sakisafecli/sakisafecli.o b/sakisafecli/sakisafecli.o new file mode 100644 index 0000000..dbd8e0c Binary files /dev/null and b/sakisafecli/sakisafecli.o differ diff --git a/screenshots/lainsafe customized 2.png b/screenshots/lainsafe customized 2.png deleted file mode 100644 index 917e1cf..0000000 Binary files a/screenshots/lainsafe customized 2.png and /dev/null differ diff --git a/screenshots/lainsafe customized.png b/screenshots/lainsafe customized.png deleted file mode 100644 index 494d10d..0000000 Binary files a/screenshots/lainsafe customized.png and /dev/null differ diff --git a/screenshots/lainsafe index.png b/screenshots/lainsafe index.png deleted file mode 100644 index 24f3fb1..0000000 Binary files a/screenshots/lainsafe index.png and /dev/null differ diff --git a/screenshots/lainsafecli example.png b/screenshots/lainsafecli example.png deleted file mode 100644 index e6f94ca..0000000 Binary files a/screenshots/lainsafecli example.png and /dev/null differ