Solved

Net::RawIP, getopts.pl

Posted on 2003-12-10
7
802 Views
Last Modified: 2006-11-17
what is the meaning of these lines ?Thank you


#!/usr/bin/perl

require 'getopts.pl';
use Net::RawIP;
use IO::Socket;

Getopts('s:d:p:q:w:t:');
$synPacket = new Net::RawIP;
$ackPacket = new Net::RawIP;

die "Usage $0 -s <IP source> -d <IP destination> -p <source port> -q <dest port> -w <window> -t <ttl>"
unless ($opt_s && $opt_d && $opt_p && $opt_q && $opt_w);
0
Comment
Question by:bertinoflex
  • 3
  • 2
7 Comments
 
LVL 3

Accepted Solution

by:
mrh30 earned 25 total points
ID: 9912492
Net::RawIP is a module for manipulating raw IP packets.  See http://search.cpan.org/~skolychev/Net-RawIP-0.1/RawIP.pm for details.

getopts.pl could be anything!  The require before it just means that if it hasn't been loaded already it will be loaded.  There's no way of telling from this code which getops will actually do.

The most likely explanation is that Getopts('s:d:p:q:w:t:') is a function supplied by getopts.pl and that this plucks the command line arguments and puts them in $opt_s etc appropriately.
0
 
LVL 2

Assisted Solution

by:PurplePerls
PurplePerls earned 25 total points
ID: 9912887
0
 
LVL 3

Expert Comment

by:mrh30
ID: 9912918
PurplePerls: There's no guarantee that getopts.pl is the same one though.  It could be anything with the same file name.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 2

Expert Comment

by:PurplePerls
ID: 9913072
From the upper link:
;# getopts.pl - a better getopt.pl

;# Usage:
;#      do Getopts('a:bc');  # -a takes arg. -b & -c not. Sets opt_* as a
;#                           #  side effect.

Of course you are true, it could be anything but getting options :)

0
 
LVL 3

Expert Comment

by:mrh30
ID: 9913092
I do also agree with you though - it is certainly the most likely candidate! :-)
0
 
LVL 20

Expert Comment

by:jmcg
ID: 10218553
Nothing has happened on this question in more than 7 weeks. It's time for cleanup!

My recommendation, which I will post in the Cleanup topic area, is to
split points between mrh30 and PurplePerls.

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now