Prevent payload creation with duplicate uuids

master
Erin Bleiweiss 2018-09-18 16:49:06 -05:00
parent 7e6c3261b6
commit 35e767e2dd
No known key found for this signature in database
GPG Key ID: F69B2138BD594660
1 changed files with 6 additions and 0 deletions

View File

@ -1,6 +1,12 @@
module Msf::DBManager::Payload
def create_payload(opts)
if opts[:uuid] && !opts[:uuid].to_s.empty?
if Mdm::Payload.find_by(uuid: opts[:uuid])
raise ArgumentError.new("A payload with this uuid already exists.") if opts[:ids].nil?
end
end
Mdm::Payload.create(opts)
end