t0ddie Posted February 10, 2006 Share Posted February 10, 2006 is there any possible way to use autoit to read and write text to the telnet window? Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
slipperylobster Posted February 10, 2006 Share Posted February 10, 2006 is there any possible way to use autoit to read and write text to the telnet window?yep Link to comment Share on other sites More sharing options...
mikeytown2 Posted February 10, 2006 Share Posted February 10, 2006 The UDF that I've been working on uses tellnet to send email... well sortahttp://www.autoitscript.com/forum/index.ph...ndpost&p=148460A smtp server is just like a telnet server, so look though the udf code for some ideas. if your going to use the UDF code and hack it up, don't forget to change the port number.Also look at the beta help for examples on how to use the TCP functions.What are you going to do with telnet? Email: POP3 & SMTP using SSL/TLS (OpenSSL)Email: IMAPEmail: Base64 & SMTP login & Send email direct to MX Server (thanks blindwig)Win: Hook Registry ChangesWin: Read/Write to Alternate Data Streams (ini example)Utility: GPS Distance Calculations, Vincenty and Haversine formulas; angles and elevationUtility: Dell Laser Printer (3000-5100) - Print LoggerUtility: Reset Router when Wireless Link FailsUtility: ImageMagick Batch jpg ProcessorVideo HCenc Batch FrontendVideo: *DEAD* YouTube Video Encoder (avs/avi to flv)Software On CD's I Like<<back|track3 Ultimate Boot CD for Windows SpinRite Ubuntu ophcrack Link to comment Share on other sites More sharing options...
DaveF Posted February 10, 2006 Share Posted February 10, 2006 is there any possible way to use autoit to read and write text to the telnet window?I'd wondered if you made any progress from the last time that you asked this. ; Telnet example ; Requires Console Telnet - http://consoletelnet.sourceforge.net/ Dim $ourTelnet, $ourRead ; Set environment variable to tell Console Telnet we're redirecting STDIN & STDOUT EnvSet("TELNET_REDIR", "1") ; Run the program $ourTelnet = Run(@ProgramFilesDir & "\telnet\telnet.exe", @ProgramFilesDir & "\telnet", @SW_HIDE, 3) ; Read initial output and display $ourRead = StdoutRead($ourTelnet) MsgBox(0, "Debug", "Telnet read: " & @CRLF & $ourRead) ; Send the string "quit" StdinWrite($ourTelnet, "quit" & @CRLF) ; Read the remaining output and display $ourRead = "" While 1 $ourRead &= StdoutRead($ourTelnet) If @error = -1 Then ExitLoop WEnd MsgBox(0, "Debug", "Telnet read: " & @CRLF & $ourRead) Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines. Link to comment Share on other sites More sharing options...
Valik Posted February 10, 2006 Share Posted February 10, 2006 I'd wondered if you made any progress from the last time that you asked this.Of course not, you didn't write the code for him last time like you did this time. Link to comment Share on other sites More sharing options...
flaxcrack Posted February 10, 2006 Share Posted February 10, 2006 Of course not, you didn't write the code for him last time like you did this time. BURN!! [quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD() Link to comment Share on other sites More sharing options...
t0ddie Posted February 14, 2006 Author Share Posted February 14, 2006 (edited) nobody wrote the code for me, your arrogantly mistaken valik.nobody wrote code for me last time... i provided the code i had....the problem im having is not with the code actually, its with the console program.http://consoletelnet.sourceforge.net/when i connect to telnet with the command prompt, i type telnet useast.battle.net 6112 and i connect. then i press c. then i enter a name and pass.with this console program, i type op useast.battle.net 6112 and i connect.THEN NO MATTER WHAT I PRESS MY CONNECTION IS TERMINATEDi just want to know how i would log onto telnet with this tool!there is no documentation and typing ? in the prompt has only 5 small directions.i basically want to log onto telnet on that server and sit in a channel, waiting for a phrase to be sent to it in that channel. yep, a bot. Edited February 14, 2006 by t0ddie Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
t0ddie Posted February 14, 2006 Author Share Posted February 14, 2006 still stuck, i know its hard for people to help me if they arent familiar with that 3rd party console program..i dont need help with the code...i just cant even use that thing manually!you can see what i mean if you log onto telnet normally with the command prompt with this.telnet useast.battle.net 6112it connects... then telnet screen is cleared. then you press "C" and this comes upConnection from [67.190.199.34] Enter your account name and password. Use 'anonymous' if you only want to issue queries. Username:then i enter username shmegma321 and a prompt comes for the pass which is qqqand that takes me right into the chatroom.with that console program http://consoletelnet.sourceforge.net/i read the help contents... to connect you use thisop useast.battle.net 6112so i do that, then i sit there... and wait the screen never clears.. i press C or ANY key and it terminates the connection.so thats where i am at.im trying to automate this logon process, so i can send messages to this bot thats logged in. the messages will trigger events depending on what i send the bot.if i can get past this little issue the rest of the script will be easy enough.would like some help from someone who knows how to use that console telnet program, or any program that autoit can read and write to the i/o stream. Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
mikeytown2 Posted February 14, 2006 Share Posted February 14, 2006 (edited) My question to you is why use a third party telnet program when autoit can do it, just grab the latest beta and run this...I hacked up my smtp script and this is what i got. it connects to your watercraft 3 serverexpandcollapse popupFunc _INetBattle($s_Server, $i_Port, $s_UserName = "", $s_Password = "") Local $v_Socket Local $s_IPAddress Local $i_Count Local $as_Auth[3] Local $as_AuthReplyCode[3];Return code from SMTP server indicating success 250 334 ect... $f_Trace = True If $s_Server = "" Or $i_Port = "" Then SetError(1) Return False EndIf If TCPStartup() = 0 Then SetError(2) Return False EndIf StringRegExp($s_Server, "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)") If @extended Then $s_IPAddress = $s_Server Else $s_IPAddress = TCPNameToIP($s_Server) EndIf If $s_IPAddress = "" Then TCPShutdown() SetError(3) Return False EndIf $v_Socket = TCPConnect($s_IPAddress, $i_Port) If $v_Socket = -1 Then TCPShutdown() SetError(4) Return False EndIf ;Login with Username And Password Commands $as_Auth[0] = "c" $as_AuthReplyCode[0] = "Username:" $as_Auth[1] = $s_UserName & @CRLF $as_AuthReplyCode[1] = "Password:" $as_Auth[2] = $s_Password & @CRLF $as_AuthReplyCode[2] = "2010" ;body would go in here but that was passed to us all ready ;Send Login For $i_Count = 0 To (UBound($as_Auth) - 1) Step + 1 _Send($v_Socket, $as_Auth[$i_Count ], $f_Trace) $s_Receive = _GetLastReplyMsg($v_Socket, $as_AuthReplyCode[$i_Count], $f_Trace) If @error Then SetError(50 + $i_Count) Return False EndIf Next While 1 _GetReply($v_Socket, $f_Trace) WEnd TCPCloseSocket($v_Socket) TCPShutdown() Return True EndFunc ;==>_INetSmtpMail ; internals routines---------------------------------- ;Waits for Reply Func _GetLastReplyMsg($v_Socket, $i_ReplyCode, $f_Trace) Local $s_Receive Local $i_Count For $i_Count = 0 To 20 Step + 1 $s_Receive = TCPRecv($v_Socket, 1000) If $s_Receive = "" Then Else If $f_Trace Then _Trace("<Recv> " & $s_Receive) EndIf If StringInStr($s_Receive, $i_ReplyCode) Then Return $s_Receive EndIf EndIf Sleep(200);will wait a max of 4 seconds for reply Next SetError(1);Recieve Timed out, it never got the right reply code Return $s_Receive EndFunc ;==>_GetLastReplyMsg Func _GetReply($v_Socket, $f_Trace) Local $s_Receive Local $i_Count For $i_Count = 0 To 5 Step + 1 $s_Receive = TCPRecv($v_Socket, 1000) If $s_Receive = "" Then Else _Trace("<Recv> " & $s_Receive) EndIf Sleep(200);will wait a max of 4 seconds for reply Next Return $s_Receive EndFunc ;==>_GetLastReplyMsg ;Trace the I/O to a gui Func _Trace($s_DisplayString, $i_Timeout = 0) Local $W_TITLE = "SMTP trace" Local $g_smtptrace = ControlGetText($W_TITLE, "", "Static1") $g_smtptrace &= @HOUR & ":" & @MIN & ":" & @SEC & " " & $s_DisplayString;& @LF If WinExists($W_TITLE) Then ControlSetText($W_TITLE, "", "Static1", $g_smtptrace) Else SplashTextOn($W_TITLE, $g_smtptrace, 450, 700, 500, 100, 4 + 16, "", 8) EndIf If $i_Timeout Then Sleep($i_Timeout * 1000) EndFunc ;==>_SmtpTrace ;send a command/msg to the smtp server Func _Send($v_Socket, $s_Command, $f_Trace) TCPSend($v_Socket, $s_Command) If @error Then SetError(1) Return False EndIf If $f_Trace Then _Trace("<Send> " & $s_Command) EndIf Return True EndFunc ;==>_SmtpSend $a = _INetBattle("useast.battle.net", "6112", InputBox("User", "Enter Username", "shmegma321"), InputBox("Pass", "Enter Password", "qqq")) MsgBox(0, "", $a)You need to write a gui to make it so you can send and have the replies scroll. so you need to change the Trace function and after you connect you need to change thisWhile 1_GetReply($v_Socket, $f_Trace)WEndand put a gui in there.look at the help index under gui.Good luck.This might help if you dont want to use what i gave youhttp://www.autoitscript.com/forum/index.ph...topic=21541&hl=If your super lazy use Scite's AU3Record... Edited February 14, 2006 by mikeytown2 Email: POP3 & SMTP using SSL/TLS (OpenSSL)Email: IMAPEmail: Base64 & SMTP login & Send email direct to MX Server (thanks blindwig)Win: Hook Registry ChangesWin: Read/Write to Alternate Data Streams (ini example)Utility: GPS Distance Calculations, Vincenty and Haversine formulas; angles and elevationUtility: Dell Laser Printer (3000-5100) - Print LoggerUtility: Reset Router when Wireless Link FailsUtility: ImageMagick Batch jpg ProcessorVideo HCenc Batch FrontendVideo: *DEAD* YouTube Video Encoder (avs/avi to flv)Software On CD's I Like<<back|track3 Ultimate Boot CD for Windows SpinRite Ubuntu ophcrack Link to comment Share on other sites More sharing options...
t0ddie Posted February 14, 2006 Author Share Posted February 14, 2006 thanks. you have succeeded where the others have failed. it is possible with autoit without a 3rd party program. the answer was in the beta thanks again! Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
Valik Posted February 15, 2006 Share Posted February 15, 2006 nobody wrote the code for me, your arrogantly mistaken valik.You are stupidly mistaken - DaveF wrote some code in post #4 which looks like it should work. Link to comment Share on other sites More sharing options...
t0ddie Posted February 15, 2006 Author Share Posted February 15, 2006 I misread your post valik. i was referring to the original post i had made with my own code. the code dave made was in this thread not the last thread, and it was code for using that third party program, i posted my code the first time in that first thread before any other posts were made. you act as if im a total noob asking someone to write code for me, when the problem i was having was with the console application. i stand corrected since i misinterpreted your post, but your reply was still a crack against me and every time i post you have something negative to say about me. why dont you leave your negative thoughts to yourself. your not helping or giving advice your trying to start an argument. being a good programmer does not make up for being an egotistical jerk with a superiority complex. Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
flaxcrack Posted February 15, 2006 Share Posted February 15, 2006 Hey guys! Lets see a little bit less of this and a lot more of this else I'm going to tell the teacher! [quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD() Link to comment Share on other sites More sharing options...
Valik Posted February 16, 2006 Share Posted February 16, 2006 i stand corrected since i misinterpreted your post, but your reply was still a crack against me and every time i post you have something negative to say about me.I do it simply because I am utterly exasperated that you can be a member of this forum since 2004 and yet show absolutely no progress in actually learning the language. You ask the same (kind of) stupid questions, make the same stupid mistakes and drag out a lot of your threads into multiple pages trying to grasp simple things. In other words, I've not seen any indication that you are capable of learning. I'm not expecting you to write AI capable of passing the Turing Test but the least you could do is demonstrate that some of this stuff is sticking. Link to comment Share on other sites More sharing options...
t0ddie Posted February 16, 2006 Author Share Posted February 16, 2006 when i started in these forums i used autoit version 2 you mentioned yourself that i started these forums in 2004... ...your label of me learning absolutely nothing contradicts itself in the same sentence since i had to learn how to use version 3... i dont always make the same stupid mistakes, but you always have the same shit attitude. are you going to continue this badmouthing of me and reply some more in an attempt to make me look stupid while only succeeding in making yourself look like a jerk? or just stfu because its getting old? i guess we will see. Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
Valik Posted February 16, 2006 Share Posted February 16, 2006 when i started in these forums i used autoit version 2you mentioned yourself that i started these forums in 2004... ...your label of me learning absolutely nothing contradicts itself in the same sentence since i had to learn how to use version 3...Well, unless you started learning v3 about 2 months ago, my comments are still valid. You've been working at this v3 thing for awhile now...i dont always make the same stupid mistakes,You do.but you always have the same shit attitude.I do.are you going to continue this badmouthing of me and reply some more in an attempt to make me look stupidI'm not trying to make you look stupid. If I wanted to do that, I'd search for a few threads you started and link them for people to see.while only succeeding in making yourself look like a jerk?I'm not really concerned with looking like a jerk. Most people don't like me anyway so why should I care?or just stfu because its getting old?Well, the simplest solution to getting me to "stfu" would be for you to demonstrate some marked improvement in the language, preferably demonstrated by the ceasation of posting here. However, since we both know that's not going to happen, I will continue to be the bastard who periodically berates you.i guess we will see.Indeed. Link to comment Share on other sites More sharing options...
mikeytown2 Posted February 16, 2006 Share Posted February 16, 2006 Incase someone else finds this useful t0ddie PM-ed me asking for help, I helped. It didn't take a lot of time. One thing though, t0ddie you should be better at programming in autoit by now... some of the mistakes you made had to do with scope as in where the code was in regards to what function it was in. I know you where using the SMTP udf code which isn't easy to understand but some of the questions you asked me seemed like you don't fully understand how programming works. But then when you made the GUI that works I wonder if its the same person... I dont know. t0ddie you should spend some time and take a formal programming class. it will help you with some of the concepts, because yes autoit is super easy, but you still have to know how general programming works if you want to make good programs. Everyone has their strengths and weaknesses... my strengths is taking code and making it better. t0ddie I know you have to have a strength in coding somewhere, but if you never learn it, you will never find it. Its good to ask questions but you need to learn from the questions that you have asked in the past and apply them. Here is the code, it should work as is; and guys t0ddie wrote just about everything here, except for what I put up from my previous post... all I did was debug his code.expandcollapse popup#include <GUIConstants.au3> Global $v_Socket Global $f_Trace = True GUICreate("Bot", 660, 500) Global $mylist = GUICtrlCreateEdit("", 0, 0, 600, 300) Global $type = GUICtrlCreateInput("", 10, 325, 500, 25) $user = GUICtrlCreateInput("shmegma321", 60, 400, 150, 25) GUICtrlCreateLabel("Account", 10, 400, 55, 25) $pass = GUICtrlCreateInput("qqq", 60, 430, 150, 25) GUICtrlCreateLabel("Password", 10, 430, 55, 25) GUICtrlCreateLabel("Public Chat", 300, 380, 55, 25) GUICtrlCreateLabel("Server", 450, 380, 55, 25) $server = GUICtrlCreateCombo("useast.battle.net", 495, 380, 115, 40) GUICtrlSetData(-1, "uswest.battle.net|europe.battle.net|asia.battle.net", "useast.battle.net") $roomstring = "" For $count = 1 To 1000 $roomstring = $roomstring & "|" & $count Next $rooms = GUICtrlCreateCombo("1", 365, 380, 50, 100) GUICtrlSetData(-1, $roomstring, "1") For $count = 1 To 1000 GUICtrlCreateListViewItem($count, $rooms) Next Global $send = GUICtrlCreateButton("Send", 550, 325, 50, 25) Global $login = GUICtrlCreateButton("Login!", 340, 420, 80, 35) Global $logout = GUICtrlCreateButton("Login Out", 450, 420, 80, 35) Global $switch GUICtrlSetLimit(-1, 200); to limit horizontal scrolling GUISetState() GUICtrlSetState($type, $GUI_FOCUS) Global $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() _GetReply($f_Trace) Select Case $msg = $GUI_EVENT_CLOSE TCPCloseSocket($v_Socket) TCPShutdown() Exit Case $msg = $send $switch = 1 ;MsgBox(0, "", GUICtrlRead($type)) _Send(GUICtrlRead($type), $f_Trace) GUICtrlSetData($type, "") GUICtrlSetState($type, $GUI_FOCUS) Case $msg = $login _INetBattle(GUICtrlRead($server), "6112", GUICtrlRead($user), GUICtrlRead($pass)) ;MsgBox(0, "", $a) Case $msg = $logout $switch = 1 _Trace(@CRLF & @CRLF & "CONNECTION CLOSED") TCPCloseSocket($v_Socket) TCPShutdown() EndSelect WEnd Func _INetBattle($s_Server, $i_Port, $s_UserName = "", $s_Password = "") Local $s_IPAddress Local $i_Count Local $as_Auth[3] Local $as_AuthReplyCode[3];Return code from SMTP server indicating success 250 334 ect... If $s_Server = "" Or $i_Port = "" Then SetError(1) Return False EndIf If TCPStartup() = 0 Then SetError(2) Return False EndIf StringRegExp($s_Server, "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)") If @extended Then $s_IPAddress = $s_Server Else $s_IPAddress = TCPNameToIP($s_Server) EndIf If $s_IPAddress = "" Then TCPShutdown() SetError(3) Return False EndIf $v_Socket = TCPConnect($s_IPAddress, $i_Port) If $v_Socket = -1 Then TCPShutdown() SetError(4) Return False EndIf ;Login with Username And Password Commands $as_Auth[0] = "c" $as_AuthReplyCode[0] = "Username:" $as_Auth[1] = $s_UserName & @CRLF $as_AuthReplyCode[1] = "Password:" $as_Auth[2] = $s_Password & @CRLF $as_AuthReplyCode[2] = "2010" ;body would go in here but that was passed to us all ready ;Send Login For $i_Count = 0 To (UBound($as_Auth) - 1) Step + 1 _Send($as_Auth[$i_Count ], $f_Trace) $s_Receive = _GetLastReplyMsg($as_AuthReplyCode[$i_Count], $f_Trace) If @error Then SetError(50 + $i_Count) Return False EndIf Next Return True EndFunc ;==>_INetBattle ; internals routines---------------------------------- ;Waits for Reply Func _GetLastReplyMsg($i_ReplyCode, $f_Trace) Local $s_Receive Local $i_Count For $i_Count = 0 To 20 Step + 1 $s_Receive = TCPRecv($v_Socket, 1000) If $s_Receive = "" Then Else If $f_Trace Then _Trace("<Recv> " & $s_Receive) EndIf If StringInStr($s_Receive, $i_ReplyCode) Then Return $s_Receive EndIf EndIf Sleep(200);will wait a max of 4 seconds for reply Next SetError(1);Recieve Timed out, it never got the right reply code Return $s_Receive EndFunc ;==>_GetLastReplyMsg Func _GetReply($f_Trace) Local $s_Receive Local $i_Count For $i_Count = 0 To 5 Step + 1 $s_Receive = TCPRecv($v_Socket, 1000) If $s_Receive = "" Then Else _Trace("<Recv> " & $s_Receive) EndIf ;Sleep(200);will wait a max of 4 seconds for reply Next Return $s_Receive EndFunc ;==>_GetReply ;Trace the I/O to a gui Func _Trace($s_DisplayString, $i_Timeout = 0) Local $W_TITLE = "Bot" Local $g_smtptrace = ControlGetText($W_TITLE, "", "Static1") $g_smtptrace = $s_DisplayString;& @LF ;StringReplace($s_DisplayString,@crlf,"test") If WinExists($W_TITLE) Then If $switch = 1 Then GUICtrlSetData($mylist, $g_smtptrace & @CRLF, 1) $switch = 0 Else GUICtrlSetData($mylist, $g_smtptrace, 1) EndIf Else MsgBox(0, "uh-oh", "We got a big error here!") EndIf If $i_Timeout Then Sleep($i_Timeout * 1000) EndFunc ;==>_Trace ;send a command/msg to the smtp server Func _Send($s_Command, $f_Trace) TCPSend($v_Socket, $s_Command) If @error Then SetError(1) Return False EndIf If $f_Trace Then _Trace("<Send> " & $s_Command) EndIf Return True EndFunc ;==>_Send Yes it is slightly bloated code but thats what you get when you hack it up. Email: POP3 & SMTP using SSL/TLS (OpenSSL)Email: IMAPEmail: Base64 & SMTP login & Send email direct to MX Server (thanks blindwig)Win: Hook Registry ChangesWin: Read/Write to Alternate Data Streams (ini example)Utility: GPS Distance Calculations, Vincenty and Haversine formulas; angles and elevationUtility: Dell Laser Printer (3000-5100) - Print LoggerUtility: Reset Router when Wireless Link FailsUtility: ImageMagick Batch jpg ProcessorVideo HCenc Batch FrontendVideo: *DEAD* YouTube Video Encoder (avs/avi to flv)Software On CD's I Like<<back|track3 Ultimate Boot CD for Windows SpinRite Ubuntu ophcrack Link to comment Share on other sites More sharing options...
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