<commit_before>
        <div id="page-intro">
            <h2 id="page_header">Attached to instance @<%=remove_proto( params['url'] )%></h2>
            <p id="page_description">
                This page allows you to see what's going on at the other end of the wire (i.e. get status messages directly from the remote scanner).
                <br/>
                <br/>
            </p>

            <div id="control_buttons">
                <%if !shutdown %>

                <%if !paused %>
                    <form action="/instance/<%=remove_proto( params['url'] )%>/pause" method="post">
                        <%= csrf_tag %>
                        <input type="submit" value="Pause" />
                    </form>
                <%end%>

                <%if paused %>
                <form action="/instance/<%=remove_proto( params['url'] )%>/resume" method="post">
                    <%= csrf_tag %>
                    <input type="submit" value="Resume" />
                </form>
                <%end%>

                <form action="/instance/<%=remove_proto( params['url'] )%>/shutdown" method="post">
                    <%= csrf_tag %>
                    <input type="submit" value="Shutdown" />
                </form>

                <% end %>
            </div>
        </div>

        <%= erb :flash, {:layout => false} %>

        <div id="scan_data">
            <div class="left">
                <h3>Scan statisics</h3>
                <ul>
                    <li>Pages discovered: <span id="crawled">0</span></li>
                    <li>Progress: <span id="percentage">0</span>%</li>
                    <li>Requests/second: <span id="avg">0</span></li>
                    <li>Runtime: <span id="runtime">00:00:00</span></li>
                    <li>Current max concurrency: <span id="max_concurrency">0</span> requests</li>
                    <li>Average response time: <span id="average_res_time">0</span>s</li>
                    <li>Timed-out requests: <span id="time_out_count">0</span></li>

                </ul>
            </div>

            <div class="right">
                <h3>Instances</h3>
                <div style="height: 245px; overflow-y: scroll" id="currently_auditing">
                </div>
            </div>

            <div>
                <p><em>
                    (Due to the fact that Arachni discovers pages using 2 complementary systems (the Spider and the Trainer)
                    you may see some backwards progress or other weird progress behavior.)
                </em></p>
                <div id="progressbar"></div>
            </div>

            <div class="left">
                <h3>Scanner output:</h3>
                <div class="output" id="output"></div>
            </div>

            <div class="right">
                <h3>Results thus far:</h3>
                <div class="output" id="output_results"></div>
            </div>

            <div style="display: none" id="dialog-loading" title="Loading the scan report...">
                <p>
                    Please wait while the scan report is being loaded. <br/>
                    This process maybe take a while depending on the size of the report.
                </p>
                <p>
                    <em>
                        If the loading process takes an unusually long time the zombie reaper
                        may have beaten you to it.<br/>
                        Use the "Reports" tab to view the report.
                    </em>
                </p>
            </div>

            <div style="display: none" id="dialog-shutdown" title="The scanner has been shutdown...">
                <p>
                    The report is waiting for you <a href="/reports">here</a>.
                </p>
            </div>

            <script type="text/javascript">
                //<![CDATA[

                function inspect( id ){
                    $( id ).dialog({
                        height: 500,
                        width: 1000,
                        modal: true
                    });
                }

                function setProgressBar( progress ) {
                    $( "#progressbar" ).progressbar({
                        value: progress
                    });
                }

                function showReport( html ){
                    document.getElementById( 'control_buttons' ).innerHTML = ""
                    document.getElementById( 'page_header' ).innerHTML = "Report"
                    document.getElementById( 'page_description' ).innerHTML =
                        "The scan has completed succesfully, you can review the results using this report.<br/>" +
                        "This report has been saved and you can view or export it in various format via the Reports tab."

                    document.getElementById( 'scan_data' ).innerHTML = "<iframe class='report' src=" + html + "></iframe>"
                }

                function setStats( stats ){
                    if( stats == undefined ){ return }

                    document.getElementById( 'crawled' ).innerHTML = stats.sitemap_size;
                    document.getElementById( 'average_res_time' ).innerHTML = stats.average_res_time;
                    document.getElementById( 'avg' ).innerHTML = stats.avg;
                    document.getElementById( 'time_out_count' ).innerHTML = stats.time_out_count;
                    document.getElementById( 'max_concurrency' ).innerHTML = stats.max_concurrency;

                    document.getElementById( 'runtime' ).innerHTML = stats.time;
                    document.getElementById( 'percentage' ).innerHTML = parseInt( stats.progress );

                    elem = document.getElementById( 'currently_auditing');
                    elem.innerHTML = '';
                    for( i in stats.instances ) {

                        elem.innerHTML += '<strong>' + stats.instances[i].url +
                        ' - ' + stats.instances[i].progress + '%' + '</strong> <br/>';

                        status = stats.instances[i].status
                        if( status == 'busy' ) {
                            page = stats.instances[i].current_page;

                            elem.innerHTML += 'Currently auditing: ' + '<a href="' +
                            page + '">' + page + '</a>';
                        } else {
                            elem.innerHTML += status.charAt(0).toUpperCase() + status.slice(1);
                        }

                        elem.innerHTML += '<div style="height:20px" id="progressbar_' + i + '"></div> <br/>';

                        $( "#progressbar_" + i ).progressbar({
                            value: stats.instances[i].progress
                        });

                    }

                }

                function updateOutput() {
                    var output_url = "/instance/<%= escape( params['url'].to_s ) %>/output.json";
                    $.getJSON( output_url, function(data) {

                        if( data.messages.status == 'finished' ){
                            showShutdownDialog( );<commit_msg>added ETA to the instance progress<commit_after>
        <div id="page-intro">
            <h2 id="page_header">Attached to instance @<%=remove_proto( params['url'] )%></h2>
            <p id="page_description">
                This page allows you to see what's going on at the other end of the wire (i.e. get status messages directly from the remote scanner).
                <br/>
                <br/>
            </p>

            <div id="control_buttons">
                <%if !shutdown %>

                <%if !paused %>
                    <form action="/instance/<%=remove_proto( params['url'] )%>/pause" method="post">
                        <%= csrf_tag %>
                        <input type="submit" value="Pause" />
                    </form>
                <%end%>

                <%if paused %>
                <form action="/instance/<%=remove_proto( params['url'] )%>/resume" method="post">
                    <%= csrf_tag %>
                    <input type="submit" value="Resume" />
                </form>
                <%end%>

                <form action="/instance/<%=remove_proto( params['url'] )%>/shutdown" method="post">
                    <%= csrf_tag %>
                    <input type="submit" value="Shutdown" />
                </form>

                <% end %>
            </div>
        </div>

        <%= erb :flash, {:layout => false} %>

        <div id="scan_data">
            <div class="left">
                <h3>Scan statisics</h3>
                <ul>
                    <li>Pages discovered: <span id="crawled">0</span></li>
                    <li>Progress: <span id="percentage">0</span>%</li>
                    <li>Requests/second: <span id="avg">0</span></li>
                    <li>Runtime: <span id="runtime">00:00:00</span></li>
                    <li>Current max concurrency: <span id="max_concurrency">0</span> requests</li>
                    <li>Average response time: <span id="average_res_time">0</span>s</li>
                    <li>Timed-out requests: <span id="time_out_count">0</span></li>

                </ul>
            </div>

            <div class="right">
                <h3>Instances</h3>
                <div style="height: 245px; overflow-y: scroll" id="currently_auditing">
                </div>
            </div>

            <div>
                <p><em>
                    (Due to the fact that Arachni discovers pages using 2 complementary systems (the Spider and the Trainer)
                    you may see some backwards progress or other weird progress behavior.)
                </em></p>
                <div id="progressbar"></div>
            </div>

            <div class="left">
                <h3>Scanner output:</h3>
                <div class="output" id="output"></div>
            </div>

            <div class="right">
                <h3>Results thus far:</h3>
                <div class="output" id="output_results"></div>
            </div>

            <div style="display: none" id="dialog-loading" title="Loading the scan report...">
                <p>
                    Please wait while the scan report is being loaded. <br/>
                    This process maybe take a while depending on the size of the report.
                </p>
                <p>
                    <em>
                        If the loading process takes an unusually long time the zombie reaper
                        may have beaten you to it.<br/>
                        Use the "Reports" tab to view the report.
                    </em>
                </p>
            </div>

            <div style="display: none" id="dialog-shutdown" title="The scanner has been shutdown...">
                <p>
                    The report is waiting for you <a href="/reports">here</a>.
                </p>
            </div>

            <script type="text/javascript">
                //<![CDATA[

                function inspect( id ){
                    $( id ).dialog({
                        height: 500,
                        width: 1000,
                        modal: true
                    });
                }

                function setProgressBar( progress ) {
                    $( "#progressbar" ).progressbar({
                        value: progress
                    });
                }

                function showReport( html ){
                    document.getElementById( 'control_buttons' ).innerHTML = ""
                    document.getElementById( 'page_header' ).innerHTML = "Report"
                    document.getElementById( 'page_description' ).innerHTML =
                        "The scan has completed succesfully, you can review the results using this report.<br/>" +
                        "This report has been saved and you can view or export it in various format via the Reports tab."

                    document.getElementById( 'scan_data' ).innerHTML = "<iframe class='report' src=" + html + "></iframe>"
                }

                function setStats( stats ){
                    if( stats == undefined ){ return }

                    document.getElementById( 'crawled' ).innerHTML = stats.sitemap_size;
                    document.getElementById( 'average_res_time' ).innerHTML = stats.average_res_time;
                    document.getElementById( 'avg' ).innerHTML = stats.avg;
                    document.getElementById( 'time_out_count' ).innerHTML = stats.time_out_count;
                    document.getElementById( 'max_concurrency' ).innerHTML = stats.max_concurrency;

                    document.getElementById( 'runtime' ).innerHTML = stats.time;
                    document.getElementById( 'percentage' ).innerHTML = parseInt( stats.progress );

                    elem = document.getElementById( 'currently_auditing');
                    elem.innerHTML = '';
                    for( i in stats.instances ) {

                        elem.innerHTML += '<strong>' + stats.instances[i].url +
                        ' - ' + stats.instances[i].progress + '%' +
                        ' - Est. remaining time: ' + stats.instances[i].eta + '</strong> <br/>';

                        status = stats.instances[i].status
                        if( status == 'busy' ) {
                            page = stats.instances[i].current_page;

                            elem.innerHTML += 'Currently auditing: ' + '<a href="' +
                            page + '">' + page + '</a>';
                        } else {
                            elem.innerHTML += status.charAt(0).toUpperCase() + status.slice(1);
                        }

                        elem.innerHTML += '<div style="height:20px" id="progressbar_' + i + '"></div> <br/>';

                        $( "#progressbar_" + i ).progressbar({
                            value: stats.instances[i].progress
                        });

                    }

                }

                function updateOutput() {
                    var output_url = "/instance/<%= escape( params['url'].to_s ) %>/output.json";
                    $.getJSON( output_url, function(data) {

                        if( data.messages.status == 'finished' ){
                            showShutdownDialog( );
{'fraction_non_alphanumeric': 0.1268465219502046, 'fraction_numerical': 0.005132117345169568, 'mean_word_length': 1.253477105797781, 'pattern_counts': {'":': 0, '<': 251, '<?xml version=': 0, '>': 251, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4813820', 'n_tokens_mistral': 3762, 'n_tokens_neox': 3370, 'n_words': 889}