Jump to content
Sign in to follow this  
Win4lif3

how do i only show specefik procces ID in netstat -ano

Recommended Posts

Win4lif3

okay my problem is that i get random addresses and all that, but i only want the addresses from PID(procces ID) 3404 (skype)

code that shows netstat -ano in cmd:

#include <Constants.au3>
$cmd = "netstat -ano"
$string = _CMDreturn($cmd)
MsgBox(0, $cmd, $string)
Func _CMDreturn($sCommand) ; Returns a the output of a DOS command as a string
    $cmdreturn = ""
    $stream = Run(@ComSpec & " /c " & $sCommand, @SystemDir, @SW_HIDE, $STDOUT_CHILD + $STDIN_CHILD)
    While 1 ; loop through the return from the command until there is no more
        $line = StdoutRead($stream)
        If @error Then ExitLoop
        $cmdreturn &= $line
    WEnd
    Return $cmdreturn
EndFunc   ;==>_CMDreturn

(this is not made by me i found it somewhere on forum)

Share this post


Link to post
Share on other sites
Manko

change:

$cmdreturn &= $line

to something like:

if stringinstr( stringright($line,8), string($PID) Then $cmdreturn &= $line

not tested... (and $PID=processexist("skype.exe") might be put at start... or what you need...)

/Manko


Yes i rush things! (I sorta do small bursts inbetween doing nothing.) Things I have rushed and reRushed:* ProDLLer - Process manager - Unload viri modules (dll) and moore...* _WinAPI_ProcessListOWNER_WTS() - Get Processes owner list...* _WinAPI_GetCommandLineFromPID() - Get commandline of target process...* _WinAPI_ThreadsnProcesses() Much info if expanded - optional Indented "Parent/Child"-style Processlist. Moore to come... eventually...

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.