Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Telnet Using Applets in JavaScript

Tags:

javascript

wsh

I am trying to open a telnet window and send some keys to this active window. Below is the JavaScript code:

var oWshShell = new ActiveXObject("WScript.Shell");
oWshShell.Run("telnet 43.43.22.45 23");
//oWshShell.Run("firefox.exe http://www.google.com");
//oWshShell.Run(" notepad.exe");
oWshShell = null;

But I am unable to open them all the same. It says the file does not exist. However, the commented lines work perfectly, when uncommented. what could be the problem?

Thanks in advance.

like image 825
Avi Avatar asked May 01 '12 12:05

Avi


1 Answers

@Avi, I dont't think you'll be able to execute this type of command when a page loads unless you use Internet Explorer and enable full trust security. If you must do this way, though, you just have to specify the full path to telnet.exe. Just beware that windows uses \ to separate the directory levels, but this is a special character to javascript, and it must be escaped; i.e:

var path = "c:\\Windows\\System32"; // this is c:\Windows\System32 in javascript
like image 65
Gerardo Lima Avatar answered Sep 20 '22 04:09

Gerardo Lima