LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 07-07-2010, 10:47 PM   #1
unraisedarc
LQ Newbie
 
Registered: Jun 2010
Posts: 19

Rep: Reputation: 0
Is there a service that binds and listens to unused ports?


Hello, I have a server that is behind a network firewall. I wish to know what ports the firewall lets through to this server. The only way I can think of testing this would be to run a bunch of services and make them listen on a bunch of ports on the server and then run nmap and scan the server. Does anyone know of some all-in-one service that will bind to unused ports in a specific range and listen on them so that I can scan with nmap?

Thanks!
 
Old 07-07-2010, 11:21 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,965
Blog Entries: 11

Rep: Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865
Hi,

You could conceivably use the "swiss army knife" of networking
for this ... have a look at netcat (nc for short).


Cheers,
Tink
 
Old 07-07-2010, 11:36 PM   #3
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Debian
Posts: 1,266

Rep: Reputation: 99
Lightbulb

Yeah Tinkster pointed it right, see this example.

Code:
bash $ nc -zuvv 192.168.1.27 30118-30121
airtelussd1 [10.2.45.197] 30121 (?) open
airtelussd1 [10.2.45.197] 30120 (?) open
airtelussd1 [10.2.45.197] 30119 (?) open
airtelussd1 [10.2.45.197] 30118 (?) : Connection refused
 
Old 07-08-2010, 12:04 AM   #4
unraisedarc
LQ Newbie
 
Registered: Jun 2010
Posts: 19

Original Poster
Rep: Reputation: 0
Thanks guys. I am beginning to mess around with netcat, but I'm not getting very far. For instance, I run the following command and nothing seems to happen:


Code:
me@me$ nc -l -p 1234 < /etc/resolv.conf 
usage: nc [-46DdhklnrStUuvzC] [-i interval] [-p source_port]
	  [-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_version]
	  [-x proxy_address[:port]] [hostname] [port[s]]

From what I've read, I expect it to wait for a connection on 1234 then dump the file to that port. Unfortunately, it seems like I have a usage problem. The -l is supposed to be for "listen" and the -p is supposed to be for "on port."

Same thing happens with the following command:

Code:
me@me$ nc -vv -z -w2 192.168.31.129
usage: nc [-46DdhklnrStUuvzC] [-i interval] [-p source_port]
	  [-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_version]
	  [-x proxy_address[:port]] [hostname] [port[s]]
Thanks again.

Last edited by unraisedarc; 07-08-2010 at 12:10 AM.
 
Old 07-08-2010, 01:50 AM   #5
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Debian
Posts: 1,266

Rep: Reputation: 99
Did you tried my example.

Usage is
Code:
nc -zuvv IP 'range of ports separated by -'
Example
Code:
nc -zuvv 192.168.1.27 30118-30121
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Close unused ports and SSH annielee Linux - Security 18 12-04-2006 11:46 AM
Closing unused ports jasone Linux - Security 12 07-02-2005 02:49 PM
List of unused ports on a machine linuxprogrammer Linux - Newbie 2 10-18-2004 02:20 PM
List of unused ports on a machine linuxprogrammer Linux - Newbie 4 10-18-2004 02:20 PM
List of unused ports on a machine linuxprogrammer Linux - Networking 1 10-18-2004 02:42 AM


All times are GMT -5. The time now is 01:53 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration