Changeset 591

Show
Ignore:
Timestamp:
11/05/06 15:55:00 (2 years ago)
Author:
mbr
Message:

added --Show-last-cmd and --Show-host-cmd args to fwknop

Files:

Legend:

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

    r588 r591  
    1818      the REQUIRE_SOURCE_ADDRESS criteria can be applied by the fwknopd 
    1919      server. 
     20    - Added --Show-last-cmd and --Show-host-cmd args to fwknop so that the 
     21      last fwknop command and the last fwknop host commands can be viewed. 
    2022    - Added the svn revision number to --Version and --help output. 
    2123 
  • fwknop/trunk/fwknop

    r590 r591  
    7373my $server_proto  = ''; 
    7474my $run_last_host = ''; 
     75my $show_last_host_cmd = ''; 
     76my $show_last_cmd = 0; 
    7577my $gpg_home_dir  = ''; 
    7678my $gpg_recipient = ''; 
     
    172174$knock_dst_pre_resolve = $knock_dst; 
    173175 
    174 if ($run_last_args) { 
     176if ($run_last_args or $show_last_cmd) { 
     177 
    175178    ### run fwknop with same command line args as the previous 
    176179    ### execution 
    177180    &run_last_cmdline(); 
    178 } elsif ($run_last_host) { 
     181 
     182} elsif ($run_last_host or $show_last_host_cmd) { 
     183 
     184    $run_last_host = $show_last_host_cmd if $show_last_host_cmd; 
     185 
    179186    ### run fwknop with the last args for this particular knock destination 
    180187    &run_last_host_cmdline(); 
     
    264271 
    265272### save our command line args (so -l can be used next time) 
    266 &save_args() unless $run_last_args or $run_last_host or $no_save_last_args; 
     273unless ($run_last_args or $run_last_host or $no_save_last_args 
     274        or $show_last_cmd or $show_last_host_cmd) { 
     275    &save_args(); 
     276
    267277 
    268278if (lc($server_mode) eq 'pcap' or lc($server_mode) eq 'knock') { 
     
    11081118        'no-save-args'   => \$no_save_last_args, 
    11091119        'Last-host=s'    => \$run_last_host, 
     1120        'Show-last-cmd'  => \$show_last_cmd, 
     1121        'Show-host-cmd=s' => \$show_last_host_cmd, 
    11101122        'Resolve-external-IP' => \$resolve_external_ip, 
    11111123        'whatismyip'     => \$resolve_external_ip, # for backwards compatibility 
     
    11291141        close S; 
    11301142        chomp $arg_line; 
     1143 
     1144        if ($show_last_cmd) { 
     1145            print "[+] Last fwknop client command line: $arg_line\n"; 
     1146            exit 0; 
     1147        } 
    11311148        print "[+] Running with last command line args: $arg_line\n" 
    11321149            unless $quiet; 
     
    11571174        if ($arg_line) { 
    11581175            chomp $arg_line; 
     1176 
     1177            if ($show_last_host_cmd) { 
     1178                print "[+] Last command run for host: $show_last_host_cmd\n", 
     1179                    "    $arg_line\n"; 
     1180                exit 0; 
     1181            } 
    11591182            print "[+] Running with last command line args: $arg_line\n" 
    11601183                unless $quiet; 
     
    12811304    --no-save-args             - Do not save command line args to 
    12821305                                 ~/.fwknop.run file. 
     1306    --Show-last-cmd            - Display the last fwknop command and exit. 
     1307    --Show-host-cmd <host>     - Display the last fwknop command that was 
     1308                                 executed for <host> and exit. 
    12831309    -d, --debug                - Run fwknop in debugging mode. 
    12841310    -v, --verbose              - Verbose mode.