| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"> |
| 5 |
<meta content="utf-8" http-equiv="encoding"> |
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1"> |
| 7 |
<title>dirsearch report</title> |
| 8 |
<style> |
| 9 |
* { |
| 10 |
color: #eef1f3; |
| 11 |
} |
| 12 |
th.active .arrow { |
| 13 |
opacity: 1; |
| 14 |
} |
| 15 |
.arrow { |
| 16 |
display: inline-block; |
| 17 |
vertical-align: middle; |
| 18 |
width: 0; |
| 19 |
height: 0; |
| 20 |
margin-left: 5px; |
| 21 |
opacity: 0.66; |
| 22 |
} |
| 23 |
.arrow.none { |
| 24 |
border-left: 4px solid transparent; |
| 25 |
border-right: 4px solid transparent; |
| 26 |
border-bottom: 4px solid #82b983; |
| 27 |
} |
| 28 |
.arrow.asc { |
| 29 |
border-left: 4px solid transparent; |
| 30 |
border-right: 4px solid transparent; |
| 31 |
border-bottom: 4px solid #42b983; |
| 32 |
} |
| 33 |
.arrow.dsc { |
| 34 |
border-left: 4px solid transparent; |
| 35 |
border-right: 4px solid transparent; |
| 36 |
border-top: 4px solid #42b983; |
| 37 |
} |
| 38 |
</style> |
| 39 |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js" integrity="sha384-ma9ivURrHX5VOB4tNq+UiGNkJoANH4EAJmhxd1mmDq0gKOv88wkKZOfRDOpXynwh" crossorigin="anonymous"></script> |
| 40 |
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-wEmeIV1mKuiNpC+IOBjI7aAzPcEZeedi5yW5f2yOq55WWLwNGmvvx4Um1vskeMj0" crossorigin="anonymous"> |
| 41 |
<script> |
| 42 |
|
| 43 |
function openURLs(){ |
| 44 |
var table = document.getElementsByClassName("table")[0]; |
| 45 |
for (let row of table.rows) { |
| 46 |
let val = row.cells[0].innerText; |
| 47 |
if (val == "URL" || val == null) |
| 48 |
continue; |
| 49 |
window.open(val, '_blank'); |
| 50 |
} |
| 51 |
} |
| 52 |
function search(app, result){ |
| 53 |
return app.searchQuery.toLowerCase().split(" ").every( |
| 54 |
(v) => result.url.toLowerCase().includes(v) || |
| 55 |
(result.contentType && result.contentType.toLowerCase().includes(v)) || |
| 56 |
result.contentLength.toLowerCase().includes(v) || |
| 57 |
result.status.toString().includes(v) || |
| 58 |
(result.redirect && result.redirect.toLowerCase().includes(v)) |
| 59 |
); |
| 60 |
} |
| 61 |
function statusExcludeSearch(app, result){ |
| 62 |
return app.statusExcludeSearchQuery.toLowerCase().split(" ").every( |
| 63 |
(v) => !result.status.toString().includes(v) |
| 64 |
); |
| 65 |
} |
| 66 |
function lengthExcludeSearch(app, result){ |
| 67 |
return app.lengthExcludeSearchQuery.toLowerCase().split(" ").every( |
| 68 |
(v) => !result.contentLength.toLowerCase() != v |
| 69 |
); |
| 70 |
} |
| 71 |
function sort(app, results){ |
| 72 |
if(app.sortColumn == null){ |
| 73 |
return results |
| 74 |
} |
| 75 |
|
| 76 |
return results.sort(function(a, b){ |
| 77 |
if(a[app.sortColumn.name] < b[app.sortColumn.name]){ |
| 78 |
return -1 * app.sortColumn.order; |
| 79 |
} |
| 80 |
if(a[app.sortColumn.name] > b[app.sortColumn.name]){ |
| 81 |
return 1 * app.sortColumn.order; |
| 82 |
} |
| 83 |
return 0 |
| 84 |
}); |
| 85 |
} |
| 86 |
|
| 87 |
window.onload = function () { |
| 88 |
var app = new Vue({ |
| 89 |
el: '#app', |
| 90 |
delimiters: ['[[', ']]'], |
| 91 |
data: { |
| 92 |
lengthExcludeSearchQuery: null, |
| 93 |
statusExcludeSearchQuery: null, |
| 94 |
searchQuery: null, |
| 95 |
resources: {{ results | tojson }}, |
| 96 |
sortColumn: null, |
| 97 |
columns: [ |
| 98 |
{name: 'url', text: 'URL', order: -1}, |
| 99 |
{name: 'status', text: 'Status', order: -1}, |
| 100 |
{name: 'contentLength', text: 'Content Length', order: -1}, |
| 101 |
{name: 'contentType', text: 'Content Type', order: -1}, |
| 102 |
{name: 'redirect', text: 'Redirect', order: -1}, |
| 103 |
] |
| 104 |
}, |
| 105 |
methods: { |
| 106 |
joinUrl: function(url, redirect){ |
| 107 |
return new URL(redirect, url).href; |
| 108 |
}, |
| 109 |
getReadableSize: function(bytes){ |
| 110 |
if (!bytes) return '0 B' |
| 111 |
|
| 112 |
const base = 1024 |
| 113 |
const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] |
| 114 |
const i = Math.floor(Math.log(bytes) / Math.log(base)) |
| 115 |
|
| 116 |
return `${Math.round(bytes / Math.pow(base, i))} ${units[i]}` |
| 117 |
}, |
| 118 |
getStatusColorClass: function(statusCode){ |
| 119 |
if (statusCode <= 199) return ""; |
| 120 |
if (statusCode <= 299) return "text-success"; |
| 121 |
if (statusCode <= 399) return "text-info"; |
| 122 |
if (statusCode <= 499) return "text-warning"; |
| 123 |
if (statusCode <= 599) return "text-danger"; |
| 124 |
} |
| 125 |
|
| 126 |
}, |
| 127 |
computed: { |
| 128 |
results: function(){ |
| 129 |
arr = this.resources |
| 130 |
if(this.searchQuery){ |
| 131 |
arr = arr.filter((result)=>{ |
| 132 |
return search(this, result) |
| 133 |
}); |
| 134 |
} |
| 135 |
if(this.statusExcludeSearchQuery){ |
| 136 |
arr = arr.filter((result)=>{ |
| 137 |
return statusExcludeSearch(this, result) |
| 138 |
}); |
| 139 |
} |
| 140 |
if(this.lengthExcludeSearchQuery){ |
| 141 |
arr = arr.filter((result)=>{ |
| 142 |
return lengthExcludeSearch(this, result) |
| 143 |
}); |
| 144 |
} |
| 145 |
|
| 146 |
return sort(this, arr); |
| 147 |
} |
| 148 |
} |
| 149 |
}); |
| 150 |
} |
| 151 |
</script> |
| 152 |
</head> |
| 153 |
<body style="background-color: #3f3f3f;"> |
| 154 |
<div id="app"> |
| 155 |
<div class="panel panel-default"> |
| 156 |
<div class="navbar navbar-expand-lg navbar-light bg-light"> |
| 157 |
<div class="p-3"> |
| 158 |
<h1><a href="https://github.com/maurosoria/dirsearch" style="text-decoration:none;color:#c84949;">dirsearch</a></h1> |
| 159 |
</div> |
| 160 |
</div> |
| 161 |
<br> |
| 162 |
<div class="w-75 p-3 mx-auto"> |
| 163 |
<span style="color: #eef1f3;"> |
| 164 |
<strong>Command: </strong> |
| 165 |
<!-- Prevent Vue.js client-side template injection. Reference: https://portswigger.net/web-security/cross-site-scripting/cheat-sheet#vuejs-reflected --> |
| 166 |
<code style="display:inline;background-color:#5C6060;color:#F7F9F9;border-radius:4px;">{{ metadata['command'] | e | replace('[', '<code>[</code>') }}</code> |
| 167 |
<br> |
| 168 |
<strong>Time:</strong> <p style="display:inline;">{{ metadata['date'] | e }}</p> |
| 169 |
<br> |
| 170 |
</span> |
| 171 |
<br> |
| 172 |
<div class="row"> |
| 173 |
<div class="search-wrapper panel-heading col-sm-4"> |
| 174 |
<input class="form-control" type="text" v-model="statusExcludeSearchQuery" placeholder="Exclude status codes, separated by space" /> |
| 175 |
</div> |
| 176 |
<div class="search-wrapper panel-heading col-sm-4"> |
| 177 |
<input class="form-control" type="text" v-model="lengthExcludeSearchQuery" placeholder="Exclude content lengths, separated by space" /> |
| 178 |
</div> |
| 179 |
<div class="col-sm-4"> |
| 180 |
<button onclick="openURLs()" type="button" class="btn btn-danger">Open all URLs</button> |
| 181 |
</div> |
| 182 |
<br> |
| 183 |
<br> |
| 184 |
<div class="search-wrapper panel-heading col-sm-12"> |
| 185 |
<input class="form-control" type="text" v-model="searchQuery" placeholder="Search" /> |
| 186 |
</div> |
| 187 |
</div> |
| 188 |
<br> |
| 189 |
<div class="table-responsive"> |
| 190 |
<table v-if="resources.length" class="table"> |
| 191 |
<tbody> |
| 192 |
<tr> |
| 193 |
<th v-for="column in columns" @click="sortColumn = column; column.order = column.order * -1" :class="{active: column == sortColumn}" style="cursor:context-menu"> |
| 194 |
[[column.text]] |
| 195 |
<span v-bind:class="['arrow', sortColumn != column ? 'none' : column.order > 0 ? 'asc' : 'dsc']"></span> |
| 196 |
</th> |
| 197 |
</tr> |
| 198 |
<tr v-for="result in results"> |
| 199 |
<td><a v-bind:class="getStatusColorClass(result.status)" v-bind:href="result.url" class="text-decoration-none" target="_blank">[[result.url]]</a></td> |
| 200 |
<td><a v-bind:class="getStatusColorClass(result.status)" class="text-decoration-none" target="_blank">[[result.status]]</a></td> |
| 201 |
<td><a :title="result.contentLength" target="_blank">[[getReadableSize(result.contentLength)]]</a></td> |
| 202 |
<td><a target="_blank">[[result.contentType]]</a></td> |
| 203 |
<!-- If you remove the "style" attribute, the redirect URL will be colored, it's a weird bug that I haven't figured out yet --> |
| 204 |
<td><a :href="joinUrl(result.url, result.redirect)" target="_blank" style="color: #eef1f3;">[[result.redirect]]</a></td> |
| 205 |
</tr> |
| 206 |
</tbody> |
| 207 |
</table> |
| 208 |
</div> |
| 209 |
</div> |
| 210 |
</div> |
| 211 |
</div> |
| 212 |
</body> |
| 213 |
</html> |