NAME

HSTS::Preloaded - inspect Chrome's HSTS preloaded list

VERSION

version 1.0.1

DESCRIPTION

This is a library to work with Chrome's HSTS preloaded list.

One can submit hosts for inclusion to the list with the form https://hstspreload.appspot.com/.

And in the source code of Chromium one can see the list of hosts that are currently in the list: https://chromium.googlesource.com/chromium/src/+/master/net/http/transport_security_state_static.json

This library simplifies the work with the preloaded list.

METHODS

new

    my $h = HSTS::Preloaded->new();

The constructor. It creates new object. It downloads all the info from Chrome's HSTS preloaded list and stores it in the object. This is the only method that interacts with intenet. All other methods uses data that object already have.

host_is_in_hsts_preloaded_list

    my $result = $h->host_is_in_hsts_preloaded_list( $host );

Method returns true value if the specified host is in HSTS preloaded list. Otherwise method returns false value.

For example:

    $h->host_is_in_hsts_preloaded_list('google.com'); # true
    $h->host_is_in_hsts_preloaded_list('microsoft.com'); # false

get_all_hsts_preloaded_list_data

    my $data = $h->get_all_hsts_preloaded_list_data();

Returns all the data. You can read the descrioption of the data structure https://code.google.com/p/chromium/codesearch#chromium/src/net/http/transport_security_state_static.json

This remoted returns perl hashref. For the boolean values that were in JSON file the JSON::PP::Boolean objects are used.

Here is an example of some part of the data.

    my $partial_data = $h->get_all_hsts_preloaded_list_data()->{entries}->[619];

The $partial_data will be:

    {
        include_subdomains => JSON::PP::Boolean  {
            public methods (0)
            private methods (1) : __ANON__
            internals: 1
        },
        mode               => "force-https",
        name               => "www.dropbox.com",
        pins               => "dropbox",
    }

AUTHOR

Ivan Bessarabov <ivan@bessarabov.ru>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by Ivan Bessarabov.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.