Browse Source

fix regex

Brent Cook 3 years ago
parent
commit
eb26202961
2 changed files with 3 additions and 7 deletions
  1. 2
    6
      lib/msf/core/opt_base.rb
  2. 1
    1
      lib/msf/core/opt_regexp.rb

+ 2
- 6
lib/msf/core/opt_base.rb View File

@@ -88,14 +88,10 @@ module Msf
88 88
     def valid?(value, check_empty: true)
89 89
       if check_empty && required?
90 90
         # required variable not set
91
-        return false if (value == nil or value.to_s.empty?)
91
+        return false if (value.nil? || value.to_s.empty?)
92 92
       end
93 93
       if regex
94
-        if value.match(regex)
95
-          return true
96
-        else
97
-          return false
98
-        end
94
+        return !!value.match(regex)
99 95
       end
100 96
       return true
101 97
     end

+ 1
- 1
lib/msf/core/opt_regexp.rb View File

@@ -17,7 +17,7 @@ class OptRegexp < OptBase
17 17
 
18 18
     begin
19 19
       Regexp.compile(value)
20
-      return super
20
+      return true
21 21
     rescue RegexpError, TypeError
22 22
       return false
23 23
     end

Loading…
Cancel
Save