Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Parse technology stack from crawl headers, grab SSH/HTTP/WinRM banners, merge smart port bundles with FleetPorts, and suggest deploy-kit lane plus SSM for EC2 metadata targets.
80 lines
2.5 KiB
Python
80 lines
2.5 KiB
Python
#!/usr/bin/env python3
|
|
from pathlib import Path
|
|
import subprocess, sys
|
|
|
|
ROOT = Path(r"g:/crypto miner")
|
|
SERVER = ROOT / "server"
|
|
|
|
def w(rel, content):
|
|
p = SERVER / rel
|
|
p.parent.mkdir(parents=True, exist_ok=True)
|
|
p.write_text(content, encoding="utf-8", newline="\n")
|
|
|
|
TYPES = r'''package recon
|
|
|
|
import "time"
|
|
|
|
var FleetPorts = []int{22, 80, 443, 445, 3389, 5985, 5986, 6262, 8080, 8443}
|
|
|
|
const (
|
|
DefaultPortDialTimeout = 2 * time.Second
|
|
DefaultCrawlDepth = 2
|
|
DefaultCrawlMaxPages = 50
|
|
)
|
|
|
|
type ScanRequest struct {
|
|
Host string `json:"host"`
|
|
Port int `json:"port,omitempty"`
|
|
Scheme string `json:"scheme,omitempty"`
|
|
Paths []string `json:"paths,omitempty"`
|
|
Profile string `json:"profile,omitempty"`
|
|
}
|
|
|
|
type PortResult struct { Port int `json:"port"`; Open bool `json:"open"` }
|
|
|
|
type FormFinding struct {
|
|
PageURL string `json:"page_url"`
|
|
Action, Method, Enctype string `json:"action,omitempty"`
|
|
Fields []string `json:"fields,omitempty"`
|
|
HasFile, Multipart bool `json:"has_file_input,omitempty"`
|
|
}
|
|
|
|
type URLFieldFinding struct {
|
|
PageURL, Name, Type, Hint string `json:"page_url"`
|
|
}
|
|
|
|
type PageFinding struct { URL string `json:"url"`; StatusCode int `json:"status_code"`; Title string `json:"title,omitempty"` }
|
|
|
|
type CrawlReport struct {
|
|
PagesFetched int `json:"pages_fetched"`
|
|
Pages []PageFinding `json:"pages,omitempty"`
|
|
FileInputs, MultipartForms []FormFinding `json:"file_inputs,omitempty"`
|
|
URLFields []URLFieldFinding `json:"url_fields,omitempty"`
|
|
SSRFScore int `json:"ssrf_score"`
|
|
CMSFingerprints []string `json:"cms_fingerprints,omitempty"`
|
|
}
|
|
|
|
type DeployRecommendation struct { Lane, Template, Reason string; Priority int `json:"priority"` }
|
|
|
|
type ScanReport struct {
|
|
ScanID, Host, Profile, Status string `json:"scan_id,omitempty"`
|
|
ScannedAt time.Time `json:"scanned_at"`
|
|
Ports []PortResult `json:"ports"`
|
|
Crawl *CrawlReport `json:"crawl,omitempty"`
|
|
RelayVia string `json:"relay_via,omitempty"`
|
|
Recommendations []DeployRecommendation `json:"recommendations,omitempty"`
|
|
}
|
|
|
|
type ReconScanDiff struct { NewPorts []int `json:"new_ports,omitempty"`; NewForms []FormFinding `json:"new_forms,omitempty"` }
|
|
|
|
type ReconHistoryEntry struct {
|
|
ScanID, Host, Profile, Status string
|
|
ScannedAt time.Time
|
|
Report *ScanReport `json:"report,omitempty"`
|
|
Diff *ReconScanDiff `json:"diff,omitempty"`
|
|
}
|
|
'''
|
|
|
|
# Fix botched types - use proper version
|
|
TYPES = Path(__file__).with_name("types.go.snippet").read_text(encoding="utf-8") if Path(__file__).with_name("types.go.snippet").exists() else None
|