my $fexserver = '';
my $rc = '/etc/resolv.conf';
local $_;
-
+
open $rc,$rc or die "$0: cannot open $rc - $!\n";
while (<$rc>) {
if (/^\s*domain\s+([\w.-]+)/) {
ezz head -3
ezz - head -3
-Limitation: zz does not work across different accounts!
+Limitation: zz does not work across different accounts!
EOD
}
our ($SH,$windoof,$sigpipe,$useragent);
our ($FEXSERVER);
-our $version = 20160104;
+our $version = 20160328;
# server defaults
my $server = 'fex.rus.uni-stuttgart.de';
-P use proxy server:port
examples: $0 1000
EOD
-
+
if ($Config{osname} =~ /^mswin/i) {
$windoof = $Config{osname};
$useragent = sprintf("fbm-$version (%s %s)",
exit;
}
-if ($opt_P) {
+if ($opt_P) {
if ($opt_P =~ /^[\w.-]+:\d+/) {
$proxy = $opt_P;
} else {
id => $id,
comment => $opt_n ? 'NOSTORE' : 'NOMAIL',
keep => 1,
- autodelete => 'YES',
+ autodelete => 'YES',
);
-
+
if (not @r or not grep /\w/,@r) {
die "$0: no response from server\n";
}
} else {
download("/ddd/$mb");
}
-
+
exit;
sub formdatapost {
- my %P = @_;
+ my %P = @_;
my ($boundary,$filename,$filesize,$length);
my (@hh,@hb,@r,@pv);
my ($t,$bt,$t0,$t1,$t2,$tt);
@r = ();
serverconnect($server,$port);
-
+
$boundary = randstring(48);
$P{command} = 'CHECKRECIPIENT';
-
+
# HTTP POST variables
@pv = qw'from to id command';
foreach my $v (@pv) {
push @hb,$P{$v};
}
}
-
+
# at last, the file
push @hb,"--$boundary";
push @hb,"Content-Disposition: form-data; name=\"FILE\"; filename=\"$filename\"";
pop @hb;
pop @hb;
nvtsend(@hh,@hb) or die "$0: server has closed the connection\n";
-
+
$t0 = $t2 = int(time);
$t1 = 0;
-
+
autoflush $SH 0;
-
+
for (;;) {
print {$SH} $buf or die "$0: server has closed the connection\n";
$b += $bs;
}
last if $bt >= $mb*M;
}
-
+
autoflush $SH 1;
print {$SH} "\r\n--$boundary--\r\n";
last if @r and $r[0] =~ / 204 / and /^$/ or /<\/html>/i;
push @r,$_;
}
-
+
$tt = (time-$t0)||1;
printf STDERR "upload: %d MB in %d s, %d kB/s \n",
int($bt/M),$tt,int($bt/k/$tt);
-
+
close $SH;
undef $SH;
-
+
return @r;
}
my ($server,$port) = @_;
my $connect = "CONNECT $server:$port HTTP/1.1";
local $_;
-
+
if ($proxy) {
tcpconnect(split(':',$proxy));
if ($port == 443) {
# set up tcp/ip connection
sub tcpconnect {
my ($server,$port) = @_;
-
+
if ($SH) {
close $SH;
undef $SH;
}
-
+
if ($port == 443) {
eval "use IO::Socket::SSL";
die "$0: cannot load IO::Socket::SSL\n" if $@;
Proto => 'tcp',
);
}
-
+
if ($SH) {
autoflush $SH 1;
} else {
die "$0: cannot connect $server:$port - $@\n";
}
-
+
print "TCPCONNECT to $server:$port\n" if $opt_v;
}
sub nvtsend {
local $SIG{PIPE} = sub { $sigpipe = "@_" };
-
+
$sigpipe = '';
-
+
die "$0: internal error: no active network handle\n" unless $SH;
die "$0: remote host has closed the link\n" unless $SH->connected;
-
+
foreach my $line (@_) {
print {$SH} $line,"\r\n";
if ($sigpipe) {
return 0;
}
}
-
+
return 1;
}
local $_;
serverconnect($server,$port);
-
+
sendheader(
"GET $proxy_prefix$fop HTTP/1.1",
"User-Agent: $useragent",
sub sendheader {
my @head = @_;
my $head;
-
+
foreach $head (@head) {
print "--> $head\n" if $opt_v;
print {$SH} $head,"\r\n";
-#!/usr/bin/perl -w
+#!/usr/bin/perl -w
# cleanup for F*EX service
#
use Digest::MD5 'md5_hex';
use constant DS => 60*60*24;
-
+
# do not run as CGI!
exit if $ENV{SCRIPT_NAME};
my $logdir = $logdir[0];
-# localized functions
+# localized functions
# (needed for reminder and account reactivation e-mails)
foreach my $lf (glob "$FEXHOME/locale/*/lib/lf.pl") { require $lf }
# clean up download key lookup directory
if (chdir $dkeydir and opendir D,'.') {
while ($file = readdir D) {
- if ($link = readlink $file and
+ if ($link = readlink $file and
(not -l "$link/dkey" or readlink "$link/dkey" ne $file)) {
logdel($file,".dkeys/$file deleted");
}
closedir D;
}
-# send account expiration warning
+# send account expiration warning
if ($account_expire and $account_expire =~ /^(\d+)/) {
my $expire = $1;
if (chdir $spooldir) {
}
}
-if ($notify_newrelease and $notify_newrelease !~ /^no$/i
+if ($notify_newrelease and $notify_newrelease !~ /^no$/i
or not defined $notify_newrelease) {
$notify_newrelease ||= $admin;
$newnew = $new = '';
$_ = slurp("$FEXHOME/doc/version")||'';
if (/(\d+)/) { $qn = "new?$hostname:$1" }
else { $qn = "new?$hostname:0" }
+ print "checking for new F*EX release\n" if $opt_v;
for (1..3) {
sleep rand(10);
$newnew = `wget -qO- http://fex.belwue.de/$qn 2>/dev/null`;
my $kf = "$to/$from/$file/keep";
my $ef = "$to/$from/$file/error";
local $_;
-
+
$keep = readlink $kf || readlink "$to/\@KEEP" || $keep_default;
$file = "$to/$from/$file";
$delay = 1 if $delay !~ /^\d+$/;
$delay--;
$mtime = lmtime($download);
- if ($mtime and $today > $delay*DS+$mtime
+ if ($mtime and $today > $delay*DS+$mtime
and logdel($data,"$data deleted")) {
if (open $ef,'>',$ef) {
printf {$ef} "%s has been autodeleted after download at %s\n",
# also _fexmail_*
logdel($file,"$file deleted") and
verbose("rmrf $file (today=$today mtime_upload=$mtime)");
- } elsif (logdel($data,"$data deleted")) {
+ } elsif (logdel($data,"$data deleted")) {
verbose("unlink $data (today=$today mtime=$mtime keep=$keep)");
if (open $ef,'>',$ef) {
$filename = $file;
}
}
}
- }
+ }
elsif ($file !~ /STDFEX$/ and
- $mtime+$warn*DS < $today and
+ $mtime+$warn*DS < $today and
$dkey = readlink("$file/dkey") and
- not -s $download and
- not -f $notify and
- (readlink("$to/\@REMINDER")||'yes') ne 'no')
+ not -s $download and
+ not -f $notify and
+ (readlink("$to/\@REMINDER")||'yes') ne 'no')
{
my $locale = readlink "$to/\@LOCALE" || readlink "$file/\@LOCALE";
$locale = 'english' unless $locale and $notify{$locale};
chomp($autodelete = <$adf>||'');
close $adf;
}
-
+
return $autodelete||$::autodelete;
}
warn "$file DEL FAILED : $!\n" if -t or $opt_v;
}
}
-
+
return $status;
}
our ($fexhome,$idf,$tmpdir,$windoof,$useragent);
our ($xv,%autoview);
our $bs = 2**16; # blocksize for tcp-reading and writing file
-our $version = 20160104;
+our $version = 20160328;
our $CTYPE = 'ISO-8859-1';
our $fexsend = $ENV{FEXSEND} || 'fexsend';
our $DEBUG = $ENV{DEBUG};
+our $_0 = $0;
my %SSL = (SSL_version => 'TLSv1');
my $sigpipe;
${'opt_+'} = 0;
$opt_s = $opt_k = $opt_i = $opt_P = '';
$_ = "$fexhome/config.pl"; require if -f;
-getopts('hvVHlLdkzoaXf+m:s:i:K:P:') or die $usage;
+getopts('hvVHlLdkzoaXVf+m:s:i:K:P:') or die $usage;
$opt_k = '?KEEP' if $opt_k;
if ($opt_m =~ /(\d+)/) {
$opt_m = 0
}
-print "Version: $version\n" if $opt_V;
+if ($opt_V) {
+ print "Version: $version\n";
+ unless (@ARGV) {
+ print "Upgrade fexget? ";
+ $_ = <STDIN>||'';
+ if (/^y/i) {
+ my $new = `wget -nv -O- http://fex.belwue.de/download/fexget`;
+ if ($new !~ /upgrade fexget/) {
+ die "$0: bad update\n";
+ }
+ system qw'cp -a',$_0,$_0.'_old';
+ exit $? if $?;
+ open $_0,'>',$_0 or die "$0: cannot write $_0. - $!\n";
+ print {$_0} $new;
+ close $_0;
+ exec $_0,qw'-V .';
+ }
+ }
+ exit if "@ARGV" eq '.';
+}
+
die $usage if $opt_h;
if ($opt_H) {
print $hints;
my @rcamel = (
'\e[A
-(_*) _ _
- \\\\/ \\/ \\
+ (_*p _ _
+ \\\\/ \/ \\
\ __ )=*
//\\\\//\\\\
',
-'\e[A \\\\/\\\\/
-',
-'\e[A //\\\\//\\\\
-');
+"\e[A \\\\/\\\\/ \n",
+"\e[A //\\\\//\\\\\n"
+);
# get fexlog
if ($opt_z) {
sub download {
my ($server,$port,$fop,$nocheck) = @_;
- my ($file,$download,$ssl,$pipe,$filesize,$checkstorage);
+ my ($file,$download,$ssl,$pipe,$filesize,$checkstorage,$dkey);
my (@hh,@r);
my ($t0,$t1,$t2,$tt,$tm,$ts,$kBs,$b,$bt,$tb,$B,$buf);
my $length = 0;
$seek = -s $download || 0;
}
+ $fop =~ m:/fop/(\w+)/: and $dkey=$1 or $dkey='';
+
push @hh,"GET $proxy_prefix$fop$opt_k HTTP/1.1",
"User-Agent: $useragent",
+ "Cookie: dkey=$dkey",
"Connection: close";
push @hh,"Range: bytes=$seek-" if $seek;
our ($FEXID,$FEXXX,$HOME);
our (%alias);
our $chunksize = 0;
-our $version = 20160104;
+our $version = 20160328;
our $_0 = $0;
our $DEBUG = $ENV{DEBUG};
my $sigpipe;
if ($Config{osname} =~ /^mswin/i) {
+ # http://slu.livejournal.com/17395.html
$windoof = $Config{osname};
$HOME = $ENV{USERPROFILE};
$fexhome = $ENV{FEXHOME} || $HOME.'\fex';
$Config{osname},$Config{archname});
$SSL{SSL_verify_mode} = 0;
} elsif ($Config{osname} =~ /^darwin/i or $ENV{MACOS}) {
- $macos = $Config{osname};
# http://stackoverflow.com/questions/989349/running-a-command-in-a-new-mac-os-x-terminal-window
+ $macos = $Config{osname};
$HOME = (getpwuid($<))[7]||$ENV{HOME};
$fexhome = $HOME.'/.fex';
$tmpdir = $ENV{FEXTMP} || $ENV{TMPDIR} || "$fexhome/tmp";
-d \# delete file on fex server
-N \# resend notification e-mail
-Q check quotas
+ -T up:down test internet speed with up and down MBs
-A edit server address book (aliases)
-S show server/user settings and auth-ID
-H show hints, examples and more options
- -V show version
+ -V show version and ask for upgrade
(# is a file number, see output from $0 -l)
examples: $0 visualization.mpg framstag\@rus.uni-stuttgart.de
$0 -a images.zip *.jpg webmaster\@flupp.org,metoo
With option -s you can send any data coming from a pipe (STDIN) as a file
without wasting local disc space.
-With option -X you can specify any URL parameter, e.g.:
+With option -X you can specify any URL parameter, e.g.:
fexsend -X autodelete=yes ...
fexsend -X 'autodelete=no&locale=german' ...
*=( __ /
\\\\/\\\\/
',
-'\e[A \\\\/\\\\/
+"\e[A \\\\/\\\\/ \n",
+"\e[A //\\\\//\\\\\n"
+);
+
+my @rrcamel = (
+'\e[A
+ (_*p _ _
+ \\\\/ \/ \\
+ \ __ )=*
+ //\\\\//\\\\
',
-'\e[A //\\\\//\\\\
-');
+"\e[A \\\\/\\\\/ \n",
+"\e[A //\\\\//\\\\\n"
+);
+autoflush STDOUT;
autoflush STDERR;
if ($windoof and not @ARGV and not $ENV{PROMPT}) {
our ($opt_q,$opt_h,$opt_H,$opt_v,$opt_m,$opt_c,$opt_k,$opt_d,$opt_l,$opt_I,
$opt_K,$opt_D,$opt_u,$opt_f,$opt_a,$opt_C,$opt_R,$opt_M,$opt_L,$opt_Q,
$opt_A,$opt_i,$opt_z,$opt_Z,$opt_b,$opt_P,$opt_x,$opt_X,$opt_V,$opt_U,
- $opt_s,$opt_o,$opt_g,$opt_F,$opt_n,$opt_r,$opt_S,$opt_N);
+ $opt_s,$opt_o,$opt_g,$opt_F,$opt_n,$opt_r,$opt_S,$opt_N,$opt_T);
if ($xx) {
$opt_q = 1 if @ARGV and $ARGV[-1] eq '--' and pop @ARGV or not -t STDOUT;
${'opt_@'} = ${'opt_!'} = ${'opt_+'} = ${'opt_.'} = ${'opt_/'} = 0;
${'opt_='} = ${'opt_#'} = '';
$opt_u = $opt_f = $opt_a = $opt_C = $opt_i = $opt_b = $opt_P = $opt_X = '';
- $opt_s = $opt_r = '';
+ $opt_s = $opt_r = $opt_T = '';
$_ = "$fexhome/config.pl"; require if -f;
- getopts('hHvcdognVDKlILUARWMFzZqQS@!+./r:m:k:u:f:a:s:C:i:b:P:x:X:N:=:#:')
+ getopts('hHvcdognVDKlILUARWMFzZqQS@!+./r:m:k:u:f:a:s:C:i:b:P:x:X:N:T:=:#:')
or die $usage;
if ($opt_H) {
if ($opt_V) {
print "Version: $version\n";
+ unless (@ARGV) {
+ print "Upgrade fexsend? ";
+ $_ = <STDIN>||'';
+ if (/^y/i) {
+ my $new = `wget -nv -O- http://fex.belwue.de/download/fexsend`;
+ if ($new !~ /upgrade fexsend/) {
+ die "$0: bad update\n";
+ }
+ system qw'cp -aL',$_0,$_0.'_old';
+ exit $? if $?;
+ open $_0,'>',$_0 or die "$0: cannot write $_0. - $!\n";
+ print {$_0} $new;
+ close $_0;
+ exec $_0,qw'-V .';
+ }
+ }
+ exit if "@ARGV" eq '.';
}
if ($opt_K and $opt_D) {
exit;
}
+if ($opt_T) {
+ my ($up,$down);
+
+ $usage = "usage: $0 -T MB_up[:MB_down] [fexserver]\n";
+ if ($opt_T =~ /^(\d+)$/) {
+ $up = $down = $1;
+ } elsif ($opt_T =~ /^(\d+):(\d+)$/) {
+ $up = $1;
+ $down = $2;
+ } else {
+ die $usage;
+ }
+
+ if (@ARGV) {
+ nettest($ARGV[0],$up,$down);
+ } elsif ($fexcgi) {
+ nettest($fexcgi,$up,$down);
+ } else {
+ nettest('fex.belwue.de',$up,$down);
+ }
+ exit;
+}
+
if (@ARGV > 1 and $ARGV[-1] =~ /(^|\/)anonymous/) {
$fexcgi = $1 if $ARGV[-1] =~ s:(.+)/::;
die "usage: $0 [options] file FEXSERVER/anonymous\n" unless $fexcgi;
my $key;
my $new;
local $_;
-
+
system 'clear';
print "\n";
print "fexsend-$version\n";
print "\n";
print "$from on $fexcgi\n";
print "\n";
-
+
for (;;) {
print "\n";
print "[s] send a file or directory\n";
print "\n";
print "your choice: ";
$key = ReadKey(0);
- if ($key eq 'q') {
+ if ($key eq 'q') {
print "$key\n";
print "\n";
print "Type [Cmd]W to close this window.\n";
exit;
}
- if ($key eq 'h') {
+ if ($key eq 'h') {
print "$key\n";
- print
+ print
"\n".
"With fexsend you can send files of any size to any e-mail address.\n".
"\n".
"\n".
"Do not forget to terminate each input line with [RETURN].\n".
"\n".
- "See http://fex.rus.uni-stuttgart.de/ for more informations.\n";
+ "See http://fex.rus.uni-stuttgart.de/ for more information.\n";
next;
}
- if ($key eq 'u') {
+ if ($key eq 'u') {
print "$key\n";
if ($0 =~ m:(^/client/|/sw/):) {
print "\n";
}
next;
}
- if ($key eq 'l') {
+ if ($key eq 'l') {
print "$key\n";
system 'clear';
&set_ID;
next;
}
- if ($key eq 's' or $key eq "\n") {
+ if ($key eq 's' or $key eq "\n") {
print "s\n";
&ask_file;
next;
my @files;
my $qfiles;
local $_;
-
+
system 'clear';
-
+
&set_ID unless -s $idf;
print "\n";
sub set_ID {
my ($server,$port,$user,$logo);
local $_;
-
+
print "\n";
for (;;) {
print "F*EX server URL: ";
sendheader(
"$server:$port",
"GET /logo.jpg HTTP/1.0",
- "User-Agent: $useragent",
"Connection: close",
);
$_ = <$SH>||'';
close $logo;
last;
}
-
+
for (;;) {
last if $user;
print "Your login (e-mail address): ";
next;
}
}
-
+
for (;;) {
last if $id;
print "Your auth-ID for this account: ";
$id = <STDIN>;
$id =~ s/[\s\n]//g;
}
-
+
open $idf,'>',$idf or die "$0: cannot write to $idf - $!\n";
print {$idf} "$server\n",
"$user\n",
}
+
+sub nettest {
+ my $url = shift;
+ my $up = shift;
+ my $down = shift;
+ my $bs = 2**16;
+ my ($length,$t0,$t1,$t2,$tt,$tb,$tc,$B,$kBs,$bt);
+
+ my $nettest = $sid = 'nettest';
+
+ $port ||= 80;
+ if ($url =~ s:^https.//::) {
+ $https = $port = 443;
+ } else {
+ $url =~ s:^http.//::;
+ $port = $1 if $url =~ s/:(\d+)//;
+ }
+ $url =~ s/[\/:].*//;
+ $server = $url;
+
+ if ($up) {
+ serverconnect($server,$port);
+ checkrecipient($nettest,$nettest);
+ warn "$0: send to $server:$port\n";
+ formdatapost(
+ from => $nettest,
+ to => $nettest,
+ id => $nettest,
+ file => $nettest,
+ size => $up*M,
+ comment => 'NOSTORE',
+ );
+ }
+
+ if ($down) {
+ serverconnect($server,$port);
+ warn "$0: receive from $server:$port\n";
+ sendheader("$server:$port","GET $proxy_prefix/ddd/$down HTTP/1.0");
+ $_ = <$SH>;
+ die "$0: no response from fex server $server\n" unless $_;
+ s/\r//;
+
+ if (/^HTTP\/[\d.]+ 2/) {
+ warn "<-- $_" if $opt_v;
+ while (<$SH>) {
+ s/\r//;
+ print "<-- $_" if $opt_v;
+ last if /^$/;
+ $length = $1 if /^Content-Length:\s*(\d+)/i;
+ }
+ } else {
+ s/HTTP\/[\d.]+ \d+ //;
+ die "$0: bad server reply: $_";
+ }
+
+ unless ($length) {
+ die "$0: no Content-Length header in server reply\n";
+ }
+
+
+ if (${'opt_+'}) {
+ print $rrcamel[0];
+ $tc = 0;
+ }
+
+ $t0 = $t1 = $t2 = int(time);
+ $B = 0;
+ while ($B < $length) {
+ $b = read $SH,$_,$bs or die "$0: cannot read after $B bytes - $!\n";
+ # defined($_ = <$SH>) or die "$0: cannot read after $B bytes - $!\n";
+ # $b = length;
+ $B += $b;
+ $bt += $b;
+ $t2 = time;
+ if (${'opt_+'} and int($t2*10)>$tc) {
+ print $rrcamel[$tc%2+1];
+ $tc = int($t2*10);
+ }
+ if (int($t2) > $t1) {
+ $kBs = int($bt/k/($t2-$t1));
+ $t1 = $t2;
+ $bt = 0;
+ printf STDERR "nettest: %d MB (%d%%) %d kB/s \r",
+ int($B/M),int(100*$B/$length),$kBs;
+ }
+ }
+ close $SH;
+
+ $tt = $t2-$t0;
+ $kBs = int($B/k/($tt||1));
+ if (${'opt_+'}) {
+ print $rrcamel[1];
+ print $rrcamel[2];
+ }
+ printf STDERR "nettest: %d MB in %d s = %d kB/s \n",
+ int($B/M),$tt,$kBs;
+ }
+}
+
+
# read one key from terminal in raw mode
sub ReadKey {
my $key;
local $SIG{INT} = sub { stty('reset'); exit };
-
+
stty('raw');
# loop necessary for ESXi support
while (not defined $key) {
sendheader(
"$server:$port",
"GET $proxy_prefix/fop/$2/$2?LIST HTTP/1.1",
- "User-Agent: $useragent",
);
$_ = <$SH>||'';
s/\r//;
die "$0: file \#$a not found in fexlist\n";
}
}
-
+
@r = formdatapost(
from => $from,
to => $opt_l ? '*' : $from,
s/&/&/g;
s/"/\"/g;
s/</</g;
- if (/^(to (.+) :)/) {
+ if (/^(to (.+) :)/) {
$s = $2 =~ /$a/;
print "\n$_\n" if $s;
print {$fexlist} "\n$_\n";
sendheader(
"$server:$port",
"GET $proxy_prefix/fop/$2/$2?DELETE HTTP/1.1",
- "User-Agent: $useragent",
);
$_ = <$SH>||'';
s/\r//;
serverconnect($server,$port);
query_sid($server,$port) unless $anonymous;
}
-
+
$file = urlencode($file);
sendheader(
"$server:$port",
"GET $proxy_prefix/fop/$to/$from/$file?id=$sid&DELETE HTTP/1.1",
- "User-Agent: $useragent",
);
-
+
while (<$SH>) {
s/\r//;
printf "<-- $_"if $opt_v;
}
}
if ($from eq $to or $from =~ /^\Q$to\E@/i
- or $nomail or $anonymous or $nonot)
+ or $nomail or $anonymous or $nonot)
{
print "$recipient\n" if $recipient;
print "$location\n" if $location;
sub formdatapost {
my %P = @_;
- my ($boundary,$filename,$length,$buf,$file,$fpsize,$resume,$seek);
+ my ($boundary,$filename,$length,$buf,$file,$fpsize,$resume,$seek,$nettest);
my ($flink);
my (@hh,@hb,@r,@pv,$to);
- my ($bytes,$t,$bt);
+ my ($bytes,$b,$t,$bt);
my ($t0,$t1,$t2,$tt,$tc);
my $bs = 2**16; # blocksize for reading and sending file
my $fileid = int(time);
}
# print "calculating archive size... ";
debug("cd $dittodir;$ditto -");
- open $ditto,"cd $dittodir;$ditto - 2>$error|"
+ open $ditto,"cd $dittodir;$ditto - 2>$error|"
or die "$0: cannot run ditto - $!\n";
$t0 = int(time) if -t STDOUT;
while ($b = read $ditto,$_,$bs) {
undef $SH; # force reconnect (timeout!)
}
+ elsif ($P{to} eq 'nettest') {
+ $filename = $nettest = 'nettest';
+ $filesize = $P{size};
+ $fileid = 0;
+ }
+
# single file
else {
$filename = encode_utf8(${'opt_='} || $file);
$filename .= '.gpg' if $opt_g;
- unless ($opt_d) {
+ unless ($opt_d or $nettest) {
if ($opt_g) {
$filesize = -1;
$fileid = int(time);
unless ($SH) {
serverconnect($server,$port);
- query_sid($server,$port) unless $anonymous;
+ query_sid($server,$port) unless $anonymous or $nettest;
}
$P{id} = $sid; # ugly hack!
$filename =~ s/\\/_/g; # \ is a illegal character for fexsrv
# ask server if this file has been already sent
- if ($file and not $xx) {
+ if ($file and not $xx and not $nettest) {
if (not $opt_d and $opt_o) {
# delete before overwrite
delete_file($from,$to,$filename);
print "Fast forward to byte $seek (resuming)\n";
readahead($file,$seek);
}
+ } elsif ($nettest) {
+ #
} else {
if ($opt_g) {
my $fileq = quote($file);
print $rcamel[0] if ${'opt_+'};
+ $buf = '#' x $bs if $nettest;
+
$SIG{ALRM} = sub { retry("timed out") };
- while (my $b = read $file,$buf,$bs) {
+
+ while ($bytes < $fpsize) {
+ if ($nettest) {
+ $b = $bs;
+ } else {
+ $b = read $file,$buf,$bs;
+ last if $b == 0;
+ }
alarm($timeout*2);
if ($https) {
print {$SH} $buf or &sigpipehandler;
}
alarm(0);
$bytes += $b;
- if ($filesize > 0 and $bytes+$seek > $filesize) {
+ if (not $nettest and $filesize > 0 and $bytes+$seek > $filesize) {
if ($tpid) {
kill 9,$tpid;
unlink $list;
last if $filesize > 0 and $bytes >= $fpsize;
sleep 1 while ($opt_m and $bytes/k/(time-$t0||1) > $opt_m);
}
- close $file; # or die "$0: error while reading $file - $!\n";
+
+ close $file unless $nettest;
+
$tt = ($t2-$t0)||1;
print $rcamel[2] if ${'opt_+'};
kill 9,$tpid;
unlink $list;
}
-
+
if ($fileid =~ /[a-z]/ and not ($opt_s or $opt_g)) {
if ($opt_a) {
if ($fileid ne md5_hex(fmd(@ARGV))) {
}
}
}
-
+
unless ($opt_q) {
if (not $chunksize and $bytes+$seek < $filesize) {
die "$0: \"$file\" filesize has shrunk while uploading\n";
if ($seek or $chunksize and $chunksize < $filesize) {
if ($fpsize>2*M) {
- printf STDERR "%s: %d MB in %d s (%d kB/s)",
+ printf STDERR "%s: %d MB in %d s = %d kB/s",
$opt_s||$opt_a||$file,
int($bytes/M),
$tt,
$chunk,int(($bytes+$seek)/M);
}
} else {
- printf STDERR "%s: %d kB in %d s (%d kB/s)",
+ printf STDERR "%s: %d kB in %d s = %d kB/s",
$opt_s||$opt_a||$file,
int($bytes/k),
$tt,
}
} else {
if ($bytes>2*M) {
- printf STDERR "%s: %d MB in %d s (%d kB/s) \n",
+ printf STDERR "%s: %d MB in %d s = %d kB/s \n",
$opt_s||$opt_a||$file,
int($bytes/M),
$tt,
int($bytes/k/$tt);
} else {
- printf STDERR "%s: %d kB in %d s (%d kB/s) \n",
+ printf STDERR "%s: %d kB in %d s = %d kB/s \n",
$opt_s||$opt_a||$file,
int($bytes/k),
$tt,
}
}
- if (-t STDOUT and not ($opt_s or $opt_g)) {
+ if (-t STDOUT and not ($opt_s or $opt_g or $nettest)) {
print STDERR "waiting for server ok..."
}
}
autoflush $SH 1;
print {$SH} "\r\n--$boundary--\r\n";
+ # return if $nettest;
# special handling of streaming file because of stunnel tcp shutdown bug
if ($opt_s or $opt_g) {
my ($response,$fexsrv,$cc);
local $_;
- $to =~ s/,.*//;
- $to =~ s/:\w+=.*//;
+ $to =~ s/[,:].*//;
$to = $AB{$to} if $AB{$to};
$filename =~ s/([^_=:,;<>()+.\w\-])/'%'.uc(unpack("H2",$1))/ge; # urlencode
if ($skey) {
if ($port eq 443 or $proxy) {
return if $features; # early return if we know enough
$req = "OPTIONS /FEX HTTP/1.1";
- $req = "HEAD / HTTP/1.1";
+ $req = "HEAD /index.html HTTP/1.1";
} else {
$req = "GET /SID HTTP/1.1";
}
- sendheader("$server:$port",$req,"User-Agent: $useragent");
+ sendheader("$server:$port",$req);
$_ = <$SH>;
unless (defined $_ and /\w/) {
print "\n" if $opt_v;
close $SH;
serverconnect($server,$port);
$req = "GET /SID HTTP/1.0";
- sendheader("$server:$port",$req,"User-Agent: $useragent");
+ sendheader("$server:$port",$req);
$_ = <$SH>;
unless (defined $_ and /\w/) {
print "\n" if $opt_v;
$xx =~ s:.*/::;
$url = "$proxy_prefix/fop/$from/$from/$xx?ID=$id";
- sendheader("$server:$port","GET $url HTTP/1.0","User-Agent: $useragent");
+ sendheader("$server:$port","GET $url HTTP/1.0");
http_response();
while (<$SH>) {
s/\r//;
$_ = shift @r or die "$0: no reply from server\n";
if (/ 2\d\d /) {
+ return if $to eq 'nettest';
foreach (@r) {
last if /^$/;
if (s/X-(Recipient: .+)/$1\n/) {
sub fileid {
my $file = shift;
my @s = stat($file);
-
+
if (@s) {
return md5_hex($file.$s[0].$s[1].$s[7].$s[9]);
} else {
sub get_mutt_alias {
my $to = shift;
my $ma = $HOME.'/.mutt/aliases';
- my $alias;
+ my ($alias,$options);
local $_;
+ $to =~ s/(:.+)// and $options = $1;
open $ma,$ma or return $to;
while (<$ma>) {
if (/^alias \Q$to\E\s/i) {
if (/@/) {
$alias = $_;
warn "$0: found mutt alias $to = $alias\n";
+ $alias .= $options if $options;
last;
}
}
}
close $ma;
+ $to = "$to:$options" if $options;
return ($alias||$to);
}
my $head;
push @head,"Host: $sp";
+ push @head,"User-Agent: $useragent";
foreach $head (@head) {
+ chomp $head;
print "--> $head\n" if $opt_v;
print {$SH} $head,"\r\n";
}
# reverse-proxy?
# (only IPv4 support!)
if ($reverse_proxy_ip and $reverse_proxy_ip eq $ra and
- /^\S*(Forwarded|Client-IP|Coming-From)\S*: ([\d.]+)/i
+ /^\S*(Forwarded|Client-IP|Coming-From)\S*: ([\da-f:.]+)/i
) {
$ENV{REMOTE_ADDR} = $ra = $2;
$ENV{REMOTE_HOST} = $rh = gethostbyaddr(inet_aton($ra),AF_INET) || '';
'</body></html>'
));
}
+ fexlog($connect,@log,"REDIRECT $newurl");
if ($rr =~ /^http/) {
exit;
} else {
# load common code, local config : $HOME/lib/fex.ph
require "$FEXLIB/fex.pp" or die "$0: cannot load $FEXLIB/fex.pp - $!\n";
-die "$0: \$admin not configured in $FEXLIB/fex.ph\n"
+die "$0: \$admin not configured in $FEXLIB/fex.ph\n"
if not $admin or $admin =~ /example.org/;
$opt_h = 0;
close $group;
}
}
-
+
foreach $subuser (glob "*/\@SUBUSER") {
if (open $subuser,$subuser) {
while (<$subuser>) {
close $subuser;
}
}
-
+
# @users = qw'framstag@fex';
die "$0: no users found\n" unless @users or grep /@/,@users;
push @users,$bcc;
# 2003-02-27 Framstag initial version
# 2003-02-28 Framstag added exit status
# 2007-03-09 Framstag added option -Q
-# 2007-06-01 Framstag added options -s and -c
+# 2007-06-01 Framstag added options -s and -c
# and changed default output mode
# 2007-06-03 Framstag added ReadLine-support
# 2007-08-31 Framstag added option -x
die <<EOD
usage: $0 [options] 'EXP' [file...]
or: $0 [options] -Q file...
-options: -r recursively scan through directories
+options: -r recursively scan through directories
-i ignore case
-v print only lines that do NOT match
-s verbose scanning/searching
$opt_XX = 0;
if (not ${'opt_~'}) {
@bfiles = grep(/~$|^#.*#$/,@ARGV);
- if (@bfiles and
+ if (@bfiles and
(grep(/[^~]$/,@ARGV) or grep(/(^|\/)#[^\/]*#$/,@ARGV))) {
$opt_XX = 1;
warn "$0: ignoring @bfiles\n"; # unless $opt_r;
if ($opt_p) { $/ = '' }
else { $/ = $opt_R }
#else { eval '$/ = "'.$opt_R.'"' }
-
+
$opt_h = 1 if not $opt_r and @ARGV < 2;
if ($opt_Q) {
$exp = '(?s)'.$exp if $opt_p or $opt_R;
#? $exp =~ s/\.\*\*/[.\n]*/g;
}
-
+
$found = 0;
-
+
if (@ARGV) {
foreach $file (@ARGV) {
next if $opt_X and $file =~ /$opt_X/;
my $dir = shift;
my $file;
my $found = 0;
-
+
opendir $dir,$dir or return;
while (defined($file = readdir $dir)) {
next if $file eq '.' or $file eq '..';
}
next unless -f $file or -c $file or -S $file or -p $file or -z $file;
$fileq = quotemeta $file;
- if (-T $file and open $file,$file or
+ if (-T $file and open $file,$file or
open $file,"strings -a -n $opt_S $fileq|") {
$found += grepf($file,$file);
close $file;
my $file = shift;
my $found = 0;
my ($n,$l,$c);
-
+
warn $B."scanning $file".$N."\n" if -t STDOUT and $opt_s;
-
+
while (<$F>) {
$_ .= "\n" unless /\n$/;
if ($opt_M) {
$C{0} = [$l,$_];
}
if ($opt_e) {
- if ($opt_v) {
+ if ($opt_v) {
next if &$egrep;
- } else {
+ } else {
unless (&$egrep) {
if ($opt_C and $c) {
print "$l:" if $opt_n;
if ($opt_Q) { $n++ while /$exp/mg }
else { $n++ while /$exp/omg }
} else {
- if ($opt_o) {
+ if ($opt_o) {
my $m = '';
while (s/($exp)//) {
$n++;
$m .= "$1\n";
}
$_ = $m;
- } elsif ($opt_Q) {
+ } elsif ($opt_Q) {
$n += s/($exp)/$B$1$N/mg;
- } else {
+ } else {
$n += s/($exp)/$B$1$N/omg;
}
}
$file = '';
}
if ($opt_x and $n) {
- if ($opt_i) { s/($opt_x)/$B$1$N/ogi }
+ if ($opt_i) { s/($opt_x)/$B$1$N/ogi }
else { s/($opt_x)/$B$1$N/og }
}
for (my $i=$opt_C;$i;$i--) {
$L{$l} = $l;
$c = $opt_C;
}
-
+
if ($opt_c) {
print "$file:" if @ARGV>1;
print "$found\n";
#
# Author: Ulli Horlacher <framstag@rus.uni-stuttgart.de>
#
-# Copyright: Perl Artistic License
+# Perl Artistic License
use Cwd qw'abs_path';
use File::Basename;
$newer = $1;
}
}
-
+
# preselect date field number
if ($opt_c) { $sdf = 'c' }
elsif ($opt_u) { $sdf = 'a' }
$opt_z = '%'.$opt_z.'s ';
@LIST = grep { s/\0 *([,\d\.\-]+) /sprintf($opt_z,$1)/e } @LIST;
}
-
+
@LIST = reverse @LIST if $opt_r;
if (not ($opt_t or $opt_U) and grep /^d[rR-][wW-][xX-]/,@LIST) {
foreach (@LIST) { print if /^d/ }
foreach (@LIST) { print unless /^d/ }
- } else {
+ } else {
print @LIST;
}
}
print "$SS file(s):";
printf " r=%d (%s Bytes)",$SS{'-'},&d3($Ss) if $SS{'-'};
delete $SS{'-'};
- foreach my $type (qw(l d c b p s ?)) {
+ foreach my $type (qw(l d c b p s ?)) {
printf " %s=%d",$type,$SS{$type} if $SS{$type};
delete $SS{$type};
}
# collect files and build file lists
-#
+#
# INPUT: filenames
#
# GLOBAL: @LIST
# loop over all argument files/directories
foreach $f (@files) {
-
+
# skip jed and emacs backup files
# next if $f =~ /~$/ and not $opt_a and not $opt_l;
-
+
# recursive?
if ($opt_R) {
list($f);
# traverse real subdirs
- if (-d $f and not -l $f) {
+ if (-d $f and not -l $f) {
$f =~ s:/*$:/:;
# skip other file systems on -x
if ($opt_x) {
}
collect(getfiles($f));
}
-
+
} else {
-
+
# suppress trailing / on -d option
$f =~ s:/$:: if $opt_d;
-
+
# on trailing / list subdirs, too
if ($f =~ m:/$:) { &list(&getfiles($f)) }
elsif ($f eq '') { &list('/') }
}
list($f);
}
-
+
}
}
}
$day = $date;
$day =~ s/\s.*//;
-
+
if ($older) {
next if $older =~ /-/ and $day gt $older;
next if $older !~ /-/ and $dates{m} > time-$older;
next if $newer =~ /-/ and $day lt $newer;
next if $newer !~ /-/ and $dates{m} < time-$newer;
}
-
+
if (defined $linkname) {
# prepend sorting string
elsif ($i eq 'l') { $line .= sprintf '%3s ', $links }
elsif ($i eq 'i') { $line .= sprintf '%14s ', $inode }
elsif ($i eq 'd') { $line .= sprintf '%10s ', $date }
- elsif ($i eq 'a') { $line .= sprintf '%10s %10s %10s ',
+ elsif ($i eq 'a') { $line .= sprintf '%10s %10s %10s ',
$dates{'a'},$dates{'m'},$dates{'c'} }
} else {
if ($i eq 'm') { $line .= $mode.' ' }
&isodate($dates{'c'}).' ' }
}
}
-
+
# predefined formats
} else {
-
+
if ($opt_n) {
if ($opt_l) { $line .= sprintf "%06o %6d %6d $z%15s %10d ",
$mode,$uid,$gid,$size,$date }
else { $line .= sprintf "%s $z%19s %s ",
$mode,$size,substr($date,0,-3) }
}
-
+
if ($opt_i) { $line .= sprintf '%3s %10s ',$links,$inode }
}
$line .= $linkname."\n";
-
- if ($postproc) {
+
+ if ($postproc) {
push @LIST,$line;
- } else {
+ } else {
$line =~ s/\0//;
print $line;
}
$found++;
-
+
} else {
lstat $file;
warn "$0: cannot get dir-info for ".quote($file)." - $!\n";
}
-
+
}
}
#
# INPUT: file name
#
-# OUTPUT: filename with linkname, inode, hard link count, size, mode string,
+# OUTPUT: filename with linkname, inode, hard link count, size, mode string,
# UID, GID, isodate
sub info {
my $file = shift;
if ($opt_L) { @stat = stat $file }
else { @stat = lstat $file }
-
+
if (@stat) {
-
+
$inode = $stat[1];
$bmode = $stat[2];
$links = $stat[3];
- %dates = ('m' => $stat[9],
- 'a' => $stat[8],
+ %dates = ('m' => $stat[9],
+ 'a' => $stat[8],
'c' => $stat[10]);
if ($opt_n) {
$gid = getgrgid($stat[5]) || $stat[5];
$date = &isodate($dates{$sdf});
}
-
+
if (-f _) { $type = '-'; $size = $stat[7]; }
elsif (!$opt_L && -l _) { $type = 'l'; }
elsif (-d _) { $type = 'd'; }
$mode = $type.$mode;
} else {
# with short list display only effektive file access modes
- $mode = $type
+ $mode = $type
. (-r _ ? 'R' : '-')
. (-w _ ? 'W' : '-')
. (-x _ ? 'X' : '-');
}
$size = &d3($size);
-
+
# determine longest size field
if ($opt_z) {
my $x = length $size;
}
$mode =~ s/\+$//;
#$mode .= ' ' unless $mode =~ /\+$/;
-
+
return ($linkname,$inode,$links,$size,$mode,$uid,$gid,$date,%dates);
}
if (opendir D,$dir) {
$dir = '' if $dir eq '.';
- while (defined($f = readdir D)) {
-
+ while (defined($f = readdir D)) {
+
# skip . and .. pseudo-subdirs
next if $f =~ m:(^|/)\.\.?/*$:;
# skip ONTAP snapshot dir
next if $f =~ m:(^|/)\.snapshot/*$:;
-
+
# skip jed and emacs backup files
# next if $f =~ /~$/ and not $opt_a and not $opt_l;
-
+
if ($f =~ /$opt_m/) {
my $x = $dir.$f;
- if (not -l $x and -d $x and not ($opt_R or $postsort or $opt_U)) {
+ if (not -l $x and -d $x and not ($opt_R or $postsort or $opt_U)) {
push @dirs,$x;
- } else {
+ } else {
push @files,$x;
}
}
} else {
warn "$0: cannot read $dir : $!\n";
}
-
+
return (@dirs,@files);
}
sub quote {
local $_ = shift;
my $mc = '\'\[\]\\\\ `"$?&<>$*()|{};';
-
+
unless (defined $_) {
die "@_";
@x = caller;
my $status = shift;
my $opts = '[-lastcuidnrzLRxNS*] [-f format] [-D X:Y]';
local *OUT = $status ? *STDERR : *STDOUT;
-
- if ($0 ne 'lf') {
+
+ if ($0 ne 'lf') {
print OUT "usage: $0 $opts [-F regexp] [file...]\n";
}
$opts =~ s/R//;
-f user defined format output, format characters are:
m=mode, u=user, g=group, s=size, l=hard links count, i=inode
n=name only, d=date, a=access+modification+inodechange dates
- -D list only files newer than X and older than Y
+ -D list only files newer than X and older than Y
XY format: NUMBER[smhd] (s=seconds, m=minutes, h=hours, d=days)
XY format: YYYY-MM-DD (Y=year, M=month, D=day)
-E show examples
print <<EOD;
l *.c # list files ending with .c
l -la # list all files in long format
-l -Rrs # list files recursive reverse sorted by size
+l -Rrs # list files recursive reverse sorted by size
l -*f mus # list files native names with format: mode+user+size
l -D 10d: # list files newer than 10 days
ll # list files long format (equal to: l -l)
.*:\s*$
);
-$/ = "\n\n";
+$/ = "\n\n";
$| = 1;
if (-t STDIN or $ENV{GATEWAY_INTERFACE}) {
foreach $weed (@weed) {
while (s/\n$weed.*\n/\n/i) {}
}
+ $post = /\nPOST\s/;
if (/^\n*(CONNECT|CONTINUE).*\s\[([\d_]+)\]/i) { $pid = $2 }
if (/\n(POST|GET)\s+\/(\w+)/i) { $cgi = $2 }
if (/Content-Length: (\d+)/i) {
read_skey($1);
print "\n";
}
- if ($debug and $pid and $cgi) {
+ if ($debug and $pid and $post) {
&read_debug_log;
};
$pid = $cgi = '';
my (@log,$log);
local $/ = "\n";
local $_;
- local $^W;
+ # https://rt.cpan.org/Public/Bug/Display.html?id=88592
+ # local $^W;
# no warnings "all";
+ no warnings 'utf8';
for (1..2) {
sleep 1;
@log = `ls -rt $logdir[0]/.debug/*_${pid}.$cgi 2>/dev/null`;
if ($log = $log[-1] and open $log,$log) {
- binmode($log,":encoding(UTF-8)");
+ binmode($log,":utf8");
while (<$log>) {
s/\r//;
if (/^Content-Disposition:.*name="FILE".*filename="(.+)"/i) {
$_ = <$log>;
my $v = <$log>||'';
$v =~ s/[\r\n]+//;
- printf " %s=\"%s\"\n",$p,utf8decode($v)||$v if $v;
- read_akey($v) if $p eq 'AKEY';
- read_skey($v) if $p eq 'SKEY';
+ if ($v) {
+ my $vv = utf8decode($v)||$v;
+ $vv =~ s/[\x00-\x1F]/_/g;
+ $vv =~ s/[\x80-\x9F]/_/g;
+ printf " %s=\"%s\"\n",$p,$vv;
+ read_akey($v) if $p eq 'AKEY';
+ read_skey($v) if $p eq 'SKEY';
+ }
} elsif (/^(Param|Exp): (\w+=".+")/) {
print " $2\n";
}
eval 'use Net::INET6Glue::INET_is_INET6';
-our $version = 20160104;
+our $version = 20160328;
our $DEBUG = $ENV{DEBUG};
my %SSL = (SSL_version => 'TLSv1');
}
request("POST /sex?BS=$bs&user=$user$mode$type$timeout$stream HTTP/1.0");
-print STDERR "==> (streaming ...)\n" if $opt_v;
+print STDERR "--> (streaming ...)\n" if $opt_v;
transfer(STDIN,$SH);
sub request {
my $req = shift;
- print STDERR "==> $req\n" if $opt_v;
- syswrite $SH,"$req\r\n\r\n";
+ print STDERR "--> $req\n" if $opt_v;
+ syswrite $SH,"$req\r\n";
+ syswrite $SH,"User-Agent: sexsend\r\n";
+ syswrite $SH,"\r\n";
for (;;) {
unless (defined($_ = &getline)) {
die "$0: server has closed the connection\n";
}
if (/^HTTP\/[\d\.]+ 200/) {
- print STDERR "<== $_" if $opt_v;
+ print STDERR "<-- $_" if $opt_v;
last;
} elsif (/^HTTP\/[\d\.]+ 199/) {
- print STDERR "<== $_" if $opt_v;
+ print STDERR "<-- $_" if $opt_v;
} else {
if ($opt_v) {
- print STDERR "<== $_";
+ print STDERR "<-- $_";
exit 3;
} else {
s:^HTTP/[ \d\.]+::;
while (defined($_ = &getline)) {
last if /^\s*$/;
$H{uc($1)} = $2 if /(.+):\s*(.+)/;
- print STDERR "<== $_" if $opt_v;
+ print STDERR "<-- $_" if $opt_v;
}
}
local $_;
$req = "GET SID HTTP/1.1";
- print STDERR "==> $req\n" if $opt_v;
+ print STDERR "--> $req\n" if $opt_v;
syswrite $SH,"$req\r\n\r\n";
$_ = &getline;
unless (defined $_ and /\w/) {
}
s/\r//;
if (/^HTTP.* 201 (.+)/) {
- print STDERR "<== $_" if $opt_v;
+ print STDERR "<-- $_" if $opt_v;
$id = 'MD5H:'.md5_hex($id.$1);
while (defined($_ = &getline)) {
s/\r//;
last if /^\n/;
- print STDERR "<== $_" if $opt_v;
+ print STDERR "<-- $_" if $opt_v;
}
} else {
die "$0: $server does not support session ID\n";
# to use zz with vim, write to your .vimrc:
#
-# noremap <silent> zz> :w !zz<CR><CR>
+# noremap <silent> zz> :w !zz<CR><CR>
# noremap <silent> zz< :r !zz<CR>
ZZ=${ZZ:-$HOME/.zz}
(within tin:) |azz
(within vi:) :w !zz
(within vi:) :r !zz
-
+
Limitation: zz does not work across different accounts or hosts! Use xx instead.
EOD
fi
-if [ "$1" = + ]; then
+if [ "$1" = + ]; then
shift
exec cat -- "$@" >>$ZZ
fi
if [ -t 0 ]; then
- if [ -z "$1" ]; then
+ if [ -z "$1" ]; then
exec cat -- $ZZ
- elif [ "$1" = .. ]; then
+ elif [ "$1" = .. ]; then
exec cat -- $ZZ~
- else
+ else
test -f $ZZ && mv $ZZ $ZZ~
exec cat -- "$@" >$ZZ
fi
else
test -f $ZZ && mv $ZZ $ZZ~
exec cat >$ZZ
-fi
+fi
$idf = "$user/@";
if (-f $idf) {
- html_error($error,"There is already an user $user!");
+ html_error($error,"There is already an user $user!");
}
open $idf,'>',$idf or http_die("cannot write $idf - $!");
if ($mdomain and $file =~ s:(.+)/(.+)/(.+):$3:) {
$to = lc $1;
$from = lc $2;
+ $to =~ s/[:,].*//;
$to .= '@'.$hostname if $to eq 'anonymous';
$from .= '@'.$hostname if $from eq 'anonymous';
$to .= '@'.$mdomain if -d "$to\@$mdomain";
} else {
$range = sprintf("bytes %s-%s/%s",$seek,$total_size-1,$total_size);
}
+ # RFC 7233 "Responses to a Range Request"
nvt_print(
'HTTP/1.1 206 Partial Content',
"Content-Length: $size",
"Connection: close",
);
# nvt_print('','HTTP/1.1 200 OK',"Content-Length: $size","Content-Type: $type"); exit;
+ nvt_print($_) foreach(@extra_header);
} else {
http_header('200 OK');
print html_header($head);
if ($type eq 'application/octet-stream') {
nvt_print(qq'Content-Disposition: attachment; filename="$filename"');
}
+ nvt_print($_) foreach(@extra_header);
}
nvt_print("X-Size: $total_size");
''
);
&reexec;
-
+
if (open $tools,"$docdir/tools.html") {
while (<$tools>) {
while (/\$([\w_]+)\$/) {
if ($user and $akey and $qs and $qs =~ /info=(.+?)&skey=(.+)/) {
$subuser = $1;
$skey = $2;
- notify_subuser($user,$subuser,"$fup?skey=$skey",$comment);
+ notify_subuser($user,$subuser,"$fup?skey=$skey#$user",$comment);
http_header("200 OK");
print html_header($head);
pq(qq(
'To: $otuser'
'Subject: Your upload URL'
'X-Mailer: F*EX'
+ 'Content-Type: text/plain; charset=utf-8'
+ 'Content-Transfer-Encoding: 8bit'
''
'This is an automatically generated e-mail.'
''
'Cc: $user'
'Subject: Your F*EX account on $server'
'X-Mailer: F*EX'
+ 'Content-Type: text/plain; charset=utf-8'
+ 'Content-Transfer-Encoding: 8bit'
''
'This is an automatically generated e-mail.'
''
my $fileid; # file ID
my $captive;
my $muser; # main user fur sub or group user
+my %specific; # upload specific KEEP and AUTODELETE parameters
# load common code, local config: $FEXLIB/fex.ph
require "$FEXLIB/fex.pp";
my %to;
foreach $to (@to) { $to{$to} = 1 }
push @to,$addto unless $to{$addto};
- if ($submit and @to == 1) { $addto = '' }
+ # user has submitted with [select from your address book] ?
+ # if ($submit and @to == 1) { $addto = '' }
}
$to = join(',',@to);
foreach my $to (@group?@group:@to) {
# my $options = sprintf "(autodelete=%s,keep=%s,locale=%s)",
# readlink "$to/\@LOCALE"||$locale||$locale{$to}||$default_locale;
- my $options = sprintf "(autodelete=%s,keep=%s,locale=%s,notification=%s)",
+ # my $options = sprintf "(autodelete=%s,keep=%s,locale=%s,notification=%s)",
+ my $options = sprintf "(autodelete=%s,keep=%s,locale=%s)",
$autodelete{$to}||$autodelete,
$keep{$to}||$keep_default,
- readlink("$to/\@LOCALE")||$default_locale,
- readlink("$to/\@NOTIFICATION")||'full';
+ readlink("$to/\@LOCALE")||$locale{$to}||$default_locale;
+ # readlink("$to/\@NOTIFICATION")||'full';
nvt_print("X-Recipient: $to $options");
}
nvt_print('');
{
present_locales('/fup');
+ # print "[$addto] [$submit] [@to]<p>\n";
+
@ab = ("<option></option>");
# select menu from server address book
if (/(\S+)[=\s]+(\S+@[\w.-]+\S*)/) {
$_ = "$1 <$2>";
s/,.*/,.../g;
+ s/:.*/>/;
push @ab,"<option>$_</option>";
}
}
print "Alternate Java client</a> (for files > 2 GB or sending of more than one file)\n";
}
print &logout;
- if (-x "$FEXHOME/cgi-bin/login") {
- print $info_login||$info_1;
- }
pq(qq(
'<p><hr><p>'
'<b>'
'<p>'
'Use a <a href="/tools.html">F*EX client</a> if you want to send more than one file or resume an interrupted upload.'
'</body></html>'
- '<p>
+ '<p>'
));
+ print $info_1;
exit;
}
# }
print "</form>\n";
- print $info_1;
+ print $info_login||$info_1;
if ($debug and $debug>1) {
print "<hr>\n<pre>\n";
my $to = $_;
$to =~ s/:\w+=.*//; # remove options from address
my $file = "$to/$from/$fkey";
- my $options = sprintf "(autodelete=%s,keep=%s,locale=%s,notification=%s)",
+ # my $options = sprintf "(autodelete=%s,keep=%s,locale=%s,notification=%s)",
+ my $options = sprintf "(autodelete=%s,keep=%s,locale=%s)",
readlink("$file/autodelete")||$autodelete,
readlink("$file/keep")||readlink("$to/\@KEEP")||$keep_default,
- readlink("$to/\@LOCALE")||readlink("$file/locale")||$default_locale,
- readlink("$to/\@NOTIFICATION")||'full';
+ readlink("$to/\@LOCALE")||readlink("$file/locale")||$default_locale;
+ # readlink("$to/\@NOTIFICATION")||'full';
nvt_print("X-Recipient: $to $options");
nvt_print("X-Location: $durl/$dkey{$to}/$fkey") unless $restricted;
}
print "&bwlimit=$bwlimit&autodelete=$autodelete&keep=$keep\">";
print "send another file</a>\n";
if ($http_client !~ /fexsend/ and $http_client =~ /Linux/i) {
- print qq'<p>Hi Linux-user, try <a href="/FAQ/user.html#Why_should_I_use_a_special_F_EX_client">fexsend</a>! ☺<p>\n';
+ print '<p>Hi Linux-user, try ',
+ '<a href="/FAQ/user.html#Why_should_I_use_a_special_F_EX_client">',
+ "fexsend</a>! ☺<p>\n";
+ }
+ if ($http_client !~ /fexit/ and $http_client =~ /Windows/i) {
+ print '<p>Hi Windows-user, try <a href="/fexit.html">fexit</a>! ',
+ "☺<p>\n";
}
print &logout;
}
if ($p eq 'KEEP' and /^\d+$/) {
$specific{'keep'} = $keep = $v;
}
+ # if ($p eq 'LOCALE') {
+ # $specific{'locale'} = $locale = $v;
+ # }
}
}
}
# collect multiple addresses and check for aliases (not group)
if (@to and "@to" !~ /^@[\w-]+$/
- and not ($gkey or $addto or $command =~ /^LIST(RECEIVED)?$/))
- {
-
+ and not ($gkey or $addto or $command =~ /^LIST(RECEIVED)?$/)) {
# read address book
if ($from and open my $AB,'<',"$from/\@ADDRESS_BOOK") {
- my ($alias,$address,$autodelete,$locale,$keep);
+ my ($alias,$addresses,$autodelete,$locale,$keep);
while (<$AB>) {
s/#.*//;
$_ = lc $_;
if (s/^\s*(\S+)[=\s]+(\S+)//) {
- ($alias,$address) = ($1,$2);
+ ($alias,$addresses) = ($1,$2);
+ # alias specific options?
$autodelete = $locale = $keep = '';
$autodelete = $1 if /autodelete=(\w+)/;
$locale = $1 if /locale=(\w+)/;
$keep = $1 if /keep=(\d+)/;
- foreach my $address (split(",",$address)) {
- $address .= '@'.$mdomain if $mdomain and $address !~ /@/;
+ foreach my $address (split(",",$addresses)) {
+ # alias address specific :options?
+ if ($address =~ s/(.+?):(.+)/$1/) {
+ my @options = split(':',$2);
+ $address = expand($address);
+ foreach (@options) {
+ if (/^keep=(\d+)$/i) {
+ $alias_keep{$alias}{$address} = $1
+ }
+ if (/^autodelete=(yes|no|delay)$/i) {
+ $alias_autodelete{$alias}{$address} = $1
+ }
+ if (/^locale=(\w+)$/i) {
+ $alias_locale{$alias}{$address} = $1
+ }
+ }
+ } else {
+ $address = expand($address);
+ }
push @{$ab{$alias}},$address;
$autodelete{$alias} = $autodelete if $autodelete;
$keep{$alias} = $keep if $keep;
# look for recipient's options and eliminate dupes
%to = ();
foreach my $to (my @loop = @to) {
- # address book alias?
- if ($to !~ /@/ and $ab{$to}) {
- foreach my $address (my @loop = @{$ab{$to}}) {
- $address .= '@'.$mdomain if $mdomain and $address !~ /@/;
+ # address book alias?
+ if ($to !~ /@/ and ($ab{$to} or $to =~ /(.+?):(.+)/ and $ab{$1})) {
+ my $alias = $to;
+ my @options = ();
+ $alias =~ s/:(.*)// and @options = split(':',$1);
+ if (@options) {
+ # alias with :options
+ $alias =~ s/:.*//;
+ foreach my $address (my @loop = @{$ab{$alias}}) {
+ $to{$address} = $address; # ignore dupes
+ foreach (@options) {
+ $keep{$address} = $1 if /^keep=(\d+)$/i;
+ $autodelete{$address} = $1 if /^autodelete=(yes|no|delay)$/i;
+ $locale{$address} = $1 if /^locale=(\w+)$/i;
+ }
+ }
+ }
+ foreach my $address (my @loop = @{$ab{$alias}}) {
$to{$address} = $address; # ignore dupes
- if ($specific{'autodelete'}) {
- $autodelete{$address} = $specific{'autodelete'};
- } elsif ($autodelete{$to}) {
- $autodelete{$address} = $autodelete{$to};
- } else {
- $autodelete{$address} = readlink "$address/\@AUTODELETE"
- || $autodelete;
+ unless ($keep{$address}) {
+ $keep{$address} = $keep{$alias} if $keep{$alias};
+ if ($specific{'keep'}) {
+ $keep{$address} = $specific{'keep'}
+ } elsif (my $keep = $alias_keep{$alias}{$address}) {
+ $keep{$address} = $keep;
+ } elsif ($keep{$alias}) {
+ $keep{$address} = $keep{$alias}
+ }
}
- if (my $locale = readlink "$address/\@LOCALE") {
- $locale{$address} = $locale;
- } elsif ($locale{$to}) {
- $locale{$address} = $locale{$to};
- } else {
- $locale{$address} = $::locale ;
+ unless ($autodelete{$address}) {
+ if ($specific{'autodelete'}) {
+ $autodelete{$address} = $specific{'autodelete'};
+ } elsif (my $autodelete = $alias_autodelete{$alias}{$address}) {
+ $autodelete{$address} = $keep;
+ } elsif ($autodelete{$alias}) {
+ $autodelete{$address} = $autodelete{$alias};
+ } else {
+ $autodelete{$address} = readlink "$address/\@AUTODELETE"
+ || $autodelete;
+ }
}
unless ($locale{$address}) {
- $locale{$address} = $default_locale || 'english';
+ if (my $locale = readlink "$address/\@LOCALE") {
+ $locale{$address} = $locale;
+ } elsif ($locale{$alias}) {
+ $locale{$address} = $locale{$alias};
+ } elsif ($locale = $alias_locale{$alias}{$address}) {
+ $locale{$address} = $locale;
+ } else {
+ $locale{$address} = $::locale ;
+ }
+ $locale{$address} ||= $default_locale || 'english';
}
- if ($specific{'keep'}) { $keep{$address} = $specific{'keep'} }
- elsif ($keep{$to}) { $keep{$address} = $keep{$to} }
}
} else {
+ # regular address, not an alias
+ if ($to =~ s/(.+?):(.+)/$1/) {
+ my @options = split(':',$2);
+ $to = expand($to);
+ foreach (@options) {
+ $keep{$to} = $1 if /^keep=(\d+)$/i;
+ $autodelete{$to} = $1 if /^autodelete=(yes|no|delay)$/i;
+ $locale{$to} = $1 if /^locale=(\w+)$/i;
+ }
+ }
$to = expand($to);
$to{$to} = $to; # ignore dupes
unless ($autodelete{$to}) {
- $autodelete{$to} = readlink "$to/\@AUTODELETE" || $autodelete;
+ $autodelete{$to} = untaint(readlink("$to/\@AUTODELETE")
+ ||$autodelete);
+ if ($specific{'autodelete'}) {
+ $autodelete{$to} = $specific{'autodelete'};
+ }
+ }
+ unless ($keep{$to}) {
+ $keep{$to} = $keep_default;
+ $keep{$to} = $keep if $keep;
+ $keep{$to} = untaint(readlink "$to/\@KEEP") if -l "$to/\@KEEP";
+ $keep{$to} = $specific{'keep'} if $specific{'keep'};
}
- $autodelete{$to} = $specific{'autodelete'} if $specific{'autodelete'};
- $keep{$to} = $keep_default;
- $keep{$to} = $keep if $keep;
- $keep{$to} = untaint(readlink "$to/\@KEEP") if -l "$to/\@KEEP";
- $keep{$to} = $specific{'keep'} if $specific{'keep'};
- # recipient specific parameters
- $keep{$to} = $1 if $to =~ /:keep=(\d+)/i;
- $autodelete{$to} = $1 if $to =~ /:autodelete=(\w+)/i;
}
$autodelete{$to} = 'NO' if $to =~ /$amdl/; # mailing lists, etc
if (-e "$to/\@CAPTIVE") {
}
@to = keys %to;
-
+
http_header('200 OK');
print html_header($head);
$locale = $1;
} elsif ($v eq 'REDIRECT' and $vv =~ /^([\w?=]+)$/) {
$redirect = $1;
- } elsif (($v eq 'KEY' or $v eq 'SKEY') and $vv =~ /^([\w:]+)$/) {
+ } elsif ($v eq 'SKEY' and $vv =~ /^([\w:]+)/) {
$skey = $1;
$restricted = $v;
- } elsif ($v eq 'GKEY' and $vv =~ /^([\w:]+)$/) {
+ } elsif ($v eq 'GKEY' and $vv =~ /^([\w:]+)/) {
$gkey = $1 unless $nomail;
$restricted = $v;
- } elsif ($v eq 'DKEY' and $vv =~ /^(\w+)$/) {
+ } elsif ($v eq 'DKEY' and $vv =~ /^(\w+)/) {
$dkey = $1;
- } elsif ($v eq 'AKEY' and $vv =~ /^(\w+)$/) {
+ } elsif ($v eq 'AKEY' and $vv =~ /^(\w+)/) {
$akey = $1;
} elsif ($v eq 'FROM' or $v eq 'USER') {
$from = normalize_email($vv);
$keep = $keep_max if $keep_max and $keep > $keep_max;
$specific{'keep'} = $keep;
} elsif ($v eq 'TIMEOUT' and $vv =~ /^(\d+)$/) {
- $specific{'timeout'} = $timeout = $1;
+ $specific{'timeout'} = $timeout = $1;
}
}
# lookup akey, skey and gkey (full and sub user and group)
sub check_keys {
+ if (@to and "@to" ne '_') {
+ http_die("you cannot mix TO and SKEY URL parameters") if $skey;
+ http_die("you cannot mix TO and GKEY URL parameters") if $gkey;
+ }
+
# only one key can be valid
$akey = $gkey = '' if $skey;
$akey = $skey = '' if $gkey;
pq(qq(
'</pre>'
'<p><hr><p>'
- '<a href="http://fex.rus.uni-stuttgart.de/users.html">User types overview</a>'
+ '<a href="/users.html">User types overview</a>'
'</body></html>'
));
} else {
while (sysread($fifo,$_,$bs)) {
syswrite STDOUT,$_ or die $!;
}
+ unlink $fifo;
exit;
}
+2016-03-11 fuc: added MIME headers to notification e-mail
+2016-03-08 fexsend: added support for recipient:options
+2016-03-07 fexsend,fexget: added update function to option -V
+2016-03-04 install: fixed bug wrong permissions for /home/fex/locale/*/htdocs
+2016-03-02 dop: run embedded <<<code>>> without return value output
+ dop: 10 s timeout for (all) embedded <<code>>
+2016-02-26 dop: run <<code>> within perl namespace (package) DOP
+2016-02-25 fexsend: added option -T internet speed test
+2016-02-22 fexit: added internet speed test
+2016-02-11 fexit: added option -s file streaming
+2016-02-08 added @extra_header config with default security settings for
+ Content-Security-Policy, X-Frame-Options, X-XSS-Protection,
+ X-Content-Type-Options
+2016-02-03 fup: every address or alias can have attached :options
+ (keep,autodelete,locale)
+2016-01-29 fexit: added xx clipboard support
+2016-01-21 fexsend: fixed bug not working cgi-bin/login
+2016-01-15 fup: fixed bug UTF8 error in italian source
+2016-01-14 fup: fixed bug after login $info_login instead of $info_1 is
+ displayed
2015-12-29 fexsend: added search pattern argument to option -l
2015-12-25 fup: added +/- download flag in LIST command output
2015-12-18 fup: allow AUTODELETE and KEEP parameter for anonymous user and
2015-08-24 better detection of UTF8 in comment
2015-08-14 fixed bug "Wide character in print at (...)/fex.pp" in function pq()
2015-07-29 install: fixed various bugs
-2015-07-15 dop: symbolic links generate a HTTP 302 (temporarily redirection)
+2015-07-15 dop: symbolic links generate a HTTP 302 (temporarily redirection)
instead of a HTTP 301 (permanently redirection) response
2015-06-16 fexsend: fixed bug hangs with https
2015-06-16 new fex.ph config variable @mailing_lists
2015-04-01 group name may only contain (some) ASCII characters
2015-03-29 fop: fixed bug no more download from same (recipient) ip
2015-03-18 added local URL redirect service
-2015-03-08 fup: fixed bug uninitialized value $address if alias address is
+2015-03-08 fup: fixed bug uninitialized value $address if alias address is
used twice
2015-03-07 disallow email addresses starting with "-"
2015-03-07 fex_cleanup: do not terminate on sendmail error
2015-03-01 no file name in email subject if notification is encrypted
-2015-02-28 fexsrv: restrict HTTP header to 64 kB ($bs) and POST (not fup) to
+2015-02-28 fexsrv: restrict HTTP header to 64 kB ($bs) and POST (not fup) to
128 MB
2015-02-27 no more usage of CGI.pm at all
2015-02-25 fup: added $auth_hook
2015-02-16 in notification+reminder emails use same protocol for download URL
like in upload
2015-02-08 rup: fixed various bugs (not working at all)
-2015-02-05 fup: fixed bug cannot send to groups
+2015-02-05 fup: fixed bug cannot send to groups
2015-01-27 fup: set autodelete=no if sender == recipient
(use case: provide download link for mailing lists)
2015-01-27 new fex.ph config variable $fex_yourself (default yes)
2014-11-20 count unfinished upload size into quota, too
2014-11-20 fixed bug wrong quota calculation on SysV UNIX like Solaris
2014-11-18 fexsend: added environment variables SSLVERIFY SSLCAPATH SSLCAFILE
-2014-11-18 dop: added HTTP basic authentication for htdoc directory with
+2014-11-18 dop: added HTTP basic authentication for htdoc directory with
.htauth file
2014-11-14 ignore @forbidden_recipients if $SPOOL/$USER exists
(admin has created user)
2014-06-03 fuc: fixed bug cannot edit and save groups
2014-05-26 fuc: ignore akey cookie to prevent cross-site request forgery
2014-05-26 fup,foc,fuc,rup,pup: better parameter filtering to prevent
- cross-site scripting attacks
+ cross-site scripting attacks
2014-05-25 fup: fixed bug insecure dependency when forwarding a file
to a user which has set a default keep value
2014-05-23 fexget: fixed bug download fails on big file and slow disk
2013-09-18 anonymous user now with hostname domain instead of mail domain
2013-09-17 dop: set locale cookie, too
2013-09-15 foc: added "Change the disclaimer" option
-2013-09-12 fup: expand domainless address with server hostname if such a user
+2013-09-12 fup: expand domainless address with server hostname if such a user
exists (needed for fbm/nettest)
2013-09-09 new FAQ design (questions first, then Q+A)
2013-09-04 fac: modify $hostname when vhost fex.ph is created
2013-09-04 fuc: recognize comment=NOMAIL
2013-08-26 fexsend: always show download URL if recipient is "."
-2013-08-20 fup,fop: fixed bug no DELETE and RESUME for fexmail and anonymous
+2013-08-20 fup,fop: fixed bug no DELETE and RESUME for fexmail and anonymous
users (because of storage swap)
2013-08-18 sexsend: fixed bug data corruption when using https
2013-08-18 fop,fup: fixed bug bad file locking when using multiple recipients
2013-08-14 fac: added option -M for resending notification emails
2013-08-09 afex: fixed bug ID for input
2013-08-06 fexsrv: always includes "Server: fexsrv" in HTTP reply
- fexsend: terminates if no fexsrv HTTP reply
+ fexsend: terminates if no fexsrv HTTP reply
2013-07-28 dop: added .htaccessfrom support
-2013-07-27 fex.ph,dop: security enhancement:
+2013-07-27 fex.ph,dop: security enhancement:
static documents must be in @doc_dirs
dop: documents with leading . are not allowed
2013-07-25 fexsend: added option -= to upload a file with another name
2013-06-12 fac(CGI): fixed bug wrong spooldir for virtual server
2013-06-11 fex.ph: new config variable $usage_conditions for registrations mails
fop: fixed bug fexmail download possible only once
-2013-06-10 fac: added option -D to disable a user
+2013-06-10 fac: added option -D to disable a user
(with hooks in fop,fop.fuc,foc,fur)
2013-06-03 fuc: fixed bug user can modify his auth-ID to an illegal value
2013-05-30 install: force creation of $admin_pw
2013-05-30 fex_cleanup: fixed bug wrong fexadmin fexid for reactivation emails
2013-05-25 added afex and asex to distribution
-2013-05-23 dop: fixed bug no output on file.stream
+2013-05-23 dop: fixed bug no output on file.stream
2013-05-22 install script installs as user fex (and not as root)
2013-05-19 security patch: config variable @local_rhosts restricts download of
files from new external users to specific ip ranges
2013-05-16 fop: fexmail support (multiple downloads allowed)
2013-05-09 fup: fixed bug anonymous only works if $mdomain is defined
2013-05-09 fop: fixed bug anonymous only works if recipient host is in
- @anonymous_upload list
+ @anonymous_upload list
2013-05-07 fup: fixed bug multiple Location HTTP headers generate an error with
- some web browsers
+ some web browsers
2013-05-03 added support for axel download accelerator (multiple HTTP Range)
2013-05-02 add X-FEX-File-ID header to notification emails
2013-04-23 dop: fixed bug HTTP 301 redirection timeout on symlinks
2012-11-06 fup,fop,fac: added user up/download IP restriction by admin
2012-11-05 added HTTP Strict Transport Security (HSTS) if $force_https is set
2012-11-05 fixed bug afex accessible via xkey from everywhere
-2012-11-02 fup: fixed bug one time upload URL gives "no recipient specified"
+2012-11-02 fup: fixed bug one time upload URL gives "no recipient specified"
error
2012-11-01 fup: fixed bug public upload always gives error
2012-10-16 fop,fup: added afex support
downloads
2012-07-05 fexsrv: added camel easteregg
2012-07-02 fup: added optional anonymous upload with fex.ph variable
- @anonymous_upload
+ @anonymous_upload
2012-07-02 fup: fixed bug throttle 0 configuration is ignored
2012-07-01 fexsend: optional argument '@' as files/recipients separator
fixed bug notification email for recipient '.'
-2012-06-21 dop: inside HTML documents: #include "file"
+2012-06-21 dop: inside HTML documents: #include "file"
2012-06-06 fexget: new option -+
2012-06-05 fexsend: new option -+
2012-06-01 fup: show transfered size instead of total size in status window
2011-11-15 fup: fixed bug with $autodelete = $NUMBER;
2011-11-08 fac: added option -S statistics
2011-11-02 fup: show remaining keep time in files listing
-2011-10-28 fup: fixed bug uninitialized value when using copy-forward
+2011-10-28 fup: fixed bug uninitialized value when using copy-forward
2011-10-13 fup: FILESIZE hack for firefox 7 to support uploads > 4 GB
2011-10-05 fup: fixed bug wrong sender quota calculation
2011-10-03 fex.ph: added configuration variables @upload_hosts @download_hosts
2011-09-20 fex.ph: added optional config variable $boring for unhumorous mode
2011-09-19 fur: $USER/.auto contains additional info about account creation
2011-09-07 fac(CGI): fixed bug infinitve loop in watch logfile
-2011-09-06 fup,fac,fur: new additional login URL type:
+2011-09-06 fup,fac,fur: new additional login URL type:
http://FEXSERVER/fup/B64ID
2011-09-06 fup: show "or select from address book" only if there are entries
2011-09-05 fexsrv: fixed bug locale cookie not fetched on http://cgi?parameter
2011-09-01 rup: fixed bug cannot find files (no more SID in akeys directory)
2011-08-30 fex.ph: new config variable @forbidden_recipients
2011-08-29 fexsend: accept file number for delete option -d, too
-2011-08-29 dop: fixed bug no text document output if external file command is
+2011-08-29 dop: fixed bug no text document output if external file command is
non-GNU
2011-08-26 added one time upload OKEY
2011-08-13 fex_cleanup: fixed bug comment missing in reminder email
2011-08-09 fup: show error on invalid SKEY or GKEY
2011-08-09 fuc: fixed bug subuser and groupuser not lowercase forced
2011-08-09 address book may also contain option locale=<languange>
-2011-08-08 fex_cleanup: auto-expire user accounts with fex.ph variable
+2011-08-08 fex_cleanup: auto-expire user accounts with fex.ph variable
$account_expire
2011-08-08 fexsend,fup: allow forward with locale
2011-08-08 dop: extra security check: files from lib and spool are not allowed
2011-07-30 fexsend: fixed bug no resume on -a archives
2011-07-30 fexsend: always ask server if file already has been uploaded
2011-07-30 fup: more information on F*EX clients download and configuration
-2011-07-27 fup: if comment contains "!bcc!" then sender will get a bcc
+2011-07-27 fup: if comment contains "!bcc!" then sender will get a bcc
of notification email
2011-07-26 fexget: added option -X do not extract archive file
2011-07-26 fexget: added option -a get all files
2011-07-22 fac(CGI): fixed bug displaying < and & in logfiles
2011-07-22 fac(CGI): added getting error.log
2011-07-22 fop: allow multiple downloads from any client if sender = recipient
-2011-07-16 added doc/reverse_proxy
+2011-07-16 added doc/reverse_proxy
2011-07-14 added optional czech localization
2011-07-01 FAQ.html reformated
2011-06-30 translate install job 20 times faster
2011-06-22 fup: disable HTML code in file listing (filename & comment)
2011-06-21 added optional italian localization
2011-06-17 fixed bug $bcc is ignored
-2011-06-16 fexsend,fexget: better reverse proxy support
+2011-06-16 fexsend,fexget: better reverse proxy support
(always send Host header)
2011-06-16 added optional galician localization
2011-06-15 fup: fixed bug always keep_default days in notification email
2011-05-17 fixed bug access problems with AKEYs: now use SID instead of SIP
2011-05-11 added helper script mksgkeys (regenerates missing SKEYs and GKEYs)
2011-05-10 fex_cleanup: cleanup ADDRESS_BOOK file upload
-2011-05-10 fex.ph,fex_cleanup: AUTODELETE=NUMBER ==>
+2011-05-10 fex.ph,fex_cleanup: AUTODELETE=NUMBER ==>
delete file on next NUMBER day after download
2011-05-09 fac,fup: added user specific autodelete default
2011-05-09 fac,fex_cleanup: added user specific keep default
2011-04-24 xx: better ESXi support (heuristic guessing of tar format)
2011-04-22 sexsend: base64 support for $FEXID and $FEXXX
2011-04-01 fexsend: continue without SID if SID is not available
-2011-03-26 fexsrv: deactivate header_hook (inquisition) if request is a
+2011-03-26 fexsrv: deactivate header_hook (inquisition) if request is a
regular fop request
2011-03-18 fexsend: base64 support for $FEXID and $FEXXX
2011-03-09 fexget,fexsend: fixed bug no file listing for https
2011-01-07 fexget: keep file permission in overwrite mode
2011-01-04 fex_cleanup: fixed bug autodelete after partial download
2010-12-26 fex_cleanup: fixed bug too early expire for forwarded files
-2010-12-10 new config variable @public_recipients for new CGI pup
+2010-12-10 new config variable @public_recipients for new CGI pup
2010-12-10 (public upload) - upload without auth-ID
2010-12-09 fex.ph,fur: new config variable @local_rdomain for self-
registration of restricted external-to-internal users
2010-11-07 fexsend: SKEY or GKEY URLs can be recipients, too
2010-11-04 fexget: added (hidden) option -K
2010-11-03 fexsend: fixed bug proxy usage failed
-2010-11-02 fop: fixed bug corrupted download with Internet Explorer
+2010-11-02 fop: fixed bug corrupted download with Internet Explorer
2010-10-25 fop,fup: better locking: no uploading is possible while a
download is in progress for the same file
2010-10-24 fix,fop: fixed bug subuser not working (SKEY problem)
2010-08-17 fac: fixed bug accept users without domain
2010-08-17 install: fixed bug empty $admin_pw
2010-08-15 fex.ph: optional fix address $sender_from (instead of F*EX user) in
- notification email From
+ notification email From
2010-08-14 added optional spanish localization
2010-08-12 fup: speedup 90%
2010-08-12 fop: speedup 20%
-2010-08-12 fop: better fexget compatibility
+2010-08-12 fop: better fexget compatibility
(close connection after file delivery)
2010-08-11 fop: fixed IE download bug (missing header separating line)
2010-08-11 fop: fixed 1 min delay bug on AUTODELETE=YES
2010-07-10 fop: workaround for stupid IE download bug
2010-07-03 fex.ph,fex.pp: new config variable @remote_domains
2010-07-01 fexsrv,fex.ph: new config variable $force_https
-2010-06-29 fop: new config variable $limited_download with default NO
+2010-06-29 fop: new config variable $limited_download with default NO
=> allow multiple downloads through proxy farm (varying IPs)
2010-06-29 fop: note every successful download in spool file "download"
2010-06-25 fexget: fixed bug download status info update too often
-2010-06-23 fur: better sendmail clone compatibility:
+2010-06-23 fur: better sendmail clone compatibility:
use space instead of comma as address separator
2010-06-19 fexget: new option -o overwrite mode
2010-06-19 fexget: use ./$file.tmp for downloading instead of $HOME/.fex/tmp/
2010-06-11 schwuppdiwupp: X-File-ID support
2010-06-08 fup,fexsend: (chunked) multi-POST for proxy with 4 GB limit
2010-06-06 fup,fop,fexsend: protocol extension X-File-ID (contains mtime
- of file) is the successor of X-Size for more
- reliable resume function
+ of file) is the successor of X-Size for more
+ reliable resume function
2010-06-02 schwuppdiwupp: added proxy support
2010-05-31 fexsend: fixed bug windows path elements in filename
-2010-05-30 better server proxy support:
- AKEY and SKEY no longer rely on client ip
+2010-05-30 better server proxy support:
+ AKEY and SKEY no longer rely on client ip
2010-05-29 fexsend: added proxy support
2010-05-28 fur: allow registration confirmation more than once
2010-05-27 fexsend: added option -b bounce (copy-forward)
2009-07-07 fup: be more restrictive in accepting (illegal) parameters values
2009-07-07 fup,fuc: subuser access key name is now SKEY (KEY is depreciated)
2009-07-07 rup: new HTML layout, fixed bug in file select box
-2009-07-06 fup: substitute all control characters in file name and comment
+2009-07-06 fup: substitute all control characters in file name and comment
with "_"
2009-07-02 better install script, guesses IP
-2009-06-29 changed spool directory layout
+2009-06-29 changed spool directory layout
$TO/$FROM/$FILE --> $TO/$FROM/md5h($FILENAME)
to avoid filename collisions
2009-06-28 added mailman authorization mma
2009-04-07 new perl based install; requires server IP for xinetd binding
2009-03-25 fexget: fixed bug saving failed if on other partition then FEXHOME
2009-03-25 fexget: fixed bug calculated wrong transfer rate
-2009-03-25 fexget: changed default answers to more secure values
+2009-03-25 fexget: changed default answers to more secure values
2009-03-24 fexsend: new option -l for listing sent files
2009-03-24 fup: support for listing sent files
2009-03-24 fex.pp: default charset is now UTF-8 in HTTP reply
2009-02-11 fop: fixed bug file size request with multiple $to gives always 0
(no upload resume possible with multiple recipients)
2009-02-11 fop: check for valid recipient address (in file path)
- ==> early abort possible when client uses illegal address for
+ ==> early abort possible when client uses illegal address for
upload (resume-HEAD-request)
2009-02-10 fur: catch errors from sendmail(clone) and save them to $log
2009-02-09 fexsrv: fixed bug wrong log sequence in debug files
2008-12-23 sexsend,sexget: added HTTPS/SSL support
2008-12-21 fup: fixed bug removing old autodelete and error files failed
2008-12-20 added logwatch
-2008-12-18 fexget: fixed bug responsiveness on slow links
+2008-12-18 fexget: fixed bug responsiveness on slow links
2008-12-18 fexget: fixed bug save file name for archives
2008-12-12 fexget: better responsiveness on slow links (modem, ISDN)
2008-12-12 fup: added warning for incompatible clients (konqueror, etc)
2008-11-20 fup: fixed bug subuser cannot send files
2008-11-19 use md5-hash of $from:$id instead of URL parameters FROM=$from&ID=$id
2008-11-19 fac: set correct exit status
-2008-11-16 fup: fixed bug DELETE not working
+2008-11-16 fup: fixed bug DELETE not working
2008-11-16 install: do not overwrite lib/fup.pl (perhaps contains site config)
2008-11-15 fex_cleanup: clean up $SPOOL/.ukeys/, too
2008-11-14 fup: show "user config" link only after authorization
2008-08-14 fup: fixed bug login possible with wrong login data (but no upload)
2008-08-13 fup: showstatus terminates immediately when empty file was uploaded
2008-08-13 fup: showstatus shows error message on illegal recipient address
- or when no file was uploaded
+ or when no file was uploaded
(nececessary for stupid Internet Explorer!)
-2008-08-11 splitted debugfiles with time stamp in filename
+2008-08-11 splitted debugfiles with time stamp in filename
2008-08-11 fex_cleanup: clean up aborted uploads, .ukeys/ and .debug/, too
2008-08-11 fexsend,fexget: allow more than one file (with all options)
2008-08-08 fup: eliminate superfluous newlines in logfile on error handling
2008-04-07 fac: added restriction option -r and delete user option -d
2008-04-06 fup: use Net::DNS instead of external host command
2008-04-06 fup: more debuglog, fixed wrong error messages
-2008-04-06 added doc/concept doc/FAQ
+2008-04-06 added doc/concept doc/FAQ
2008-04-02 install: better error handling (patch by chris@citecs.de)
2008-04-02 more docs and improved logging
2008-04-01 cgilaunch: fixed bug in determing REMOTE_HOST when using stunnel
Beate Herrmann <beate@fex.rus.uni-stuttgart.de>:
- - artwork
+ - artwork
Sebastian Zaiser <szcode@arcor.de>:
- upload status window
Kurt Jaeger <pi@nepustil.net>:
- ipv6 support
-
+
Andre Hafner <andrehafner@gmx.net>:
- web admin interface fac
- VM
Waldemar Bronsch <aw.bronsch@gmx.de>:
- German localization
-
+
Tobias Gunkel <tobias.gunkel@qumido.de>:
- German localization
Hans-Georg Bickel <bickelhg@gmx.de>:
- Swabian localization
-
+
Francisco Ruiz <fjrbas@yahoo.es>:
- Spanish localization
Anton Meixome <meixome@certima.net>:
- Galician localization
-
+
Vanni Piagno <vpiagno@gmail.com>:
- Italian localization
-
+
Michal Simunek <michal.simunek@gmail.com>:
- Czech localization
To enable IPv6 on the server you need:
- The Perl module Socket6
- You can install it on Debian or Ubuntu with:
+ You can install it on Debian or Ubuntu with:
apt-get install libsocket6-perl
- Add to /etc/xinetd.d/fex the line:
To enable IPv6 for fexsend, fexget and sexsend you need:
- The Perl module Net::INET6Glue::INET_is_INET6
- You can install it on Debian or Ubuntu with:
+ You can install it on Debian or Ubuntu with:
apt-get install libnet-inet6glue-perl
3) on destination host get container.tar from F*EX-server and extract it:
- fexget FEXURL
+ fexget FEXURL
tar xvf container.tar
rm container.tar
- creation of container.tar needs (a lot of) time
- container.tar needs (too much) disk space on source and destination host
and on the F*EX-Server
-
+
Small solution:
(*) The example above has only a few kB, but one can use sexxx for many GB
or even TB!
On my VMs I get a throughput of 90 MB/s.
-
chmod 600 stunnel.pem
cat <<EOD>stunnel.conf
+debug = warning
+output = /home/fex/spool/stunnel.log
cert = /home/fex/etc/stunnel.pem
sslVersion = all
TIMEOUTclose = 1
execargs = perl -T /home/fex/bin/fexsrv stunnel
EOD
-case $(lsb_release -a 2>/dev/null) in
+case $(lsb_release -a 2>/dev/null) in
*CentOS*) echo 'fips = no' >>stunnel.conf;;
esac
* full-users can create subusers, who can send only to this full-user
* full-users can create groups, an analogy to mailing lists, but for files
* self registration possible for internal and external users
- * maintenance-free: no admin interaction necessary
+ * maintenance-free: no admin interaction necessary
* sending to multiple recipients needs storage on the server only once
* quotas for sending and receiving
* F*EX is a HTTP web-service and needs no firewall-tunnels
The end user normally uses F*EX with his web browser and the URLs
http://YOURFEXSERVER/fup (file upload) and http://YOURFEXSERVER/fop (file
-download).
+download).
F*EX is not an anonymous service (exception: "public upload" and
Alternativly the users can register theirselves with http://YOURFEXSERVER/fur
(F*EX user registration), if the admin allows them to do so. This is done by
setting the variables @local_domains and @local_hosts in FEXHOME/lib/fex.ph
-Example:
+Example:
@local_hosts = qw(127.0.0.1 10.10.100.0-10.10.255.255);
@local_domains = qw(rus.uni-stuttgart.de flupp.org);
F*EX full users can create one time upload URLs with
-http://YOURFEXSERVER/fuc
+http://YOURFEXSERVER/fuc
With such a URL a foreign user can send this F*EX full user a single file.
F*EX full users can theirselves register "subusers" with
-http://YOURFEXSERVER/fuc
+http://YOURFEXSERVER/fuc
Subusers can only fex to their full-user, not to any others, and they
cannot create other subusers.
The F*EX user is the same as the "sender" in the fup CGI and the "from"
-parameter in the F*EX URL.
+parameter in the F*EX URL.
The (confusing) naming scheme is historically based :-)
You do not need to build F*EX URLs manually, they are generated by the
-F*EX programs.
+F*EX programs.
A F*EX session is based on unique URL parameters or POST variables (FROM,
A GKEY is made of md5_hex("$mainuser:$groupname:$groupuser:$groupuserid")
Note: the AKEY, SKEY and GKEY always can be stolen by a network sniffer!
-If you need true security, then you have to use https instead of http!
+If you need true security, then you have to use https instead of http!
After download the file will be deleted after a grace time of 1 minute.
This grace time allows a recipient to get the file again if he had
-problems in saving it.
+problems in saving it.
With the fexsend client the sender can change this behavior:
option -D means "delay autodelete": do not delete the the file directly
after download, but with the nightly fex_cleanup cronjob. More downloads
are possible only from the same client (identified by cookie or ip
-address).
+address).
option -K means "keep file": do not delete the file after download, but
only after expiration date (normally 5 days). More downloads are possible
and auth-ID.
See extra documentation SSL for using https.
-If you want to have encrypted emails, then you need a GPG public key for
+If you want to have encrypted emails, then you need a GPG public key for
the user fex. Create it with "gpg --gen-key" (use fex@YOURFEXSERVER as the
user or the $bcc address from fex.ph if you have set it, see below). Next,
the user has to upload his public key via webinterface "user config &
FEXHOME contains:
- spool/ spool directory and user data
+ spool/ spool directory and user data
htdocs/ directory for generic download files
bin/ directory for programs
cgi-bin/ directory for CGI programs
lib/ directory for library and config files
doc/ additional documentation
locale/ alternative language installation
-
+
Files in spool:
$user/@KEEP keep default
$user/@LOCALE locale default
$user/@CAPTIVE user must not change his settings
- $user/@FEXYOURSELF user can only fex to himself via
+ $user/@FEXYOURSELF user can only fex to himself via
web interface
$to/$from/$file/upload file data in upload progress
$to/$from/$file/filename original file name
The download key (DKEY) is a unique identifier for - guess what -
downloading. It also prevents an attacker to get the file, because only
the recipient knows the DKEY as part of the download URL from the
-notification email.
+notification email.
XKEY is an optional extra download key to have a short download URL in
shape http://YOURFEXSERVER//XKEY
Example: fexsend schwuppdiwupp.jpg //
The user has to realize that such URLs have very low security.
-If you need to trace a F*EX request, then set
+If you need to trace a F*EX request, then set
$debug = 1;
in fex.ph and look in ~/spool/.debug/ for the correspondening files.
F*EX comes with its own web server: fexsrv
Standard web servers like apache have been proven problematic, either in
-speed or because of a 2-GB-limit.
+speed or because of a 2-GB-limit.
It is not possible to use the F*EX CGIs with an alternative web server,
because the F*EX CGIs need special fexsrv features.
xinetd starts fexsrv for every new connection, which then executes the
CGIs fup (file upload), fop (file output), fuc (fex user control), foc
(fex operation control), fac (fex admin control), fur (fex user
-registration) and sex (stream exchange).
+registration) and sex (stream exchange).
SEX has the opposite authorization model of FEX: The sender does not
call them also fuckyou and fuckme :-)
-With the F*EX client fexsend you can have a streaming file transfer with
+With the F*EX client fexsend you can have a streaming file transfer with
spooling: on client side there is no temporary buffer file (archive), but
the data is sent directly to the F*EX server. This saves time and disk
space on the client.
129.69.0.0-129.69.255.255)
dop is not a regular CGI program (like fup or fop), but a sub-program of
-fexsrv.
+fexsrv.
*.html files may contain $VARIABLES$ which will be substituted with the
value of the corresponding environment variable. See example
$SERVER_ADMIN$ in FEXHOME/htdocs/index.html
*.html files may contain <<perl-code>> (even multiline) which will be
-evaluated. See example FEXHOME/htdocs/dynamic.html
+evaluated and its output will be placed in. Same goes for <<<perl-code>>>
+but without output catching.
+See example FEXHOME/htdocs/dynamic.html
This perl-code must not contain '>>' strings itself!
Pay attention: do not place security relevant data inside << >> because it
will be delivered to the client if the URL ends with '!'! See example:
$account_expire = "365:delete";
This deletes user accounts automatically which have been inactive for 365
-days.
+days.
Of course you can use any number of days.
See fex-client_2.pdf for the F*EX protocol specification.
To understand and trace the F*EX protocol you can use fexsend with the -v
-option.
+option.
Example (--> means send to server, <-- means receive from server):
<-- X-SID: 8p2Y2qa2
<-- X-Timeout: 30
<-- Content-Length: 0
-<--
+<--
--> HEAD /fop/framstag@flupp.org/framstag@fex.rus.uni-stuttgart.de/X.png??ID=MD5H:226e896d0adab86892957aa8158b37ba HTTP/1.1
-->
<-- HTTP/1.1 200 OK
<-- Content-Length: 0
<-- X-Size: 0
<-- X-Features: SID,CHECKRECIPIENT,GROUPS,QUOTA,FILEID,MULTIPOST,XKEY
-<--
+<--
--> POST /fup HTTP/1.1
--> Host: fex.rus.uni-stuttgart.de
--> User-Agent: fexsend (Ubuntu 8.04.4 LTS)
--> Content-Length: 149935162
--> Content-Type: multipart/form-data; boundary=JhUOtQ3sgV5ZcHJzrTny523nBFqgUNvSAOUHoRMTdZfGpAjs
--->
+-->
--> --JhUOtQ3sgV5ZcHJzrTny523nBFqgUNvSAOUHoRMTdZfGpAjs
--> Content-Disposition: form-data; name="FROM"
--->
+-->
--> framstag@fex.rus.uni-stuttgart.de
--> --JhUOtQ3sgV5ZcHJzrTny523nBFqgUNvSAOUHoRMTdZfGpAjs
--> Content-Disposition: form-data; name="TO"
--->
+-->
--> framstag@flupp.org
--> --JhUOtQ3sgV5ZcHJzrTny523nBFqgUNvSAOUHoRMTdZfGpAjs
--> Content-Disposition: form-data; name="ID"
--->
+-->
--> MD5H:226e896d0adab86892957aa8158b37ba
--> --JhUOtQ3sgV5ZcHJzrTny523nBFqgUNvSAOUHoRMTdZfGpAjs
--> Content-Disposition: form-data; name="FILESIZE"
--->
+-->
--> 149934400
--> --JhUOtQ3sgV5ZcHJzrTny523nBFqgUNvSAOUHoRMTdZfGpAjs
--> Content-Disposition: form-data; name="FILE"; filename="X.png"
--> Content-Type: application/octet-stream
--> Content-Length: 149934400
--> X-File-ID: 1283077463
--->
+-->
--> (file content)
--> --JhUOtQ3sgV5ZcHJzrTny523nBFqgUNvSAOUHoRMTdZfGpAjs--
<-- Location: http://fex.rus.uni-stuttgart.de/fop/CoVhikzk/X.png
<-- X-Recipient: framstag@flupp.org (autodelete=YES,keep=5)
-<--
+<--
Comment on the HEAD request above:
The client fexsend sends it to request whether the file has been sent
email address is valid to the server.
GET ADDRESS_BOOK is a HTTP GET request to check if the recipient with a
short address (= address without @) is an alias in the senders server
-address book.
+address book.
Please use "fexsend -v" by yourself to see the whole protocol dialoge.
Many HTTP proxies have a POST limit, which is often at 2 GB, but sometimes
If this does not help at all, contact me :-)
framstag@rus.uni-stuttgart.de
-
==============
To install the F*EX server, you need a UNIX system with perl, xinetd and
-/usr/lib/sendmail (either original or a clone like postfix or exim).
+/usr/lib/sendmail (either original or a clone like postfix or exim).
Your perl must have the following standard core modules:
CGI
local config. If you want to upgrade from a previous F*EX version, you
also can run "./install", no old config files will be overwritten. Also
index.html is kept.
-
+
Alternativly use "./install -p 8888" to install F*EX on port 8888 instead
-on default port 80.
+on default port 80.
Run "./install" again for installing optional localizations (languages).
Important changes:
-- added fexit (Windows client) and macfexsend (MacOS client) support
+- recipient address can have attached :options (keep,autodelete,locale)
+
+- added config variable @extra_header with default HTTP security headers,
+ see: https://securityheaders.io/?q=http%3A%2F%2Ffex.belwue.de
+
+- dynamic HTML runs in own Perl namespace (DOP)
- fixed various bugs
New features for users
----------------------
+2016-03-15:
+
+- recipient address can have attached :options (keep,autodelete,locale)
+
+
2016-01-04:
- new Windows client fexit
- fexsend has new option -N resend notification email
-
+
2014-12-24:
- the CLI clients respect the environment variables SSLVERIFY SSLVERSION
- allow multiple downloads from same ip
- fexget proxy support
-
-fex-20160104
+fex-20160328
With xx you have a network wide shell based clip board for files and
STDIN/STDOUT: easy data exchange between different accounts on different
-hosts.
+hosts.
usage: send file(s): xx file...
or: send STDIN: xx -
framstag@tandem:~: uname -a | xx
/home/framstag/.fex/tmp/STDFEX : 0 kB in 1 s (0 kB/s)
-
-
+
+
framstag@fex:~: xx
transfered: 0 MB (100%)
Linux tandem 2.6.24-28-server #1 SMP Wed Aug 18 22:01:20 UTC 2010 i686 GNU/Linux
(...)
/boot/System.map-2.6.24-27-generic
/home/framstag/.fex/tmp/STDFEX : 34 MB in 2 s (17605 kB/s)
-
-
+
+
framstag@fex:/tmp: xx
transfered: 34 MB (100%)
Files in transfer-container:
-
+
drwxr-xr-x root/root 0 2010-10-20 07:37 boot/
-rw-r--r-- root/root 7905085 2010-05-25 15:38 boot/initrd.img-2.6.24-27-generic
-rw-r--r-- root/root 1927544 2010-10-16 20:38 boot/vmlinuz-2.6.24-28-generic
(...)
-rw-r--r-- root/root 906803 2010-03-24 14:33 boot/System.map-2.6.24-27-generic
-
- Extract these files?
+
+ Extract these files?
One problem are shared system accounts like root where different persons
But you can put the ID authorization in the environment variable FEXID.
-fexsend on your local account gives you a string for "cut and paste", example:
+fexsend on your local account gives you a string for "cut and paste", example:
framstag@moep:~: fexsend -I
export FEXID='fex.rus.uni-stuttgart.de:8080 framstag jmBhf9ht'
root@tandem:~# grep sshd /var/log/daemon | xx
transfered: 265 kB in 1 s (265 kB/s)
-
+
framstag@moep:~: xx | wc -l
434279
then use: tar cvf - your files... | xx
With default usage only one "storage slot" is available: STDFEX
-But you can use as many "storage slots" as you want by using "xx :TAG"
+But you can use as many "storage slots" as you want by using "xx :TAG"
Examples:
uname -a | xx
-
+
grep sshd /var/log/daemon | xx :log
-
- xx :log | grep obertux
-
+
+ xx :log | grep obertux
+
xx :config /boot /etc /root
-
+
xx :config --
* https://github.com/FileZ/FileZ
* http://freshmeat.net/projects/eventh/
- * http://www.schaarwaechter.de/sp/projekte/dateiaustausch.html (German only!)
+ * http://www.schaarwaechter.de/sp/projekte/dateiaustausch.html (German only!)
which implement a file exchange as pure CGIs, but with a 2 GB file size limit, which F*EX does not have.
/home/fex/bin/fac -u memyselfandi@my.do.main secret-auth-id
</pre>
Then log in using the web interface: http://YOURFEXSERVER/
-
+
... and join the F*EX mailing list! ☺
https://listserv.uni-stuttgart.de/mailman/listinfo/fex
A: fac stands for F*EX Admin Control
/home/fex/bin/fac is the (full) CLI version
-
- /home/fex/cgi-bin/fac is the (restricted) web version. You have to call it with your webbrowser:
+
+ /home/fex/cgi-bin/fac is the (restricted) web version. You have to call it with your webbrowser:
http://YOURFEXSERVER/fac
Q: F*EX is not working at all! I cannot connect to it with my web browser!
cd /home/fex/spool
ln -s user@do.main alias@other.address
</code>
-
+
Now the user is known as user@do.main and alias@other.address
Q: I want that all my local users can use F*EX. How?
<pre>
# your local receiving domains
@local_rdomains = qw(flupp.org *.flupp.org);
-
+
# your local receiving hosts
@local_rhosts = qw(127.0.0.1 129.69.0.0-129.69.255.255 176.9.84.26);
</pre>
-
+
Or you can manually create a restricted external user with (example):
<pre>
/home/fex/bin/fac -u framstag@rus.uni-stuttgart.de hoppla
This allows multiple downloads.
Q: I need more security! How can I enable (https) encryption?
-A: Read doc/SSL and also look for "fop_auth" in doc/concept
+A: Read doc/SSL and also look for "fop_auth" in doc/concept
(doc is a local directory in your installation or online http://fex.belwue.de/doc/)
For email encryption see http://fex.belwue.de/gpg.html
* Contact <fex@nepustil.net> http://www.nepustil.net/ if you need more customization.
Q: F*EX is too complicated for my tie users. I need a simplified upload form.
-A: See /home/fex/htdocs/fup_template.html and /home/fex/htdocs/sup.html
+A: See /home/fex/htdocs/fup_template.html and /home/fex/htdocs/sup.html
or use public upload, see http://fex.belwue.de/usecases/foreign.html
Q: F*EX is still too complicated! I need something more simplified.
Q: Can I get a localized version in my native languange?
A: With your help, yes. Please contact <framstag@rus.uni-stuttgart.de>
-Q: I need ACLs for group access, a file browser and integration in my
- native file system.
+Q: I need ACLs for group access, versioning, a file browser and integration in
+ my local file system.
A: This is beyond the scope of F*EX, which is designed for efficient file transfer only.
Q: Feature/design XY is missing.
$q =~ s! (/\w[\S]+/[\S]+)! <code>$1</code>!g;
$a =~ s/[\s\n]+$/\n/;
$a =~ s/^\s+//;
- while ($a =~ s/^(\s*)\*/$1<ul>\n$1<li>/m) {
+ while ($a =~ s/^(\s*)\*/$1<ul>\n$1<li>/m) {
while ($a =~ s/(<li>.*\n\s*)\*/$1<li>/g) {}
$a =~ s:(.*\n)(\s*)(<li>[^\n]+\n):$1$2$3$2</ul>\n:s
}
Q: What is so special about F*EX?
-A: See feature list http://fex.belwue.de/features.html
- and use cases http://fex.belwue.de/usecases/
+A: See feature list http://fex.rus.uni-stuttgart.de/features.html
+ and use cases http://fex.rus.uni-stuttgart.de/usecases/
Q: Why not use one of the commercial services like DropLoad, ALLPeers, YouSendIt, etc?
A: * They have a file size limit of 2 GB or even less.
* There are no UNIX (CLI) clients for them.
* They need java, active-X, flash or other evil plugins.
* It is unknown how long they will exist - DropLoad and ALLPeers already have terminated their business.
-
+
Q: Why name "F*EX" and not shortly "FEX"?
A: At publication time there was already a program named "FEX" listed on freshmeat.net.
Try this with an ordinary webserver like Apache!
Q: Which licence does F*EX have? And why?
-A: Perl Artistic free software with a special anti-military clause:
+A: Perl Artistic free software with a special anti-military clause:
http://fex.belwue.de/doc/Licence
"I want peace on earth and goodwill towards men"
https://www.youtube.com/watch?v=JHU0HinVhYc https://en.wikipedia.org/wiki/Sneakers_%281992_film%29
Clients: 180 kB, 5500 lines of code
Documentation: 130 kB
Localizations: 250 kB
-
+
Q: Who else is using F*EX?
A: For example:
* German Aerospace Center http://fex.dlr.de
F*EX does not use an extra web server or a (SQL) database, so no typical web attacks are possible.
F*EX was analysed by security company revshell.com and labeled as "secure".
F*EX comes with source code, so everybody can verify it.
-
+
Q: Feature/design XY is missing.
A: Contact the author <framstag@rus.uni-stuttgart.de>
see thunderbird's filelink
https://support.mozillamessaging.com/en-US/kb/filelink-large-attachments
https://developer.mozilla.org/en/Thunderbird/Filelink_Providers
- <li>more (other) languange support (japanese, bavarian, klingon ...)
+ <li>more (other) languange support (japanese, bavarian, klingon ...)
</ul>
Q: Can I donate something for F*EX?
Q: Can I fex to a mailing list?
A: Generally: no, because the first download makes the file no more available for others.
- Contact $SERVER_ADMIN$, he can allow multiple downloads for specific addresses.
-
+ Contact $SERVER_ADMIN$, he can allow multiple downloads for specific addresses.
+
Q: Sending as a F*EX user is easy, but how to receive files from others, outside?
A: Register them as your subusers, create a F*EX group or a one-time upload key with "user config & operation control"
See also http://fex.belwue.de/usecases/foreign.html
+Q: What is a F*EX group?
+A: F*EX group is similar to a mailing list, but for files:
+ When a member fexes a file to this list, then all other members will receive it.
+ Any full user can create a F*EX group and add or delete members.
+ See "user config & operation control" → "Manage your subusers and groups"
+
Q: I am not a user of your site. How can I send a file to a registered user?
A: See question above: you must ask a regular user to register you as his subuser.
You will then get a specific upload URL from him.
A: The F*EX server has a grace time of 1 minute after first sucessfully download in which the file is still available. This is necessary because of some stupid "download managers" which request the file several times at once. Otherwise they would report an error to the user.
Your fexmaster has set AUTODELETE=DELAY as default, which means that the autodelete cleanup process is called once a day.
-
+
Power users (use the source, Luke!) can set a "do not delete after download" flag.
Q: I have uploaded a file to a list of recipients. Will the file be deleted after the first recipient has dowloaded it?
Q: Can I have encrypted emails?
A: See http://fex.belwue.de/gpg.html
+Q: I need ACLs for group access, versioning, a file browser and integration in
+ my local file system.
+A: This is beyond the scope of F*EX, which is designed for efficient file transfer only.
+
Q: I cannot download files with Internet Explorer, it tells me "Cannot open Internet site". What shall I do?
A: Use Firefox or any other Internet-compatible web browser, that Internet Explorer is not.
This is one of the many bugs of Internet Explorer.
Q: How can I prevent the fexsend error <code>SSL3_GET_SERVER_CERTIFICATE:certificate verify failed</code>?
A: Set the environment variable <code>SSLVERIFY=0</code>
- Rationale:
- Your openssl library cannot resolve the SSL certification path.
+ Rationale:
+ Your openssl library cannot resolve the SSL certification path.
With <code>SSLVERIFY=0</code> you tell openssl to ignore certification verification.
Yes, this is a crude workaround :-}
-<HTML>
+<HTML>
<HEAD><TITLE>Stream EXchange</TITLE></HEAD>
<BODY>
<center></center>
our ($fexhome,$idf,$tmpdir,$windoof,$useragent);
our ($xv,%autoview);
our $bs = 2**16; # blocksize for tcp-reading and writing file
-our $version = 20160104;
+our $version = 20160328;
our $CTYPE = 'ISO-8859-1';
our $fexsend = $ENV{FEXSEND} || 'fexsend';
our $DEBUG = $ENV{DEBUG};
+our $_0 = $0;
my %SSL = (SSL_version => 'TLSv1');
my $sigpipe;
${'opt_+'} = 0;
$opt_s = $opt_k = $opt_i = $opt_P = '';
$_ = "$fexhome/config.pl"; require if -f;
-getopts('hvVHlLdkzoaXf+m:s:i:K:P:') or die $usage;
+getopts('hvVHlLdkzoaXVf+m:s:i:K:P:') or die $usage;
$opt_k = '?KEEP' if $opt_k;
if ($opt_m =~ /(\d+)/) {
$opt_m = 0
}
-print "Version: $version\n" if $opt_V;
+if ($opt_V) {
+ print "Version: $version\n";
+ unless (@ARGV) {
+ print "Upgrade fexget? ";
+ $_ = <STDIN>||'';
+ if (/^y/i) {
+ my $new = `wget -nv -O- http://fex.belwue.de/download/fexget`;
+ if ($new !~ /upgrade fexget/) {
+ die "$0: bad update\n";
+ }
+ system qw'cp -a',$_0,$_0.'_old';
+ exit $? if $?;
+ open $_0,'>',$_0 or die "$0: cannot write $_0. - $!\n";
+ print {$_0} $new;
+ close $_0;
+ exec $_0,qw'-V .';
+ }
+ }
+ exit if "@ARGV" eq '.';
+}
+
die $usage if $opt_h;
if ($opt_H) {
print $hints;
my @rcamel = (
'\e[A
-(_*) _ _
- \\\\/ \\/ \\
+ (_*p _ _
+ \\\\/ \/ \\
\ __ )=*
//\\\\//\\\\
',
-'\e[A \\\\/\\\\/
-',
-'\e[A //\\\\//\\\\
-');
+"\e[A \\\\/\\\\/ \n",
+"\e[A //\\\\//\\\\\n"
+);
# get fexlog
if ($opt_z) {
sub download {
my ($server,$port,$fop,$nocheck) = @_;
- my ($file,$download,$ssl,$pipe,$filesize,$checkstorage);
+ my ($file,$download,$ssl,$pipe,$filesize,$checkstorage,$dkey);
my (@hh,@r);
my ($t0,$t1,$t2,$tt,$tm,$ts,$kBs,$b,$bt,$tb,$B,$buf);
my $length = 0;
$seek = -s $download || 0;
}
+ $fop =~ m:/fop/(\w+)/: and $dkey=$1 or $dkey='';
+
push @hh,"GET $proxy_prefix$fop$opt_k HTTP/1.1",
"User-Agent: $useragent",
+ "Cookie: dkey=$dkey",
"Connection: close";
push @hh,"Range: bytes=$seek-" if $seek;
our ($FEXID,$FEXXX,$HOME);
our (%alias);
our $chunksize = 0;
-our $version = 20160104;
+our $version = 20160328;
our $_0 = $0;
our $DEBUG = $ENV{DEBUG};
my $sigpipe;
if ($Config{osname} =~ /^mswin/i) {
+ # http://slu.livejournal.com/17395.html
$windoof = $Config{osname};
$HOME = $ENV{USERPROFILE};
$fexhome = $ENV{FEXHOME} || $HOME.'\fex';
$Config{osname},$Config{archname});
$SSL{SSL_verify_mode} = 0;
} elsif ($Config{osname} =~ /^darwin/i or $ENV{MACOS}) {
- $macos = $Config{osname};
# http://stackoverflow.com/questions/989349/running-a-command-in-a-new-mac-os-x-terminal-window
+ $macos = $Config{osname};
$HOME = (getpwuid($<))[7]||$ENV{HOME};
$fexhome = $HOME.'/.fex';
$tmpdir = $ENV{FEXTMP} || $ENV{TMPDIR} || "$fexhome/tmp";
-d \# delete file on fex server
-N \# resend notification e-mail
-Q check quotas
+ -T up:down test internet speed with up and down MBs
-A edit server address book (aliases)
-S show server/user settings and auth-ID
-H show hints, examples and more options
- -V show version
+ -V show version and ask for upgrade
(# is a file number, see output from $0 -l)
examples: $0 visualization.mpg framstag\@rus.uni-stuttgart.de
$0 -a images.zip *.jpg webmaster\@flupp.org,metoo
With option -s you can send any data coming from a pipe (STDIN) as a file
without wasting local disc space.
-With option -X you can specify any URL parameter, e.g.:
+With option -X you can specify any URL parameter, e.g.:
fexsend -X autodelete=yes ...
fexsend -X 'autodelete=no&locale=german' ...
*=( __ /
\\\\/\\\\/
',
-'\e[A \\\\/\\\\/
+"\e[A \\\\/\\\\/ \n",
+"\e[A //\\\\//\\\\\n"
+);
+
+my @rrcamel = (
+'\e[A
+ (_*p _ _
+ \\\\/ \/ \\
+ \ __ )=*
+ //\\\\//\\\\
',
-'\e[A //\\\\//\\\\
-');
+"\e[A \\\\/\\\\/ \n",
+"\e[A //\\\\//\\\\\n"
+);
+autoflush STDOUT;
autoflush STDERR;
if ($windoof and not @ARGV and not $ENV{PROMPT}) {
our ($opt_q,$opt_h,$opt_H,$opt_v,$opt_m,$opt_c,$opt_k,$opt_d,$opt_l,$opt_I,
$opt_K,$opt_D,$opt_u,$opt_f,$opt_a,$opt_C,$opt_R,$opt_M,$opt_L,$opt_Q,
$opt_A,$opt_i,$opt_z,$opt_Z,$opt_b,$opt_P,$opt_x,$opt_X,$opt_V,$opt_U,
- $opt_s,$opt_o,$opt_g,$opt_F,$opt_n,$opt_r,$opt_S,$opt_N);
+ $opt_s,$opt_o,$opt_g,$opt_F,$opt_n,$opt_r,$opt_S,$opt_N,$opt_T);
if ($xx) {
$opt_q = 1 if @ARGV and $ARGV[-1] eq '--' and pop @ARGV or not -t STDOUT;
${'opt_@'} = ${'opt_!'} = ${'opt_+'} = ${'opt_.'} = ${'opt_/'} = 0;
${'opt_='} = ${'opt_#'} = '';
$opt_u = $opt_f = $opt_a = $opt_C = $opt_i = $opt_b = $opt_P = $opt_X = '';
- $opt_s = $opt_r = '';
+ $opt_s = $opt_r = $opt_T = '';
$_ = "$fexhome/config.pl"; require if -f;
- getopts('hHvcdognVDKlILUARWMFzZqQS@!+./r:m:k:u:f:a:s:C:i:b:P:x:X:N:=:#:')
+ getopts('hHvcdognVDKlILUARWMFzZqQS@!+./r:m:k:u:f:a:s:C:i:b:P:x:X:N:T:=:#:')
or die $usage;
if ($opt_H) {
if ($opt_V) {
print "Version: $version\n";
+ unless (@ARGV) {
+ print "Upgrade fexsend? ";
+ $_ = <STDIN>||'';
+ if (/^y/i) {
+ my $new = `wget -nv -O- http://fex.belwue.de/download/fexsend`;
+ if ($new !~ /upgrade fexsend/) {
+ die "$0: bad update\n";
+ }
+ system qw'cp -aL',$_0,$_0.'_old';
+ exit $? if $?;
+ open $_0,'>',$_0 or die "$0: cannot write $_0. - $!\n";
+ print {$_0} $new;
+ close $_0;
+ exec $_0,qw'-V .';
+ }
+ }
+ exit if "@ARGV" eq '.';
}
if ($opt_K and $opt_D) {
exit;
}
+if ($opt_T) {
+ my ($up,$down);
+
+ $usage = "usage: $0 -T MB_up[:MB_down] [fexserver]\n";
+ if ($opt_T =~ /^(\d+)$/) {
+ $up = $down = $1;
+ } elsif ($opt_T =~ /^(\d+):(\d+)$/) {
+ $up = $1;
+ $down = $2;
+ } else {
+ die $usage;
+ }
+
+ if (@ARGV) {
+ nettest($ARGV[0],$up,$down);
+ } elsif ($fexcgi) {
+ nettest($fexcgi,$up,$down);
+ } else {
+ nettest('fex.belwue.de',$up,$down);
+ }
+ exit;
+}
+
if (@ARGV > 1 and $ARGV[-1] =~ /(^|\/)anonymous/) {
$fexcgi = $1 if $ARGV[-1] =~ s:(.+)/::;
die "usage: $0 [options] file FEXSERVER/anonymous\n" unless $fexcgi;
my $key;
my $new;
local $_;
-
+
system 'clear';
print "\n";
print "fexsend-$version\n";
print "\n";
print "$from on $fexcgi\n";
print "\n";
-
+
for (;;) {
print "\n";
print "[s] send a file or directory\n";
print "\n";
print "your choice: ";
$key = ReadKey(0);
- if ($key eq 'q') {
+ if ($key eq 'q') {
print "$key\n";
print "\n";
print "Type [Cmd]W to close this window.\n";
exit;
}
- if ($key eq 'h') {
+ if ($key eq 'h') {
print "$key\n";
- print
+ print
"\n".
"With fexsend you can send files of any size to any e-mail address.\n".
"\n".
"\n".
"Do not forget to terminate each input line with [RETURN].\n".
"\n".
- "See http://fex.rus.uni-stuttgart.de/ for more informations.\n";
+ "See http://fex.rus.uni-stuttgart.de/ for more information.\n";
next;
}
- if ($key eq 'u') {
+ if ($key eq 'u') {
print "$key\n";
if ($0 =~ m:(^/client/|/sw/):) {
print "\n";
}
next;
}
- if ($key eq 'l') {
+ if ($key eq 'l') {
print "$key\n";
system 'clear';
&set_ID;
next;
}
- if ($key eq 's' or $key eq "\n") {
+ if ($key eq 's' or $key eq "\n") {
print "s\n";
&ask_file;
next;
my @files;
my $qfiles;
local $_;
-
+
system 'clear';
-
+
&set_ID unless -s $idf;
print "\n";
sub set_ID {
my ($server,$port,$user,$logo);
local $_;
-
+
print "\n";
for (;;) {
print "F*EX server URL: ";
sendheader(
"$server:$port",
"GET /logo.jpg HTTP/1.0",
- "User-Agent: $useragent",
"Connection: close",
);
$_ = <$SH>||'';
close $logo;
last;
}
-
+
for (;;) {
last if $user;
print "Your login (e-mail address): ";
next;
}
}
-
+
for (;;) {
last if $id;
print "Your auth-ID for this account: ";
$id = <STDIN>;
$id =~ s/[\s\n]//g;
}
-
+
open $idf,'>',$idf or die "$0: cannot write to $idf - $!\n";
print {$idf} "$server\n",
"$user\n",
}
+
+sub nettest {
+ my $url = shift;
+ my $up = shift;
+ my $down = shift;
+ my $bs = 2**16;
+ my ($length,$t0,$t1,$t2,$tt,$tb,$tc,$B,$kBs,$bt);
+
+ my $nettest = $sid = 'nettest';
+
+ $port ||= 80;
+ if ($url =~ s:^https.//::) {
+ $https = $port = 443;
+ } else {
+ $url =~ s:^http.//::;
+ $port = $1 if $url =~ s/:(\d+)//;
+ }
+ $url =~ s/[\/:].*//;
+ $server = $url;
+
+ if ($up) {
+ serverconnect($server,$port);
+ checkrecipient($nettest,$nettest);
+ warn "$0: send to $server:$port\n";
+ formdatapost(
+ from => $nettest,
+ to => $nettest,
+ id => $nettest,
+ file => $nettest,
+ size => $up*M,
+ comment => 'NOSTORE',
+ );
+ }
+
+ if ($down) {
+ serverconnect($server,$port);
+ warn "$0: receive from $server:$port\n";
+ sendheader("$server:$port","GET $proxy_prefix/ddd/$down HTTP/1.0");
+ $_ = <$SH>;
+ die "$0: no response from fex server $server\n" unless $_;
+ s/\r//;
+
+ if (/^HTTP\/[\d.]+ 2/) {
+ warn "<-- $_" if $opt_v;
+ while (<$SH>) {
+ s/\r//;
+ print "<-- $_" if $opt_v;
+ last if /^$/;
+ $length = $1 if /^Content-Length:\s*(\d+)/i;
+ }
+ } else {
+ s/HTTP\/[\d.]+ \d+ //;
+ die "$0: bad server reply: $_";
+ }
+
+ unless ($length) {
+ die "$0: no Content-Length header in server reply\n";
+ }
+
+
+ if (${'opt_+'}) {
+ print $rrcamel[0];
+ $tc = 0;
+ }
+
+ $t0 = $t1 = $t2 = int(time);
+ $B = 0;
+ while ($B < $length) {
+ $b = read $SH,$_,$bs or die "$0: cannot read after $B bytes - $!\n";
+ # defined($_ = <$SH>) or die "$0: cannot read after $B bytes - $!\n";
+ # $b = length;
+ $B += $b;
+ $bt += $b;
+ $t2 = time;
+ if (${'opt_+'} and int($t2*10)>$tc) {
+ print $rrcamel[$tc%2+1];
+ $tc = int($t2*10);
+ }
+ if (int($t2) > $t1) {
+ $kBs = int($bt/k/($t2-$t1));
+ $t1 = $t2;
+ $bt = 0;
+ printf STDERR "nettest: %d MB (%d%%) %d kB/s \r",
+ int($B/M),int(100*$B/$length),$kBs;
+ }
+ }
+ close $SH;
+
+ $tt = $t2-$t0;
+ $kBs = int($B/k/($tt||1));
+ if (${'opt_+'}) {
+ print $rrcamel[1];
+ print $rrcamel[2];
+ }
+ printf STDERR "nettest: %d MB in %d s = %d kB/s \n",
+ int($B/M),$tt,$kBs;
+ }
+}
+
+
# read one key from terminal in raw mode
sub ReadKey {
my $key;
local $SIG{INT} = sub { stty('reset'); exit };
-
+
stty('raw');
# loop necessary for ESXi support
while (not defined $key) {
sendheader(
"$server:$port",
"GET $proxy_prefix/fop/$2/$2?LIST HTTP/1.1",
- "User-Agent: $useragent",
);
$_ = <$SH>||'';
s/\r//;
die "$0: file \#$a not found in fexlist\n";
}
}
-
+
@r = formdatapost(
from => $from,
to => $opt_l ? '*' : $from,
s/&/&/g;
s/"/\"/g;
s/</</g;
- if (/^(to (.+) :)/) {
+ if (/^(to (.+) :)/) {
$s = $2 =~ /$a/;
print "\n$_\n" if $s;
print {$fexlist} "\n$_\n";
sendheader(
"$server:$port",
"GET $proxy_prefix/fop/$2/$2?DELETE HTTP/1.1",
- "User-Agent: $useragent",
);
$_ = <$SH>||'';
s/\r//;
serverconnect($server,$port);
query_sid($server,$port) unless $anonymous;
}
-
+
$file = urlencode($file);
sendheader(
"$server:$port",
"GET $proxy_prefix/fop/$to/$from/$file?id=$sid&DELETE HTTP/1.1",
- "User-Agent: $useragent",
);
-
+
while (<$SH>) {
s/\r//;
printf "<-- $_"if $opt_v;
}
}
if ($from eq $to or $from =~ /^\Q$to\E@/i
- or $nomail or $anonymous or $nonot)
+ or $nomail or $anonymous or $nonot)
{
print "$recipient\n" if $recipient;
print "$location\n" if $location;
sub formdatapost {
my %P = @_;
- my ($boundary,$filename,$length,$buf,$file,$fpsize,$resume,$seek);
+ my ($boundary,$filename,$length,$buf,$file,$fpsize,$resume,$seek,$nettest);
my ($flink);
my (@hh,@hb,@r,@pv,$to);
- my ($bytes,$t,$bt);
+ my ($bytes,$b,$t,$bt);
my ($t0,$t1,$t2,$tt,$tc);
my $bs = 2**16; # blocksize for reading and sending file
my $fileid = int(time);
}
# print "calculating archive size... ";
debug("cd $dittodir;$ditto -");
- open $ditto,"cd $dittodir;$ditto - 2>$error|"
+ open $ditto,"cd $dittodir;$ditto - 2>$error|"
or die "$0: cannot run ditto - $!\n";
$t0 = int(time) if -t STDOUT;
while ($b = read $ditto,$_,$bs) {
undef $SH; # force reconnect (timeout!)
}
+ elsif ($P{to} eq 'nettest') {
+ $filename = $nettest = 'nettest';
+ $filesize = $P{size};
+ $fileid = 0;
+ }
+
# single file
else {
$filename = encode_utf8(${'opt_='} || $file);
$filename .= '.gpg' if $opt_g;
- unless ($opt_d) {
+ unless ($opt_d or $nettest) {
if ($opt_g) {
$filesize = -1;
$fileid = int(time);
unless ($SH) {
serverconnect($server,$port);
- query_sid($server,$port) unless $anonymous;
+ query_sid($server,$port) unless $anonymous or $nettest;
}
$P{id} = $sid; # ugly hack!
$filename =~ s/\\/_/g; # \ is a illegal character for fexsrv
# ask server if this file has been already sent
- if ($file and not $xx) {
+ if ($file and not $xx and not $nettest) {
if (not $opt_d and $opt_o) {
# delete before overwrite
delete_file($from,$to,$filename);
print "Fast forward to byte $seek (resuming)\n";
readahead($file,$seek);
}
+ } elsif ($nettest) {
+ #
} else {
if ($opt_g) {
my $fileq = quote($file);
print $rcamel[0] if ${'opt_+'};
+ $buf = '#' x $bs if $nettest;
+
$SIG{ALRM} = sub { retry("timed out") };
- while (my $b = read $file,$buf,$bs) {
+
+ while ($bytes < $fpsize) {
+ if ($nettest) {
+ $b = $bs;
+ } else {
+ $b = read $file,$buf,$bs;
+ last if $b == 0;
+ }
alarm($timeout*2);
if ($https) {
print {$SH} $buf or &sigpipehandler;
}
alarm(0);
$bytes += $b;
- if ($filesize > 0 and $bytes+$seek > $filesize) {
+ if (not $nettest and $filesize > 0 and $bytes+$seek > $filesize) {
if ($tpid) {
kill 9,$tpid;
unlink $list;
last if $filesize > 0 and $bytes >= $fpsize;
sleep 1 while ($opt_m and $bytes/k/(time-$t0||1) > $opt_m);
}
- close $file; # or die "$0: error while reading $file - $!\n";
+
+ close $file unless $nettest;
+
$tt = ($t2-$t0)||1;
print $rcamel[2] if ${'opt_+'};
kill 9,$tpid;
unlink $list;
}
-
+
if ($fileid =~ /[a-z]/ and not ($opt_s or $opt_g)) {
if ($opt_a) {
if ($fileid ne md5_hex(fmd(@ARGV))) {
}
}
}
-
+
unless ($opt_q) {
if (not $chunksize and $bytes+$seek < $filesize) {
die "$0: \"$file\" filesize has shrunk while uploading\n";
if ($seek or $chunksize and $chunksize < $filesize) {
if ($fpsize>2*M) {
- printf STDERR "%s: %d MB in %d s (%d kB/s)",
+ printf STDERR "%s: %d MB in %d s = %d kB/s",
$opt_s||$opt_a||$file,
int($bytes/M),
$tt,
$chunk,int(($bytes+$seek)/M);
}
} else {
- printf STDERR "%s: %d kB in %d s (%d kB/s)",
+ printf STDERR "%s: %d kB in %d s = %d kB/s",
$opt_s||$opt_a||$file,
int($bytes/k),
$tt,
}
} else {
if ($bytes>2*M) {
- printf STDERR "%s: %d MB in %d s (%d kB/s) \n",
+ printf STDERR "%s: %d MB in %d s = %d kB/s \n",
$opt_s||$opt_a||$file,
int($bytes/M),
$tt,
int($bytes/k/$tt);
} else {
- printf STDERR "%s: %d kB in %d s (%d kB/s) \n",
+ printf STDERR "%s: %d kB in %d s = %d kB/s \n",
$opt_s||$opt_a||$file,
int($bytes/k),
$tt,
}
}
- if (-t STDOUT and not ($opt_s or $opt_g)) {
+ if (-t STDOUT and not ($opt_s or $opt_g or $nettest)) {
print STDERR "waiting for server ok..."
}
}
autoflush $SH 1;
print {$SH} "\r\n--$boundary--\r\n";
+ # return if $nettest;
# special handling of streaming file because of stunnel tcp shutdown bug
if ($opt_s or $opt_g) {
my ($response,$fexsrv,$cc);
local $_;
- $to =~ s/,.*//;
- $to =~ s/:\w+=.*//;
+ $to =~ s/[,:].*//;
$to = $AB{$to} if $AB{$to};
$filename =~ s/([^_=:,;<>()+.\w\-])/'%'.uc(unpack("H2",$1))/ge; # urlencode
if ($skey) {
if ($port eq 443 or $proxy) {
return if $features; # early return if we know enough
$req = "OPTIONS /FEX HTTP/1.1";
- $req = "HEAD / HTTP/1.1";
+ $req = "HEAD /index.html HTTP/1.1";
} else {
$req = "GET /SID HTTP/1.1";
}
- sendheader("$server:$port",$req,"User-Agent: $useragent");
+ sendheader("$server:$port",$req);
$_ = <$SH>;
unless (defined $_ and /\w/) {
print "\n" if $opt_v;
close $SH;
serverconnect($server,$port);
$req = "GET /SID HTTP/1.0";
- sendheader("$server:$port",$req,"User-Agent: $useragent");
+ sendheader("$server:$port",$req);
$_ = <$SH>;
unless (defined $_ and /\w/) {
print "\n" if $opt_v;
$xx =~ s:.*/::;
$url = "$proxy_prefix/fop/$from/$from/$xx?ID=$id";
- sendheader("$server:$port","GET $url HTTP/1.0","User-Agent: $useragent");
+ sendheader("$server:$port","GET $url HTTP/1.0");
http_response();
while (<$SH>) {
s/\r//;
$_ = shift @r or die "$0: no reply from server\n";
if (/ 2\d\d /) {
+ return if $to eq 'nettest';
foreach (@r) {
last if /^$/;
if (s/X-(Recipient: .+)/$1\n/) {
sub fileid {
my $file = shift;
my @s = stat($file);
-
+
if (@s) {
return md5_hex($file.$s[0].$s[1].$s[7].$s[9]);
} else {
sub get_mutt_alias {
my $to = shift;
my $ma = $HOME.'/.mutt/aliases';
- my $alias;
+ my ($alias,$options);
local $_;
+ $to =~ s/(:.+)// and $options = $1;
open $ma,$ma or return $to;
while (<$ma>) {
if (/^alias \Q$to\E\s/i) {
if (/@/) {
$alias = $_;
warn "$0: found mutt alias $to = $alias\n";
+ $alias .= $options if $options;
last;
}
}
}
close $ma;
+ $to = "$to:$options" if $options;
return ($alias||$to);
}
my $head;
push @head,"Host: $sp";
+ push @head,"User-Agent: $useragent";
foreach $head (@head) {
+ chomp $head;
print "--> $head\n" if $opt_v;
print {$SH} $head,"\r\n";
}
eval 'use Net::INET6Glue::INET_is_INET6';
-our $version = 20160104;
+our $version = 20160328;
our $DEBUG = $ENV{DEBUG};
my %SSL = (SSL_version => 'TLSv1');
}
request("POST /sex?BS=$bs&user=$user$mode$type$timeout$stream HTTP/1.0");
-print STDERR "==> (streaming ...)\n" if $opt_v;
+print STDERR "--> (streaming ...)\n" if $opt_v;
transfer(STDIN,$SH);
sub request {
my $req = shift;
- print STDERR "==> $req\n" if $opt_v;
- syswrite $SH,"$req\r\n\r\n";
+ print STDERR "--> $req\n" if $opt_v;
+ syswrite $SH,"$req\r\n";
+ syswrite $SH,"User-Agent: sexsend\r\n";
+ syswrite $SH,"\r\n";
for (;;) {
unless (defined($_ = &getline)) {
die "$0: server has closed the connection\n";
}
if (/^HTTP\/[\d\.]+ 200/) {
- print STDERR "<== $_" if $opt_v;
+ print STDERR "<-- $_" if $opt_v;
last;
} elsif (/^HTTP\/[\d\.]+ 199/) {
- print STDERR "<== $_" if $opt_v;
+ print STDERR "<-- $_" if $opt_v;
} else {
if ($opt_v) {
- print STDERR "<== $_";
+ print STDERR "<-- $_";
exit 3;
} else {
s:^HTTP/[ \d\.]+::;
while (defined($_ = &getline)) {
last if /^\s*$/;
$H{uc($1)} = $2 if /(.+):\s*(.+)/;
- print STDERR "<== $_" if $opt_v;
+ print STDERR "<-- $_" if $opt_v;
}
}
local $_;
$req = "GET SID HTTP/1.1";
- print STDERR "==> $req\n" if $opt_v;
+ print STDERR "--> $req\n" if $opt_v;
syswrite $SH,"$req\r\n\r\n";
$_ = &getline;
unless (defined $_ and /\w/) {
}
s/\r//;
if (/^HTTP.* 201 (.+)/) {
- print STDERR "<== $_" if $opt_v;
+ print STDERR "<-- $_" if $opt_v;
$id = 'MD5H:'.md5_hex($id.$1);
while (defined($_ = &getline)) {
s/\r//;
last if /^\n/;
- print STDERR "<== $_" if $opt_v;
+ print STDERR "<-- $_" if $opt_v;
}
} else {
die "$0: $server does not support session ID\n";
</head>
<body>
-<<$ENV{FEXIT} = 'http://fex.belwue.de/download/fexit.exe';'';>>
+<<<$ENV{FEXIT} = 'http://fex.belwue.de/download/fexit.exe'>>>
-<h1><a href="$FEXIT$">fexit</a> for Windows</h1>
+<h1><img src="fex.png"><a href="$FEXIT$">fexit</a> for Windows</h1>
+##<<<sleep(12)>>>
+
+#if $ENV{ID}
+<<require "./fexitinstaller">>
+#endif
+<p>
<a href="$FEXIT$">fexit</a> is a <a href="/index.html">F*EX</a>
-client for sending files of any size to any e-mail address.<br>
+client for sending files of <b>any</b> size to <b>any</b> e-mail address.<br>
<a href="$FEXIT$">fexit</a> can also send directories or
-download files and resume the upload or download after link failures,
-which your webbrowser cannot do.
+download files and resume the upload or download after link failures.<br>
+Your webbrowser cannot do this.
<p>
-You can start <a href="$FEXIT$">fexit</a> via Windows explorer or
-via command console (cmd).<br>
+You can start <a href="$FEXIT$">fexit</a> via Windows explorer
+(double-click fexit icon) or via <a href="#cmd">command console (cmd.exe)</a>.
+<br>
You can also drag files or directories to the fexit icon with the Windows
explorer.
<p>
+With <a href="$FEXIT$">fexit</a> you also have access to the
+<a href="/usecases/xx.html">F*EX internet clipboard</a> to exchange files
+between your Windows or UNIX accounts.
+<p>
+<a href="$FEXIT$"><img src='fexit.png'></a>
+<p>
+
#if $ENV{ID}
-When you run <a href="$FEXIT$">fexit</a> for the first time you are
-asked for the "F*EX server URL". You can enter your personal URL:
+<p><hr><p>
+When you run <a href="$FEXIT$">fexit</a> for the first time and you are
+asked for the "F*EX server URL" you can enter your personal URL:
<p>
<code>
-<<"$ENV{PROTO}://$ENV{HTTP_HOST}/fup/".b64("from=$ENV{USER}&id=$ENV{ID}")>>
+<<"$ENV{PROTO}://$ENV{HTTP_HOST}/fup/".::b64("from=$ENV{USER}&id=$ENV{ID}")>>
</code>
<p>
(use your mouse for copy+paste)
-<p>
-<<require "./fexitinstaller";''>>
#endif
-##<pre><<foreach $v (keys %ENV) { printf "%s=%s\n",$v,$ENV{$v} }>>
+
+##<pre><<foreach $v (keys %ENV) { printf "%s=%s\n",$v,$ENV{$v} }>></pre>
+
+<p><hr><p>
+<a name="cmd"><h3>command line usage</h3></a>
+<pre>
+upload usage: fexit [-c "comment"] [-a archive] file(s) recipient[,...]
+example: fexit flupp.avi framstag@rus.uni-stuttgart.de
+example: fexit -c "lab research" -a data *.png x1@flupp.org,x2@flupp.org
+
+download usage: fexit FEX-download-URL
+example: fexit http://fex.rus.uni-stuttgart.de/fop/jHn34yp7/flupp.avi
+
+additional options:
+ -v # HTTP verbose output
+ -u fexserver/user@domain:auth-ID # use this server & user
+ -o # overwrite file
+ -d # delete file
+ -x [files] # F*EX clipboard read/write
+ -s [files] # SEX read/write yourself
+ -m kBs # max kBs throuput
+ -T up-MBs[:down-MBs] # test internet speed
+ -X "parameter" # additional URI parameter
+ -X? # show recipients parameter
+</pre>
+
</body>
</html>
#!/usr/bin/perl -w
$user = $ENV{USER};
-$id = $ENV{ID};
+$authid = $ENV{ID};
$url = "$ENV{PROTO}://$ENV{HTTP_HOST}";
$fi = 'fexitinstaller.cmd';
+$id = '%USERPROFILE%\\fex\\id';
$fe = 'http://fex.belwue.de/download/fexit.exe';
+$fx = '%USERPROFILE%\\Desktop\\fexit.exe';
$ps = '%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe';
$cmd = <<EOD;
-mkdir "%USERPROFILE%\\fex"
-cd "%USERPROFILE%\\fex"
-if not exist id (
- echo $url>id
- echo $user>>id
- echo $id>>id
-)
-cd "%USERPROFILE%\\Desktop"
-$ps -command "& { (New-Object Net.WebClient).DownloadFile('$fe','fexit.exe') }"
-\@explorer "%USERPROFILE%\\Desktop"
-\@set /p x="press [ENTER]"
+ mkdir "%USERPROFILE%\\fex"
+ if not exist "$id" (
+ echo $url>"$id"
+ echo $user>>"$id"
+ echo $authid>>"$id"
+ )
+ $ps -command "& { (New-Object Net.WebClient).DownloadFile('$fe','$fx') }"
+ setx PATH "%PATH%;%USERPROFILE%\\Desktop"
+ \@echo.
+ \@set /p x="See fexit on Desktop."
EOD
+# \@explorer "%USERPROFILE%\\Desktop"
+$cmd =~ s/^ //gm;
$cmd =~ s/\n/\r\n/g;
-if (chdir "$spooldir/$user" and open $fi,'>',$fi) {
+if (chdir "$::spooldir/$user" and open $fi,'>',$fi) {
print {$fi} $cmd;
close $fi;
- system "$FEXHOME/bin/fexsend ".
- "-oKq -C 'fexit for your Windows desktop' $fi $user >/dev/null";
+ system "$::FEXHOME/bin/fexsend ".
+ "-oKq -C 'fexit for your Windows desktop' $fi $user >/dev/null 2>&1";
if ($? == 0) {
print "<p>\n";
print "<h3>A fexit installer has been sent to you. Check your email.</h3>\n";
}
unlink $fi;
}
+
+return '';
</script>
<form name="upload"
action="/fup"
- method="post"
- accept-charset="UTF-8"
- enctype="multipart/form-data"
+ method="post"
+ accept-charset="UTF-8"
+ enctype="multipart/form-data"
onsubmit="return showstatus();">
<input type="hidden" name="uid" value="$RANDOM$">
<table>
<tr><td>recipient(s):<td><input type="text" name="to" size="80" value="">(e-mail address)</tr>
<tr><td>comment: <td><input type="text" name="comment" size="80" value="">(optional)</tr>
<tr><td>file name: <td><input type="file" name="file" size="80" value=""></tr>
- </table>
+ </table>
<p>
<input type="submit" value="submit">
</form>
<p>
<p><hr><p>
-After "submit" you will see an upload progress bar
+After "submit" you will see an upload progress bar
(if you have javascript enabled and popups allowed).
<p>
<em>NOTE: Most web browsers cannot upload files > 2 GB!</em><br>
-<HTML>
+<HTML>
<HEAD><TITLE>F*EX - File EXchange</TITLE></HEAD>
<BODY>
<center>
F*EX (Frams' Fast File EXchange) is a service to send big (large, huge,
giant, ...) files from a user A to a user B.
<p>
-The sender uploads the file to the F*EX server using a
+The sender uploads the file to the F*EX server using a
<a href="/fup">WWW upload form</a> and the recipient
-automatically gets a notification e-mail with a download-URL.
+automatically gets a notification e-mail with a download-URL.
<p>
You say:
You still need F*EX :-)
</em></blockquote>
<p>
-
+
For example, you want to send your friend your last holiday video (1 GB).
You have the following possibilities (and problems):<p>
<ul>
<li><h3>sending a DVD by postal service</h3><p>
- Out of the question - we live in the year
- <<my @x=gmtime(time); $x[5]-69;>>
+ Out of the question - we live in the year
+ <<my @x=gmtime(time); $x[5]-69;>>
after invention of the internet!
Sending media (hardware) is for grandpas.
<p>
<li>Who else can download your file?
<li>Who else can delete your file?
<li>You have to send your friend the download-URL, he has to
- inform you about the successful download, you have to delete
+ inform you about the successful download, you have to delete
it afterwards.<br>
All in all: a pain in the ass.
</ul>
Authentication is the same as with F*EX.
<h2>Still questions?</h2>
-See the <a href="http://fex.belwue.de/features.html">full feature list</a>,
+See the <a href="http://fex.belwue.de/features.html">full feature list</a>,
the <a href="/FAQ/FAQ.html">FAQ</a>
and the <a href="http://fex.belwue.de/usecases/">use cases</a>.
<ADDRESS>contact: <A HREF="mailto:$SERVER_ADMIN$">fexmaster</A></ADDRESS>
</BODY>
-</HTML>
+</HTML>
<h3>To install fexsend:</h3>
<ol>
<li> start a "Terminal":<br>
- go to <mark>Finder</mark>, press ⇧⌘U to open the Utility
- Application folder and double-click <mark>Terminal.app</mark> with left
+ go to <mark>Finder</mark>, press ⇧⌘U to open the Utility
+ Application folder and double-click <mark>Terminal.app</mark> with left
mouse button
<p>
<li> copy this code into the Terminal window:
<<
if ($ENV{ID}) {
my $url = "$ENV{PROTO}://$ENV{HTTP_HOST}/fup/"
- . b64("from=$ENV{USER}&id=$ENV{ID}");
+ . ::b64("from=$ENV{USER}&id=$ENV{ID}");
qq(
When asked for "F*EX server URL" enter:
<p>
<p><hr><p>
<form name="upload"
action="/fup"
- method="post"
- accept-charset="UTF-8"
- enctype="multipart/form-data"
+ method="post"
+ accept-charset="UTF-8"
+ enctype="multipart/form-data"
onsubmit="return showstatus();">
<input type="hidden" name="uid" value="$RANDOM$">
<input type="hidden" name="comment" value="!SHORTMAIL!">
<tr><td>your file:
<td><input type="file" name="file" size="80" value="">
</tr>
- </table>
+ </table>
<p>
<input type="submit" value="submit">
</form>
<p>
<p><hr><p>
-After "submit" you will see an upload progress bar
+After "submit" you will see an upload progress bar
(if you have javascript enabled and popups allowed).<br>
After the end a download URL will be shown.
<p>
-You can also use the <a href="/fup">regular upload form</a>
+You can also use the <a href="/fup">regular upload form</a>
(with more features).
<p>
<em>NOTE: Only Firefox or Google Chrome can upload files > 2 GB!</em><br>
-<HTML>
+<HTML>
<HEAD><TITLE>F*EX tools</TITLE></HEAD>
<BODY>
<center></center>
<h3>UNIX:</h3>
<table border=1>
<tr><td><a href="/download/fexsend">fexsend</a>
- <td>client for sending files (with many
+ <td>client for sending files (with many
<a href="$TA$/fstools/fexsend.html">
additional features</a>)</tr>
<tr><td><a href="/download/fexget">fexget</a>
- <td>client for receiving files (with many
+ <td>client for receiving files (with many
<a href="$TA$/fstools/fexget.html">
additional features</a>)</tr>
<tr><td><a href="/download/sex.tar">sexsend, sexget</a>
or directories greater than 2 GB and are able to resume interrupted
up/downloads.
<p>
-Hint for UNIX users:
+Hint for UNIX users:
<pre> wget -qO- http://$HTTP_HOST$/xx.tar | tar xvf -</pre>
installs fexsend, fexget and
<a href="http://fex.rus.uni-stuttgart.de/usecases/xx.html">xx</a>.
also installs the client programs for
<a href="$TA$/SEX.html">Stream EXchange</a> and
<<
- my $a = "/usecases/anonymous.html";
+ my $a = "/usecases/anonymous.html";
print "<a href=\"";
print "http://fex.rus.uni-stuttgart.de" unless -s "$docdir$a";
print "$a\">anonymous usage</a>";
--- /dev/null
+<HTML> \r
+<HEAD><TITLE>F*EX users types</TITLE></HEAD>\r
+<BODY>\r
+<h1><a href="/">F*EX</a> users types</h1>\r
+This is a short overview over the different F*EX user types.\r
+\r
+<ul>\r
+<li><h3>regular (full) user</h3>\r
+<ul>\r
+ <li>created by the fexmaster or self registration\r
+ <li>can send to anybody\r
+ <li>can change his settings (user configuration)\r
+ <li>can edit address book\r
+ <li>can use all F*EX clients\r
+ <li>can create sub users\r
+ <li>can create groups and group users\r
+ <li>can create one-time upload keys\r
+</ul>\r
+<li><h3>sub user</h3>\r
+<ul>\r
+ <li>created by a regular user (= main user)\r
+ <li>can send only to his main user\r
+ <li>cannot change his settings (user configuration)\r
+ <li>cannot create other users\r
+</ul>\r
+<li><h3>group user</h3>\r
+<ul>\r
+ <li>created by a regular user (= main user)\r
+ <li>can send only to his group\r
+ <li>cannot change his settings (user configuration)\r
+ <li>cannot create other users\r
+</ul>\r
+<li><h3>restricted user</h3>\r
+<ul>\r
+ <li>created by the fexmaster\r
+ <li>can send only to recipients defined by the fexmaster\r
+ <li>can change some of his settings (user configuration)\r
+ <li>can have upload or download restrictions\r
+ <li>cannot create other users\r
+</ul>\r
+<li><h3>external user</h3>\r
+<ul>\r
+ <li>is a restricted user created by self registration\r
+</ul>\r
+<li><h3>anonymous user</h3>\r
+<ul>\r
+ <li>created by the fexmaster\r
+ <li>authentificated by his IP\r
+ <li>cannot change his settings (user configuration)\r
+ <li>can send only to himself, but forward the download URL to anybody\r
+ <li>cannot create other users\r
+</ul>\r
+<li><h3>public user</h3>\r
+<ul>\r
+ <li>created by the fexmaster\r
+ <li>is only a recipient, anybody can send to him wihout registration\r
+ <li>cannot change his settings (user configuration)\r
+ <li>can be an extension of a regular user\r
+</ul>\r
+<li><h3>captive user</h3>\r
+<ul>\r
+ <li>created by the fexmaster\r
+ <li>is a super-restricted user\r
+ <li>cannot change his settings (user configuration)\r
+ <li>cannot create other users\r
+</ul>\r
+<li><h3>demo user</h3>\r
+<ul>\r
+ <li>sub type of the full user with limited quota and account life time\r
+ <li>suitable only for testing\r
+</ul>\r
+</ul>\r
+</BODY>\r
+</HTML> \r
-fex-20160104
+fex-20160328
die "host $fex is not resolvable - check /etc/resolv.conf\n";
}
+# $fexupdate = '/root/bin/fexupdate';
+# die "found $fexupdate\n" if -x $fexupdate;
+
$opt_p = 80;
if (open $xinetd,$xinetd) {
unless (getpwnam('fex')) {
print "creating user fex\n";
- system 'groupadd -g 80 fex 2>/dev/null || groupadd fex';
+ system 'groupadd --system fex 2>/dev/null || groupadd fex';
my @g = getgrnam('fex') or die "$0: cannot groupadd fex\n";
my $gid = $g[2];
if (getpwuid($gid)) {
system qw'crontab -u fex fex.cron';
}
- chownr('fex:root',$FEXHOME,"$FEXHOME/spool/.");
+ chownr('fex:root',$FEXHOME,"$FEXHOME/spool/.","$FEXHOME/htdocs/.");
chmodr('go-r',"$FEXHOME/lib","$FEXHOME/cgi-bin","$FEXHOME/spool/.");
print "\n";
"< $FEXHOME/doc/newfeatures\n";
}
+chmod 0755,"$FEXHOME/htdocs/locale";
+chmod 0755,glob("$FEXHOME/locale/*/htdocs");
+
if (@local_rdomains and not @local_rhosts) {
print "\nWARNING:\n";
print "In $fph you have \@local_rdomains but not \@local_rhosts!\n";
}
$dynamic = $htmldoc =~ s/$mark/$include/;
}
- # evaluate <<perl-code>>
- while ($htmldoc =~ /<<(.+?)>>/s) {
- local $pc = $1;
- local $__ = '';
- tie *STDOUT => "Buffer",\$__;
- $__ .= eval $pc;
- untie *STDOUT;
- $dynamic = $htmldoc =~ s/<<(.+?)>>/$__/s;
- };
+ # evaluate <<perl-code>> or <<<perl-code>>>
+ {
+ local $timeout = '';
+ local $SIG{ALRM} = sub { $timeout = '<h3>TIMEOUT!</h3>' };
+ alarm(10);
+ while ($htmldoc =~ /<<(.+?>?)>>/s) {
+ local $pc = $1;
+ if ($pc =~ s/^<(.+)>$/$1/) {
+ # eval code without output substitution
+ eval('package DOP;' . $pc);
+ last if $timeout;
+ $dynamic = $htmldoc =~ s/<<<(.+?)>>>//s;
+ } else {
+ # eval code with output substitution
+ local $__ = '';
+ tie *STDOUT => "Buffer",\$__;
+ $__ .= eval('package DOP;' . $pc);
+ untie *STDOUT;
+ last if $timeout;
+ $dynamic = $htmldoc =~ s/<<(.+?)>>/$__/s;
+ }
+ }
+ alarm(0);
+ $dynamic = $htmldoc =~ s/<<(.+?>?)>>/$timeout/sg if $timeout;
+ }
# substitute $variable$ with value from environment (if present)
while ($htmldoc =~ /\$([\w_]+)\$/g) {
$var = $1;
"Content-Length: $size",
"Content-Range: $range",
"Content-Type: $type",
- '',
);
} else {
# streaming?
'Server: fexsrv',
"Expires: 0",
"Content-Type: $type",
- '',
);
} else {
# Java (clients) needs Last-Modified header!
"Content-Length: $size",
"Content-Type: $type",
);
- nvt_print("Set-Cookie: locale=$locale") if $use_cookies and $locale;
- nvt_print('');
+ # nvt_print("Set-Cookie: locale=$locale") if $use_cookies and $locale;
}
}
+ nvt_print($_) foreach(@extra_header);
+ nvt_print('');
if ($ENV{REQUEST_METHOD} eq 'GET') {
if ($type eq 'text/html') {
## to change it, you MUST call: fac -/ admin-email-address auth-id
$admin = 'fex@'.$hostname;
-## server admin email address shown on web page
+## server admin email address shown on web page
$ENV{SERVER_ADMIN} = $admin;
## restrict web administration to ip range(s)
## optional: download-URLs sent in notification emails
# @durl = qw(
-# http://MYFEXSERVER/fop
-# https://MYFEXSERVER/fop
+# http://MYFEXSERVER/fop
+# https://MYFEXSERVER/fop
# http://MYPROXY/fex/fop
# );
# $logdir = $spooldir;
## default quota in MB for recipient; 0 means "no quota"
-$recipient_quota = 0;
+$recipient_quota = 0;
## default quota in MB for sender; 0 means "no quota"
-$sender_quota = 0;
+$sender_quota = 0;
## expiration: keep files that number of days (default)
-$keep = 5;
+$keep = 5;
## expiration: keep files that number of days (maximum)
$keep_max = 99;
## autodelete: delete files after download (automatically)
## YES ==> immediatelly (1 minute grace time)
-## DELAY ==> after download at next fex_cleanup cronjob run
+## DELAY ==> after download at next fex_cleanup cronjob run
## 2 ==> 2 days after download (can be any number!)
## NO ==> keep until expiration date (see $keep)
$autodelete = 'YES';
$limited_download = 'YES';
## allow RECIPIENT = SENDER
-## in this case subsequentials downloads from any ip are possible until
+## in this case subsequentials downloads from any ip are possible until
## regular file expiration (KEEP); exception for $limited_download
$fex_yourself = 'YES';
## allow user requests for forgotten auth-IDs (then send by email)
$mail_authid = 'YES';
-
-## optional: from which hosts and for which mail domains users may
+
+## optional: from which hosts and for which mail domains users may
## register themselves as full users (must set both!)
# @local_hosts = qw(127.0.0.1 ::1 10.10.100.0-10.10.200.255 129.69.1.129);
# @local_domains = qw(uni-stuttgart.de flupp.org);
## optional: allow restricted user registration only by certain hosts
# @registration_hosts = qw(129.69.0.0-129.69.255.255 176.9.84.26);
-## optional: for certain remote domains do not use sender address in
-## notfication email From, because their MTA will probably
+## optional: for certain remote domains do not use sender address in
+## notfication email From, because their MTA will probably
## reject it if From and To contain their domain name.
## Instead use $admin for From. See also $sender_from
# @remote_domains = qw(flupp.org);
## 0 means : full speed
## first match wins
# @throttle = qw(
-# framstag@*:0 microsoft.com:100
+# framstag@*:0 microsoft.com:100
# 127.0.0.1:0 202.0.0.0-211.255.255.255:1024
# [::1]:0 [fe00::0-fe00::ffff]:0
# );
$force_https = 0;
$debug = 0;
+# https://securityheaders.io/
+# https://scotthelme.co.uk/hardening-your-http-response-headers/
+# http://content-security-policy.com/
+@extra_header = (
+ # "Content-Security-Policy: sandbox allow-forms allow-scripts",
+ "Content-Security-Policy: script-src 'self' 'unsafe-inline'",
+ "X-Frame-Options: SAMEORIGIN",
+ "X-XSS-Protection: 1; mode=block",
+ "X-Content-Type-Options: nosniff",
+);
+
$FHS = -f '/etc/fex/fex.ph' and -d '/usr/share/fex/lib';
# Debian FHS
if ($FHS) {
nvt_print("Server: fexsrv");
nvt_print("Expires: 0");
nvt_print("Cache-Control: no-cache");
- # http://en.wikipedia.org/wiki/Clickjacking
- nvt_print("X-Frame-Options: SAMEORIGIN");
if ($force_https) {
# https://www.owasp.org/index.php/HTTP_Strict_Transport_Security
+ # https://scotthelme.co.uk/hsts-the-missing-link-in-tls/
nvt_print("Strict-Transport-Security: max-age=2851200; preload");
}
+ nvt_print($_) foreach(@extra_header);
if ($use_cookies) {
$akey = md5_hex("$from:$id") if $id and $from;
if ($akey) {
or http_die("cannot start sendmail - $!");
}
}
- $comment .= "\n" if $comment;
- if ($comment =~ s/^!(shortmail|\.)!\s*//i
+ $comment = "\n$comment\n" if $comment;
+ if ($comment =~ s/\n!(shortmail|\.)!\s*//i
or (readlink("$to/\@NOTIFICATION")||'') =~ /short/i
) {
$body = qqq(qq(
''
'Questions? ==> F*EX admin: $admin'
));
- $disclaimer .= "\n" . $::disclaimer if $::disclaimer;
+ $disclaimer .= "\n$::disclaimer\n" if $::disclaimer;
$body = qqq(qq(
'$comment'
'$from has uploaded the file'
$info_2 = <<EOD;
<p><hr><p>
-After submission you will see an upload progress bar
+After submission you will see an upload progress bar
(if you have javascript enabled and popups allowed).
<p>
<em>NOTE: Many web browsers cannot upload files > 2 GB!</em><br>
or Firefox or Google Chrome which have no size limit.<br>
You also need a <a href="/tools.html">F*EX client</a> for resuming interrupted uploads. Your web browser cannot do this.
<p>
-If you want to send more than one file, then put them in a zip or tar archive,
+If you want to send more than one file, then put them in a zip or tar archive,
e.g. with <a href="http://www.7-zip.org/download.html">7-Zip</a>.
<p>
See also the <a href="/FAQ/user.html">FAQ<a> and
--- /dev/null
+<html>
+<head><title>F*EX FAQ</title></head>
+<body>
+
+## <pre>
+## << while (($v,$vv) = each %ENV) { print "$v = $vv\n" } >>
+## </pre>
+
+<< require "./faq.pl" or print $! >>
+
+</body>
+</html>
## </pre>
Ce document est périmé. Merci de consulter
-la <a href="/FAQ/meta.html?locale=french">FAQ anglaise</a>
+la <a href="/FAQ/meta.html?locale=english">FAQ anglaise</a>
<p>
<< require "./faq.pl" or print $! >>
## </pre>
Ce document est périmé. Merci de consulter
-la <a href="/FAQ/meta.html?locale=french">FAQ anglaise</a>
+la <a href="/FAQ/meta.html?locale=english">FAQ anglaise</a>
<p>
<< require "./faq.pl" or print $! >>
## </pre>
Ce document est périmé. Merci de consulter
-la <a href="/FAQ/meta.html?locale=french">FAQ anglaise</a>
+la <a href="/FAQ/meta.html?locale=english">FAQ anglaise</a>
<p>
<< require "./faq.pl" or print $! >>
A: fex.rus.uni-stuttgart.de tourne sur un ordinateur de bureau et est capable de gérer des uploads
à plus de 300 MB/s. Essayer donc ça avec un serveur web généraliste comme Apache !
-Q: De quoi ais-je besoin pour installer F*EX ?
+Q: De quoi ai-je besoin pour installer F*EX ?
A: D'une machine UNIX avec une entrée DNS et un service smtp fonctionnel. Vous devez être root sur la machine.
Q: Qu'est-ce que DNS et smtp ?
## </pre>
Ce document est périmé. Merci de consulter
-la <a href="/FAQ/meta.html?locale=french">FAQ anglaise</a>
+la <a href="/FAQ/meta.html?locale=english">FAQ anglaise</a>
<p>
<< require "./faq.pl" or print $! >>
## </pre>
Ce document est périmé. Merci de consulter
-la <a href="/FAQ/meta.html?locale=french">FAQ anglaise</a>
+la <a href="/FAQ/meta.html?locale=english">FAQ anglaise</a>
<p>
<< require "./faq.pl" or print $! >>
## </pre>
Ce document est périmé. Merci de consulter
-la <a href="/FAQ/meta.html?locale=french">FAQ anglaise</a>
+la <a href="/FAQ/meta.html?locale=english">FAQ anglaise</a>
<p>
<< require "./faq.pl" or print $! >>
--- /dev/null
+<html>
+<head><title>F*EX FAQ</title></head>
+<body>
+
+## <pre>
+## << while (($v,$vv) = each %ENV) { print "$v = $vv\n" } >>
+## </pre>
+
+<< require "./faq.pl" or print $! >>
+
+</body>
+</html>
--- /dev/null
+<html>
+<head><title>F*EX FAQ</title></head>
+<body>
+
+## <pre>
+## << while (($v,$vv) = each %ENV) { print "$v = $vv\n" } >>
+## </pre>
+
+<< require "./faq.pl" or print $! >>
+
+</body>
+</html>
--- /dev/null
+<html>
+<head><title>F*EX FAQ</title></head>
+<body>
+
+## <pre>
+## << while (($v,$vv) = each %ENV) { print "$v = $vv\n" } >>
+## </pre>
+
+<< require "./faq.pl" or print $! >>
+
+</body>
+</html>
--- /dev/null
+<html>
+<head><title>F*EX FAQ</title></head>
+<body>
+
+## <pre>
+## << while (($v,$vv) = each %ENV) { print "$v = $vv\n" } >>
+## </pre>
+
+<< require "./faq.pl" or print $! >>
+
+</body>
+</html>
$> = $FEX[2];
$) = $FEX[3];
+umask 022;
+
$FEXHOME = $ENV{FEXHOME} || $FEX[7];
# require "$FEXHOME/lib/fex.pp"
print "$ft written\n";
}
-foreach $file (@cpfiles) {
- my $fs = "locale/$lang/$file";
- if (-e $fs) {
- my $fd = "$FEXHOME/$fs";
- mkdirp(dirname($fd));
- if (-f $fs) {
- $fd .= '_new' if -e $fd;
- if (copy($fs,$fd)) {
- chmod((stat $fs)[2],$fd);
- print "$fd written\n";
- }
- } else {
- if (-f $fd) {
- my $fds = $fd.'_save';
- my $fdn = $fd.'_new';
- system "rm -rf $fds $fdn";
- rename $fd,$fds;
- system "tar cf - $fs | (cd $FEXHOME; tar xf -)";
- rename $fd,$fdn;
- rename $fds,$fd;
- print "$fdn written\n";
+if ($FEXHOME !~ /fexdev/) {
+
+ foreach $file (@cpfiles) {
+ my $fs = "locale/$lang/$file";
+ if (-e $fs) {
+ my $fd = "$FEXHOME/$fs";
+ mkdirp(dirname($fd));
+ if (-f $fs) {
+ $fd .= '_new' if -e $fd;
+ if (copy($fs,$fd)) {
+ chmod((stat $fs)[2],$fd);
+ print "$fd written\n";
+ }
} else {
- system "tar cf - $fs | (cd $FEXHOME; tar xf -)";
- print "$fd written\n";
+ if (-f $fd) {
+ my $fds = $fd.'_save';
+ my $fdn = $fd.'_new';
+ system "rm -rf $fds $fdn";
+ rename $fd,$fds;
+ system "tar cf - $fs | (cd $FEXHOME; tar xf -)";
+ rename $fd,$fdn;
+ rename $fds,$fd;
+ print "$fdn written\n";
+ } else {
+ system "tar cf - $fs | (cd $FEXHOME; tar xf -)";
+ print "$fd written\n";
+ }
}
}
}
-}
-foreach $fs (qw(fex.ph dop)) {
- $fd = "$FEXHOME/locale/$lang/lib/$fs";
- symlink "../../../lib/$fs",$fd and print "$fd linked\n";
-}
+ foreach $fs (qw(fex.ph dop)) {
+ $fd = "$FEXHOME/locale/$lang/lib/$fs";
+ symlink "../../../lib/$fs",$fd and print "$fd linked\n";
+ }
+
+ unless (-f "$FEXHOME/locale/$lang/htdocs/FAQ/meta.faq") {
+ unlink "$FEXHOME/locale/$lang/htdocs/FAQ/FAQ.html";
+ rmdir "$FEXHOME/locale/$lang/htdocs/FAQ";
+ }
-unless (-f "$FEXHOME/locale/$lang/htdocs/FAQ/meta.faq") {
- unlink "$FEXHOME/locale/$lang/htdocs/FAQ/FAQ.html";
- rmdir "$FEXHOME/locale/$lang/htdocs/FAQ";
}
make_lf($lang);
ond a Was-macha-musch-E-Mail isch do no verschickt worda
y un email de información ha sido enviado a esta dirección
e un correo informativo acaba de se enviar a este enderezo
-e una e-mail di informazioni è stata spedita a questo indirizzo
+e una e-mail di informazioni è stata spedita a questo indirizzo
a informační e-mail byl odeslán na tuto adresu
et un message d'information a été envoyé à cette adresse
check recipient(s) and continue
Empfänger überprüfen und fortsetzen
-Empfänger ieberpriafe ond weitermache
+Empfängr ieberpriafa ond weitermacha
compruebe el/los destinatario(s) y continúe
comprobe o/os destinatario(s) e continúe
controlla i/il destinatari(o) e continua
Dei Domain <code>$exd</code> ghod ned for d'Regischtrierong
Su dominio <code>$exd</code> no está permitido a registrar
Your domain <code>$exd</code> is not allowed for registration
-Il tuo dominio <code>$exd</code> non è permesso per la registrazione
+Il tuo dominio <code>$exd</code> non è permesso per la registrazione
Registrace z domény <code>$exd</code> není povolena
Votre domaine <code>$exd</code> n'est pas autorisé à l'enregistrement
Du hosch dei F*EX Konto seit $expire Tag nemme bnutzt
Su cuenta de F*EX ha estado inactivo $expire dias
A súa conta F*EX estivo inactiva durante $expire día
-Il tuo account F*EX è stato inattivo per $expire giorni
+Il tuo account F*EX è stato inattivo per $expire giorni
Váš F*EX účet byl neaktivní $expire dnů
Votre compte F*EX a été inactif pendant $expire days