From c5976c82007582a2b530578b2cbae7484c822d13 Mon Sep 17 00:00:00 2001 From: qorg11 Date: Sat, 15 Aug 2020 21:48:03 +0200 Subject: [PATCH] Added --get-response (closes: #11) so you can debug lainsafecli i guess Also added documentation about --tor and --get-respone to the manpage --- doc/lainsafecli.1 | 11 +++++++++++ lainsafecli | 7 +++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/doc/lainsafecli.1 b/doc/lainsafecli.1 index 4f4b3b4..7d434ff 100644 --- a/doc/lainsafecli.1 +++ b/doc/lainsafecli.1 @@ -32,6 +32,17 @@ server will be used if no .I --server is given. +.I --tor +Uses tor to upload the file. This requires +.I LWP::Protocol::socks +to be installed on your system. You also need to have tor running at +127.0.0.1:9050 + +.I --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! + .SH CONFIGURATION there are configuration values in diff --git a/lainsafecli b/lainsafecli index aeb1610..ede293f 100755 --- a/lainsafecli +++ b/lainsafecli @@ -26,6 +26,7 @@ use warnings; # variables my $help; my $tor; +my $get_response; my $DEFAULT_SERVER; my $file; my $DISPLAY_ASCII; @@ -85,7 +86,8 @@ sub enable_tor GetOptions ("server=s" => \$DEFAULT_SERVER, "help|" => \$help, - "tor"=> \$tor + "tor"=> \$tor, + "get-response"=>\$get_response ); &help if $help || not defined $ARGV[0]; @@ -106,7 +108,8 @@ $ua->agent("Mozilla/5.0 (X11; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0 # check if server is running lainsafe if (!$ua->get($url_to_upload)->is_success) { - print "$url_to_upload is not running lainsafe.\n"; + print "$url_to_upload is not running lainsafe. (--get-response to check the error)\n"; + print $ua->get($url_to_upload)->decoded_content if $get_response; exit; }