### Build Go Library from Source Source: https://context7.com/chainreactors/gogo/llms.txt Commands to clone the repository, install dependencies, generate embedded templates, and build the Go library for the current platform. ```bash # Clone with submodules (templates repository) git clone --recurse-submodules https://github.com/chainreactors/gogo cd gogo/v2 # Install dependencies go mod tidy # Generate embedded templates (required before first build) go generate # Build for current platform go build . ``` -------------------------------- ### Gogo Workflow Override Example Source: https://github.com/chainreactors/gogo/blob/master/README.md Demonstrates overriding workflow parameters with command-line arguments. Here, the target network is specified via -i, overriding any target defined within the '10' workflow. ```bash gogo -w 10 -i 11.0.0.0/8 ``` -------------------------------- ### Run Scan Tasks with core.RunTask and core.InitConfig Source: https://context7.com/chainreactors/gogo/llms.txt Shows how to initialize and run a scan task using `core.RunTask` and `core.InitConfig`. Requires loading built-in resources like port configurations and fingerprints before initializing the configuration. ```go package main import ( "log" "github.com/chainreactors/gogo/v2/core" "github.com/chainreactors/gogo/v2/pkg" "github.com/chainreactors/parsers" ) func main() { // Load built-in resources (must be called before RunTask) if err := pkg.LoadPortConfig(""); err != nil { log.Fatal(err) } if err := pkg.LoadFinger(nil); err != nil { log.Fatal(err) } if err := pkg.LoadExtractor(); err != nil { log.Fatal(err) } config := pkg.Config{ GOGOConfig: &parsers.GOGOConfig{ IP: "192.168.1.0/24", Ports: "top2,win,db", Mod: pkg.Default, }, RunnerOpt: &pkg.RunnerOption{ Delay: 2, HttpsDelay: 2, VersionLevel: 1, Exploit: "none", }, Outputf: "full", FileOutputf: "jl", Compress: true, } preparedConfig, err := core.InitConfig(&config) if err != nil { log.Fatal(err) } // Run the scan (blocking) core.RunTask(*preparedConfig) } ``` -------------------------------- ### Define and Parse Workflows with pkg.Workflow Source: https://context7.com/chainreactors/gogo/llms.txt Illustrates defining workflows programmatically using `pkg.Workflow` and loading them from YAML. It shows how to look up workflows, prepare configurations, and parse YAML input. ```go package main import ( "fmt" "github.com/chainreactors/gogo/v2/pkg" ) func main() { // Load built-in workflows workflowMap := pkg.LoadWorkFlow() // Look up workflow by name or tag workflows := workflowMap.Choice("10") for _, wf := range workflows { fmt.Printf("Name: %s, IP: %s, Ports: %s, Mod: %s\n", wf.Name, wf.IP, wf.Ports, wf.Mod) } // Define a workflow programmatically wf := &pkg.Workflow{ Name: "custom_internal", Description: "Scan custom 172.16 range", IP: "172.16.0.0/12", Ports: "top2,win,db", Mod: "ss", Ping: true, Exploit: "auto", Verbose: 1, File: "auto", Tags: []string{"internal", "172"}, } fmt.Println(wf.Marshal()) // prints YAML representation // Parse workflow(s) from YAML bytes yamlBytes := []byte(` - name: quick_web ip: 192.168.0.0/24 ports: top1 mod: default ping: false `) parsed := pkg.ParseWorkflowsFromInput(yamlBytes) for _, w := range parsed { runtimeConfig := pkg.NewDefaultConfig(pkg.DefaultRunnerOption) cfg := w.PrepareConfig(runtimeConfig) fmt.Printf("PreparedConfig IP=%s Ports=%s\n", cfg.IP, cfg.Ports) } } ``` -------------------------------- ### Cross-compile Gogo for Windows (64-bit) Source: https://context7.com/chainreactors/gogo/llms.txt Use this command to build a 64-bit Windows executable of Gogo. Ensure you are in the project directory. ```bash GOOS=windows GOARCH=amd64 go build -o gogo.exe . ``` -------------------------------- ### Gogo View All Workflows Source: https://github.com/chainreactors/gogo/blob/master/README.md List all available workflow configurations. This command helps in identifying and utilizing predefined scanning strategies. ```bash gogo -P workflow ``` -------------------------------- ### Gogo View All Port Configurations Source: https://github.com/chainreactors/gogo/blob/master/README.md Display all available port tags and their corresponding port numbers. This command helps in understanding predefined port sets. ```bash gogo -P port ``` -------------------------------- ### Programmatic CLI Entry Point in Go Source: https://context7.com/chainreactors/gogo/llms.txt Instantiates and configures the `core.Runner` struct for embedding gogo in a larger Go program. Prepares, initializes, and runs the scan lifecycle. ```go package main import ( "github.com/chainreactors/gogo/v2/core" "github.com/chainreactors/gogo/v2/pkg" "github.com/chainreactors/logs" ) func main() { runner := core.NewRunner() // Configure via option structs runner.InputOption = core.InputOption{ IP: "192.168.1.0/24", Ports: "top2,win,db", } runner.OutputOption = core.OutputOption{ Outputf: "full", FileOutputf: "jl", AutoFile: true, } runner.ConfigOption = core.ConfigOption{ Threads: 1000, Delay: 2, Exploit: false, Verbose: []bool{true}, // -v } runner.SmartOption = core.SmartOption{ Mod: pkg.Default, } // Initialize logger logs.Log = logs.NewLogger(0) // Prepare (validates config, sets up proxy, handles -F/-P early exits) if ok := runner.Prepare(); !ok { return } // Init (loads fingerprints, port configs, neutron templates) if err := runner.Init(); err != nil { logs.Log.Error(err.Error()) return } // Run (blocking — executes the full scan) runner.Run() } ``` -------------------------------- ### Create and Use Scan Results with pkg.NewResult Source: https://context7.com/chainreactors/gogo/llms.txt Demonstrates creating a scan result object using `pkg.NewResult` and accessing its core fields and output helper methods after dispatching a task with `engine.Dispatch`. Useful for processing scan outcomes. ```go package main import ( "fmt" "github.com/chainreactors/gogo/v2/engine" "github.com/chainreactors/gogo/v2/pkg" ) func main() { result := pkg.NewResult("10.10.10.1", "8080") opt := &pkg.RunnerOption{ Delay: 3, HttpsDelay: 3, VersionLevel: 1, Exploit: "none", } engine.Dispatch(opt, result) if !result.Open { return } // Core fields fmt.Println("IP:", result.Ip) fmt.Println("Port:", result.Port) fmt.Println("Protocol:", result.Protocol) // "http", "https", "tcp" fmt.Println("Status:", result.Status) // HTTP status code or "open" fmt.Println("Title:", result.Title) fmt.Println("Host:", result.Host) // Server header / NTLM hostname fmt.Println("Midware:", result.Midware) // Middleware (nginx, iis, etc.) fmt.Println("Frameworks:", result.Frameworks.String()) // Detected frameworks fmt.Println("Vulns:", result.Vulns.String()) fmt.Println("Timing:", result.Timing, "ms") // Output helpers fmt.Println(result.FullOutput()) // tab-separated full line fmt.Println(result.ColorOutput()) // ANSI-colored full line fmt.Println(result.JsonOutput()) // single JSON object fmt.Println(result.CsvOutput()) // CSV row fmt.Println(result.GetBaseURL()) // "http://10.10.10.1:8080" fmt.Println(result.GetTarget()) // "10.10.10.1:8080" // Add results manually (for custom integrations) result.AddFramework(result.Frameworks.List()[0]) result.AddExtracts(result.Extracteds["email"]) result.GuessFramework() // guess from port number when no fingerprint matched } ``` -------------------------------- ### Verify Gogo Binary Source: https://context7.com/chainreactors/gogo/llms.txt After compilation, run this command to verify the Gogo binary and check its version. ```bash ./gogo --version ``` -------------------------------- ### Configure Active Fingerprinting with Go Library Source: https://context7.com/chainreactors/gogo/llms.txt Customize scan options like `Delay`, `HttpsDelay`, and `VersionLevel` via `pkg.RunnerOption` for active fingerprinting. `VersionLevel: 1` enables active HTTP probes and favicon fetching. ```go // Active fingerprinting (version level 1) opt := &pkg.RunnerOption{ Delay: 2, HttpsDelay: 2, VersionLevel: 1, // enables active HTTP probes + favicon Exploit: "none", Debug: false, Opsec: false, } result2 := pkg.NewResult("10.0.0.1", "443") engine.Dispatch(opt, result2) if result2.Open { fmt.Printf("Protocol: %s\n", result2.Protocol) fmt.Printf("Title: %s\n", result2.Title) fmt.Printf("Frameworks: %s\n", result2.Frameworks.String()) fmt.Printf("Vulns: %s\n", result2.Vulns.String()) } ``` -------------------------------- ### Load Resource Engines in Go Source: https://context7.com/chainreactors/gogo/llms.txt Initializes global fingerprint, port preset, and extractor engines from embedded template data. Must be called once before any scan. ```go package main import ( "log" "github.com/chainreactors/gogo/v2/pkg" ) func main() { // Load built-in port presets (embedded YAML) if err := pkg.LoadPortConfig(""); err != nil { log.Fatal("port config:", err) } // Load custom port config file if err := pkg.LoadPortConfig("/path/to/custom_ports.yaml"); err != nil { log.Fatal("custom port config:", err) } // Load built-in HTTP + socket fingerprints if err := pkg.LoadFinger(nil); err != nil { log.Fatal("finger:", err) } // Load built-in fingerprints + supplement with extra finger files if err := pkg.LoadFinger([]string{"/path/to/extra_fingers.yaml"}); err != nil { log.Fatal("finger:", err) } // Load built-in extractors (email, IP, phone, JWT, etc.) if err := pkg.LoadExtractor(); err != nil { log.Fatal("extractor:", err) } // Access the initialized engines directly _ = pkg.FingerEngine // *fingers.FingersEngine _ = pkg.FingerprintHubEngine // *fingerprinthub.FingerPrintHubEngine _ = pkg.Extractors // parsers.Extractors (map[string][]*parsers.Extractor) } ``` -------------------------------- ### Cross-compile Gogo for Windows Server 2003 (32-bit) Source: https://context7.com/chainreactors/gogo/llms.txt This command compiles Gogo for a 32-bit Windows environment, specifically targeting older versions like Windows Server 2003. Requires Go version 1.11 or later. ```bash GOOS=windows GOARCH=386 go1.11 build . ``` -------------------------------- ### Dispatch Scan with Default Options using Go Library Source: https://context7.com/chainreactors/gogo/llms.txt Use `engine.Dispatch` with default `RunnerOption` to scan a single target. The `pkg.NewResult` function initializes the result struct with target IP and port. ```go package main import ( "fmt" "github.com/chainreactors/gogo/v2/engine" "github.com/chainreactors/gogo/v2/pkg" ) func main() { // Scan a single target using the default runner options result := pkg.NewResult("192.168.1.10", "80") engine.Dispatch(pkg.DefaultRunnerOption, result) if result.Open { fmt.Println(result.FullOutput()) // Example output: // http://192.168.1.10:80 nginx/1.18.0 nginx 8849 [200] Welcome to nginx! } else { fmt.Printf("%s is closed\n", result.GetTarget()) } } ``` -------------------------------- ### Gogo Workflow with Manual Target Source: https://github.com/chainreactors/gogo/blob/master/README.md Use a workflow configuration (e.g., 'ss' mode) but specify the target network range manually via the -i flag. Workflow parameters have lower priority than command-line arguments. ```bash gogo -w ss -i 11.0.0.0/8 ``` -------------------------------- ### Basic Target Scan with Port Presets Source: https://context7.com/chainreactors/gogo/llms.txt Scan a CIDR range with specified port presets. Results are printed to stdout in full format. Use '-p -' for all ports. ```bash # Scan a /28 with common web ports gogo -i 81.68.175.32/28 -p top2 # Scan with multiple port groups: web + Windows + database gogo -i 192.168.1.0/24 -p top2,win,db # Scan a single host on all ports (1-65535) with verbose output gogo -i 10.10.10.5 -p - -v # Full-range ports on a /24, output to file, enable exploit scan gogo -i 10.10.10.0/24 -p top2,win,db -e --af # Expected stdout (full format): # [*] Current goroutines: 4000, Version Level: 0, Exploit: none, PortSpray: false, 2024-01-01 12:00.00 # [*] Start task 81.68.175.32/28, total ports: 100, mod: default # [+] http://81.68.175.32:80 nginx/1.18.0 (Ubuntu) nginx 8849 [200] Welcome to nginx! # [+] tcp://81.68.175.33:3306 mysql 5.6.50-log [tcp] # [*] Alived: 5, Total: 1594 # [*] Time consuming: 4.04s ``` -------------------------------- ### Configure Exploit Scan for SMB with Go Library Source: https://context7.com/chainreactors/gogo/llms.txt Set `Exploit: "auto"` in `pkg.RunnerOption` to enable automatic exploit matching for detected frameworks, such as MS17-010 and SMBGhost against SMB services. ```go // Exploit scan against SMB (MS17-010 + SMBGhost) exploitOpt := &pkg.RunnerOption{ Delay: 2, HttpsDelay: 2, Exploit: "auto", // auto-match templates to detected frameworks } smbResult := pkg.NewResult("10.0.0.5", "445") engine.Dispatch(exploitOpt, smbResult) if smbResult.Open { fmt.Printf("SMB: %s | Vulns: %s\n", smbResult.Title, smbResult.Vulns.String()) } ``` -------------------------------- ### Resource Loaders Source: https://context7.com/chainreactors/gogo/llms.txt Initializes the global fingerprint, port preset, and extractor engines from embedded template data. Must be called once before any scan. ```APIDOC ## Go Library — `pkg.LoadFinger`, `pkg.LoadPortConfig`, `pkg.LoadExtractor` Resource loaders initialize the global fingerprint, port preset, and extractor engines from embedded template data. Must be called once before any scan. ```go package main import ( "log" "github.com/chainreactors/gogo/v2/pkg" ) func main() { // Load built-in port presets (embedded YAML) if err := pkg.LoadPortConfig(""); err != nil { log.Fatal("port config:", err) } // Load custom port config file if err := pkg.LoadPortConfig("/path/to/custom_ports.yaml"); err != nil { log.Fatal("custom port config:", err) } // Load built-in HTTP + socket fingerprints if err := pkg.LoadFinger(nil); err != nil { log.Fatal("finger:", err) } // Load built-in fingerprints + supplement with extra finger files if err := pkg.LoadFinger([]string{"/path/to/extra_fingers.yaml"}); err != nil { log.Fatal("finger:", err) } // Load built-in extractors (email, IP, phone, JWT, etc.) if err := pkg.LoadExtractor(); err != nil { log.Fatal("extractor:", err) } // Access the initialized engines directly _ = pkg.FingerEngine // *fingers.FingersEngine _ = pkg.FingerprintHubEngine // *fingerprinthub.FingerPrintHubEngine _ = pkg.Extractors // parsers.Extractors (map[string][]*parsers.Extractor) } ``` ``` -------------------------------- ### Port Configuration Options Source: https://context7.com/chainreactors/gogo/llms.txt Configure port scanning using built-in tags, numeric ranges, protocol aliases, or custom YAML files. Use '-P port' to list available tags. ```bash # Show all built-in port presets gogo -P port # Use a numeric range gogo -i 192.168.1.1/24 -p 8000-9000 # Combine tag + range + specific port gogo -i 192.168.1.1/24 -p top2,8888,10000-10010,redis # All ports (alias for 1-65535, also includes oxid/icmp probes) gogo -i 192.168.1.1/24 -p - # Custom port config file (YAML, same schema as built-in port.yaml) gogo -i 192.168.1.1/24 -p myports --port-config ./custom_ports.yaml ``` -------------------------------- ### Programmatic CLI Entry Point Source: https://context7.com/chainreactors/gogo/llms.txt `Runner` is the top-level struct that embeds all option groups and drives the full scan lifecycle. It can be instantiated directly for embedding gogo in a larger Go program. ```APIDOC ## Go Library — `core.Runner` (Programmatic CLI Entry Point) `Runner` is the top-level struct that embeds all option groups and drives the full scan lifecycle. It can be instantiated directly for embedding gogo in a larger Go program. ```go package main import ( "github.com/chainreactors/gogo/v2/core" "github.com/chainreactors/gogo/v2/pkg" "github.com/chainreactors/logs" ) func main() { runner := core.NewRunner() // Configure via option structs runner.InputOption = core.InputOption{ IP: "192.168.1.0/24", Ports: "top2,win,db", } runner.OutputOption = core.OutputOption{ Outputf: "full", FileOutputf: "jl", AutoFile: true, } runner.ConfigOption = core.ConfigOption{ Threads: 1000, Delay: 2, Exploit: false, Verbose: []bool{true}, // -v } runner.SmartOption = core.SmartOption{ Mod: pkg.Default, } // Initialize logger logs.Log = logs.NewLogger(0) // Prepare (validates config, sets up proxy, handles -F/-P early exits) if ok := runner.Prepare(); !ok { return } // Init (loads fingerprints, port configs, neutron templates) if err := runner.Init(); err != nil { logs.Log.Error(err.Error()) return } // Run (blocking — executes the full scan) runner.Run() } ``` ``` -------------------------------- ### Gogo Basic Scan Source: https://github.com/chainreactors/gogo/blob/master/README.md Perform a default scan on a specified network range. Output is printed to the command line. ```bash gogo -i 192.168.1.1/24 -p win,db,top2 ``` -------------------------------- ### Exclude IPs and Subnets with gogo CLI Source: https://context7.com/chainreactors/gogo/llms.txt Use `--exclude` to specify single CIDRs or comma-separated lists of CIDRs to exclude from scanning. For larger lists, use `--exclude-file` with one CIDR per line. ```bash # Exclude a single subnet gogo -i 192.168.0.0/16 -p top2 --exclude 192.168.1.0/24 ``` ```bash # Exclude multiple CIDRs (comma-separated) gogo -i 10.0.0.0/8 -p top2 --exclude "10.0.1.0/24,10.0.2.0/24" ``` ```bash # Exclude from file (one CIDR per line) gogo -i 10.0.0.0/8 -p top2 --exclude-file exclude_list.txt ``` -------------------------------- ### Enable OPSEC Mode with gogo CLI Source: https://context7.com/chainreactors/gogo/llms.txt Activate OPSEC mode with the `--opsec` flag to suppress noisy fingerprinting probes, relying only on passive identification to minimize detection risk. ```bash gogo -i 192.168.1.0/24 -p top2 --opsec ``` -------------------------------- ### Enable Port Spray Mode with gogo CLI Source: https://context7.com/chainreactors/gogo/llms.txt Force port spray mode using the `-s` flag to iterate through IPs per port, improving throughput for large port lists and avoiding per-host rate limits. Use `--no-spray` to disable auto-spray. ```bash # Force port spray mode gogo -i 10.0.0.0/16 -p top2 -s ``` ```bash # Disable auto-spray (auto-enabled when ports > 500) gogo -i 10.0.0.0/16 -p - --no-spray ``` -------------------------------- ### Gogo Workflow Scan Source: https://github.com/chainreactors/gogo/blob/master/README.md Execute a predefined workflow for scanning. This command is equivalent to a complex set of arguments, simplifying complex scan configurations. ```bash gogo -w 172 ``` -------------------------------- ### Workflow Execution Source: https://context7.com/chainreactors/gogo/llms.txt Execute predefined scan configurations using named workflows. Workflows can be loaded from built-in presets, custom YAML files, or standard input. Target IPs can be overridden. ```bash # Use built-in workflow for 10.x internal range gogo -w 10 # Override the target IP in a workflow gogo -w 10 -i 11.0.0.0/8 # Use smart-mode preset, supply target manually gogo -w ss -i 192.168.10.0/16 # Load a custom workflow file gogo -w ./my_workflow.yaml -i 10.0.0.0/8 # Read workflow from stdin cat workflow.yaml | gogo -W ``` -------------------------------- ### Heuristic Smart Scan Modes Source: https://context7.com/chainreactors/gogo/llms.txt Utilize smart scan modes ('s', 'ss') to efficiently scan large address spaces by probing representative IPs first. Use '--ping' for pre-checks and '--sp' for custom port probes. ```bash # Smart scan (C-class discovery, /16 target) with ping pre-check gogo -i 172.16.0.0/16 -m s --ping -p top2,win,db --af # SuperSmart scan (/8 target): probe B-class, then C-class, then default gogo -i 10.0.0.0/8 -m ss -p top2,win,db --af # SuperSmart but stop after B/C discovery (no full port scan) gogo -i 10.0.0.0/8 -m ss -n --af # Smart scan with custom port probe (instead of default 80/icmp) gogo -i 172.16.0.0/16 -m s --sp 443,8080 -p top2 # Expected log output: # [*] Spraying 10.0.0.0/8 with ss, Estimated to take 120 seconds # [*] Smart port probes: icmp,23,80 , Smart IP probes: [1 254] # [*] Found 10.1.0.0/16 # [*] Smart scan: 10.0.0.0/8 finished, found 3 alive cidrs ``` -------------------------------- ### Gogo Custom Port Scan Source: https://github.com/chainreactors/gogo/blob/master/README.md Scan a target IP range using a combination of port ranges, common ports, and specific tags like 'http' and 'db'. Multiple configurations can be comma-separated. ```bash gogo -i 1.1.1.1/24 -p 1-1000,common,http,db ``` -------------------------------- ### Gogo Heuristic Scan with Ping Check Source: https://github.com/chainreactors/gogo/blob/master/README.md Perform a supersmart heuristic scan on a broad subnet (e.g., /12). The --ping flag checks IP reachability before fingerprinting, reducing unnecessary packets. Use --af to automatically specify an output file for extensive results. ```bash gogo -i 172.16.1.1/12 -m ss --ping -p top2,win,db --af ``` -------------------------------- ### Go Library - engine.Dispatch Source: https://context7.com/chainreactors/gogo/llms.txt The `engine.Dispatch` function in the Go library serves as the central scan dispatcher. It takes runner options and a result struct, automatically selecting the appropriate scan handler, performing fingerprinting, and populating the result. ```APIDOC ## Go Library — `engine.Dispatch` The central scan dispatcher. Given a `*pkg.RunnerOption` and a `*pkg.Result` (seeded with IP and port), it automatically selects the correct scan handler (HTTP, SMB, ICMP, SNMP, WMI, WinRM, etc.), performs passive and optionally active fingerprinting, and populates the result struct. ```go package main import ( "fmt" "github.com/chainreactors/gogo/v2/engine" "github.com/chainreactors/gogo/v2/pkg" ) func main() { // Scan a single target using the default runner options result := pkg.NewResult("192.168.1.10", "80") engine.Dispatch(pkg.DefaultRunnerOption, result) if result.Open { fmt.Println(result.FullOutput()) // Example output: // http://192.168.1.10:80 nginx/1.18.0 nginx 8849 [200] Welcome to nginx! } else { fmt.Printf("%s is closed\n", result.GetTarget()) } // Active fingerprinting (version level 1) opt := &pkg.RunnerOption{ Delay: 2, HttpsDelay: 2, VersionLevel: 1, // enables active HTTP probes + favicon Exploit: "none", Debug: false, Opsec: false, } result2 := pkg.NewResult("10.0.0.1", "443") engine.Dispatch(opt, result2) if result2.Open { fmt.Printf("Protocol: %s\n", result2.Protocol) fmt.Printf("Title: %s\n", result2.Title) fmt.Printf("Frameworks: %s\n", result2.Frameworks.String()) fmt.Printf("Vulns: %s\n", result2.Vulns.String()) } // Exploit scan against SMB (MS17-010 + SMBGhost) exploitOpt := &pkg.RunnerOption{ Delay: 2, HttpsDelay: 2, Exploit: "auto", // auto-match templates to detected frameworks } smbResult := pkg.NewResult("10.0.0.5", "445") engine.Dispatch(exploitOpt, smbResult) if smbResult.Open { fmt.Printf("SMB: %s | Vulns: %s\n", smbResult.Title, smbResult.Vulns.String()) } } ``` ``` -------------------------------- ### CLI Port Spray Mode Source: https://context7.com/chainreactors/gogo/llms.txt Enable port spray mode with the `-s` flag to iterate through IPs per port, which can improve throughput for large port lists and large IP ranges, and help avoid per-host rate limits. Use `--no-spray` to disable auto-spray. ```APIDOC ## CLI — Port Spray Mode (`-s`) Port spray iterates all IPs per port (instead of all ports per IP), which improves throughput for large port lists over large IP ranges and avoids triggering per-host rate limits. ```bash # Force port spray mode gogo -i 10.0.0.0/16 -p top2 -s # Disable auto-spray (auto-enabled when ports > 500) gogo -i 10.0.0.0/16 -p - --no-spray ``` ``` -------------------------------- ### CLI Concurrency and Timeout Options Source: https://context7.com/chainreactors/gogo/llms.txt Control the concurrency and timeouts for Gogo scans using the `-t`, `-d`, and `-D` flags. Adjust thread counts for different network environments and set TCP/HTTPS timeouts to manage slow networks or reduce missed results. ```APIDOC ## CLI — Concurrency and Timeout (`-t`, `-d`, `-D`) ```bash # Custom thread count (recommended for weak network environments) gogo -i 192.168.1.0/24 -p top2 -t 500 # Increase TCP timeout to reduce missed results on slow networks gogo -i 192.168.1.0/24 -p top2 -d 5 # Separate HTTPS/TLS timeout gogo -i 192.168.1.0/24 -p top2 -d 3 -D 6 # Proxy (SOCKS5) — use with reduced thread count gogo -i 192.168.1.0/24 -p top2 -t 20 --proxy socks5://127.0.0.1:1080 # Multiple proxies (chain) gogo -i 192.168.1.0/24 -p top2 -t 10 \ --proxy socks5://127.0.0.1:1080 \ --proxy socks5://127.0.0.1:1081 ``` Recommended thread counts by environment: | Environment | Recommended `-t` | |--------------------------|-----------------| | Home/NAT router | 100–500 | | Linux production server | 4000 (default) | | Windows production server| 1000 (default) | | Forward web proxy | 10–30 | | Reverse proxy (frp) | 10–100 | ``` -------------------------------- ### Load and Process Result Files in Go Source: https://context7.com/chainreactors/gogo/llms.txt Loads, parses, and processes previously saved `.dat` result files for offline analysis or re-scanning. Handles different result data types. ```go package main import ( "fmt" "log" "os" "github.com/chainreactors/gogo/v2/pkg" "github.com/chainreactors/utils/fileutils" ) func main() { // Open a .dat result file (deflate-compressed JSON lines) f, err := fileutils.Open("results.dat") if err != nil { log.Fatal(err) } data := pkg.LoadResultFile(f) switch v := data.(type) { case *pkg.ResultsData: fmt.Printf("Scan target: %s\n", v.Config.IP) fmt.Printf("Total results: %d\n", len(v.Data)) // Human-readable formatted output fmt.Print(v.ToFormat(false)) // plain text grouped by IP fmt.Print(v.ToFormat(true)) // ANSI color version // Export formats _ = v.ToJson() // single large JSON blob _ = v.ToCsv() // CSV string _ = v.ToCobaltStrike() // CobaltStrike external-C2 format _ = v.ToExtracteds() // extracted fields (email, tokens, etc.) // Filter results filtered := v.Filter("framework::redis") fmt.Printf("Redis results: %d\n", len(filtered)) // Iterate individual results for _, result := range v.Data { fmt.Printf("%s:%s [%s] %s %s\n", result.Ip, result.Port, result.Status, result.Frameworks.String(), result.Vulns.String()) } case *pkg.SmartResult: // Smart scan intermediate output (alive CIDRs) fmt.Printf("Alive CIDRs: %v\n", v.List()) default: fmt.Println("Unknown result type") } // Read from stdin stdinData := pkg.LoadResultFile(os.Stdin) _ = stdinData } ``` -------------------------------- ### Set Custom Thread Count with gogo CLI Source: https://context7.com/chainreactors/gogo/llms.txt Adjust the number of concurrent threads using the `-t` flag. Recommended for weaker network environments or when using proxies to avoid overwhelming the network or proxy. ```bash # Custom thread count (recommended for weak network environments) gogo -i 192.168.1.0/24 -p top2 -t 500 ``` ```bash # Proxy (SOCKS5) — use with reduced thread count gogo -i 192.168.1.0/24 -p top2 -t 20 --proxy socks5://127.0.0.1:1080 ``` ```bash # Multiple proxies (chain) gogo -i 192.168.1.0/24 -p top2 -t 10 \ --proxy socks5://127.0.0.1:1080 \ --proxy socks5://127.0.0.1:1081 ``` -------------------------------- ### Result File Loading and Processing Source: https://context7.com/chainreactors/gogo/llms.txt Load, parse, and process previously saved `.dat` result files for offline analysis or re-scanning. ```APIDOC ## Go Library — `pkg.LoadResultFile` and `ResultsData` Load, parse, and process previously saved `.dat` result files for offline analysis or re-scanning. ```go package main import ( "fmt" "log" "os" "github.com/chainreactors/gogo/v2/pkg" "github.com/chainreactors/utils/fileutils" ) func main() { // Open a .dat result file (deflate-compressed JSON lines) f, err := fileutils.Open("results.dat") if err != nil { log.Fatal(err) } data := pkg.LoadResultFile(f) switch v := data.(type) { case *pkg.ResultsData: fmt.Printf("Scan target: %s\n", v.Config.IP) fmt.Printf("Total results: %d\n", len(v.Data)) // Human-readable formatted output fmt.Print(v.ToFormat(false)) // plain text grouped by IP fmt.Print(v.ToFormat(true)) // ANSI color version // Export formats _ = v.ToJson() // single large JSON blob _ = v.ToCsv() // CSV string _ = v.ToCobaltStrike() // CobaltStrike external-C2 format _ = v.ToExtracteds() // extracted fields (email, tokens, etc.) // Filter results filtered := v.Filter("framework::redis") fmt.Printf("Redis results: %d\n", len(filtered)) // Iterate individual results for _, result := range v.Data { fmt.Printf("%s:%s [%s] %s %s\n", result.Ip, result.Port, result.Status, result.Frameworks.String(), result.Vulns.String()) } case *pkg.SmartResult: // Smart scan intermediate output (alive CIDRs) fmt.Printf("Alive CIDRs: %v\n", v.List()) default: fmt.Println("Unknown result type") } // Read from stdin stdinData := pkg.LoadResultFile(os.Stdin) _ = stdinData } ``` ``` -------------------------------- ### CLI OPSEC Mode Source: https://context7.com/chainreactors/gogo/llms.txt Activate OPSEC mode with the `--opsec` flag to suppress noisy fingerprinting probes, relying only on passive identification to minimize detection risk. ```APIDOC ## CLI — OPSEC Mode (`--opsec`) Suppresses fingerprinting probes that are considered "noisy" or potentially alerting, keeping only passive identification. ```bash gogo -i 192.168.1.0/24 -p top2 --opsec ``` ``` -------------------------------- ### CLI IP Exclusion Options Source: https://context7.com/chainreactors/gogo/llms.txt Exclude specific IP ranges or subnets from scans using the `--exclude` and `--exclude-file` flags. This allows for fine-grained control over the target scope. ```APIDOC ## CLI — IP Exclusion (`--exclude`, `--exclude-file`) ```bash # Exclude a single subnet gogo -i 192.168.0.0/16 -p top2 --exclude 192.168.1.0/24 # Exclude multiple CIDRs (comma-separated) gogo -i 10.0.0.0/8 -p top2 --exclude "10.0.1.0/24,10.0.2.0/24" # Exclude from file (one CIDR per line) gogo -i 10.0.0.0/8 -p top2 --exclude-file exclude_list.txt ``` ``` -------------------------------- ### Increase TCP Timeout with gogo CLI Source: https://context7.com/chainreactors/gogo/llms.txt Modify the TCP connection timeout using the `-d` flag to prevent missed results on slow or unreliable networks. This setting is separate from the HTTPS/TLS timeout. ```bash # Increase TCP timeout to reduce missed results on slow networks gogo -i 192.168.1.0/24 -p top2 -d 5 ``` ```bash # Separate HTTPS/TLS timeout gogo -i 192.168.1.0/24 -p top2 -d 3 -D 6 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.