|
@@ -1,4 +1,4 @@
|
|
|
-package scan
|
|
|
+package kyoketsu
|
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
@@ -6,8 +6,6 @@ import (
|
|
|
"net/netip"
|
|
|
"sync"
|
|
|
"time"
|
|
|
-
|
|
|
-
|
|
|
)
|
|
|
|
|
|
var PORT_MAP = map[int]string{
|
|
@@ -16,29 +14,29 @@ var PORT_MAP = map[int]string{
|
|
|
}
|
|
|
|
|
|
type TcpScanHost struct {
|
|
|
- Host string `json:"host"`
|
|
|
- Ipv4Address netip.Addr `json:"ipv4_address"`
|
|
|
- PortsScanned []PortScanResult `json:"ports_scanned"`
|
|
|
+ Host string `json:"host"`
|
|
|
+ Ipv4Address netip.Addr `json:"ipv4_address"`
|
|
|
+ PortsScanned []PortScanResult `json:"ports_scanned"`
|
|
|
}
|
|
|
|
|
|
type PortScanResult struct {
|
|
|
- PortNumber int `json:"port_number"`
|
|
|
- Service string `json:"service"`
|
|
|
- Protocol string `json:"protocol"`
|
|
|
- Listening bool `json:"listening"`
|
|
|
+ PortNumber int `json:"port_number"`
|
|
|
+ Service string `json:"service"`
|
|
|
+ Protocol string `json:"protocol"`
|
|
|
+ Listening bool `json:"listening"`
|
|
|
}
|
|
|
|
|
|
type PortScanDirective struct {
|
|
|
- Pairs map[int]string
|
|
|
+ Pairs map[int]string
|
|
|
}
|
|
|
|
|
|
func RetrieveScanDirectives() PortScanDirective {
|
|
|
return PortScanDirective{Pairs: PORT_MAP}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/*
|
|
|
Scans a single host on a single port
|
|
|
+
|
|
|
:param addr: the address to dial
|
|
|
:param port: the port number to dial
|
|
|
*/
|
|
@@ -55,13 +53,14 @@ func singlePortScan(addr string, port int, svcs string) *PortScanResult {
|
|
|
|
|
|
/*
|
|
|
Perform a TCP scan on the pointers host
|
|
|
+
|
|
|
:param posts: a list of ports to scan against a host
|
|
|
*/
|
|
|
func (t *TcpScanHost) ScanPortRange(ports []int) []*PortScanResult {
|
|
|
wg := &sync.WaitGroup{}
|
|
|
out := make(chan *PortScanResult)
|
|
|
var res []*PortScanResult
|
|
|
- wgOuter := &sync.WaitGroup{}
|
|
|
+ wgOuter := &sync.WaitGroup{}
|
|
|
wgOuter.Add(1)
|
|
|
go func() {
|
|
|
defer wgOuter.Done()
|
|
@@ -90,14 +89,9 @@ func (t *TcpScanHost) ScanPortRange(ports []int) []*PortScanResult {
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/*
|
|
|
Evaluate whether the host has an entry in the ARP table
|
|
|
*/
|
|
|
func (h *TcpScanHost) IsOnline() bool {
|
|
|
return false
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|