Skip to content

Commit 985641d

Browse files
author
HD Moore
committed
Add missing Context, fixes rapid7#4723
1 parent eb4226d commit 985641d

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

lib/metasploit/framework/ftp/client.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ def data_connect(mode = nil, nsock = self.sock)
4444
# convert port to FTP syntax
4545
datahost = "#{$1}.#{$2}.#{$3}.#{$4}"
4646
dataport = ($5.to_i * 256) + $6.to_i
47-
self.datasocket = Rex::Socket::Tcp.create('PeerHost' => datahost, 'PeerPort' => dataport)
47+
self.datasocket = Rex::Socket::Tcp.create(
48+
'PeerHost' => datahost,
49+
'PeerPort' => dataport,
50+
'Context' => { 'Msf' => framework, 'MsfExploit' => self }
51+
)
4852
end
4953
self.datasocket
5054
end

lib/metasploit/framework/login_scanner/snmp.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def attempt_login(credential)
3838
:Timeout => connection_timeout,
3939
:Retries => 2,
4040
:Transport => ::SNMP::RexUDPTransport,
41-
:Socket => ::Rex::Socket::Udp.create
41+
:Socket => ::Rex::Socket::Udp.create('Context' => { 'Msf' => framework, 'MsfExploit' => self })
4242
)
4343

4444
result_options[:proof] = test_read_access(snmp_client)

lib/metasploit/framework/tcp/client.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ def connect(global = true, opts={})
8989
'SSL' => dossl,
9090
'SSLVersion' => opts['SSLVersion'] || ssl_version,
9191
'Proxies' => proxies,
92-
'Timeout' => (opts['ConnectTimeout'] || connection_timeout || 10).to_i
92+
'Timeout' => (opts['ConnectTimeout'] || connection_timeout || 10).to_i,
93+
'Context' => { 'Msf' => framework, 'MsfExploit' => self }
9394
)
9495
# enable evasions on this socket
9596
set_tcp_evasions(nsock)

lib/msf/core/exploit/ftp.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ def data_connect(mode = nil, nsock = self.sock)
8383
# convert port to FTP syntax
8484
datahost = "#{$1}.#{$2}.#{$3}.#{$4}"
8585
dataport = ($5.to_i * 256) + $6.to_i
86-
self.datasocket = Rex::Socket::Tcp.create('PeerHost' => datahost, 'PeerPort' => dataport)
86+
self.datasocket = Rex::Socket::Tcp.create(
87+
'PeerHost' => datahost,
88+
'PeerPort' => dataport,
89+
'Context' => { 'Msf' => framework, 'MsfExploit' => self }
90+
)
8791
end
8892
self.datasocket
8993
end

0 commit comments

Comments
 (0)