Esempio n. 1
0
function verify_domain_by_url($url)
{
    // echo "<br/>$url: [".$url."]";
    $certificate_chain_length = load_certificate_chain($url);
    $result_array = get_chain_verification_results($certificate_chain_length, $url);
    $verification_result = verify_chain($result_array) ? "PASS" : "FAIL";
    $result = get_company_data($url);
    $result['verification_result'] = $verification_result;
    $url_matching = match_urls(get_domain_from_url($url), $result['company_url']);
    $result['url_matching'] = $url_matching;
    // unset($result['company_url']); # we don't need it anymore after matching
    return $result;
}
<?php

// include '../test_helper.php';
include '/var/www/html/verify/test/test_helper.php';
// include SSL_ROOT.'verify_ssl.php';
include '/var/www/html/verify/domain/verify_ssl.php';
$results_file_path = TEST_ROOT . '/test_results.html';
// mimicking json from eyal
$verified_json = load_json('verified');
$unverified_json = load_json('unverified');
$fake_networks_json = load_json('fake_networks');
$bofa_url = 'https://www.bankofamerica.com';
// VARS
$good_array = array('good', 'good', 'good');
$bad_array = array('good', 'good', 'bad');
$chain_length = load_certificate_chain($bofa_url);
// BANK OF AMERICA
$bofa = verify_domain($bofa_url);
// WELLS FARGO
$wf_url = 'https://www.wellsfargo.com';
$wf = verify_domain($wf_url);
// GITHUB
$github_url = 'https://github.com';
$github = verify_domain($github_url);
$get_url_test = get_url($verified_json) == $bofa_url ? PASS : FAIL;
$get_domain_from_url_test = get_domain_from_url($bofa_url) == 'www.bankofamerica.com' ? PASS : FAIL;
$bofa_test = $bofa["company_name"] == "Bank of America Corporation" && $bofa["company_url"] == 'www.bankofamerica.com' && $bofa["verification_result"] == 'PASS' ? PASS : FAIL;
$wf_test = $wf["company_name"] == "Wells Fargo and Company" && $wf["company_url"] == 'www.wellsfargo.com' && $wf["verification_result"] == 'PASS' ? PASS : FAIL;
$github_test = $github["company_name"] == "Wells Fargo and Company" && $github["company_url"] == 'www.wellsfargo.com' && $github["verification_result"] == 'PASS' ? PASS : FAIL;
// TESTS
// $var_test = ()? PASS:FAIL;