Skip to content

Commit 6388578

Browse files
committed
Style fixes
1 parent 98355c3 commit 6388578

File tree

6 files changed

+30
-29
lines changed

6 files changed

+30
-29
lines changed

lib/rex/io/datagram_abstraction.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ module IO
1313
###
1414
module DatagramAbstraction
1515
include Rex::IO::SocketAbstraction
16+
1617
#
1718
# Creates a streaming socket pair
1819
#

lib/rex/post/meterpreter/channels/datagram.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def dio_write_handler( packet, data )
5252
Rex::Post::Meterpreter::Extensions::Stdapi::TLV_TYPE_PEER_PORT
5353
)
5454

55-
if( peerhost and peerport )
55+
if peerhost && peerport
5656
# Maxlen here is 65507, to ensure we dont overflow, we need to write twice
5757
# If the other side has a full 64k, handle by splitting up the datagram and
5858
# writing multiple times along with the sockaddr. Consumers calling recvfrom

lib/rex/post/meterpreter/channels/socket_abstraction.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ def close
7979
#
8080
module DirectChannelWrite
8181

82-
def syswrite( buf )
83-
channel._write( buf )
82+
def syswrite(buf)
83+
channel._write(buf)
8484
end
8585

8686
attr_accessor :channel

lib/rex/post/meterpreter/extensions/stdapi/net/socket.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ def initialize(client)
4141

4242
# register the inbound handler for the tcp server channel (allowing us to
4343
# receive new client connections to a tcp server channel)
44-
client.register_inbound_handler( Rex::Post::Meterpreter::Extensions::Stdapi::Net::SocketSubsystem::TcpServerChannel )
44+
client.register_inbound_handler(Rex::Post::Meterpreter::Extensions::Stdapi::Net::SocketSubsystem::TcpServerChannel)
4545

4646
end
4747

4848
#
4949
# Deregister the inbound handler for the tcp server channel
5050
#
5151
def shutdown
52-
client.deregister_inbound_handler( Rex::Post::Meterpreter::Extensions::Stdapi::Net::SocketSubsystem::TcpServerChannel )
52+
client.deregister_inbound_handler(Rex::Post::Meterpreter::Extensions::Stdapi::Net::SocketSubsystem::TcpServerChannel)
5353
end
5454

5555
##
@@ -63,17 +63,17 @@ def shutdown
6363
# in the socket parameters instance. The +params+ argument is expected to be
6464
# of type Rex::Socket::Parameters.
6565
#
66-
def create( params )
66+
def create(params)
6767
res = nil
6868

69-
if( params.tcp? )
70-
if( params.server? )
71-
res = create_tcp_server_channel( params )
69+
if params.tcp?
70+
if params.server?
71+
res = create_tcp_server_channel(params)
7272
else
73-
res = create_tcp_client_channel( params )
73+
res = create_tcp_client_channel(params)
7474
end
75-
elsif( params.udp? )
76-
res = create_udp_channel( params )
75+
elsif params.udp?
76+
res = create_udp_channel(params)
7777
end
7878

7979
return res
@@ -102,7 +102,7 @@ def create_tcp_server_channel(params)
102102
def create_tcp_client_channel(params)
103103
begin
104104
channel = SocketSubsystem::TcpClientChannel.open(client, params)
105-
if( channel != nil )
105+
if channel != nil
106106
return channel.lsock
107107
end
108108
return nil
@@ -121,7 +121,7 @@ def create_tcp_client_channel(params)
121121
def create_udp_channel(params)
122122
begin
123123
channel = SocketSubsystem::UdpChannel.open(client, params)
124-
if( channel != nil )
124+
if channel != nil
125125
return channel.lsock
126126
end
127127
return nil

lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_client_channel.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ def TcpClientChannel.open(client, params)
6969
#
7070
# Passes the channel initialization information up to the base class.
7171
#
72-
def initialize( client, cid, type, flags )
73-
super( client, cid, type, flags )
72+
def initialize(client, cid, type, flags)
73+
super(client, cid, type, flags)
7474

75-
lsock.extend( SocketInterface )
76-
lsock.extend( DirectChannelWrite )
75+
lsock.extend(SocketInterface)
76+
lsock.extend(DirectChannelWrite)
7777
lsock.channel = self
7878

79-
rsock.extend( SocketInterface )
79+
rsock.extend(SocketInterface)
8080
rsock.channel = self
8181

8282
end
@@ -101,7 +101,7 @@ def shutdown(how = 1)
101101
request.add_tlv(TLV_TYPE_SHUTDOWN_HOW, how)
102102
request.add_tlv(TLV_TYPE_CHANNEL_ID, self.cid)
103103

104-
response = client.send_request(request)
104+
client.send_request(request)
105105

106106
return true
107107
end

lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/udp_channel.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,17 @@ def UdpChannel.open(client, params)
6060
#
6161
# Simply initialize this instance.
6262
#
63-
def initialize( client, cid, type, flags )
64-
super( client, cid, type, flags )
63+
def initialize(client, cid, type, flags)
64+
super(client, cid, type, flags)
6565

66-
lsock.extend( Rex::Socket::Udp )
66+
lsock.extend(Rex::Socket::Udp)
6767
lsock.initsock
68-
lsock.extend( SocketInterface )
69-
lsock.extend( DirectChannelWrite )
68+
lsock.extend(SocketInterface)
69+
lsock.extend(DirectChannelWrite)
7070
lsock.channel = self
7171

7272
# rsock.extend( Rex::Socket::Udp )
73-
rsock.extend( SocketInterface )
73+
rsock.extend(SocketInterface)
7474
rsock.channel = self
7575

7676
end
@@ -79,8 +79,8 @@ def initialize( client, cid, type, flags )
7979
# This function is called by Rex::Socket::Udp.sendto and writes data to a specified
8080
# remote peer host/port via the remote end of the channel.
8181
#
82-
def send( buf, flags, saddr )
83-
af, peerhost, peerport = Rex::Socket.from_sockaddr( saddr )
82+
def send(buf, flags, saddr)
83+
_af, peerhost, peerport = Rex::Socket.from_sockaddr(saddr)
8484

8585
addends = [
8686
{
@@ -93,7 +93,7 @@ def send( buf, flags, saddr )
9393
}
9494
]
9595

96-
return _write( buf, buf.length, addends )
96+
return _write(buf, buf.length, addends)
9797
end
9898

9999
end

0 commit comments

Comments
 (0)