Skip to content
This repository was archived by the owner on Oct 22, 2020. It is now read-only.

Commit 5dc2011

Browse files
committed
Add file validation
1 parent 3aea9c7 commit 5dc2011

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

payloads/custom.rb

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,21 @@ def encoded
2222
raw
2323
end
2424

25+
def payload_path
26+
File.expand_path(datastore['payload_path'])
27+
end
28+
29+
def prepare(mod)
30+
unless File.exist?(payload_path)
31+
mod.emit_error "#{payload_path} does not exist"
32+
return false
33+
end
34+
35+
true
36+
end
37+
2538
def raw
26-
File.open(File.expand_path(datastore['payload_path']), 'rb', &:read)
39+
File.open(payload_path, 'rb', &:read)
2740
end
2841
end
2942
end

0 commit comments

Comments
 (0)