dillonlim Posted April 8, 2010 Posted April 8, 2010 (edited) Wrote this a part of a framework for a friend's project. I've only tested it on x86 WinXP. It only works with Microsoft telnet client. It WILL fail with PuTTY, any third party telnet client and any flavor Linux/Unix telnet client. expandcollapse popup$port = "666" TCPStartup () $GIT = TCPListen(@IPAddress1, $port) If $GIT = -1 Then MsgBox(0, "Error", "Unable to start server on " & $port) Exit EndIf While 1 Do $GOT = TCPAccept($GIT) Until $GOT <> -1 TCPSend($GOT, "Command? ") While 1 $HAS = TCPRecv($GOT, 4096) $CHKVAR = StringLen($HAS) If $CHKVAR > 0 Then Local $HASSING = "" Do $HASSING &= TCPRecv($GOT, 4096) $CHKCHAR = StringRight($HASSING, 1) Until $CHKCHAR = ";" $HASSAN = StringTrimRight($HASSING, 1) $CMSG = $HAS & $HASSAN TCPSend($GOT, @CRLF & "Command? ") If StringLower($CMSG) <> "exit" Then TrayTip("i haz a msg", $CMSG, 5, 0) Else TrayTip("", "", 5, 0) EndIf Select Case StringLower($CMSG) = "exit" TCPSend($GOT, "Goodbye!") TCPCloseSocket($GOT) ExitLoop Case StringLower($CMSG) = "close" Send("!{F4}") Case StringLower($CMSG) = "return" Send("{ENTER}") Case StringLeft(StringLower($CMSG), 4) = "send" $TRIMMER = StringTrimLeft($CMSG, 5) Send($TRIMMER) Send("{ENTER}") Case StringLeft(StringLower($CMSG), 2) = "go" $TRIMMER = StringTrimLeft($CMSG, 3) ShellExecute($TRIMMER) EndSelect EndIf WEnd WEnd TCPShutDown() Edited April 8, 2010 by dillonlim
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