mirror of
https://github.com/webmin/webmin.git
synced 2025-08-16 14:51:18 +00:00
Module for a telnet client that uses the flashterm code.
This commit is contained in:
1
flashterm/config.info
Normal file
1
flashterm/config.info
Normal file
@ -0,0 +1 @@
|
||||
telnetport=Port for telnet server,3,Default (23)
|
BIN
flashterm/flashterm.swf
Normal file
BIN
flashterm/flashterm.swf
Normal file
Binary file not shown.
9
flashterm/global.js
Normal file
9
flashterm/global.js
Normal file
@ -0,0 +1,9 @@
|
||||
function stormInit() {
|
||||
showFlash();
|
||||
var appendLinks = document.getElementsByTagName("a");
|
||||
for (var i = 0; i < appendLinks.length; i++) {
|
||||
if (appendLinks[i].rel == "append") {
|
||||
appendLinks[i].href += this.location;
|
||||
}
|
||||
}
|
||||
}
|
BIN
flashterm/images/icon.gif
Executable file
BIN
flashterm/images/icon.gif
Executable file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
79
flashterm/index.cgi
Executable file
79
flashterm/index.cgi
Executable file
@ -0,0 +1,79 @@
|
||||
#!/usr/local/bin/perl
|
||||
# Starts the flash policy server on port 843, then outputs an HTML page that
|
||||
# references the flash object
|
||||
|
||||
BEGIN { push(@INC, ".."); };
|
||||
use WebminCore;
|
||||
use Socket;
|
||||
&init_config();
|
||||
|
||||
&ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1);
|
||||
|
||||
# Work out host and port
|
||||
$host = $ENV{'HTTP_HOST'};
|
||||
$host =~ s/\:\d+$//;
|
||||
$telnetport = $config{'telnetport'} || 23;
|
||||
|
||||
# Check for telnet
|
||||
&open_socket($host, $telnetport, TEST, \$err);
|
||||
$err && &error(&text('index_etelnet', $telnetport));
|
||||
close(TEST);
|
||||
|
||||
# Start the policy file server on port 843
|
||||
$port = 843;
|
||||
$proto = getprotobyname('tcp');
|
||||
socket(MAIN, PF_INET, SOCK_STREAM, $proto) ||
|
||||
&error(&text('index_esocket', "$!"));
|
||||
setsockopt(MAIN, SOL_SOCKET, SO_REUSEADDR, pack("l", 1));
|
||||
bind(MAIN, sockaddr_in($port, INADDR_ANY)) ||
|
||||
&error(&text('index_eport', $port));
|
||||
listen(MAIN, SOMAXCONN);
|
||||
|
||||
# Fork the process that will accept the connection
|
||||
$pid = fork();
|
||||
if (!$pid) {
|
||||
$rmask = undef;
|
||||
vec($rmask, fileno(MAIN), 1) = 1;
|
||||
$sel = select($rmask, undef, undef, 10);
|
||||
exit(1) if ($sel <= 0);
|
||||
accept(SOCK, MAIN);
|
||||
close(MAIN);
|
||||
select(SOCK); $| = 1;
|
||||
$header = "<policy-file-request/>\000";
|
||||
read(SOCK, $buf, length($header));
|
||||
$buf eq $header || die "Invalid message $buf";
|
||||
print SOCK <<EOF;
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE cross-domain-policy SYSTEM "/xml/dtds/cross-domain-policy.dtd">
|
||||
<cross-domain-policy>
|
||||
<site-control permitted-cross-domain-policies="master-only"/>
|
||||
<allow-access-from domain="$host" to-ports="$telnetport" />
|
||||
</cross-domain-policy>
|
||||
EOF
|
||||
close(SOCK);
|
||||
exit(0);
|
||||
}
|
||||
close(MAIN);
|
||||
|
||||
# Output HTML for the flash object
|
||||
print <<EOF;
|
||||
<script type="text/javascript" src="swfobject.js"></script>
|
||||
<script type="text/javascript" src="js/global.js"></script>
|
||||
<script type="text/javascript">
|
||||
var flashvars = {};
|
||||
var params = {};
|
||||
params.menu = "false";
|
||||
params.bgcolor = "000000";
|
||||
var attributes = {};
|
||||
flashvars.settings = 'settings.cgi';
|
||||
swfobject.embedSWF("flashterm.swf", "flash", "650", "440", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
|
||||
function setFocusOnFlash() {
|
||||
var fl = document.getElementById("flash");
|
||||
fl.focus();
|
||||
}
|
||||
swfobject.addLoadEvent(setFocusOnFlash);
|
||||
</script>
|
||||
<div id="flashcontainer"><div id="flash"></div></div>
|
||||
EOF
|
||||
|
||||
&ui_print_footer("/", $text{'index'});
|
4
flashterm/lang/en
Normal file
4
flashterm/lang/en
Normal file
@ -0,0 +1,4 @@
|
||||
index_title=FlashTerm
|
||||
index_esocket=Socket failed : $1
|
||||
index_eport=Port $1 is already in use, perhaps by another Flash policy server
|
||||
index_etelnet=This system is not running a Telnet server on port $1.
|
2
flashterm/module.info
Normal file
2
flashterm/module.info
Normal file
@ -0,0 +1,2 @@
|
||||
desc=FlashTerm
|
||||
version=1.0
|
28
flashterm/settings.cgi
Normal file
28
flashterm/settings.cgi
Normal file
@ -0,0 +1,28 @@
|
||||
#!/usr/local/bin/perl
|
||||
# Output the XML settings file
|
||||
|
||||
BEGIN { push(@INC, ".."); };
|
||||
use WebminCore;
|
||||
$trust_unknown_referers = 1;
|
||||
&init_config();
|
||||
print "Content-type: text/plain\n\n";
|
||||
|
||||
# Work out host and port
|
||||
$host = $ENV{'HTTP_HOST'};
|
||||
$host =~ s/\:\d+$//;
|
||||
$telnetport = $config{'telnetport'} || 23;
|
||||
|
||||
print <<EOF;
|
||||
<connection
|
||||
name="FlashTerm"
|
||||
address="$host"
|
||||
port="$telnetport"
|
||||
socket_server_port="843"
|
||||
info_graphic=""
|
||||
default_font=""
|
||||
columns="80"
|
||||
lines="25"
|
||||
/>
|
||||
EOF
|
||||
|
||||
|
5
flashterm/swfobject.js
Normal file
5
flashterm/swfobject.js
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user