remove spaces at EOL

This commit is contained in:
James Lee 2011-11-20 11:30:15 +11:00
parent a4cadf0d53
commit 60c3c44800
3 changed files with 33 additions and 33 deletions

View File

@ -102,12 +102,12 @@ class Config
return routes return routes
end end
alias routes get_routes alias routes get_routes
# #
# Adds a route to the target machine. # Adds a route to the target machine.
# #
def add_route(subnet, netmask, gateway) def add_route(subnet, netmask, gateway)
request = Packet.create_request('stdapi_net_config_add_route') request = Packet.create_request('stdapi_net_config_add_route')
@ -136,9 +136,9 @@ class Config
end end
protected protected
attr_accessor :client # :nodoc: attr_accessor :client # :nodoc:
end end
end; end; end; end; end; end end; end; end; end; end; end

View File

@ -46,8 +46,8 @@ class Interface
"Hardware MAC: %02x:%02x:%02x:%02x:%02x:%02x\n" + "Hardware MAC: %02x:%02x:%02x:%02x:%02x:%02x\n" +
"IP Address : %s\n" + "IP Address : %s\n" +
"Netmask : %s\n" + "Netmask : %s\n" +
"\n", "\n",
macocts[0], macocts[1], macocts[2], macocts[3], macocts[0], macocts[1], macocts[2], macocts[3],
macocts[4], macocts[5], ip, netmask) macocts[4], macocts[5], ip, netmask)
end end

View File

@ -14,78 +14,78 @@ module Net
module SocketSubsystem module SocketSubsystem
class TcpServerChannel < Rex::Post::Meterpreter::Channel class TcpServerChannel < Rex::Post::Meterpreter::Channel
# #
# This is a class variable to store all pending client tcp connections which have not been passed # This is a class variable to store all pending client tcp connections which have not been passed
# off via a call to the respective server tcp channels accept method. The dictionary key is the # off via a call to the respective server tcp channels accept method. The dictionary key is the
# tcp server channel instance and the values held are an array of pending tcp client channels # tcp server channel instance and the values held are an array of pending tcp client channels
# connected to the tcp server channel. # connected to the tcp server channel.
# #
@@server_channels = {} @@server_channels = {}
class << self class << self
include Rex::Post::Meterpreter::InboundPacketHandler include Rex::Post::Meterpreter::InboundPacketHandler
# #
# This is the request handler which is registerd to the respective meterpreter instance via # This is the request handler which is registerd to the respective meterpreter instance via
# Rex::Post::Meterpreter::Extensions::Stdapi::Net::Socket. All incoming requests from the meterpreter # Rex::Post::Meterpreter::Extensions::Stdapi::Net::Socket. All incoming requests from the meterpreter
# for a 'tcp_channel_open' will be processed here. We create a new TcpClientChannel for each request # for a 'tcp_channel_open' will be processed here. We create a new TcpClientChannel for each request
# received and store it in the respective tcp server channels list of new pending client channels. # received and store it in the respective tcp server channels list of new pending client channels.
# These new tcp client channels are passed off via a call the the tcp server channels accept() method. # These new tcp client channels are passed off via a call the the tcp server channels accept() method.
# #
def request_handler( client, packet ) def request_handler( client, packet )
if( packet.method == "tcp_channel_open" ) if( packet.method == "tcp_channel_open" )
cid = packet.get_tlv_value( TLV_TYPE_CHANNEL_ID ) cid = packet.get_tlv_value( TLV_TYPE_CHANNEL_ID )
pid = packet.get_tlv_value( TLV_TYPE_CHANNEL_PARENTID ) pid = packet.get_tlv_value( TLV_TYPE_CHANNEL_PARENTID )
localhost = packet.get_tlv_value( TLV_TYPE_LOCAL_HOST ) localhost = packet.get_tlv_value( TLV_TYPE_LOCAL_HOST )
localport = packet.get_tlv_value( TLV_TYPE_LOCAL_PORT ) localport = packet.get_tlv_value( TLV_TYPE_LOCAL_PORT )
peerhost = packet.get_tlv_value( TLV_TYPE_PEER_HOST ) peerhost = packet.get_tlv_value( TLV_TYPE_PEER_HOST )
peerport = packet.get_tlv_value( TLV_TYPE_PEER_PORT ) peerport = packet.get_tlv_value( TLV_TYPE_PEER_PORT )
if( cid == nil or pid == nil ) if( cid == nil or pid == nil )
return false return false
end end
server_channel = client.find_channel( pid ) server_channel = client.find_channel( pid )
if( server_channel == nil ) if( server_channel == nil )
return false return false
end end
params = Rex::Socket::Parameters.from_hash( params = Rex::Socket::Parameters.from_hash(
{ {
'Proto' => 'tcp', 'Proto' => 'tcp',
'LocalHost' => localhost, 'LocalHost' => localhost,
'LocalPort' => localport, 'LocalPort' => localport,
'PeerHost' => peerhost, 'PeerHost' => peerhost,
'PeerPort' => peerport, 'PeerPort' => peerport,
'Comm' => server_channel.client 'Comm' => server_channel.client
} }
) )
client_channel = TcpClientChannel.new( client, cid, TcpClientChannel, CHANNEL_FLAG_SYNCHRONOUS ) client_channel = TcpClientChannel.new( client, cid, TcpClientChannel, CHANNEL_FLAG_SYNCHRONOUS )
client_channel.params = params client_channel.params = params
if( @@server_channels[server_channel] == nil ) if( @@server_channels[server_channel] == nil )
@@server_channels[server_channel] = [] @@server_channels[server_channel] = []
end end
@@server_channels[server_channel] << client_channel @@server_channels[server_channel] << client_channel
return true return true
end end
return false return false
end end
def cls def cls
return CHANNEL_CLASS_STREAM return CHANNEL_CLASS_STREAM
end end
end end
# #
# Open a new tcp server channel on the remote end. # Open a new tcp server channel on the remote end.
# #
@ -104,7 +104,7 @@ class TcpServerChannel < Rex::Post::Meterpreter::Channel
c.params = params c.params = params
c c
end end
# #
# Simply initilize this instance. # Simply initilize this instance.
# #
@ -113,7 +113,7 @@ class TcpServerChannel < Rex::Post::Meterpreter::Channel
# add this instance to the class variables dictionary of tcp server channels # add this instance to the class variables dictionary of tcp server channels
@@server_channels[self] = [] @@server_channels[self] = []
end end
# #
# Accept a new tcp client connection form this tcp server channel. This method does not block # Accept a new tcp client connection form this tcp server channel. This method does not block
# and returns nil if no new client connection is available. # and returns nil if no new client connection is available.
@ -126,7 +126,7 @@ class TcpServerChannel < Rex::Post::Meterpreter::Channel
end end
return result return result
end end
# #
# Accept a new tcp client connection form this tcp server channel. This method will block indefinatly # Accept a new tcp client connection form this tcp server channel. This method will block indefinatly
# if no timeout is specified. # if no timeout is specified.
@ -150,7 +150,7 @@ class TcpServerChannel < Rex::Post::Meterpreter::Channel
protected protected
def _accept def _accept
while( true ) while( true )
if( @@server_channels[self].empty? ) if( @@server_channels[self].empty? )
Rex::ThreadSafe.sleep( 0.2 ) Rex::ThreadSafe.sleep( 0.2 )
next next