Documentation
¶
Overview ¶
GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
kyoketsu, a Client-To-Client Network Enumeration System Copyright (C) 2024 Russell Hrubesky, ChiralWorks Software LLC
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Index ¶
- Constants
- Variables
- func NetSweep(ips []net.IP, ports []int, scanned chan Host)
- func NewDialer() net.Dialer
- func NewTCPSock(interfaceName string) *syscall.SockaddrLinklayer
- func PortWalk(addr string, ports []int) []int
- func RetrieveScanDirectives() []int
- func RunHttpServer(port int, dbhook TopologyDatabaseIO, portmap []int)
- type AssetHandler
- type ExecutionHandler
- type Host
- type HtmlHandler
- type IpSubnetMapper
- type NetworkInterfaceNotFound
- type PortScanResult
- type PromptEntry
- type SQLiteRepo
- type ScanRequest
- type TopologyDatabaseIO
- type TuiSelectionFeed
Constants ¶
const IPV4_BITLEN = 32
Variables ¶
Functions ¶
func NetSweep ¶
Perform a port scan sweep across an entire subnet
:param ip: the IPv4 address WITH CIDR notation :param portmap: the mapping of ports to scan with (port number mapped to protocol name)
func NewTCPSock ¶
func NewTCPSock(interfaceName string) *syscall.SockaddrLinklayer
Create a new low level networking interface socket :param intf: the name of the interface to bind the socket to
func PortWalk ¶
Perform a concurrent TCP port dial on a host, either by domain name or IP.
:param addr: the address of fqdn to scan :param ports a list of port numbers to dial the host with
func RetrieveScanDirectives ¶
func RetrieveScanDirectives() []int
Wrapper function to dependency inject the resource for a port -> service name mapping. May move to a database, or something.
func RunHttpServer ¶
func RunHttpServer(port int, dbhook TopologyDatabaseIO, portmap []int)
Run a new webserver
:param port: port number to run the webserver on
Types ¶
type AssetHandler ¶
type AssetHandler struct {
Root embed.FS // Should be able to use anything that implements the fs.FS interface for serving asset files
EmbedRoot string // This is the root of the embeded file system
RelPath string // The path that will be used for the handler, relative to the root of the webserver (/static, /assets, etc)
}
func (*AssetHandler) ServeHTTP ¶
func (a *AssetHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
Handler function to serve out asset files (HTMX, bootstrap, pngs etc)
:param w: http.ResponseWriter interface for sending data back to the caller :param r: pointer to an http.Request
type ExecutionHandler ¶
type ExecutionHandler struct {
DbHook TopologyDatabaseIO
TableEntry *template.Template
PortMap []int
}
func (*ExecutionHandler) ServeHTTP ¶
func (e *ExecutionHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type Host ¶
type Host struct {
Fqdn string // The FQDN of the address targeted as per the systems default resolver
IpAddress string // the IPv4 address (no ipv6 support yet)
PingResponse bool // boolean value representing if the host responded to ICMP
ListeningPorts []int // list of maps depicting a port number -> service name
PortString string
Id int64
}
type HtmlHandler ¶
type HtmlHandler struct {
Home *template.Template // pointer to the HTML homepage
DbHook TopologyDatabaseIO
}
func (*HtmlHandler) ServeHTTP ¶
func (h *HtmlHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
Handler function for HTML serving
:param w: http.ResponseWriter interface for sending data back :param r: pointer to the http.Request coming in
type IpSubnetMapper ¶
type IpSubnetMapper struct {
Ipv4s []net.IP `json:"addresses"`
NetworkAddr net.IP
Current net.IP
Mask int
}
func GetNetworkAddresses ¶
func GetNetworkAddresses(addr string) (IpSubnetMapper, error)
Get all of the IPv4 addresses in the network that 'addr' belongs to. YOU MUST PASS THE ADDRESS WITH CIDR NOTATION i.e. '192.168.50.1/24'
:param addr: the ipv4 address to use for subnet discovery
type NetworkInterfaceNotFound ¶
type NetworkInterfaceNotFound struct{ Passed string }
func (*NetworkInterfaceNotFound) Error ¶
func (n *NetworkInterfaceNotFound) Error() string
Implementing error interface
type PortScanResult ¶
type PortScanResult struct {
// This is used to represent the results of a port scan against one host
PortNumber int `json:"port_number"` // The port number that was scanned
Service string `json:"service"` // the name of the service that the port was identified/mapped to
Protocol string `json:"protocol"` // The IP protocol (TCP/UDP)
Listening bool `json:"listening"` // A boolean value that depicts if the service is listening or not
}
type PromptEntry ¶
type SQLiteRepo ¶
type SQLiteRepo struct {
// contains filtered or unexported fields
}
func (*SQLiteRepo) All ¶
func (r *SQLiteRepo) All() ([]Host, error)
Get all Hosts from the host table
func (*SQLiteRepo) Create ¶
func (r *SQLiteRepo) Create(host Host) (*Host, error)
Create an entry in the hosts table
:param host: a Host entry from a port scan
func (*SQLiteRepo) GetByIP ¶
func (r *SQLiteRepo) GetByIP(ip string) (*Host, error)
Get a record by its FQDN
func (*SQLiteRepo) Migrate ¶
func (r *SQLiteRepo) Migrate() error
Creates a new SQL table with necessary data
type ScanRequest ¶
type ScanRequest struct {
IpAddress string `json:"ip_address"`
}
type TopologyDatabaseIO ¶
type TopologyDatabaseIO interface {
/*
This interface defines the Input and output methods that will be necessary
for an appropriate implementation of the data storage that the distributed system will use.
When I get around to implementing the client-to-client format of this, it could be anything.
*/
Migrate() error
Create(host Host) (*Host, error)
All() ([]Host, error)
GetByIP(ip string) (*Host, error)
Update(id int64, updated Host) (*Host, error)
Delete(id int64) error
}
type TuiSelectionFeed ¶
type TuiSelectionFeed struct {
Choice []PromptEntry
}
func RetrieveLocalAddresses ¶
func RetrieveLocalAddresses() (TuiSelectionFeed, error)
Needs cleanup, but this function populatest a data structure that will be used during TUI program startup