• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 847
  • Last Modified:

Net::RawIP, getopts.pl

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
bertinoflex
Asked:
bertinoflex
  • 3
  • 2
2 Solutions
 
mrh30Commented:
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
 
PurplePerlsCommented:
0
 
mrh30Commented:
PurplePerls: There's no guarantee that getopts.pl is the same one though.  It could be anything with the same file name.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
PurplePerlsCommented:
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
 
mrh30Commented:
I do also agree with you though - it is certainly the most likely candidate! :-)
0
 
jmcgOwnerCommented:
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now