/usr/share/thpot/lib/ftpport.pl is in tinyhoneypot 0.4.6-10.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | sub ftpport {
use IO::Socket;
my $portspec = shift;
my @portspec = split (/\,/, $portspec);
$rhost = "$portspec[0].$portspec[1].$portspec[2].$portspec[3]";
$rport = (($portspec[4] << 8) + $portspec[5]);
if (inet_aton($rhost) ne inet_aton($saddr)) {
return "port502";
} else {
return "port200";
}
}
sub active {
use IO::Socket;
%actvhash = (
dir150 => "150 Opening ASCII mode data connection for directory listing.\x0d\x0a",
retr150 => "150 Opening BINARY mode data connection for $arg.\x0d\x0a",
stor150 => "150 Opening BINARY mode data connection for $arg.\x0d\x0a"
);
my $actvcmd = shift;
my $arg = shift;
my $sock = IO::Socket::INET -> new(PeerAddr => "$rhost",
PeerPort => "$rport",
Proto => "tcp"
)
or return "actv425";
if ($actvcmd =~ /stor/i) {
print STDERR $actvhash{stor150};
} elsif ($actvcmd =~ /retr/i) {
print STDERR $actvhash{retr150};
}
my ($upload, $booty);
return unless (defined ($upload = fork()));
if ($upload) {
while ($booty = <$sock>) {
print LOG $booty;
LOG->autoflush(1);
}
kill ('TERM', $upload);
} else {
while (<STDIN>) {
print $sock $_;
}
}
close $sock;
return "compl";
}
|