mirror of
https://github.com/drwetter/testssl.sh.git
synced 2025-01-10 18:50:58 +01:00
d8fb7dc680
it's too late now to do something about it
39 lines
1.2 KiB
Perl
Executable File
39 lines
1.2 KiB
Perl
Executable File
#!/usr/bin/env perl
|
|
|
|
use strict;
|
|
use Test::More;
|
|
use Data::Dumper;
|
|
use JSON;
|
|
|
|
my $tests = 0;
|
|
|
|
pass("Running openssl based client simulations against smtp-relay.gmail.com:587"); $tests++;
|
|
my $opensslout = `./testssl.sh -c --ssl-native -t smtp --jsonfile tmp.json --color 0 smtp-relay.gmail.com:587`;
|
|
my $openssl = json('tmp.json');
|
|
unlike($opensslout, qr/Running client simulations via sockets/, "Tests didn't run via sockets"); $tests++;
|
|
|
|
pass("Running socket based client simulations against smtp-relay.gmail.com:587"); $tests++;
|
|
my $socketout = `./testssl.sh -c -t smtp --jsonfile tmp.json --color 0 smtp-relay.gmail.com:587`;
|
|
my $socket = json('tmp.json');
|
|
like($socketout, qr/Running client simulations via sockets/, "Tests ran via sockets"); $tests++;
|
|
|
|
my $i = 0;
|
|
foreach my $o ( @$openssl ) {
|
|
my $s = $$socket[$i];
|
|
if ( $o->{id} =~ /^client_/ ) {
|
|
pass("Comparing $o->{id}"); $tests++;
|
|
cmp_ok($o->{id}, "eq", $s->{id}, "Id's match"); $tests++;
|
|
cmp_ok($o->{severity}, "eq", $s->{severity}, "Severities match"); $tests++;
|
|
cmp_ok($o->{finding}, "eq", $s->{finding}, "Findings match"); $tests++;
|
|
}
|
|
$i++;
|
|
}
|
|
|
|
done_testing($tests);
|
|
|
|
sub json($) {
|
|
my $file = shift;
|
|
$file = `cat $file`;
|
|
unlink $file;
|
|
return from_json($file);
|
|
} |