Module Plug

Imported modules

Class PlugProxy

Implements a general plug proxy, with optionally disabling data transfer in either direction.

By default plug copies all data in both directions. To change this set the copy_to_client or copy_to_server attributes to FALSE.

Note

Copying out of band data is not supported.

Attributes

Table 4-75. Attributes for class PlugProxy

copy_to_serverCopy data in client->server direction
copy_to_clientCopy data in server->client direction
bandwidth_to_clientReadonly variable containing the utilized bandwidth in server->client direction.
bandwidth_to_serverReadonly variable containing the utilized bandwidth in client->server direction.
packet_stats_intervalThe number of milliseconds between two successive packetStats() events. By default: 0. NOTE: this is currently implemented as the number of passing packages, not as milliseconds.
stack_proxythe proxy class to stack into the connection

Notes

packetStats() event is called whenever the time interval elapses (or as currently implemented the given number of packets were transmitted). this event receives packet statistics as parameters.

It's useful for terminating connections with excessive bandwidth requirements (for instance to limit the impact of the covert channel opened when using plug instead of a protocol specific proxy)

packetStats is defined as:

def packetStats(self, client_bytes, client_pkts, server_bytes, server_pkts)

Constructor __init__

Initialize a PlugProxy instance.

Synopsis

__init__ ( self,  session )

Description

Create and set up a PlugProxy instance.

Arguments

Table 4-76. Arguments for PlugProxy.__init__()

selfthis instance
sessionsession this instance belongs to

Method requestStack

Query if something is to be stacked into this plug.

Synopsis

requestStack ( self )

Description

Callback called by the underlying C proxy to query if something is to be stacked.

Arguments

Table 4-77. Arguments for PlugProxy.requestStack()

selfthis instance

Returns

the class of the proxy to stack in

Method stackProxy

Stack a proxy instance within this plug.

Synopsis

stackProxy (
        self,
        client_fd,
        server_fd,
        )

Description

Callback called by the underlying C proxy to actually stack in something.

Arguments

Table 4-78. Arguments for PlugProxy.stackProxy()

selfthis instance
client_fdclient fd
server_fdserver fd