Jump to content

Working Telnet Client


Schatten
 Share

Recommended Posts

I read in some forums and found out that some people may want to use telnet with autoit.

So i scripted a telnet client with autoit :whistle:

most of the comments are written in german

#include <GUIConstants.au3>

;TCP starten
TCPStartup ()

;GUI Creation
GuiCreate("Telnet Client", 500, 390,-1, -1 )

;----------> GUI Control Creation Anfang <----------
    
    ;Edit Control für Chat Text
    $Edit = GuiCtrlCreateEdit("", 10, 10, 480, 330)
    
    ;Input Control für Chat Text Eingabe
    $Input = GuiCtrlCreateInput("", 10, 360, 480, 20)
    
;-----------> GUI Control Creation Ende <-----------

;GUI sichtbar machen
GUISetState ()

;Client Hostname auflösen
$Host = TCPNameToIP ( "THE HOST YOU WANT TO CONNECT TO" ) ;<<<<<<<<<< change the host

;Mit Host Connecten
$Conection = TCPConnect ( $Host, THE PORT OF THE HOST ) ;<<<<<<<<<< change the port
If @error Then Exit

While 1
    $msg = GuiGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit
    $recv = TCPRecv ( $Conection,2048 )
    If $recv <> "" Then
    $text = GUICtrlRead ( $Edit )
    GUICtrlSetData ( $Edit,$text & $recv )
    ControlSend ( "Telnet Client","", $Edit, "{ENTER}")
    EndIf

    
    If $msg = $Input Then 
        $text = GUICtrlRead ( $Edit )
        $eingabe = GUICtrlRead ( $Input )
        GUICtrlSetData ( $Edit, $text & $eingabe )
        GUICtrlSetData ( $Input, "" )
        ControlSend ( "Telnet Client","", $Edit, "{ENTER}")
        TCPSend ( $Conection, $eingabe & Chr ( 10 ) )
        

        If @error Then 
            MsgBox (0,"","Error")
            Exit
            EndIf
        EndIf
    WEnd

you only have to change the host and the port if you want to use it

if someone have some ideas for my proggy pls post

Edited by Schatten
Link to comment
Share on other sites

puh... that was hard...

I added two script lines, lol

now the proggy has a little (poor) interface for host and port input

#include <GUIConstants.au3>

;TCP starten
TCPStartup ()

;GUI Creation
GuiCreate("Telnet Client", 500, 390,-1, -1 )

;----------> GUI Control Creation Anfang <----------
    
    ;Edit Control für Chat Text
    $Edit = GuiCtrlCreateEdit("", 10, 10, 480, 330)
    
    ;Input Control für Chat Text Eingabe
    $Input = GuiCtrlCreateInput("", 10, 360, 480, 20)
    
;-----------> GUI Control Creation Ende <-----------

;user input for host and port

$HostI = InputBox ( "Telnet Client", "Please enter the name of the host you want to connect to" )
$PortI = InputBox ( "Telnet Client", "Please enter the port of the host" )


;GUI sichtbar machen

GUISetState ()
ControlSend ( "Telnet Client","", $Edit, "{TAB}")
;Client Hostname auflösen
$Host = TCPNameToIP ( $HostI )

;Mit Host Connecten
$Conection = TCPConnect ( $Host, $PortI )
If @error Then Exit

While 1
    $msg = GuiGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit
    $recv = TCPRecv ( $Conection,2048 )
    If $recv <> "" Then
    $text = GUICtrlRead ( $Edit )
    GUICtrlSetData ( $Edit,$text & $recv )
    ControlSend ( "Telnet Client","", $Edit, "{ENTER}")
    EndIf

    
    If $msg = $Input Then 
        $text = GUICtrlRead ( $Edit )
        $eingabe = GUICtrlRead ( $Input )
        GUICtrlSetData ( $Edit, $text & $eingabe )
        GUICtrlSetData ( $Input, "" )

        TCPSend ( $Conection, $eingabe & Chr ( 10 ) )
        ControlSend ( "Telnet Client","", $Edit, "{ENTER}")

        If @error Then 
            MsgBox (0,"","Error")
            Exit
            EndIf
        EndIf
    WEnd

here the script for download :whistle:

telnet_client.au3

in the next version i will:

- add functions to automate telnet commands

- replace the german comments through english ;)

if you have suggestions what i could fix or do better, please post it

Edited by Schatten
Link to comment
Share on other sites

I don't have anything to telnet right now but does this work well?

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

Its just an edit box. Basically.

oh, so i will take that as a no. Is there going to be telnet support or not in the future?

if not, does anyone know how to TCP raw telnet data?

Thanks

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

telnet is a dos programm that only sends raw data to a server so theres no protocoll or something else.

Because of that you can connect to EVERY kind of server you want.

You only have to know what you have to send to the server... I think...

Edited by Schatten
Link to comment
Share on other sites

here a server where you can try to connect to with my client:

server: void.dune.net

Port: 3000

the text formatting with my client is very bad but the basic functions work

Oh, it seems like it works well thanks

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

What about the line feeds? are those suposed to be there?

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

ssh is a protocoll and i dont know how it works

(if someone can explain me the protocoll i could try to add ssh)

I don't want to be a smart-ass, but your code is NOT a telnet client. It's "just" a TCP client. There is more to telnet than just a TCP connection. Read the RFC for the telnet protocol to learn more about that. http://www.faqs.org/rfcs/rfc854.html. Btw: If you need a telnet server to test a real telnet client, use this list: http://www.telnet.org/htm/places.htm

SSH is the secure shell protocol. You can find plenty of information about SSH here: http://en.wikipedia.org/wiki/Ssh and of course here: http://www.openssh.org/. You can use the open source code of openssh to extend your tcp client. However, that will multiply the size of your code by ~ 17.354. ;)

Cheers

Kurt

Edited by /dev/null

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

i think that telnet is not a real protocoll

but youre right, there are some telnet commands (e.g. for color).

I dont know all telnet commands (in order to be honest i know none).

However if anyone knows a documentation of telnet commands please post it ^^

hmm... later i'll take a look at the ssh things ;)

Edited by Schatten
Link to comment
Share on other sites

i think that telnet is not a real protocoll

but youre right, there are some telnet commands (e.g. for color).

well, I'm sorry to tell you that TELNET IS a protocol. Just read the RFC and you will understand....

Cheers

Kurt

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

ok, ok telnet IS a protocoll :mad:

thx for the links but im too lazy to read all the pages cause i have to translate it all into german :evil:

but i will give my best to transform my faked telnet client to a real one :lmao:

maybe i will need some help ;)

Edited by Schatten
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...