Files
AetherForge/server/internal/recon/html_tree.go
AetherForge f3e5a9a07d
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Add browser deploy recon backend with port scan, web crawl, and deploy lane recommendations.
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.
2026-06-07 11:23:10 -07:00

41 lines
730 B
Go

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
}