michardy/account-hijacking-prevention

View on GitHub
static/html/typing_test.html

Summary

Maintainability
Test Coverage
<!DOCTYPE html>
<html>
    <head>
        <title>Keystroke Dynamics Module Test Page</title>
        <script>var hijackingPreventionCK = "testClientKey";var hijackingPreventionSID = "sid";</script>
        <script src="/static/js/send.js"></script>
        <script src="/dynamic/collect.js"></script>
        <script>
            //Runs da console and stuff
            function invoke_api(){
                var xhttpr = new XMLHttpRequest();
                xhttpr.open("POST", document.getElementById('action').value);
                xhttpr.setRequestHeader("Content-type", "application/json");
                xhttpr.onreadystatechange = function () {
                    if (xhttpr.readyState == 4 && xhttpr.status == 200) {
                        document.getElementById('console').textContent = xhttpr.responseText;
                    }
                }
                xhttpr.send(document.getElementById('json').value);
            }
        </script>
    <head>
    <body>
        <h1>Keystroke Dynamics Module Test Page</h1>
        <h3>Type something here</h3>
        <textarea></textarea>
        <h3>Data Processing</h3>
        <textarea id="json">{"uid":"uid", "sid":"sid", "ak":"testServerKey"}</textarea><br/>
        <input type="text" id="action" value="/api/get_trust"></input><br/>
        <button onclick="invoke_api()">Process</button><br/>
        <code id="console"></code>
    </body>
</head>