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/rex/post/meterpreter/pivot_container.rb
Views: 11784
# -*- coding: binary -*-12module Rex3module Post4module Meterpreter56###7#8# This interface is meant to be included by things that are meant to contain9# zero or more pivot instances in the form of a hash.10#11###12module PivotContainer1314#15# Initializes the pivot association hash16#17def initialize_pivots18self.pivot_sessions = {}19self.pivot_listeners = {}20end2122#23# Adds a pivot to the container that is indexed by the pivoted24# session guid.25#26def add_pivot_session(pivot)27self.pivot_sessions[pivot.pivoted_session.session_guid] = pivot28end2930def add_pivot_listener(listener)31self.pivot_listeners[listener.id] = listener32end3334#35# Looks up a pivot instance based on its pivoted session guid.36#37def find_pivot_session(pivot_session_guid)38return self.pivot_sessions[pivot_session_guid]39end4041def find_pivot_listener(listener_id)42return self.pivot_listeners[listener_id]43end4445#46# Removes a pivot based on its pivoted session guid.47#48def remove_pivot_session(pivot_session_guid)49return self.pivot_sessions.delete(pivot_session_guid)50end5152def remove_pivot_listener(listener_id)53return self.pivot_listeners.delete(listener_id)54end5556#57# The hash of pivot sessions.58#59attr_reader :pivot_sessions6061attr_reader :pivot_listeners6263protected6465attr_writer :pivot_sessions # :nodoc:6667attr_writer :pivot_listeners # :nodoc:6869end7071end; end; end727374