LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-10-2011, 03:19 PM   #1
dazdaz
Member
 
Registered: Aug 2003
Location: Europe
Distribution: RHEL, CentOS, Ubuntu
Posts: 333

Rep: Reputation: 17
opening remote UDP port


Hi, is it possible using a perl script to test for a socket listening on a UDP port on a remote host ?

I work in an environment where netcat is not allowed and from time to time I need to see if a UDP port is open on a remote host.
 
Old 03-10-2011, 03:32 PM   #2
jrtayloriv
Member
 
Registered: Jun 2004
Location: Inland NW, US
Distribution: Ubuntu
Posts: 366
Blog Entries: 1

Rep: Reputation: 44
Take a look at this.

After you've read through the above, I'd also recommend taking a quick look at this.

Last edited by jrtayloriv; 03-10-2011 at 03:34 PM.
 
1 members found this post helpful.
Old 05-14-2011, 03:43 PM   #3
dazdaz
Member
 
Registered: Aug 2003
Location: Europe
Distribution: RHEL, CentOS, Ubuntu
Posts: 333

Original Poster
Rep: Reputation: 17
I found a good TCP and UDP port scanner wrote in perl here :

http://www.decorous.co.uk/perl.html
 
Old 05-24-2011, 02:42 PM   #4
atavus1
LQ Newbie
 
Registered: Jul 2010
Location: Bogota
Distribution: fedora
Posts: 7

Rep: Reputation: 0
Hi

You could use netcat, but, you need to use option "-u" to specify udp protocol. Ex: "nc -u localhost 3333"

AtAvUs
 
Old 05-24-2011, 02:54 PM   #5
dazdaz
Member
 
Registered: Aug 2003
Location: Europe
Distribution: RHEL, CentOS, Ubuntu
Posts: 333

Original Poster
Rep: Reputation: 17
Yes thanks, I know that, but I was looking for a perl script. It's not always possible to deploy a new binary easily onto a system.
 
Old 05-24-2011, 04:34 PM   #6
atavus1
LQ Newbie
 
Registered: Jul 2010
Location: Bogota
Distribution: fedora
Posts: 7

Rep: Reputation: 0
Hi again.


I found this script in Internet, I hope it will be useful.

Quote:

#!perl -w
use strict;
use Socket;

my %opts = (
i => '127.0.0.1',
t => 'udp',
p => 4971,
);
my $protocol = getprotobyname $opts{t} or die $!;
socket( SOCKET, PF_INET, SOCK_DGRAM, $protocol )
or die "socket creation failed\n$!";
my $internet_addr = inet_aton( $opts{i} )
or die "couldn't convert '$opts{i}' into an Internet address: $!\n";
my $paddr = sockaddr_in( $opts{p}, $internet_addr );

send( SOCKET, "x", 0, $paddr ) or die "FAILURE: $opts{i}:$opts{p} ($opts{t})\n";
print "SUCCESS: $opts{i}:$opts{p} ($opts{t})\n";




AtAvUs
 
Old 05-24-2011, 11:38 PM   #7
dazdaz
Member
 
Registered: Aug 2003
Location: Europe
Distribution: RHEL, CentOS, Ubuntu
Posts: 333

Original Poster
Rep: Reputation: 17
The script above is not very good. Read the comments before the perl script in the link I sent above.
 
  


Reply



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
UDP port answerme Linux - Newbie 8 06-05-2008 07:45 AM
Port Tcp/udp rlnd Linux - Networking 1 06-11-2006 01:05 PM
udp port 1024 frgtn Linux - Security 2 03-27-2005 07:10 AM
UDP Port 1697 RandomIZE Linux - Networking 5 03-23-2004 03:47 PM
How do I open up a UDP port? Dirt Linux - Networking 9 06-06-2003 05:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:22 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration