Articles

Metasploit Framework Windows Tutorial
Remote Desktop Connection
Windows Processes That May Be Dangerous
How-To use NetCat a Tutorial
Common Linux Commands
Common Ports
Netcat Commands
HTTP Response Codes
War-Google Hack Terms
Wardriving
Avoiding Social Engineering and Phishing Attacks
Intrusion Detection on Linux
Linux Intrusion Detection
Penetration Testing Guide
Penetration Testing Tools
Social Engineering Fundamentals, Part I: Hacker Tactics
Social engineering (computer security)
The Psychology of Social Engineering

The Archives

General GSO
GovernmentSecurity.org News & Suggestions
In The News
Open Topic
General Security Information
Trash Can
Exploit & Vulnerability Mailing List Archives
Trial Member Forum
Product and Program Reviews GSO Tutorials
System Security
Windows Systems
Beginners Section
Linux & Unix Systems
File Downloads
Exploit Research & Discussion Trojan & Virus Errata
Networking Security / Firewall / IDS / VPN / Routers
System Hardening
E-Mail Security
Wifi Security
Trial Member Uploads
Upload discovered Trojans & Mal ware
GSO Programming Section
C , C++ , VC++
Visual Basic.NET
Perl /CGI
Java/Javascript
PHP/XML/ASP/HTML
Assembly + Other
The Cork Board
Network Security Consultant Directory
Network Security Jobs
The Archives
Encryption Information
General Network Security
Internet Anonymity
HTTP Protocol Security
Linux Security
MS IIS Information
Exploit Articles
Programming / Tool Design
GSO Software Projects
Public Downloads
Microsoft Security Questions and Papers

Full Version: Perl Process To Port
Skydriver
HI All

i am trying to know if there is anyway to get in perl a list of all the Process and what port they r opening and to were they are connected something like netstat+process.

tcpview of sysinternal is doing that but i want to do it in perl.

any help will be great

thanx in advance
Serhat
the easiest though maybe not the smartest is try to use ps and netstat..
I don't have an box to try it on and confirm it.. but I normally use
'ps -ef' to get me a list of process running + PID and some other info..
and not sure about this one.. netstat -ano or netstat -anp or something similar which would show per connection to which PID they belong too.. so you can match them using both.. I would use the man pages to be sure about the switches..
this should get you somewhere I hope..

here's a perl subroutine + explanation how to use the info of 'ps -ef'
http://www.devdaily.com/perl/edu/articles/pl020004/
I am sure you'll be able to use the same trick on netstat

Serhat
Skydriver
QUOTE(Serhat @ Jul 23 2005, 03:22 AM)
the easiest though maybe not the smartest is try to use ps and netstat..
I don't have an box to try it on and confirm it.. but I normally use
'ps -ef' to get me a list of process running + PID  and some other info..
and not sure about this one.. netstat -ano or netstat -anp or something similar which would show per connection to which PID they belong too.. so you can match them using both.. I would use the man pages to be sure about the switches..
this should get you somewhere I hope..

here's a perl subroutine + explanation how to use the info of 'ps -ef'
http://www.devdaily.com/perl/edu/articles/pl020004/
I am sure you'll be able to use the same trick on netstat

Serhat
*


thanx for the repaly but i am searching for something without using the system commands

p.s by the way i need to do it on a windows machine

Serhat
guess you'll need to access windows API calls then..
after some searching..
http://www.xav.com/perl/site/lib/Win32API/
about some default WIN 32 API commands.. like FILE/register/net Api's..
though don't think that's will help you in any way
http://www.xav.com/perl/lib/Win32.html
just check the menu on the left.. it has menu documentation on different stuff.. you might find something usefull..
the only thing I can think of is using API calls to get that info if you don't want to run other software..

after some more searching I found that you can write your own perl extensions in C
this might be usefull (using google's cache)
http://64.233.183.104/search?q=cache:AmeAv...xtensions&hl=en
this way you can write an extension that can do the stuff for you? or it might be just a little thing giving you access to certain api calls in windows you need?

I don't know very much about Perl.. google helped me in finding these.. hope they're usefull one way or another..

Serhat
toe
skydriver can you explain why you need something like this maybe i can tell you a easier more efficient way. I cant think why, maybe your just interested.

-toe
Killaloop
no such package for perl.
you would need to write your own in C, but then again this is not simple and since you are trying to do something in perl I'm sure your C is not good enough.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2005 Invision Power Services, Inc.