Record UUID upon pingback_reverse_tcp generation and callback
This commit is contained in:
parent
3b54fb30dd
commit
6d6b33968f
|
@ -37,21 +37,26 @@ class Pingback
|
||||||
if uuid_raw
|
if uuid_raw
|
||||||
uuid_string = uuid_raw.each_byte.map { |b| "%02x" % b.to_i() }.join
|
uuid_string = uuid_raw.each_byte.map { |b| "%02x" % b.to_i() }.join
|
||||||
puts("Incoming Pingback_UUID = |" + uuid_string + "|")
|
puts("Incoming Pingback_UUID = |" + uuid_string + "|")
|
||||||
#asoto-r7, check the database for the entery here!
|
|
||||||
|
res = Mdm::Payload.find_by uuid: uuid_string
|
||||||
|
require 'pry'; binding.pry
|
||||||
|
|
||||||
begin
|
begin
|
||||||
uuid_original = opts[:datastore]['PingbackUUID'].to_s
|
if res.nil?
|
||||||
puts("Original UUID = |" + uuid_original.gsub("-", "") + "|")
|
puts("Provided UUID (#{uuid_string}) was not found in database!")
|
||||||
if uuid_original.gsub("-", "") == uuid_string
|
#TODO: Abort, somehow?
|
||||||
puts("UUIDs Match!")
|
|
||||||
else
|
else
|
||||||
puts("UUIDs DO NOT Match!")
|
puts("UUID identified (#{uuid_string})")
|
||||||
end
|
end
|
||||||
rescue => e
|
rescue => e
|
||||||
puts("Can't get original UUID")
|
#TODO: Can we have a more specific exception handler?
|
||||||
|
# Test: what if we send no bytes back? What if we send less than 16 bytes? Or more than?
|
||||||
|
puts "Can't get original UUID"
|
||||||
puts "Exception Class: #{ e.class.name }"
|
puts "Exception Class: #{ e.class.name }"
|
||||||
puts "Exception Message: #{ e.message }"
|
puts "Exception Message: #{ e.message }"
|
||||||
puts "Exception Backtrace: #{ e.backtrace }"
|
puts "Exception Backtrace: #{ e.backtrace }"
|
||||||
end
|
end
|
||||||
|
conn.close
|
||||||
end
|
end
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
|
@ -47,8 +47,9 @@ module PingbackOptions
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
def generate_pingback_uuid
|
|
||||||
puts("generate_pingback_uuid")
|
def generate_pingback_uuid
|
||||||
|
puts("Msf::Sessions::PingbackOptions.generate_pingback_uuid")
|
||||||
conf = {}
|
conf = {}
|
||||||
if datastore['PingbackUUID'].to_s.length > 0
|
if datastore['PingbackUUID'].to_s.length > 0
|
||||||
#
|
#
|
||||||
|
@ -59,7 +60,16 @@ module PingbackOptions
|
||||||
conf[:pingback_store] = datastore['PingbackUUIDDatabase']
|
conf[:pingback_store] = datastore['PingbackUUIDDatabase']
|
||||||
pingback = Msf::Payload::Pingback.new(conf)
|
pingback = Msf::Payload::Pingback.new(conf)
|
||||||
datastore['PingbackUUID'] ||= pingback.uuid
|
datastore['PingbackUUID'] ||= pingback.uuid
|
||||||
#asoto-r7, this is where we write the UUID to the database.
|
|
||||||
|
require 'pry'; binding.pry
|
||||||
|
|
||||||
|
vprint_status("Writing UUID #{datastore['PingbackUUID']} to database...")
|
||||||
|
Mdm::Payload.create!(name: datastore['PayloadUUIDName'],
|
||||||
|
uuid: datastore['PingbackUUID'].gsub('-',''),
|
||||||
|
description: 'pingback',
|
||||||
|
platform: platform.platforms.first.realname.downcase,
|
||||||
|
workspace: framework.db.workspace)
|
||||||
|
|
||||||
pingback.uuid
|
pingback.uuid
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue