Skip to content

Commit

Permalink
fixed the db subcommand -ip output
Browse files Browse the repository at this point in the history
Co-authored-by: Kaushal Mallya <chaeyib@users.noreply.github.com>
  • Loading branch information
caffix and chaeyib committed Jul 25, 2023
1 parent 0d507a1 commit 0210058
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
4 changes: 4 additions & 0 deletions cmd/amass/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ func runDBCommand(clArgs []string) {
color.Output = io.Discard
color.Error = io.Discard
}
if args.Options.IPs {
args.Options.IPv4 = true
args.Options.IPv6 = true
}
if args.Filepaths.Domains != "" {
list, err := config.GetListFromFile(args.Filepaths.Domains)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/amass/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func EventOutput(ctx context.Context, g *netmap.Graph, domains []string, since t
lookup[n] = o
}
// Build the lookup map used to create the final result set
if pairs, err := g.NamesToAddrs(ctx, since, names...); err == nil {
if pairs, err := g.NamesToAddrs(ctx, qtime, names...); err == nil {
for _, p := range pairs {
addr := p.Addr.Address.String()

Expand Down
20 changes: 7 additions & 13 deletions format/print.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,6 @@ func OutputLineParts(out *requests.Output, addrs, demo bool) (name, ips string)
ips += a.Address.String()
}
}
if ips == "" {
ips = "N/A"
}
}
name = out.Name
if demo {
Expand All @@ -210,20 +207,17 @@ func OutputLineParts(out *requests.Output, addrs, demo bool) (name, ips string)

// DesiredAddrTypes removes undesired address types from the AddressInfo slice.
func DesiredAddrTypes(addrs []requests.AddressInfo, ipv4, ipv6 bool) []requests.AddressInfo {
if !ipv4 && !ipv6 {
return addrs
}
var kept []requests.AddressInfo

var keep []requests.AddressInfo
for _, addr := range addrs {
if amassnet.IsIPv4(addr.Address) && !ipv4 {
continue
} else if amassnet.IsIPv6(addr.Address) && !ipv6 {
continue
if ipv4 && amassnet.IsIPv4(addr.Address) {
kept = append(kept, addr)
} else if ipv6 && amassnet.IsIPv6(addr.Address) {
kept = append(kept, addr)
}
keep = append(keep, addr)
}
return keep

return kept
}

// InterfaceInfo returns network interface information specific to the current host.
Expand Down

0 comments on commit 0210058

Please sign in to comment.