hardware.html 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <link rel="stylesheet" href="../../script/semantic/semantic.min.css">
  6. <script type="text/javascript" src="../../script/jquery.min.js"></script>
  7. <script type="text/javascript" src="../../script/semantic/semantic.min.js"></script>
  8. <title>Network Interfaces</title>
  9. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  10. <style>
  11. .ts.items>.item>.image:not(.ts):not(.flexible) {
  12. width: 60px;
  13. }
  14. </style>
  15. </head>
  16. <body>
  17. <br>
  18. <div class="ui container">
  19. <div class="ui divided items" id="nics">
  20. </div>
  21. </div>
  22. <script>
  23. var template = '<div class="item"><div class="image"><img style="height:64px;width:auto" src="/SystemAO/network/img/%image%"></div><div class="content"><p class="header">%interfacename%</p><div class="description">%data%</div></div></div>';
  24. $.getJSON("../../system/network/getNICinfo", function(result) {
  25. $.each(result, function(i, field) {
  26. var image = getImageFromName(field.Name);
  27. $("#nics").append(template.replace("%image%", image).replace("%interfacename%", field["Name"]).replace("%data%", "MAC Address : " + field["HardwareAddr"] + "<br>IPv4 Address : " + field["IPv4Addr"] + "<br>IPv6 Address : " + field["IPv6Addr"]));
  28. });
  29. });
  30. function getImageFromName(nicname){
  31. nicname = nicname.toLowerCase().trim();
  32. if (nicname.includes("loopback") || nicname == "lo"){
  33. return "loopback.svg"
  34. }else if (nicname.substr(0,3) == "enp" || nicname.substr(0,3) == "eth"){
  35. return "ethernet.svg";
  36. }else if (nicname.substr(0,3) == "wlp" || nicname.substr(0,4) == "wlan"){
  37. return "wifi.svg";
  38. }else if (nicname.includes("isatap")){
  39. return "isatap.svg";
  40. }else if (nicname.includes("hamachi") || nicname.includes("zerotier") || nicname.includes("openvpn")){
  41. return "vpn.svg";
  42. }else if (nicname.includes("hyper-v") || nicname.includes("virtualbox")){
  43. return "virtualize.svg";
  44. }
  45. return "Unknown.png"
  46. }
  47. </script>
  48. </body>
  49. </html>