onedayillpay Posted April 1, 2007 Share Posted April 1, 2007 is there a way to log all ips that Establish a Tcp conection threw port 6112...I can make a bot that will run command prompt and netstat -n then copy the text displayed and save it to a file but thats way to lame... any advice will sure help... Link to comment Share on other sites More sharing options...
The Kandie Man Posted April 1, 2007 Share Posted April 1, 2007 (edited) You would have to create a Winsock library in autoit to do the job:http://msdn2.microsoft.com/en-us/library/ms741416.aspxor you could just use TCPView:http://www.microsoft.com/technet/sysintern...es/TcpView.mspxIt has both a Console and GUI version. That means you can read the StdoutRead stream to capture data from the console version. You could then use autoit string functions to get exactly what you want from that output and then you could write the data to a log. Though this isn't much different than netstat -n, this program will actively refresh the connections so you only need to run the program once and just continue to read its output.EDIT:Hmm, at appears that the console version has randomly decided to stop refreshing and now only displays active connections and then closes. Don't know why it is doing that because it was constantly refreshing the first time i ran it. Edited April 1, 2007 by The Kandie Man "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire Link to comment Share on other sites More sharing options...
onedayillpay Posted April 1, 2007 Author Share Posted April 1, 2007 im having problems downloading TCPView but i dont think i need it... im starting to understand StdoutRead... but I am unable to write to the commad prompt. maybe can some one show me how i can use $foo = Winactivate("C:\WINDOWS\system32\cmd.exe") and then StdinWrite #include <Constants.au3> $foo = Run(@SystemDir & "\cmd.exe", @SystemDir, @SW_SHOW, $STDERR_CHILD + $STDOUT_CHILD) While 1 $line = StdoutRead($foo) If @error Then ExitLoop MsgBox(0, "STDOUT read:", $line) Wend While 1 $line = StderrRead($foo) If @error Then ExitLoop MsgBox(0, "STDERR read:", $line) Wend MsgBox(0, "Debug", "Exiting...") Link to comment Share on other sites More sharing options...
Uten Posted April 1, 2007 Share Posted April 1, 2007 The way to do it: #include <Constants.au3> $foo = Run(@SystemDir & "\cmd.exe /C netstat -n", @SystemDir, @SW_SHOW, $STDERR_CHILD + $STDOUT_CHILD) While 1 $line = StdoutRead($foo) If @error Then ExitLoop msg(0, "STDOUT read:", $line) Wend While 1 $line = StderrRead($foo) If @error Then ExitLoop msg(0, "STDERR read:", $line) Wend msg(0, "Debug", "Exiting...") Func msg($icon, $title, $msg, $timout=0, $erl=@ScriptLineNumber, $err=@error) ConsoleWrite("(" & $erl & ") := (" & $err & ")" & $msg & @CRLF) EndFunc Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling 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