Skip to content

Commit 0210058

Browse files
caffixchaeyib
andcommitted
fixed the db subcommand -ip output
Co-authored-by: Kaushal Mallya <chaeyib@users.noreply.github.com>
1 parent 0d507a1 commit 0210058

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

cmd/amass/db.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ func runDBCommand(clArgs []string) {
9696
color.Output = io.Discard
9797
color.Error = io.Discard
9898
}
99+
if args.Options.IPs {
100+
args.Options.IPv4 = true
101+
args.Options.IPv6 = true
102+
}
99103
if args.Filepaths.Domains != "" {
100104
list, err := config.GetListFromFile(args.Filepaths.Domains)
101105
if err != nil {

cmd/amass/io.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func EventOutput(ctx context.Context, g *netmap.Graph, domains []string, since t
152152
lookup[n] = o
153153
}
154154
// Build the lookup map used to create the final result set
155-
if pairs, err := g.NamesToAddrs(ctx, since, names...); err == nil {
155+
if pairs, err := g.NamesToAddrs(ctx, qtime, names...); err == nil {
156156
for _, p := range pairs {
157157
addr := p.Addr.Address.String()
158158

format/print.go

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,6 @@ func OutputLineParts(out *requests.Output, addrs, demo bool) (name, ips string)
197197
ips += a.Address.String()
198198
}
199199
}
200-
if ips == "" {
201-
ips = "N/A"
202-
}
203200
}
204201
name = out.Name
205202
if demo {
@@ -210,20 +207,17 @@ func OutputLineParts(out *requests.Output, addrs, demo bool) (name, ips string)
210207

211208
// DesiredAddrTypes removes undesired address types from the AddressInfo slice.
212209
func DesiredAddrTypes(addrs []requests.AddressInfo, ipv4, ipv6 bool) []requests.AddressInfo {
213-
if !ipv4 && !ipv6 {
214-
return addrs
215-
}
210+
var kept []requests.AddressInfo
216211

217-
var keep []requests.AddressInfo
218212
for _, addr := range addrs {
219-
if amassnet.IsIPv4(addr.Address) && !ipv4 {
220-
continue
221-
} else if amassnet.IsIPv6(addr.Address) && !ipv6 {
222-
continue
213+
if ipv4 && amassnet.IsIPv4(addr.Address) {
214+
kept = append(kept, addr)
215+
} else if ipv6 && amassnet.IsIPv6(addr.Address) {
216+
kept = append(kept, addr)
223217
}
224-
keep = append(keep, addr)
225218
}
226-
return keep
219+
220+
return kept
227221
}
228222

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

0 commit comments

Comments
 (0)