aboutsummaryrefslogtreecommitdiff
path: root/scripts/print-profile.py
blob: 081d26024925bcd7d272efb24e1f9e3ad53f0687 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# $Id$
#
# Copyright (C) 2010  Internet Systems Consortium, Inc. ("ISC")
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.

import pstats, glob

for f in glob.iglob("*.prof"):
  pstats.Stats(f).sort_stats("time").print_stats(50)
alt'>
 
      
                                   
         
 
                 
 







                               

 
               









                                                                           

                 









                                                      

             


                                         
 
:
# $Id$
eval 'exec perl -w -S $0 ${1+"$@"}'
    if 0;

use MIME::Base64;

sub g {
    my $x = shift;
    $x =~ s{:}{}g;
    $x = pack("H*", $x);
    $x = encode_base64($x, "");
    $x =~ y{+/}{-_};
    $x =~ s{=+$}{};
    return $x;
}

while (@ARGV) {
    my ($file, $aki, $ski, $a, $s) = shift(@ARGV);
    if ($file =~ /\.cer$/) {
	open(F, "-|", qw(openssl x509 -noout -inform DER -text -in), $file)
	    or die("Couldn't run openssl x509 on $file: $!\n");
    } elsif  ($file =~ /\.crl$/) {
	open(F, "-|", qw(openssl crl  -noout -inform DER -text -in), $file)
	    or die("Couldn't run openssl x509 on $file: $!\n");
    } else {
	next;
    }
    while (<F>) {
	chomp;
	s/^\s*//;
	s/^keyid://;
	$a = $. + 1
	    if (/X509v3 Authority Key Identifier:/);
	$s = $. + 1
	    if (/X509v3 Subject Key Identifier:/);    
	$aki = $_
	    if ($a && $. == $a);
	$ski = $_
	    if ($s && $. == $s);
    }
    close(F);
    my $gaki = $aki ? g($aki) : "=" x 27;
    my $gski = $ski ? g($ski) : "=" x 27;
    print("$gaki $gski $file\n");
}