@@ -33,7 +33,7 @@ def initialize(info = {})
33
33
34
34
register_options ( [
35
35
OptEnum . new ( 'PROTOCOL' , [ true , 'Protocol to use' , 'udp' , %w{ tcp udp } ] ) ,
36
- OptAddress . new ( 'CLIENT' , [ true , ' Client from target\ 's bootparams file' ] )
36
+ OptAddress . new ( 'CLIENT' , [ true , " Client from target's bootparams file" ] )
37
37
] )
38
38
39
39
register_advanced_options ( [
@@ -52,11 +52,9 @@ def run
52
52
1 # Program Version: 1
53
53
)
54
54
rescue Rex ::ConnectionError
55
- print_error ( 'Could not connect to portmapper' )
56
- return
55
+ fail_with ( Failure ::Unreachable , 'Could not connect to portmapper' )
57
56
rescue Rex ::Proto ::SunRPC ::RPCError
58
- print_error ( 'Could not connect to bootparamd' )
59
- return
57
+ fail_with ( Failure ::Unreachable , 'Could not connect to bootparamd' )
60
58
end
61
59
62
60
# Flavor: AUTH_NULL (0)
@@ -76,33 +74,30 @@ def run
76
74
bootparam_whoami # Boot Parameters
77
75
)
78
76
rescue Rex ::Proto ::SunRPC ::RPCError
79
- print_error ( 'Could not call bootparamd procedure' )
80
- return
77
+ fail_with ( Failure ::NotFound , 'Could not call bootparamd procedure' )
81
78
rescue Rex ::Proto ::SunRPC ::RPCTimeout
82
- print_error ( 'Could not disclose NIS domain name (try another CLIENT?)' )
83
- return
79
+ fail_with ( Failure :: NotVulnerable ,
80
+ 'Could not disclose NIS domain name (try another CLIENT?)' )
84
81
ensure
85
82
# Shut it down! Shut it down forever!
86
83
sunrpc_destroy
87
84
end
88
85
89
- if res . nil?
90
- print_error ( 'Invalid response from server' )
91
- return
86
+ unless res
87
+ fail_with ( Failure ::Unknown , 'No response from server' )
92
88
end
93
89
94
90
bootparams = begin
95
91
Timeout . timeout ( datastore [ 'XDRTimeout' ] ) do
96
92
parse_bootparams ( res )
97
93
end
98
94
rescue Timeout ::Error
99
- print_error ( 'XDR decoding timed out (try increasing XDRTimeout?)' )
100
- return
95
+ fail_with ( Failure :: TimeoutExpired ,
96
+ 'XDR decoding timed out (try increasing XDRTimeout?)' )
101
97
end
102
98
103
- if bootparams . nil? || bootparams . empty?
104
- print_error ( 'Could not parse bootparams' )
105
- return
99
+ if bootparams . blank?
100
+ fail_with ( Failure ::Unknown , 'Could not parse bootparams' )
106
101
end
107
102
108
103
bootparams . each do |host , domain |
0 commit comments