Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html>
- <head>
- <!--
- NetLogsViewer, March 2022.
- https://www.reddit.com/user/jcunews1
- https://pastebin.com/u/jcunews
- https://greasyfork.org/en/users/85671-jcunews
- -->
- <meta charset=utf-8 />
- <meta http-equiv="x-ua-compatible" content="IE=9" />
- <title>NetLogsViewer</title>
- <style>
- html,body{margin:0;height:100%;font-family:sans-serif}
- table{position:absolute;left:1vw;top:2vh;border-collapse:collapse;box-sizing:border-box;width:98vw;height:96vh;background:#eee}
- td{padding:0}
- td:first-child{width:16em;padding-right:1vw}
- #fileList,#fileView{box-sizing:border-box;width:100%;height:96vh}
- </style>
- </head>
- <body>
- <table><tr>
- <td><select id=fileList size=2></select></td>
- <td><textarea id=fileView wrap=off></textarea></td>
- </tr></table>
- <script>
- fs = new ActiveXObject("scripting.filesystemobject");
- [
- ["Acryllic", "C:\\Program Files (x86)\\NETWORK\\Acrylic\\"],
- ["Apache", "E:\\xampp\\apache\\logs\\"],
- ["PHP", "E:\\xampp\\php\\logs\\"]
- ].forEach(function(ar) {
- dr = fs.getFolder(ar[1]);
- en = new Enumerator(dr.files);
- while (!en.atEnd()) {
- fl = en.item();
- if (/log$/i.test(fl.name)) {
- (o = document.createElement("OPTION")).value = ar[1] + fl.name;
- o.textContent = ar[0] + " " + fl.name;
- fileList.add(o);
- }
- en.moveNext();
- }
- });
- fileList.onchange = function() {
- if (fs.getFile(fileList.value).size) {
- f = fs.openTextFile(fileList.value);
- s = f.readAll();
- f.close();
- } else s = "";
- o = fileList.options[fileList.selectedIndex];
- if (o.textContent.substr(0, 2) === "Ac") {
- fileView.value = s.replace(/\t/g, " ") + "\n";
- } else if (o.textContent.substr(7, 2) === "ss") {
- fileView.value = s.replace(/(TLSv\S+ \S+) ("\S+)/g,
- function(t, a, b) {
- return (a + " ".substr(0, 36 - a.length)) +
- (b + " ".substr(0, 5 - b.length))
- }
- ) + "\n";
- } else {
- fileView.value = s.replace(/\n127.0.0.1|\n::1/g,
- function(t) {
- return t.length > 4 ? t + " " : t + " "
- }
- ) + "\n";
- }
- fileView.selectionStart = fileView.selectionEnd = 0;
- };
- fileList.selectedIndex = 0;
- fileList.onchange();
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement