Jump to content
Sign in to follow this  
Irongeek

Telnet Daemon?

Recommended Posts

Has anyone coded a Telnet server/daemon in Autoit3 yet? I've tried to make one just redirecting StdOut to a TCP stream and the reverse for StdIn, but things are not working quite as expected. I figure why reinvent the wheel if someone else already did it.

Share this post


Link to post
Share on other sites

I've searched and I must be missing it. I'm not looking to write a telnet client, but a telnet server that redirects cmd.exe. Here is what I have so far but it does not work:

;SERVER!! Start Me First !!!!!!!!!!!!!!!
$g_IP = "127.0.0.1"

; Start The TCP Services
;==============================================
TCPStartUp()

; Create a Listening "SOCKET"
;==============================================
$MainSocket = TCPListen($g_IP, 65432,  100 )
If $MainSocket = -1 Then Exit


$cmdpid = Run(@comspec, @SystemDir, @SW_MAXIMIZE, 3)
;  look for client connection
;--------------------
Do
    $ConnectedSocket = TCPAccept($MainSocket)
Until $ConnectedSocket <> -1
While ($ConnectedSocket >= 0)
        
        $line = StdoutRead($cmdpid)
        TCPSend( $ConnectedSocket ,  $line)
        
        
        $recv = TCPRecv( $ConnectedSocket, 2048)
        StdinWrite($cmdpid, $recv)
;If $recv <> "" Then msgbox(0, "monkey", $recv)
;StdinWrite($cmdpid, "dir")
;StdinWrite($cmdpid)    
Wend

Thanks.

Edited by Irongeek

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...