Delta Posted August 30, 2009 Posted August 30, 2009 (edited) I don't know how many of you have rented a steam game server before but most of the hosts use the same admin panel. In the panel there is an option to automatically update the server files. When you select the option a pop-up window occurs and it will show you exactly what the updater outputs. I wanted to duplicate this in AutoIt and I did by allowing a user to connect to the server via web browser and control cmd prompt.This project was to basically expand my knowledge a little since the whole script uses AutoIt, HTML, and Ajax and I have never used Ajax before. I'm going to slap a "works on my machine cert" on it because my friend kept getting a browser bug while helping me test this that I was unable to duplicate and fix. Also all the code is extremly messy.Uses Kip's TCP UDF. (Included in the ZIP)Most of the functions and code were taken and modified from Manadar's HTTP Server.There are now two versions, a web client version and a telnet client version.Web Client Version- Features - Access Cmd Promt from any device that has a web browser. Requires username and password to access.- Bugs -Cls command does nothing.Client screen shotTelnet Client Version- Features -Access Cmd Prompt from telnet.Multiple users control seprate cmd prompt sessionsForce users to start in a specific directoryRestrict users commandsCommands Logout, Quit, Exit will end a users session and log them outCmd Promt closes when a users session ends- Bugs -Cannot backspace.Cls command does nothing.- Notes -Includes a Read me, READ IT.If you don't wish to compile as a CUI remove the #NoTrayIcon line.Change LogUpdate [9-5-09]Released telnet versionUpdate [9-1-09]Requires username and password authentication to send any commandsdata.html contains Manadar's Ajax fix.DownloadsOld Version StatsRemoteCmdControl.zip (7.31K)Number of downloads: 45 Edited June 10, 2010 by Deltaforce229 [size="1"]Please stop confusing "how to" with "how do"[/size]
6105 Posted August 31, 2009 Posted August 31, 2009 dont work only writed Loading... and its all [center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Don't utter a single word[/font][/center][center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Just shut your pretty mouth[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you again[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you[/font][/center][center][font=courier new,courier,monospace]In hell[/font][/center]
jvanegmond Posted September 1, 2009 Posted September 1, 2009 (edited) Hi Deltaforce, thanks for the credits and using my code! It's good to see it being used in the field.Edit: It worked straight out of the box! I ran it and navigated to localhost:82 and done.I had a minor problem with the AJAX refreshing the page constantly. I fixed it by only getting the new page once the current page has finished downloading:data.html<html> <head> <title></title> <script language="Javascript" type="text/javascript"> var data_old; function ajaxFunction(){ var xmlhttp; if (window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest(); } else if (window.ActiveXObject){ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } else { alert("Your browser does not support XMLHTTP!"); } xmlhttp.onreadystatechange=function(){ if(xmlhttp.readyState==4){ if(xmlhttp.responseText != data_old){ data_old = xmlhttp.responseText document.getElementById('cmdpage').innerHTML=xmlhttp.responseText; var objDiv = document.getElementById('cmdpage'); objDiv.scrollTop = objDiv.scrollHeight; } setTimeout(ajaxFunction, 1) } } xmlhttp.open("GET","/innerdata.html",true); xmlhttp.send(null); } setTimeout(ajaxFunction, 1); </script> </head> <body bgcolor="black" id="cmdpage"> <center><font face="Lucida Console" size="2" color="white">Loading...</font></center> </body> </html> Edited September 1, 2009 by Manadar github.com/jvanegmond
Delta Posted September 1, 2009 Author Posted September 1, 2009 (edited) Hey Manadar thank you very very much for both your HTTP script and for fixing mine Updated the script with authentication and Manadars Ajax fix. rapid2share and toader try the updated version. If that doesn't work post your browser specs. I only have Firefox 3 and IE8 so if your using something else I can't test it. I'm also working on a Telnet version that will allow multiple simultaneous users to be logged on to their own sessions of cmd prompt. Edited September 1, 2009 by Deltaforce229 [size="1"]Please stop confusing "how to" with "how do"[/size]
jvanegmond Posted September 1, 2009 Posted September 1, 2009 Ah, I tested this in Google Chrome. Worked perfect.I'm also working on a Telnet version that will allow multiple simultaneous users to be logged on to their own sessions of cmd prompt.You can use sessions/cookies for this with HTTP. Can't give you a syntax example now, but shouldn't be too hard to whip up some PHP and scan for packets. github.com/jvanegmond
Delta Posted September 1, 2009 Author Posted September 1, 2009 I have never really messed with sessions for http connections. The only reason I can set them up with telnet is because telnet provides a constant connection where http doesn't. [size="1"]Please stop confusing "how to" with "how do"[/size]
jvanegmond Posted September 2, 2009 Posted September 2, 2009 That's exactly why sessions/cookies where invented. You can use it to match several connections to one browser. It works like this:Client: (This is the first visit by the client)GET /index.html HTTP/1.1Host: www.foo.barServer: (Server sees that no cookies have been sent, so it sends a Set-Cookie. where foo is the name of the cookie and bar is the data.HTTP/1.1 200 OKContent-type: text/htmlSet-Cookie: foo=barClient: (A new request and any following requests)GET /index.html HTTP/1.1Host: www.foo.barCookie: foo=bar github.com/jvanegmond
rapid2share Posted September 2, 2009 Posted September 2, 2009 work fine for me:) i intrested i develop this code
Delta Posted September 2, 2009 Author Posted September 2, 2009 I have used cookies before in PHP and javascript. It's using them in AutoIt that I have never done before. I think javascript will be the easiest route in this application though. The first thing I need to do though is to clean up the code. On a side note I'm almost done with the telnet code and I'll be posting that soon. [size="1"]Please stop confusing "how to" with "how do"[/size]
BrettF Posted September 2, 2009 Posted September 2, 2009 I did make an example of Manadars server using cookies so it was "Secure". Maybe give it a go Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Delta Posted September 4, 2009 Author Posted September 4, 2009 I feel like a jerk because I said I would have this stuff posted soon. Unfortunately I've gotten sick and it has become impossible to focus on anything. That being said, BrettF I was wondering if you could post a link to your script. I tried searching for it but my head just kinda shutdown [size="1"]Please stop confusing "how to" with "how do"[/size]
jvanegmond Posted September 4, 2009 Posted September 4, 2009 I feel like a jerk because I said I would have this stuff posted soon. Unfortunately I've gotten sick and it has become impossible to focus on anything. That being said, BrettF I was wondering if you could post a link to your script. I tried searching for it but my head just kinda shutdown I think he posted it here: #668956 github.com/jvanegmond
ValeryVal Posted September 4, 2009 Posted September 4, 2009 (edited) @Deltaforce229: Thank you. It works fine under Windows XP Russian. See result below (Russian). To do it the users should just make in _CleanHtml body two actions: Func _CleanHtml($sHtml) $sHtml = Convert_FROM_DOS_CHARSET_TO_WINDOWS_CHARSET($sHtml) $sHtml = Convert_FROM_WINDOWS_CHARSET_TO_UTF8($sHtml) $sHtml = StringReplace($sHtml, " ", " ") $sHtml = StringReplace($sHtml, "<", "<") $sHtml = StringReplace($sHtml, ">", ">") $sHtml = StringReplace($sHtml, @CRLF, @CRLF & "<br>") Return $sHtml EndFunc ;==>_CleanHtml Func Convert_FROM_DOS_CHARSET_TO_WINDOWS_CHARSET($sHtml) is to convert from DOS locale to Windows locale Func Convert_FROM_WINDOWS_CHARSET_TO_UTF8($sHtml) is to convert from Windows locale to UTF-8 Edited September 4, 2009 by Valery The point of world view
jvanegmond Posted September 4, 2009 Posted September 4, 2009 You probably ment to post something like this: $sHtml = StringReplace($sHtml, "<", "<") $sHtml = StringReplace($sHtml, ">", ">") $sHtml = StringReplace($sHtml, @CRLF, @CRLF & "<br />") github.com/jvanegmond
ValeryVal Posted September 4, 2009 Posted September 4, 2009 You probably ment to post something like this:You are right! Thanx. To escape this source must be in code tags here, I think. The point of world view
Delta Posted September 4, 2009 Author Posted September 4, 2009 (edited) Thanks Manadar I'll start working on a new version as soon as I'm feeling better. Valery I have never heard of those functions charset functions before are they part of a UDF? Edited September 4, 2009 by Deltaforce229 [size="1"]Please stop confusing "how to" with "how do"[/size]
Delta Posted September 6, 2009 Author Posted September 6, 2009 Released telnet version. See first post. [size="1"]Please stop confusing "how to" with "how do"[/size]
Sascha Posted September 7, 2009 Posted September 7, 2009 Released telnet version. See first post.Nice but it takes 100% CPU time.I added a little Sleep(50) in the while loop.RegardsSascha
Zachlr Posted November 12, 2009 Posted November 12, 2009 Released telnet version. See first post. Seems to encounter a runtime array error when (logging in) the user enters a string that does not contain a space. This causes StringSplit($Clients[$hSocket][2], " ") to fail, and later an array element is accessed that doesn't exist. It's an easy fix though. I found that adding these four lines fixed the problem. See below. Add the below lines AFTER line 109 (line109: $Clients[$hSocket][2] = StringReplace($Clients[$hSocket][2], @CRLF, "") ) If not StringInStr($Clients[$hSocket][2], " ") Then ;if there isn't a space, get the heck out, because stringsplit will fail and will cause a runtime array error _TCP_Send($hSocket, "- Invalid login string. Remember to separate username and password by one space." & @CRLF) Return 1 EndIf Aside from that, it seems like a really good script. No other errors that I could find. It seems to work quite nicely.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now