Changeset 1241

Show
Ignore:
Timestamp:
09/13/08 09:06:08 (2 months ago)
Author:
mbr
Message:

Added --Save-packet-append to allow large sets of SPA packets to be collected by calling fwknop in a loop from a shell

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • fwknop/trunk/fwknop

    r1232 r1241  
    102102my $save_packet_mode = 0; 
    103103my $save_packet_file = ''; 
     104my $save_packet_append = 0; 
    104105my $cmdline_pcap_cmd   = ''; 
    105106my $no_save_last_args  = 0; 
     
    430431        $save_packet_file = "$homedir/fwknop_save_packet.$$"; 
    431432    } 
    432     unlink $save_packet_file if -e $save_packet_file; 
     433    unless ($save_packet_append) { 
     434        unlink $save_packet_file if -e $save_packet_file; 
     435    } 
    433436} 
    434437 
     
    896899    if ($save_packet_mode) { 
    897900        print "    Saving packet data to: $save_packet_file\n" unless $quiet; 
    898         open F, "> $save_packet_file" or die "[*] Could not open ", 
    899             "$save_packet_file: $!"; 
    900         print F $msg; 
     901        if ($save_packet_append) { 
     902            open F, ">> $save_packet_file" or die "[*] Could not open ", 
     903                "$save_packet_file: $!"; 
     904        } else { 
     905            open F, "> $save_packet_file" or die "[*] Could not open ", 
     906                "$save_packet_file: $!"; 
     907        } 
     908        print F $msg, "\n"; 
    901909        close F; 
    902910    } 
     
    16241632        'Save-packet'    => \$save_packet_mode, 
    16251633        'Save-packet-file=s' => \$save_packet_file, 
     1634        'Save-packet-append' => \$save_packet_append, 
    16261635        'Save-dst'       => \$save_destination, 
    16271636        'user-rc=s'      => \$user_rc_file, 
     
    19791988                                 to a file (~/fwknop_save_packet.<pid> by 
    19801989                                 default). 
    1981     --Save-packet-file         - Specify the path to the file where the 
     1990    --Save-packet-file <file>  - Specify the path to the file where the 
    19821991                                 encrypted SPA packet is stored when the 
    19831992                                 --Save-packet argument is used. 
     1993    --Save-packet-append       - Append a newly generated SPA packet to the 
     1994                                 --Save-packet-file instead of overwriting 
     1995                                 an existing file.  This is useful for 
     1996                                 creating lots of SPA packets for testing 
     1997                                 randomness and encryption properties. 
    19841998    --Source-port <port>       - Fix a specific source port for outgoing SPA 
    19851999                                 packets.  This is not usually necessary, 
  • fwknop/trunk/fwknop.8

    r1239 r1241  
    285285command line can be complex and difficult to recall. 
    286286.TP 
    287 .BR \-L "\fR,\fP " \-\^\-Last-host\ \<host> 
     287.BR \-\^\-Last-host\ \<host> 
    288288Instruct 
    289289.B fwknop 
     
    337337See the \-\-NAT-local and \-\-NAT-access command line arguments to fwknop for 
    338338additional details on gaining access to services via a NAT operation. 
     339.TP 
     340.BR \-\^\-Save-packet 
     341Instruct the 
     342.B fwknop 
     343client to write a newly created SPA packet out to a file so that it can be 
     344examined off-line.  The default path is 
     345.I ~/fwknop_save_packet.<pid> 
     346where <pid> is the process ID of the fwknop client process, but this can be 
     347changed with the \-\-Save-packet-file argument (see below). 
     348.TP 
     349.BR \-\^\-Save-packet-file\ \<file> 
     350Specify the file to write a new SPA packet to in 
     351.I \-\-Save-packet 
     352mode. 
     353.TP 
     354.BR \-\^\-Save-packet-append 
     355In 
     356.I \-\-Save-packet 
     357mode fwknop normally overwrite the file used to save a new SPA packet, but 
     358this command line argument instructs fwknop to append a new SPA packet to 
     359the file instead.  This is useful for generating large sets of SPA packets 
     360in order to test randomness or encryption properties. 
    339361.TP 
    340362.BR \-\^\-time-offset-plus\ \<time>