Jump to content

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


Win4lif3
 Share

Recommended Posts

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)

Link to comment
Share on other sites

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...
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...