Strip safely, avoid nil.strip errors
parent
5b3d877b25
commit
d8200c65a8
|
@ -48,7 +48,7 @@ class Metasploit4 < Msf::Post
|
||||||
def extract_key(path)
|
def extract_key(path)
|
||||||
data = read_file(path)
|
data = read_file(path)
|
||||||
keys = data.split(':').select { |k| k =~ /[0-9a-f]{32}/ }
|
keys = data.split(':').select { |k| k =~ /[0-9a-f]{32}/ }
|
||||||
keys.first.strip
|
keys.map {|k| k.strip}.first
|
||||||
end
|
end
|
||||||
|
|
||||||
def download_key(paths)
|
def download_key(paths)
|
||||||
|
|
Loading…
Reference in New Issue