Browse Source

Fix #6362, avoid overriding def peer repeatedly

def peer is a method that gets repeated a lot in modules, so we
should have it in the tcp mixin. This commit also clears a few
modules that use the HttpClient mixin with def peer.
wchen-r7 4 years ago
parent
commit
cea3bc27b9
26 changed files with 6 additions and 98 deletions
  1. 0
    4
      lib/msf/core/auxiliary/redis.rb
  2. 0
    6
      lib/msf/core/exploit/java/rmi/client.rb
  3. 5
    0
      lib/msf/core/exploit/tcp.rb
  4. 0
    4
      modules/auxiliary/admin/atg/atg_client.rb
  5. 0
    3
      modules/auxiliary/admin/misc/sercomm_dump_config.rb
  6. 0
    4
      modules/auxiliary/admin/smb/delete_file.rb
  7. 0
    4
      modules/auxiliary/admin/smb/download_file.rb
  8. 0
    4
      modules/auxiliary/admin/smb/upload_file.rb
  9. 0
    4
      modules/auxiliary/dos/misc/ibm_sametime_webplayer_dos.rb
  10. 0
    4
      modules/auxiliary/scanner/dlsw/dlsw_leak_capture.rb
  11. 0
    4
      modules/auxiliary/scanner/elasticsearch/indices_enum.rb
  12. 0
    4
      modules/auxiliary/scanner/http/netgear_sph200d_traversal.rb
  13. 0
    3
      modules/auxiliary/scanner/rdp/ms12_020_check.rb
  14. 0
    4
      modules/auxiliary/scanner/rsync/modules_list.rb
  15. 0
    4
      modules/auxiliary/scanner/ssh/ssh_version.rb
  16. 0
    4
      modules/auxiliary/scanner/ssl/openssl_ccs.rb
  17. 0
    4
      modules/auxiliary/scanner/ssl/openssl_heartbleed.rb
  18. 1
    4
      modules/exploits/linux/http/nginx_chunked_size.rb
  19. 0
    4
      modules/exploits/linux/misc/jenkins_java_deserialize.rb
  20. 0
    4
      modules/exploits/multi/misc/hp_data_protector_exec_integutil.rb
  21. 0
    4
      modules/exploits/multi/misc/java_jdwp_debugger.rb
  22. 0
    4
      modules/exploits/multi/misc/java_rmi_server.rb
  23. 0
    3
      modules/exploits/windows/misc/hp_dataprotector_cmd_exec.rb
  24. 0
    3
      modules/exploits/windows/misc/hp_dataprotector_exec_bar.rb
  25. 0
    4
      modules/exploits/windows/misc/hp_dataprotector_traversal.rb
  26. 0
    4
      modules/exploits/windows/misc/solidworks_workgroup_pdmwservice_file_write.rb

+ 0
- 4
lib/msf/core/auxiliary/redis.rb View File

@@ -31,10 +31,6 @@ module Msf
31 31
       )
32 32
     end
33 33
 
34
-    def peer
35
-      "#{rhost}:#{rport}"
36
-    end
37
-
38 34
     def read_timeout
39 35
       datastore['READ_TIMEOUT']
40 36
     end

+ 0
- 6
lib/msf/core/exploit/java/rmi/client.rb View File

@@ -51,12 +51,6 @@ module Msf
51 51
               datastore['RPORT']
52 52
             end
53 53
 
54
-            # Returns the RMI server peer
55
-            #
56
-            # @return [String]
57
-            def peer
58
-              "#{rhost}:#{rport}"
59
-            end
60 54
 
61 55
             # Sends a RMI header stream
62 56
             #

+ 5
- 0
lib/msf/core/exploit/tcp.rb View File

@@ -82,6 +82,11 @@ module Exploit::Remote::Tcp
82 82
     )
83 83
   end
84 84
 
85
+  # Returns the rhost:rport
86
+  def peer
87
+    "#{rhost}:#{rport}"
88
+  end
89
+
85 90
   #
86 91
   # Establishes a TCP connection to the specified RHOST/RPORT
87 92
   #

+ 0
- 4
modules/auxiliary/admin/atg/atg_client.rb View File

@@ -190,10 +190,6 @@ class Metasploit3 < Msf::Auxiliary
190 190
     response
191 191
   end
192 192
 
193
-  def peer
194
-    "#{rhost}:#{rport}"
195
-  end
196
-
197 193
   def protocol
198 194
     datastore['PROTOCOL']
199 195
   end

+ 0
- 3
modules/auxiliary/admin/misc/sercomm_dump_config.rb View File

@@ -134,9 +134,6 @@ class Metasploit3 < Msf::Auxiliary
134 134
     return nil
135 135
   end
136 136
 
137
-  def peer
138
-    return "#{rhost}:#{rport}"
139
-  end
140 137
 
141 138
   def fingerprint_endian
142 139
     begin

+ 0
- 4
modules/auxiliary/admin/smb/delete_file.rb View File

@@ -40,10 +40,6 @@ class Metasploit3 < Msf::Auxiliary
40 40
     ], self.class)
41 41
   end
42 42
 
43
-  def peer
44
-    "#{rhost}:#{rport}"
45
-  end
46
-
47 43
   def smb_delete_files
48 44
     vprint_status("#{peer}: Connecting to the server...")
49 45
     connect()

+ 0
- 4
modules/auxiliary/admin/smb/download_file.rb View File

@@ -40,10 +40,6 @@ class Metasploit3 < Msf::Auxiliary
40 40
     ], self.class)
41 41
   end
42 42
 
43
-  def peer
44
-    "#{rhost}:#{rport}"
45
-  end
46
-
47 43
   def smb_download
48 44
     vprint_status("#{peer}: Connecting...")
49 45
     connect()

+ 0
- 4
modules/auxiliary/admin/smb/upload_file.rb View File

@@ -47,10 +47,6 @@ class Metasploit3 < Msf::Auxiliary
47 47
 
48 48
   end
49 49
 
50
-  def peer
51
-    "#{rhost}:#{rport}"
52
-  end
53
-
54 50
   def run_host(_ip)
55 51
     begin
56 52
       vprint_status("#{peer}: Connecting to the server...")

+ 0
- 4
modules/auxiliary/dos/misc/ibm_sametime_webplayer_dos.rb View File

@@ -116,10 +116,6 @@ class Metasploit3 < Msf::Auxiliary
116 116
 
117 117
   end
118 118
 
119
-  def peer
120
-    "#{rhost}:#{rport}"
121
-  end
122
-
123 119
   def dos_user
124 120
     length = 12000 # enough to overflow the end of allocated memory
125 121
     msg = create_message(length)

+ 0
- 4
modules/auxiliary/scanner/dlsw/dlsw_leak_capture.rb View File

@@ -42,10 +42,6 @@ class Metasploit3 < Msf::Auxiliary
42 42
       ], self.class)
43 43
   end
44 44
 
45
-  def peer
46
-    "#{rhost}:#{rport}"
47
-  end
48
-
49 45
   def get_response(size = 72)
50 46
     connect
51 47
     response = sock.get_once(size)

+ 0
- 4
modules/auxiliary/scanner/elasticsearch/indices_enum.rb View File

@@ -31,10 +31,6 @@ class Metasploit3 < Msf::Auxiliary
31 31
       ], self.class)
32 32
   end
33 33
 
34
-  def peer
35
-    "#{rhost}:#{rport}"
36
-  end
37
-
38 34
   def run_host(ip)
39 35
     vprint_status("#{peer} - Querying indices...")
40 36
     begin

+ 0
- 4
modules/auxiliary/scanner/http/netgear_sph200d_traversal.rb View File

@@ -36,10 +36,6 @@ class Metasploit3 < Msf::Auxiliary
36 36
       ], self.class)
37 37
   end
38 38
 
39
-  def peer
40
-    "#{rhost}:#{rport}"
41
-  end
42
-
43 39
   def extract_words(wordfile)
44 40
     return [] unless wordfile && File.readable?(wordfile)
45 41
     begin

+ 0
- 3
modules/auxiliary/scanner/rdp/ms12_020_check.rb View File

@@ -124,9 +124,6 @@ class Metasploit3 < Msf::Auxiliary
124 124
     "\x02\xf0\x80\x38"
125 125
   end
126 126
 
127
-  def peer
128
-    "#{rhost}:#{rport}"
129
-  end
130 127
 
131 128
   def check_rdp_vuln
132 129
     # check if rdp is open

+ 0
- 4
modules/auxiliary/scanner/rsync/modules_list.rb View File

@@ -56,10 +56,6 @@ class Metasploit3 < Msf::Auxiliary
56 56
     )
57 57
   end
58 58
 
59
-  def peer
60
-    "#{rhost}:#{rport}"
61
-  end
62
-
63 59
   def read_timeout
64 60
     datastore['READ_TIMEOUT']
65 61
   end

+ 0
- 4
modules/auxiliary/scanner/ssh/ssh_version.rb View File

@@ -37,10 +37,6 @@ class Metasploit3 < Msf::Auxiliary
37 37
     )
38 38
   end
39 39
 
40
-  def peer
41
-    "#{rhost}:#{rport}"
42
-  end
43
-
44 40
   def timeout
45 41
     datastore['TIMEOUT'] <= 0 ? DEFAULT_TIMEOUT : datastore['TIMEOUT']
46 42
   end

+ 0
- 4
modules/auxiliary/scanner/ssl/openssl_ccs.rb View File

@@ -111,10 +111,6 @@ class Metasploit3 < Msf::Auxiliary
111 111
       ], self.class)
112 112
   end
113 113
 
114
-  def peer
115
-    "#{rhost}:#{rport}"
116
-  end
117
-
118 114
   def response_timeout
119 115
     datastore['RESPONSE_TIMEOUT']
120 116
   end

+ 0
- 4
modules/auxiliary/scanner/ssl/openssl_heartbleed.rb View File

@@ -170,10 +170,6 @@ class Metasploit3 < Msf::Auxiliary
170 170
 
171 171
   end
172 172
 
173
-  def peer
174
-    "#{rhost}:#{rport}"
175
-  end
176
-
177 173
   #
178 174
   # Main methods
179 175
   #

+ 1
- 4
modules/exploits/linux/http/nginx_chunked_size.rb View File

@@ -33,7 +33,7 @@ class Metasploit4 < Msf::Exploit::Remote
33 33
           ['CVE', '2013-2028'],
34 34
           ['OSVDB', '93037'],
35 35
           ['URL', 'http://nginx.org/en/security_advisories.html'],
36
-          ['URL', 'http://packetstormsecurity.com/files/121560/Nginx-1.3.9-1.4.0-Stack-Buffer-Overflow.html']
36
+          ['PACKETSTORM', '121560']
37 37
         ],
38 38
       'Privileged'     => false,
39 39
       'Payload'        =>
@@ -73,9 +73,6 @@ class Metasploit4 < Msf::Exploit::Remote
73 73
 
74 74
   end
75 75
 
76
-  def peer
77
-    "#{rhost}:#{rport}"
78
-  end
79 76
 
80 77
   def check
81 78
     begin

+ 0
- 4
modules/exploits/linux/misc/jenkins_java_deserialize.rb View File

@@ -54,10 +54,6 @@ class Metasploit3 < Msf::Exploit::Remote
54 54
     ], self.class)
55 55
   end
56 56
 
57
-  def peer
58
-    "#{rhost}:#{rport}"
59
-  end
60
-
61 57
   def exploit
62 58
     unless vulnerable?
63 59
       fail_with(Failure::Unknown, "#{peer} - Jenkins is not vulnerable, aborting...")

+ 0
- 4
modules/exploits/multi/misc/hp_data_protector_exec_integutil.rb View File

@@ -129,10 +129,6 @@ class Metasploit3 < Msf::Exploit::Remote
129 129
     end
130 130
   end
131 131
 
132
-  def peer
133
-    "#{rhost}:#{rport}"
134
-  end
135
-
136 132
   def build_pkt(fields)
137 133
     data = "\xff\xfe" # BOM Unicode
138 134
     fields.each do |v|

+ 0
- 4
modules/exploits/multi/misc/java_jdwp_debugger.rb View File

@@ -147,10 +147,6 @@ class Metasploit3 < Msf::Exploit::Remote
147 147
   end
148 148
 
149 149
 
150
-  def peer
151
-    "#{rhost}:#{rport}"
152
-  end
153
-
154 150
   def default_timeout
155 151
     datastore['RESPONSE_TIMEOUT']
156 152
   end

+ 0
- 4
modules/exploits/multi/misc/java_rmi_server.rb View File

@@ -106,10 +106,6 @@ class Metasploit3 < Msf::Exploit::Remote
106 106
     end
107 107
   end
108 108
 
109
-  def peer
110
-    "#{rhost}:#{rport}"
111
-  end
112
-
113 109
   def primer
114 110
     connect
115 111
 

+ 0
- 3
modules/exploits/windows/misc/hp_dataprotector_cmd_exec.rb View File

@@ -87,9 +87,6 @@ class Metasploit3 < Msf::Exploit::Remote
87 87
     Exploit::CheckCode::Detected
88 88
   end
89 89
 
90
-  def peer
91
-    "#{rhost}:#{rport}"
92
-  end
93 90
 
94 91
   def get_fingerprint
95 92
     ommni = connect

+ 0
- 3
modules/exploits/windows/misc/hp_dataprotector_exec_bar.rb View File

@@ -105,9 +105,6 @@ class Metasploit3 < Msf::Exploit::Remote
105 105
     end
106 106
   end
107 107
 
108
-  def peer
109
-    "#{rhost}:#{rport}"
110
-  end
111 108
 
112 109
   def build_pkt(fields)
113 110
     data = "\xff\xfe" # BOM Unicode

+ 0
- 4
modules/exploits/windows/misc/hp_dataprotector_traversal.rb View File

@@ -101,10 +101,6 @@ class Metasploit3 < Msf::Exploit::Remote
101 101
     register_file_for_cleanup("wbem\\mof\\good\\#{mof_name}")
102 102
   end
103 103
 
104
-  def peer
105
-    "#{rhost}:#{rport}"
106
-  end
107
-
108 104
   def build_pkt(fields)
109 105
     data = "\xff\xfe" # BOM Unicode
110 106
     fields.each do |v|

+ 0
- 4
modules/exploits/windows/misc/solidworks_workgroup_pdmwservice_file_write.rb View File

@@ -66,10 +66,6 @@ class Metasploit3 < Msf::Exploit::Remote
66 66
     ], self.class)
67 67
   end
68 68
 
69
-  def peer
70
-    "#{rhost}:#{rport}"
71
-  end
72
-
73 69
   #
74 70
   # Check
75 71
   #

Loading…
Cancel
Save