Sign in to follow this  
Followers 0
Irongeek

Telnet Daemon?

4 posts in this topic

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



Welcome to the forums....

search "telnet" in scripts and scraps forum

there are many to choose from

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Well, I can read StdOut, I can write to StdIn but I can't seem to do both at the same time. Any help?

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  
Followers 0