Sign in to follow this  
Followers 0
onedayillpay

ip/port logger

4 posts in this topic

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...

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You would have to create a Winsock library in autoit to do the job:

http://msdn2.microsoft.com/en-us/library/ms741416.aspx

or you could just use TCPView:

http://www.microsoft.com/technet/sysintern...es/TcpView.mspx

It 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 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

Share this post


Link to post
Share on other sites

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...")

Share this post


Link to post
Share on other sites

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

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