kenp11w Posted September 12, 2008 Share Posted September 12, 2008 Does anyone have a script that test Telent connections and logs the error if the conenction fails or connects? I saw a few scripts that run Telnet in batch reads from an IP list. I need to the log any errors or succesful connects. The script opens port xxx 443 for each server if it connects we need to disconnect and mark server as good if it fails we need to mark server as bad. AutoItSetOption ( "WinTitleMatchMode" , 2) #include <file.au3> Dim $ipfile="servers.txt" Dim $functionfile="Function.txt" Dim $ipadress, $function ;read ip address into array If Not _FileReadToArray($ipfile, $ipadress) Then MsgBox(4096,"Error", $ipfile & " Not Found") Exit EndIf ;read function into array If Not _FileReadToArray($functionfile, $function) Then MsgBox(4096,"Error", $functionfile & " Not Found") Exit EndIf ;go into loop untill out of ip adresses For $loop = 1 to $ipadress[0] Run("telnet " & $ipadress[$loop] & " 443" ) Sleep(1800) ;go into loop untill all functions are done For $loop2 = 1 to $function[0] WinActivate("Telnet " & $ipadress[$loop]) WinWaitActive("Telnet " & $ipadress[$loop]) Send($function[$loop2] & "{ENTER}") Next If WinExists("Telnet " & $ipadress[$loop]) Then WinClose("Telnet " & $ipadress[$loop]) Next Link to comment Share on other sites More sharing options...
Andreik Posted September 12, 2008 Share Posted September 12, 2008 Replace Run("telnet " & $ipadress[$loop] & " 443" ) with #include <Process.au3> _RunDOS("telnet " & $ipadress[$loop] & " 443 >" & @TempDir & "\myoutput.txt") $FILE = FileOpen(@TempDir & "\myoutput.txt",0) $DATA = FileRead($FILE) FileClose($FILE) MsgBox(0,"",$DATA) You can adapt the code, replace MsgBox with an if statements. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
kenp11w Posted September 12, 2008 Author Share Posted September 12, 2008 Replace Run("telnet " & $ipadress[$loop] & " 443" ) with #include <Process.au3> _RunDOS("telnet " & $ipadress[$loop] & " 443 >" & @TempDir & "\myoutput.txt") $FILE = FileOpen(@TempDir & "\myoutput.txt",0) $DATA = FileRead($FILE) FileClose($FILE) MsgBox(0,"",$DATA) You can adapt the code, replace MsgBox with an if statements. Thanks. I tried the code replacement and it error'd on line 25 Process.au3 Func_ProcessGenName($i_PID) Error : "FOR" statement has no matching "Next" statement My Process.au3 is version ; Include Version:1.59 (04/20/2006) do i need a newer one? Link to comment Share on other sites More sharing options...
Andreik Posted September 12, 2008 Share Posted September 12, 2008 Thanks. I tried the code replacement and it error'd on line 25 Process.au3 Func_ProcessGenName($i_PID) Error : "FOR" statement has no matching "Next" statement My Process.au3 is version ; Include Version:1.59 (04/20/2006) do i need a newer one?Put this line first in your script: #include <Process.au3> When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 12, 2008 Moderators Share Posted September 12, 2008 Func_ProcessGenName ?Func _ProcessGetName Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
kenp11w Posted September 15, 2008 Author Share Posted September 15, 2008 (edited) Thanks. I tried the code replacement and it error'd on line 25 Process.au3Func_ProcessGenName($i_PID)Error : "FOR" statement has no matching "Next" statement My Process.au3 is version ; Include Version:1.59 (04/20/2006) do i need a newer one?I changed the Include state ment to the top.I get a MSsgBox with OK on it and the MYOUPUT files has 0 bytes.It does not appear to open Telnet at all or DOS sesion Edited September 15, 2008 by kenp11w Link to comment Share on other sites More sharing options...
kenp11w Posted September 15, 2008 Author Share Posted September 15, 2008 Put this line first in your script: #include <Process.au3> I searched for GenName and did not see the text in any file in INCLUDE directory Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 15, 2008 Moderators Share Posted September 15, 2008 As I stated, it's not GeNName ... It's GeTName Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
kenp11w Posted September 16, 2008 Author Share Posted September 16, 2008 As I stated, it's not GeNName ... It's GeTNameProcess.au3 has GeTName..... but when I run the script the error shows as GenName. Where is the error coming from? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 17, 2008 Moderators Share Posted September 17, 2008 Process.au3 has GeTName..... but when I run the script the error shows as GenName. Where is the error coming from?From your script, you have a typo. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
tr1px Posted September 17, 2008 Share Posted September 17, 2008 Kenp11w Nice way to write an automatic exploiter . I guess I am the only one here that caught on. PM me because I am working on a few thing myself. Link to comment Share on other sites More sharing options...
kenp11w Posted September 17, 2008 Author Share Posted September 17, 2008 From your script, you have a typo.I changed the Include state ment to the top. The error does not occurrI get a MSsgBox with OK on it and the MYOUPUT files has 0 bytes.It does not appear to open Telnet at all or DOS sesion Link to comment Share on other sites More sharing options...
kenp11w Posted September 17, 2008 Author Share Posted September 17, 2008 Kenp11w Nice way to write an automatic exploiter . I guess I am the only one here that caught on. PM me because I am working on a few thing myself.Actually we use the script to test 8 domain controllers and the thousands of computers connected.Our Auditing software cant access som computers so we telnet to ports if netbios does not work 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