Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Console Application in Web Browser Window - HowTo?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
stenny
Tux's lil' helper
Tux's lil' helper


Joined: 06 Feb 2003
Posts: 100
Location: Germany

PostPosted: Mon Nov 07, 2005 11:10 pm    Post subject: Console Application in Web Browser Window - HowTo? Reply with quote

I want to connect to my private Web server (Apache2) from the internet and then start a predefined console application by a specific link (or URL typed in the browser's address box). In my case I want to start telnet to connect to a small computer running embedded Linux. ( http://www.axis.com - DevBoardLX)

Is there any information available on the net, describing how to achieve this goal?


stefan
Back to top
View user's profile Send private message
drwook
Veteran
Veteran


Joined: 30 Mar 2005
Posts: 1324
Location: London

PostPosted: Tue Nov 08, 2005 12:39 pm    Post subject: Reply with quote

Umm.... Any reason not to use telnet/ssh/vnc/nx?
Back to top
View user's profile Send private message
stenny
Tux's lil' helper
Tux's lil' helper


Joined: 06 Feb 2003
Posts: 100
Location: Germany

PostPosted: Tue Nov 08, 2005 9:51 pm    Post subject: Reply with quote

Yes :-(
The client machine is sitting behind a firmly closed firewall. Internet connections can only be established by using a http-proxy, which only supports http(s).

And as I've never set up a configuration like this, I consider it a good exercise :-(. If only I knew, where to start ...

stefan
Back to top
View user's profile Send private message
drwook
Veteran
Veteran


Joined: 30 Mar 2005
Posts: 1324
Location: London

PostPosted: Wed Nov 09, 2005 9:42 am    Post subject: Reply with quote

Why not just run a telnet server on port 80? Don't see how a proxy could determine what it was, afaik most are simply port based.
Back to top
View user's profile Send private message
stenny
Tux's lil' helper
Tux's lil' helper


Joined: 06 Feb 2003
Posts: 100
Location: Germany

PostPosted: Wed Nov 09, 2005 10:06 pm    Post subject: Reply with quote

running a telnet server on port 80 is no answer to this question for 2 reasons:

1) a http proxy server like squid is not only a port based filter (like e.g. a firewall). Towards the client, it behaves like a http server and towards the server it behaves like a browser. Whenever you request a http page from a server, the proxy checks if it already has the page in it's cache and serves the browser from there. Otherwise, it asks the real server. The proxy can also do some basic checks on http-requests. Telnet-like packages do not contain http-requests and are therefor blocked by the proxy.

2) The configuration I want to set up looks like this:

Client --- <Internet/http> --- Machine 1 --- <LAN/telnet> --- Machine 2

The Client runs a normal web browser, like Firefox, Opera or any other
Machine 1 runs an Apache HTTP server and connects to Machine 2 (a small embedded Linux device) via telnet

If redirected port 80 to Machine 2, I could not reach my web server on Machine 1 any longer.

These are the reasons, why I'd prefer a solution, which uses only http as communication protocol and Machine 1 as a http/telnet gateway.

Regards
stefan
Back to top
View user's profile Send private message
dpc
n00b
n00b


Joined: 09 Nov 2005
Posts: 16
Location: Chicago

PostPosted: Wed Nov 09, 2005 10:21 pm    Post subject: Reply with quote

Not sure if this is what you're looking for, but could you set up the web server itself as a proxy? (ala mod_proxy perhaps or some sort of socks proxy?)

I haven't done this myself, but...kind of seems like what you might be looking for. If you set up mod_proxy with the AllowCONNECT directive, you could then probably use a telnet client that can use an HTTP proxy and specify the telnet command such as connect <host> <port> (I know putty does this).

Good luck!
_________________
Former die-hard Debian user, now co-mingling my Debian boxes with Gentoo and posting on the Gentoo forums...what has the world come to?
Back to top
View user's profile Send private message
think4urs11
Bodhisattva
Bodhisattva


Joined: 25 Jun 2003
Posts: 6659
Location: above the cloud

PostPosted: Wed Nov 09, 2005 10:51 pm    Post subject: Reply with quote

I'm nearly sure you are searching for something like

http://www.appgate.com/products/80_MindTerm/
or
http://www.modernminds.com/Info/TelnetApplet/TelnetApplet.html

HTH
T.
_________________
Nothing is secure / Security is always a trade-off with usability / Do not assume anything / Trust no-one, nothing / Paranoia is your friend / Think for yourself
Back to top
View user's profile Send private message
d11wtq
Apprentice
Apprentice


Joined: 14 Jul 2005
Posts: 192
Location: Manchester, UK

PostPosted: Wed Nov 09, 2005 10:54 pm    Post subject: Reply with quote

Use PHP.

It;s dangerous in any situation to use shell commands over HTTP but in any case:

Code:

<?php

//Use the system() command to execute shell commands
system('ls -al'); //Run the ls command

//Or use backticks to execute the command
`ls -al`;

?>


You can pass that output around too, and print things to screen (you can even collect output into an array).
Back to top
View user's profile Send private message
tutaepaki
Apprentice
Apprentice


Joined: 11 Nov 2003
Posts: 279
Location: New Zealand

PostPosted: Wed Nov 09, 2005 11:07 pm    Post subject: Reply with quote

sounds like stunnel is what you are looking for.

[url]stunnel.org[/url]
Back to top
View user's profile Send private message
wjholden
l33t
l33t


Joined: 01 Mar 2004
Posts: 826
Location: Augusta, GA

PostPosted: Thu Nov 10, 2005 3:46 am    Post subject: Reply with quote

Bah, a stateless protocol like HTTP is terrible for something as resource intensive and interactive as a terminal. But, we all understand the occasional need for this kind of thing, just don't expect to use a console text editor.
You should consider writing a form-based text editor in addition to your command-line interface.

An example of your command-line interface:
Code:
#!/usr/bin/perl
#
sub getcgivars {
   my $in = shift;
        $in =~ s/\+/ /g ;
        $in =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/ge ;
        $in =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/ge ;
   $in =~ s/\n/<br>/g;
   return $in;
}

print "Content-type: text/html\n\n";

read(STDIN, $line, $ENV{'CONTENT_LENGTH'});

$line = ($line =~ s/&/ /ge);
$line = ($line =~ s/input=//);
$line = &getcgivars($line);

$returnvalue = `$line`;

$br = '<br>
';

$returnvalue = ($returnvalue =~ s/\n/$br/ge);

print '<html>
<title>Console</title>
<body>
<h3>Console</h3>
<p>
';
print $returnvalue;
print '</p><p>
<form action="http://example.com/cgi-bin/console.pl" method="post">
Enter a command: <input type="text" name="input">
<INPUT type="submit">
</form>
</p>
</body>
</html>';
If that code doesn't work I'll be happy to read whatever errors it produces, but you won't see me running this on my webserver.

I should mention that WebMin has the features you're asking for, although you wouldn't be able to use it as a result of the firewalling issues you discussed earlier.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum