Skip to content

Commit 66d23e3

Browse files
committed
Delete file: validation on normalization again
1 parent 57df5c4 commit 66d23e3

File tree

3 files changed

+7
-26
lines changed

3 files changed

+7
-26
lines changed

lib/msf/core/opt_address_range.rb

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,18 @@ def type
1414

1515
def normalize(value)
1616
return nil unless value.kind_of?(String)
17-
if (value =~ /^file:(.*)/)
18-
path = $1
19-
return false if not File.exists?(path) or File.directory?(path)
20-
return File.readlines(path).map{ |s| s.strip}.join(" ")
21-
elsif (value =~ /^rand:(.*)/)
17+
if value =~ /^rand:(.*)/
2218
count = $1.to_i
2319
return false if count < 1
2420
ret = ''
25-
count.times {
26-
ret << " " if not ret.empty?
27-
ret << [ rand(0x100000000) ].pack("N").unpack("C*").map{|x| x.to_s }.join(".")
28-
}
21+
count.times do
22+
ret << ' ' if not ret.empty?
23+
ret << [ rand(0x100000000) ].pack('N').unpack('C*').map{|x| x.to_s }.join('.')
24+
end
2925
return ret
3026
end
31-
return value
27+
28+
value
3229
end
3330

3431
def valid?(value)

lib/msf/core/opt_raw.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,6 @@ def type
1313
end
1414

1515
def normalize(value)
16-
if (value =~ /^file:(.*)/)
17-
path = $1
18-
begin
19-
value = File.read(path)
20-
rescue ::Errno::ENOENT, ::Errno::EISDIR
21-
value = nil
22-
end
23-
end
2416
value
2517
end
2618

lib/msf/core/opt_string.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,6 @@ def type
1313
end
1414

1515
def normalize(value)
16-
if (value =~ /^file:(.*)/)
17-
path = $1
18-
begin
19-
value = File.read(path)
20-
rescue ::Errno::ENOENT, ::Errno::EISDIR
21-
value = nil
22-
end
23-
end
2416
value
2517
end
2618

0 commit comments

Comments
 (0)