Browse Source

updates and stuff

AETH-erial 10 months ago
parent
commit
9b37e9f8a3
4 changed files with 26 additions and 50 deletions
  1. 17 16
      pkg/html/templates/home.html
  2. 6 6
      pkg/html/templates/ip_table.html
  3. 2 8
      pkg/scanner.go
  4. 1 20
      pkg/webserver.go

+ 17 - 16
pkg/html/templates/home.html

@@ -6,10 +6,10 @@
     </head>
 
     <body style="background-color: black;">
-        <div class="container-fluid sticky-top pb-0">
+        <div class="container-fluid sticky-top pb-0" style="background-color: black; opacity: 0.5;">
             <div class="row align-items-center justify-content-center h-100 shadow-lg p-0 mb-0 rounded">
                 <div class="col-sm-8 p-3">
-                    <div style="color: rgba(35, 207, 0, 0.87); font-size: xx-large; font-family: monospace;">
+                    <div style="color: rgba(35, 207, 0, 0.87); font-size: xx-large; font-family: monospace; opacity: 1;">
                         <a href="/home" style="color: rgba(35, 207, 0, 0.87)">// Kyoketsu</a>
                     </div>
                 </div>
@@ -26,24 +26,25 @@
                 </div>
             </div>
         </div>
-        <div class="container-fluid row">
-            <div class="col"></div>
-            <div class="col-auto p-3 m-3 position-absolute top-50 start-50 translate-middle" style="max-width: 80vw;">
-                <img src="/static/img/chiralworkslogo-dark.png" style="max-height: 120vh;"/>
-            </div>
-            <div class="col"></div>
-        </div>
-        <div class="row container-fluid">
-            <div class="col border border-white text-white"><p class="font-monospace fs-3">FQDN</p></div>
-            <div class="col border border-white text-white"><p class="font-monospace fs-3">IPv4 Address</p></div>
-            <div class="col border border-white text-white"><p class="font-monospace fs-3">Ping Response?</p></div>
-            <div class="col border border-white text-white"><p class="font-monospace fs-3">Listening Ports</p></div>
-        </div>
-        <div id="response-div"></div>
+
+        <table class="table table-dark table-bordered table-hover table-">
+            <thead>
+                <tr>
+                    <th scope="col"><p style="font-family: monospace;">FQDN</p></th>
+                    <th scope="col"><p style="font-family: monospace;">IPv4 Address</p></th>
+                    <th scope="col"><p style="font-family: monospace;">Ping Response?</p></th>
+                    <th scope="col"><p style="font-family: monospace;">Listening Ports</p></th>
+                </tr>
+            </thead>
+            <tbody>
         {{ range . }}
             {{ template "ip_table.html" . }}
         {{ end }}
 
+            </tbody>
+        </table>
+        <div id="response-div"></div>
+
     
     
         <script src="/static/htmx.min.js"></script>

+ 6 - 6
pkg/html/templates/ip_table.html

@@ -1,8 +1,8 @@
 {{ define "ip_table.html" }}
-<div class="row container-fluid">
-    <div class="col border border-white text-white"><p class="font-monospace fs-3">{{ .Fqdn }}</p></div>
-    <div class="col border border-white text-white"><p class="font-monospace fs-3">{{ .IpAddress }}</p></div>
-    <div class="col border border-white text-white"><p class="font-monospace fs-3">{{ .PingResponse }}</p></div>
-    <div class="col border border-white text-white"><p class="font-monospace fs-3">{{ .PortString }}</p></div>
-</div>
+    <tr>
+        <th scope="row"><p style="font-family: monospace;">{{ .Fqdn }}</p></th>
+        <td><p style="font-family: monospace;">{{ .IpAddress }}</p></td>
+        <td><p style="font-family: monospace;">{{ .PingResponse }}</p></td>
+        <td><p style="font-family: monospace;">{{ .PortString }}</p></td>
+    </tr>
 {{ end }}

+ 2 - 8
pkg/scanner.go

@@ -79,13 +79,7 @@ May move to a database, or something.
 */
 func RetrieveScanDirectives() []int {
 
-	var portmap = []int{22, 443, 8080, 4379, 445, 53, 153, 27017}
-	/*map[int]string{
-		22: "ssh", 23: "telnet", 53: "dns", 80: "http", 25: "smtp", 443: "https", 8080: "unknown", 8081: "unknown",
-		8082: "unknown", 8085: "unknown", 8090: "unknown", 8091: "unknown", 9010: "unknown", 9012: "unknown", 10000: "unknown", 1433: "microsoft_sql",
-		3306: "mysql", 3050: "firebird", 5432: "postgres", 27017: "mongo", 6379: "redis", 8005: "tomcat", 6443: "kubernetes", 853: "dns-tls", 143: "imap",
-		389: "ldap", 445: "smb", 543: "kerberos", 544: "kerberos", 749: "kerberos", 760: "kerberos",
-	} */
+	var portmap = []int{22, 80, 443, 8080, 4379, 445, 53, 153, 27017}
 	return portmap
 }
 
@@ -98,7 +92,7 @@ Scans a single host on a single port
 */
 func singlePortScan(addr string, port int) int {
 
-	conn, err := net.DialTimeout("tcp", fmt.Sprintf("%v:%d", addr, port), 2*time.Second)
+	conn, err := net.DialTimeout("tcp", fmt.Sprintf("%v:%d", addr, port), 4*time.Second)
 	if err != nil {
 		return 0
 		//	return PortScanResult{PortNumber: port, Protocol: "tcp", Listening: false}

+ 1 - 20
pkg/webserver.go

@@ -18,7 +18,7 @@ type ScanRequest struct {
 
 // Holding all static web server resources
 //
-//go:embed html/bootstrap-5.0.2-dist/js/* html/bootstrap-5.0.2-dist/css/* html/* html/templates/* html/img/*
+//go:embed html/bootstrap-5.0.2-dist/js/* html/bootstrap-5.0.2-dist/css/* html/* html/templates/*
 var content embed.FS
 
 /*
@@ -98,25 +98,6 @@ func (e *ExecutionHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 		}
 	}()
 	NetSweep(subnetMap.Ipv4s, RetrieveScanDirectives(), scanned)
-	/*
-		rec, err := e.DbHook.GetByIP(host.IpAddress)
-		if err != nil {
-			if err != ErrNotExists {
-				log.Fatal(err, "There was a fatal error querying the database\n")
-			}
-			_, err = e.DbHook.Create(host)
-			if err != nil {
-				log.Fatal(err, "There was a fatal error creating this record in the database.\n")
-			}
-			continue
-		}
-		_, err = e.DbHook.Update(rec.Id, host)
-		if err != nil {
-			log.Fatal(err, "there was a fatal error updating this record: ", rec)
-		}
-		continue
-	*/
-	// not adding these to the database because this isnt really that important
 }
 
 // handlers //