Mike Chirico on 4 Mar 2004 22:00:03 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PLUG] Weird Bash Question


> Message: 3
> Date: Thu, 4 Mar 2004 10:40:13 -0500 (EST)
> From: Martin DiViaio <scatterbrained@usermail.com>
> To: plug@lists.phillylinux.org
> Subject: [PLUG] Weird Bash Question
> Reply-To: plug@lists.phillylinux.org
>
>
> Anyone know of an easy way to find an open, non-priviledged TCP port
in
> bash?
>
> I could troll through the output from netstat and then pick a port
that
> isn't listed, but I'm hoping there is an easier solution.
>

Iana has a listing.
http://www.iana.org/assignments/port-numbers

0 through 1023 well-know ports
1024 to 49151 registered ports
49151 to 65535 private ports

I think you can find your well-know ports: 0 through 1023 in
/etc/services?


So, anything between 49151 and 65535 should work, and won't require
root privileges.

I think the easest way is to pick a private port, then, try
telnet from the 2 computers.

telnet xxx.xxx.xxx.xxx 49151

On the second computer, run the following, assuming ssh (port 22)
is the only port being used, and the NIC is eth0.  At least you'll see
if a rounter
is blocking you.  Even if the target computer has a personal firewall,
output
will  show up with the tcpdump command.

/usr/sbin/tcpdump -i eth0 -nN -vvv -xX -s 1500 port not 22

Regards,

Mike Chirico


___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug