File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
spec/support/shared/examples/metasploit/framework/login_scanner Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 54
54
[ pub_blank , pub_pub , pub_pri ]
55
55
}
56
56
57
+ let ( :socket_error ) {
58
+ ::SocketError . new ( "getaddrinfo: nodename nor servname provided, or not known" )
59
+ }
60
+
57
61
it { is_expected . to respond_to :connection_timeout }
58
62
it { is_expected . to respond_to :cred_details }
59
63
it { is_expected . to respond_to :host }
101
105
end
102
106
103
107
context 'host' do
108
+ before do
109
+ allow ( ::Rex ::Socket ) . to receive ( :getaddress ) . with ( '192.168.1.1.5' , true ) . and_raise ( socket_error )
110
+ allow ( ::Rex ::Socket ) . to receive ( :getaddress ) . with ( '192.168' , true ) . and_return ( '192.0.0.168' )
111
+ allow ( ::Rex ::Socket ) . to receive ( :getaddress ) . with ( '192.300.675.123' , true ) . and_raise ( socket_error )
112
+ allow ( ::Rex ::Socket ) . to receive ( :getaddress ) . with ( 'nosuchplace.metasploit.com' , true ) . and_raise ( socket_error )
113
+ end
104
114
105
115
it 'is not valid for not set' do
106
116
expect ( login_scanner ) . to_not be_valid
You can’t perform that action at this time.
0 commit comments