Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/lib/msf/base/sessions/pingback.rb
Views: 11623
# -*- coding: binary -*-12module Msf3module Sessions45###6#7# This class provides the ability to receive a pingback UUID8#9###10class Pingback1112#13# This interface supports basic interaction.14#15include Msf::Session16include Msf::Session::Basic1718attr_accessor :arch19attr_accessor :platform20attr_accessor :uuid_string2122#23# Returns the type of session.24#25def self.type26"pingback"27end2829def initialize(rstream, opts = {})30super31self.platform ||= ""32self.arch ||= ""33datastore = opts[:datastore]34end3536def self.create_session(rstream, opts = {})37Msf::Sessions::Pingback.new(rstream, opts)38end3940def process_autoruns(datastore)41uuid_read42cleanup43end4445def cleanup46if rstream47# this is also a best-effort48rstream.close rescue nil49rstream = nil50end51end5253def uuid_read54uuid_raw = rstream.get_once(16, 1)55return nil unless uuid_raw56self.uuid_string = uuid_raw.each_byte.map { |b| "%02x" % b.to_i() }.join57print_status("Incoming UUID = #{uuid_string}")58if framework.db.active59begin60payload = framework.db.payloads(uuid: uuid_string).first61if payload.nil?62print_warning("Provided UUID (#{uuid_string}) was not found in database!")63else64print_good("UUID identified (#{uuid_string})")65end66rescue ActiveRecord::ConnectionNotEstablished67print_status("WARNING: UUID verification and logging is not available, because the database is not active.")68rescue => e69# TODO: Can we have a more specific exception handler?70# Test: what if we send no bytes back? What if we send less than 16 bytes? Or more than?71elog('Can\'t get original UUID', error: e)72end73else74print_warning("WARNING: UUID verification and logging is not available, because the database is not active.")75end76end7778#79# Returns the session description.80#81def desc82"Pingback"83end8485def self.can_cleanup_files86false87end8889#90# Calls the class method91#92def type93self.class.type94end95end96end97end9899100