File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
modules/exploits/linux/http Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -112,9 +112,15 @@ def check
112
112
# trying to get the model and version number
113
113
# unfortunately JSON parsing fails, so we need to use this ugly REGEX :-(
114
114
version = res . body . match ( /.?(version).?\s *:\s *.?((\\ |[^,])*)/ )
115
+ # when found, remove whitespaces and make all uppercase to avoid suprises in string splitting and comparison
115
116
unless version . nil?
116
- version_number = version [ 2 ] . split ( '-V' ) [ 1 ] . chop
117
- model_number = version [ 2 ] . split ( '-V' ) [ 0 ] [ /\( ([^(]+)/ , 1 ] . chop
117
+ version_number = version [ 2 ] . upcase . split ( '-V' ) [ 1 ] . gsub ( /[[:space:]]/ , '' ) . chop
118
+ # The model number part is usually something like Netis(NC63), but occassionally you see things like Stonet-N3D
119
+ if version [ 2 ] . upcase . split ( '-V' ) [ 0 ] . include? ( '-' )
120
+ model_number = version [ 2 ] . upcase . split ( '-V' ) [ 0 ] [ /-([^-]+)/ , 1 ] . gsub ( /[[:space:]]/ , '' )
121
+ else
122
+ model_number = version [ 2 ] . upcase . split ( '-V' ) [ 0 ] [ /\( ([^)]+)/ , 1 ] . gsub ( /[[:space:]]/ , '' )
123
+ end
118
124
# Check if target is model MW5360 and running firmware 1.0.1.3442 (newest release 2024-04-24) or lower
119
125
if version_number && model_number == 'MW5360' && ( Rex ::Version . new ( version_number ) <= Rex ::Version . new ( '1.0.1.3442' ) )
120
126
return CheckCode ::Appears ( version [ 2 ] . chop . to_s )
You can’t perform that action at this time.
0 commit comments