mirror of
https://github.com/drwetter/testssl.sh.git
synced 2025-01-01 06:19:44 +01:00
Major imporvement to unit test for client simulations
- we don't check the head line only but errors - don't use "pass" if you didn't run a test - add simulation for http too
This commit is contained in:
parent
2176f29104
commit
c38a1e6896
@ -1,25 +1,55 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
# Just a functional test, whether there are any problems on the client side
|
||||
# Probably we could also inspect the JSON for any problems for
|
||||
# "id" : "scanProblem"
|
||||
# "finding" : "Scan interrupted"
|
||||
|
||||
use strict;
|
||||
use Test::More;
|
||||
use Data::Dumper;
|
||||
use JSON;
|
||||
|
||||
my $tests = 0;
|
||||
my $check2run ="--client-simulation -q --ip=one --color 0";
|
||||
|
||||
unlink "tmp.json";
|
||||
pass("Running openssl based client simulations against smtp-relay.gmail.com:587"); $tests++;
|
||||
my $opensslout = `./testssl.sh --client-simulation --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++;
|
||||
unlink "tmp.json";
|
||||
my $socketout = `./testssl.sh --client-simulation -t smtp --jsonfile tmp.json --color 0 smtp-relay.gmail.com:587`;
|
||||
printf "\n%s\n", "Running socket based client simulations against google.com ...";
|
||||
# $tests++;
|
||||
my $socketout = `./testssl.sh $check2run --jsonfile tmp.json google.com`;
|
||||
my $socket = json('tmp.json');
|
||||
like($socketout, qr/Running client simulations via sockets/, "Tests ran via sockets"); $tests++;
|
||||
#FIXME: This comparison is maybe not sufficient yet:
|
||||
unlike($socketout, qr/(e|E)rror|(f|F)atal/, "");
|
||||
$tests++;
|
||||
|
||||
|
||||
unlink "tmp.json";
|
||||
printf "\n%s\n", "Running OpenSSL based client simulations against google.com ...";
|
||||
# $tests++;
|
||||
my $opensslout = `./testssl.sh $check2run --ssl-native --jsonfile tmp.json google.com`;
|
||||
my $openssl = json('tmp.json');
|
||||
#FIXME: This comparison is maybe sufficient yet:
|
||||
unlike($opensslout, qr/(e|E)rror|(f|F)atal|Oops|s_client connect problem/, "");
|
||||
$tests++;
|
||||
|
||||
|
||||
unlink "tmp.json";
|
||||
printf "\n%s\n", "STARTTLS: Running socket based client simulations against smtp-relay.gmail.com:587 ...";
|
||||
# $tests++;
|
||||
my $socketout = `./testssl.sh $check2run --jsonfile tmp.json -t smtp smtp-relay.gmail.com:587`;
|
||||
my $socket = json('tmp.json');
|
||||
unlike($socketout, qr/(e|E)rror|(f|F)atal/, "");
|
||||
$tests++;
|
||||
|
||||
|
||||
unlink "tmp.json";
|
||||
printf "\n%s\n", "STARTTLS: Running OpenSSL based client simulations against smtp-relay.gmail.com:587 ...";
|
||||
# $tests++;
|
||||
my $opensslout = `./testssl.sh --ssl-native $check2run --jsonfile tmp.json -t smtp smtp-relay.gmail.com:587`;
|
||||
my $openssl = json('tmp.json');
|
||||
unlike($opensslout, qr/(e|E)rror|(f|F)atal|Oops|s_client connect problem/, "");
|
||||
$tests++;
|
||||
|
||||
#my $i = 0;
|
||||
#foreach my $o ( @$openssl ) {
|
||||
# my $s = $$socket[$i];
|
||||
@ -42,5 +72,3 @@ sub json($) {
|
||||
return from_json($file);
|
||||
}
|
||||
|
||||
# problem: 1-4 ok but of limited use: wy should we test whether runs really via sockets or openssl??
|
||||
# 5-n: no sense, we know sockets and ssl are diffferent why should we have a unit test comparing those???
|
||||
|
Loading…
Reference in New Issue
Block a user