Add browser deploy recon backend with port scan, web crawl, and deploy lane recommendations.
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
POST /api/v1/recon/scan probes fleet ports from the server host, crawls owned HTTP targets, maps findings to spread lanes, and records optional oath ledger rows.
This commit is contained in:
40
server/internal/recon/html_tree.go
Normal file
40
server/internal/recon/html_tree.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package recon
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"golang.org/x/net/html"
|
||||
)
|
||||
|
||||
type htmlNode struct {
|
||||
tag string
|
||||
attrs map[string]string
|
||||
children []*htmlNode
|
||||
}
|
||||
|
||||
func (n *htmlNode) attr(key string) string {
|
||||
if n == nil || n.attrs == nil {
|
||||
return ""
|
||||
}
|
||||
return n.attrs[key]
|
||||
}
|
||||
|
||||
func parseHTMLTree(body string) (*html.Node, error) {
|
||||
return html.Parse(strings.NewReader(body))
|
||||
}
|
||||
|
||||
func toHTMLNode(n *html.Node) *htmlNode {
|
||||
if n == nil {
|
||||
return nil
|
||||
}
|
||||
out := &htmlNode{tag: n.Data, attrs: map[string]string{}}
|
||||
for _, a := range n.Attr {
|
||||
out.attrs[a.Key] = a.Val
|
||||
}
|
||||
for c := n.FirstChild; c != nil; c = c.NextSibling {
|
||||
if child := toHTMLNode(c); child != nil {
|
||||
out.children = append(out.children, child)
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
Reference in New Issue
Block a user