@@ -283,8 +283,9 @@ def cmd_hosts(*args)
283
283
if set_rhosts
284
284
# only unique addresses
285
285
addr = ( host . scope ? host . address + '%' + host . scope : host . address )
286
- rhosts << addr unless rhosts . include? ( addr )
286
+ rhosts << addr
287
287
end
288
+ rhosts . uniq!
288
289
end
289
290
end
290
291
return
@@ -323,8 +324,9 @@ def cmd_hosts(*args)
323
324
tbl << columns
324
325
if set_rhosts
325
326
addr = ( host . scope ? host . address + '%' + host . scope : host . address )
326
- rhosts << addr unless rhosts . include? ( addr )
327
+ rhosts << addr
327
328
end
329
+ rhosts . uniq!
328
330
if mode == :delete
329
331
host . destroy
330
332
delete_count += 1
@@ -347,6 +349,8 @@ def cmd_hosts(*args)
347
349
set_rhosts_from_addrs ( rhosts ) if set_rhosts
348
350
print_status ( "Deleted #{ delete_count } hosts" ) if delete_count > 0
349
351
}
352
+ ##
353
+ ##
350
354
end
351
355
352
356
def cmd_services_help
@@ -508,8 +512,9 @@ def cmd_services(*args)
508
512
tbl << columns
509
513
if set_rhosts
510
514
addr = ( host . scope ? host . address + '%' + host . scope : host . address )
511
- rhosts << addr unless rhosts . include? ( addr )
515
+ rhosts << addr
512
516
end
517
+ rhosts . uniq!
513
518
514
519
if ( mode == :delete )
515
520
service . destroy
@@ -828,8 +833,9 @@ def cmd_creds(*args)
828
833
end
829
834
if set_rhosts
830
835
addr = ( cred . service . host . scope ? cred . service . host . address + '%' + cred . service . host . scope : cred . service . host . address )
831
- rhosts << addr unless rhosts . include? ( addr )
836
+ rhosts << addr
832
837
end
838
+ rhosts . uniq!
833
839
creds_returned += 1
834
840
end
835
841
@@ -954,8 +960,9 @@ def cmd_notes(*args)
954
960
msg << " host=#{ note . host . address } "
955
961
if set_rhosts
956
962
addr = ( host . scope ? host . address + '%' + host . scope : host . address )
957
- rhosts << addr unless rhosts . include? ( addr )
963
+ rhosts << addr
958
964
end
965
+ rhosts . uniq!
959
966
end
960
967
if ( note . service )
961
968
name = ( note . service . name ? note . service . name : "#{ note . service . port } /#{ note . service . proto } " )
0 commit comments