File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 308308 net-smtp (0.3.3 )
309309 net-protocol
310310 net-ssh (7.1.0 )
311- network_interface (0.0.2 )
311+ network_interface (0.0.4 )
312312 nexpose (7.3.0 )
313313 nio4r (2.5.9 )
314314 nokogiri (1.14.5 )
Original file line number Diff line number Diff line change @@ -10,7 +10,12 @@ module Msf
1010###
1111class OptAddressLocal < OptAddress
1212 def interfaces
13- NetworkInterface . interfaces || [ ]
13+ begin
14+ NetworkInterface . interfaces || [ ]
15+ rescue NetworkInterface ::Error => e
16+ elog ( e )
17+ [ ]
18+ end
1419 end
1520
1621 def normalize ( value )
Original file line number Diff line number Diff line change 9494 end
9595 end
9696 end
97+ describe '#interfaces' do
98+ context 'getting errors' do
99+ before ( :each ) do
100+ allow ( NetworkInterface ) . to receive ( :interfaces ) . and_raise ( NetworkInterface ::Error )
101+ end
102+
103+ it 'rescues and returns an empty array' do
104+ expect ( required_opt ) . to receive ( :elog ) . with ( an_instance_of ( NetworkInterface ::Error ) )
105+ result = required_opt . interfaces ( )
106+ expect ( result ) . to eq ( [ ] )
107+ end
108+ end
109+ end
97110end
You can’t perform that action at this time.
0 commit comments