Advertisement
jcunews

NetLogsViewer.hta

Mar 25th, 2022
1,176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.18 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <!--
  5. NetLogsViewer, March 2022.
  6. https://www.reddit.com/user/jcunews1
  7. https://pastebin.com/u/jcunews
  8. https://greasyfork.org/en/users/85671-jcunews
  9. -->
  10. <meta charset=utf-8 />
  11. <meta http-equiv="x-ua-compatible" content="IE=9" />
  12. <title>NetLogsViewer</title>
  13. <style>
  14. html,body{margin:0;height:100%;font-family:sans-serif}
  15. table{position:absolute;left:1vw;top:2vh;border-collapse:collapse;box-sizing:border-box;width:98vw;height:96vh;background:#eee}
  16. td{padding:0}
  17. td:first-child{width:16em;padding-right:1vw}
  18. #fileList,#fileView{box-sizing:border-box;width:100%;height:96vh}
  19. </style>
  20. </head>
  21. <body>
  22. <table><tr>
  23. <td><select id=fileList size=2></select></td>
  24. <td><textarea id=fileView wrap=off></textarea></td>
  25. </tr></table>
  26. <script>
  27. fs = new ActiveXObject("scripting.filesystemobject");
  28. [
  29.  ["Acryllic", "C:\\Program Files (x86)\\NETWORK\\Acrylic\\"],
  30.  ["Apache", "E:\\xampp\\apache\\logs\\"],
  31.  ["PHP", "E:\\xampp\\php\\logs\\"]
  32. ].forEach(function(ar) {
  33.   dr = fs.getFolder(ar[1]);
  34.   en = new Enumerator(dr.files);
  35.   while (!en.atEnd()) {
  36.     fl = en.item();
  37.     if (/log$/i.test(fl.name)) {
  38.       (o = document.createElement("OPTION")).value = ar[1] + fl.name;
  39.       o.textContent = ar[0] + " " + fl.name;
  40.       fileList.add(o);
  41.     }
  42.     en.moveNext();
  43.   }
  44. });
  45. fileList.onchange = function() {
  46.   if (fs.getFile(fileList.value).size) {
  47.     f = fs.openTextFile(fileList.value);
  48.     s = f.readAll();
  49.     f.close();
  50.   } else s = "";
  51.   o = fileList.options[fileList.selectedIndex];
  52.   if (o.textContent.substr(0, 2) === "Ac") {
  53.     fileView.value = s.replace(/\t/g, " ") + "\n";
  54.   } else if (o.textContent.substr(7, 2) === "ss") {
  55.     fileView.value = s.replace(/(TLSv\S+ \S+) ("\S+)/g,
  56.       function(t, a, b) {
  57.         return (a + "          ".substr(0, 36 - a.length)) +
  58.           (b + " ".substr(0, 5 - b.length))
  59.       }
  60.     ) + "\n";
  61.   } else {
  62.     fileView.value = s.replace(/\n127.0.0.1|\n::1/g,
  63.       function(t) {
  64.         return t.length > 4 ? t + "    " : t + "          "
  65.       }
  66.     ) + "\n";
  67.   }
  68.   fileView.selectionStart = fileView.selectionEnd = 0;
  69. };
  70. fileList.selectedIndex = 0;
  71. fileList.onchange();
  72. </script>
  73. </body>
  74. </html>
  75.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement