/usr/share/honeyd/scripts/router-telnet.pl is in honeyd-common 1.5c-8ubuntu1.
This file is owned by root:root, with mode 0o755.
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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | #!/usr/bin/perl
# Copyright 2002 Niels Provos <provos@citi.umich.edu>
# All rights reserved.
#
# For the license refer to the main source code of Honeyd.
#
# Don't echo Will Echo Will Surpress Go Ahead
$return = pack('ccccccccc', 255, 254, 1, 255, 251, 1, 255, 251, 3);
syswrite STDOUT, $return, 9;
$string =
"Users (authorized or unauthorized) have no explicit or\r
implicit expectation of privacy. Any or all uses of this\r
system may be intercepted, monitored, recorded, copied,\r
audited, inspected, and disclosed to authorized site,\r
and law enforcement personnel, as well as to authorized\r
officials of other agencies, both domestic and foreign.\r
By using this system, the user consents to such\r
interception, monitoring, recording, copying, auditing,\r
inspection, and disclosure at the discretion of authorized\r
site.\r
\r
Unauthorized or improper use of this system may result in\r
administrative disciplinary action and civil and criminal\r
penalties. By continuing to use this system you indicate\r
your awareness of and consent to these terms and conditions\r
of use. LOG OFF IMMEDIATELY if you do not agree to the\r
conditions stated in this warning.\r
\r
\r
\r
User Access Verification\r
";
syswrite STDOUT, $string;
$count = 0;
while ($count < 3) {
do {
$count++;
syswrite STDOUT, "\r\n";
$word = read_word("Username: ", 1);
} while (!$word && $count < 3);
if ($count >= 3 && !$word) {
exit;
}
$password = read_word("Password: ", 0);
if (!$password) {
syswrite STDOUT, "% Login invalid\r\n";
} else {
syswrite STDERR, "Attempted login: $word/$password";
syswrite STDOUT, "% Access denied\r\n";
}
}
exit;
sub read_word {
local $prompt = shift;
local $echo = shift;
local $word;
syswrite STDOUT, "$prompt";
$word = "";
$alarmed = 0;
eval {
local $SIG{ALRM} = sub { $alarmed = 1; die; };
alarm 30;
$finished = 0;
do {
$nread = sysread STDIN, $buffer, 1;
die unless $nread;
if (ord($buffer) == 0) {
; #ignore
} elsif (ord($buffer) == 255) {
sysread STDIN, $buffer, 2;
} elsif (ord($buffer) == 13 || ord($buffer) == 10) {
syswrite STDOUT, "\r\n" if $echo;
$finished = 1;
} else {
syswrite STDOUT, $buffer, 1 if $echo;
$word = $word.$buffer;
}
} while (!$finished);
alarm 0;
};
syswrite STDOUT, "\r\n" if $alarmed || ! $echo;
if ($alarmed) {
syswrite STDOUT, "% $prompt timeout expired!\r\n";
return (0);
}
return ($word);
}
|