Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AddCmd = &cobra.Command{ Use: "add", Short: "Add items to scope", Long: `Add items to scope unless it has been excluded via scopious exclude. For example: cat customer-supplied.txt | scopious add scopious add -i internal 10.0.0.0/22 `, Run: func(cmd *cobra.Command, args []string) { scopeName, _ := cmd.Flags().GetString("scope") all, _ := cmd.Flags().GetBool("all") scope := scoperInstance.GetScope(scopeName) if len(args) > 0 { scope.Add(all, args...) } else { scanner := bufio.NewScanner(os.Stdin) for scanner.Scan() { scopeLine := scanner.Text() scope.Add(all, scopeLine) } if scanner.Err() != nil { log.Printf("STDIN scanner encountered an error: %s", scanner.Err()) } } scoperInstance.Save() }, }
AddCmd represents the add command
View Source
var DomainsCmd = &cobra.Command{ Use: "domains", Short: "Print out in scope domains", Long: `Print out in scope domains. For example: Print all domains in scope: scopious domains Print in scope root domains: scopious domains -r `, Run: func(cmd *cobra.Command, args []string) { scopeName, _ := cmd.Flags().GetString("scope") showRootDomains, _ := cmd.Flags().GetBool("root-domains") allRootDomains, _ := cmd.Flags().GetBool("all-root-domains") totals, _ := cmd.Flags().GetBool("totals") withSuffix, _ := cmd.Flags().GetString("suffix") scope := scoperInstance.GetScope(scopeName) var domains []string if allRootDomains { domains = scope.GetRootDomainSlice(false) } else if showRootDomains { domains = scope.RootDomains() } else { domains = scope.AllDomains() } if totals && (allRootDomains || showRootDomains) { totalMap := map[string]int{} allDomains := scope.AllDomains() for _, rootDomain := range domains { for _, domain := range allDomains { if strings.HasSuffix(domain, rootDomain) { totalMap[rootDomain]++ } } } for rootDomain, count := range totalMap { fmt.Println(rootDomain, count) } return } for _, domain := range domains { if withSuffix != "" { if strings.HasSuffix(domain, withSuffix) { fmt.Println(domain) } } else { fmt.Println(domain) } } }, }
DomainsCmd represents the domains command
View Source
var ExcludeCmd = &cobra.Command{ Use: "exclude", Short: "Add an item to the exclude list", Long: `Add items to to the exclude list. Sometimes not every subdomain underneath a domain or IP address in a CIDR is in scope. scopious exclude admin.example.com `, Run: func(cmd *cobra.Command, args []string) { shouldList, _ := cmd.Flags().GetBool("list") scopeName, _ := cmd.Flags().GetString("scope") scope := scoperInstance.GetScope(scopeName) if shouldList { for excluded := range scope.Excludes { fmt.Println(excluded) } return } if len(args) > 0 { scope.AddExclude(args...) } else { scanner := bufio.NewScanner(os.Stdin) for scanner.Scan() { scopeLine := scanner.Text() scope.AddExclude(scopeLine) } if scanner.Err() != nil { log.Printf("STDIN scanner encountered an error: %s", scanner.Err()) } } scoperInstance.Save() }, }
ExcludeCmd represents the block command
View Source
var ExpandCmd = &cobra.Command{ Use: "expand", Short: "Expand CIDRs", Long: `Expand CIDRs. For example: cat customer-supplied.txt | scopious expand scopious expand 10.0.0.0/22 `, Run: func(cmd *cobra.Command, args []string) { all, _ := cmd.Flags().GetBool("all") public, _ := cmd.Flags().GetBool("public") private, _ := cmd.Flags().GetBool("private") if public && private { public = false private = false } if len(args) > 0 { for _, scopeLine := range args { processScopeLine(scopeLine, all, public, private) } } else { scanner := bufio.NewScanner(os.Stdin) for scanner.Scan() { scopeLine := scanner.Text() processScopeLine(scopeLine, all, public, private) } if scanner.Err() != nil { log.Printf("STDIN scanner encountered an error: %s", scanner.Err()) } } }, }
View Source
var GetCmd = &cobra.Command{ Use: "get", Short: "get scope things", Long: `get scope things `, Run: func(cmd *cobra.Command, args []string) { scopeName, _ := cmd.Flags().GetString("scope") ipv4, _ := cmd.Flags().GetBool("ipv4") ipv6, _ := cmd.Flags().GetBool("ipv6") domain, _ := cmd.Flags().GetBool("domain") exclude, _ := cmd.Flags().GetBool("exclude") if ipv4 { fmt.Println(scoperInstance.GetScopeIPv4Path(scopeName)) } if ipv6 { fmt.Println(scoperInstance.GetScopeIPv6Path(scopeName)) } if domain { fmt.Println(scoperInstance.GetScopeDomainsPath(scopeName)) } if exclude { fmt.Println(scoperInstance.GetScopeExcludePath(scopeName)) } }, }
GetCmd represents the add command
View Source
var IpsCmd = &cobra.Command{ Use: "ips", Short: "List IP addresses in scope", Long: `List IP addresses in scope. Show in scope ips scopious ips Expand CIDRs and remove excluded ips scopious ips -x `, Run: func(cmd *cobra.Command, args []string) { scopeName, _ := cmd.Flags().GetString("scope") shouldExpand, _ := cmd.Flags().GetBool("expand") all, _ := cmd.Flags().GetBool("all") scope := scoperInstance.GetScope(scopeName) var scopeStrings []string if shouldExpand { scopeStrings = scope.AllExpanded(all) sort.Strings(scopeStrings) } else { scopeStrings = scope.AllIPs() } for _, ip := range scopeStrings { fmt.Println(ip) } }, }
IpsCmd represents the ips command
View Source
var PruneCmd = &cobra.Command{ Use: "prune", Short: "Prune excluded scope items from input", Long: `Prune excluded scope items from input cat urls.txt | scopious prune `, Run: func(cmd *cobra.Command, args []string) { scopeName, _ := cmd.Flags().GetString("scope") scope := scoperInstance.GetScope(scopeName) scopePrinted := map[string]bool{} scanner := bufio.NewScanner(os.Stdin) for scanner.Scan() { scopeLine := scanner.Text() if scope.IsInScope(scopeLine) { if _, ok := scopePrinted[scopeLine]; !ok { scopePrinted[scopeLine] = true fmt.Println(scopeLine) } } } if scanner.Err() != nil { log.Printf("STDIN scanner encountered an error: %s", scanner.Err()) } }, }
PruneCmd represents the check command
View Source
var RootCmd = &cobra.Command{ Use: "scopious", Short: "Manage scope for your network based projects", Long: `Scoper can help you manage the scope of network projects by: - Automatically detecting and separating IP addresses or domains - Ensuring an item is in the scope of your engagement - Keep track of multiple scope for your engagement To use, simply supply your scope as arguments to scopious add scopious add example.com example.net 203.0.113.0/24 cat scope.txt | scopious add By default scope is stored in ./scope/external/. This scan be changed by specifying -s scopious add -s internal evil.corp internal.corpdev 10.0.0.1/24 You can exclude things from scope as well scope excluded admin.example.com 203.0.113.0/29 Scoper can validate items are in scope cat maybe-inscope.txt | scopious prune > inscope.txt Need to view your scope data, scopious can show you all your scope in various ways List in scope domains scopious domains list in scope root domains scopious domains -r list in scope ips scopious ips expand cidrs and remove excluded things scopious ips -x list excluded things scopious exclude -l `, PersistentPreRun: func(cmd *cobra.Command, args []string) { debug := viper.GetBool("debug") if debug { state.Debug = true } scopeDir := viper.GetString("scope-dir") scoperInstance = scopious.FromPath(scopeDir) }, Run: func(cmd *cobra.Command, args []string) { scopeName, _ := cmd.Flags().GetString("scope") scope := scoperInstance.GetScope(scopeName) for _, ip := range scope.AllIPs() { fmt.Println(ip) } for _, domain := range scope.AllDomains() { fmt.Println(domain) } }, }
RootCmd represents the base command when called without any subcommands
Functions ¶
Types ¶
This section is empty.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.