view libtomcrypt/filter.pl @ 984:d46e7f613157

Handle invalid agent keys by skipping rather than exiting. My agent exposes both conventional keys and certs ([email protected]) and I want dropbear to be able to use the former.
author Catalin Patulea <cat@vv.carleton.ca>
date Thu, 01 Jan 2015 17:47:46 -0500
parents 0cbe8f6dbf9e
children
line wrap: on
line source

#!/usr/bin/perl

# we want to filter every between START_INS and END_INS out and then insert crap from another file (this is fun)

$dst = shift;
$ins = shift;

open(SRC,"<$dst");
open(INS,"<$ins");
open(TMP,">tmp.delme");

$l = 0;
while (<SRC>) {
   if ($_ =~ /START_INS/) {
      print TMP $_;
      $l = 1;
      while (<INS>) {
         print TMP $_;
      }
      close INS;
   } elsif ($_ =~ /END_INS/) {
      print TMP $_;
      $l = 0;
   } elsif ($l == 0) {
      print TMP $_;
   }
}

close TMP;
close SRC;