1
mirror of https://github.com/rapid7/metasploit-payloads synced 2024-11-20 14:39:22 +01:00

add missing @Override

This commit is contained in:
XenoAmess 2021-02-11 23:20:09 +08:00
parent badaaa4df2
commit 8cac54b070
20 changed files with 42 additions and 0 deletions

View File

@ -87,17 +87,21 @@ public class MemoryBufferURLConnection extends URLConnection {
contentType = file.substring(pos + 1);
}
@Override
public void connect() throws IOException {
}
@Override
public InputStream getInputStream() throws IOException {
return new ByteArrayInputStream(data);
}
@Override
public int getContentLength() {
return data.length;
}
@Override
public String getContentType() {
return contentType;
}

View File

@ -16,6 +16,7 @@ public class MemoryBufferURLStreamHandler extends URLStreamHandler {
private List files = new ArrayList();
@Override
protected URLConnection openConnection(URL u) throws IOException {
return new MemoryBufferURLConnection(u);
}

View File

@ -80,6 +80,7 @@ public class StreamForwarder extends Thread {
this.closeOut = closeOut;
}
@Override
public void run() {
try {
forward(in, out, closeOut);

View File

@ -4,6 +4,7 @@ package metasploit;
import java.applet.*;
public class PayloadApplet extends Applet {
@Override
public void init() {
try {
Payload.main(null);

View File

@ -16,6 +16,7 @@ public class PayloadServlet extends HttpServlet implements Runnable {
}
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, java.io.IOException {
PrintWriter out = res.getWriter();

View File

@ -41,6 +41,7 @@ public class RMILoader extends ClassLoader implements Serializable {
return null;
}
@Override
public URL getResource(String name) {
return getClass().getClassLoader().getResource(name);
}

View File

@ -172,6 +172,7 @@ public class Channel {
this.handleClose = handleClose;
}
@Override
public void run() {
try {
byte[] buffer = new byte[1024*1024];

View File

@ -42,10 +42,12 @@ public class HttpTransport extends Transport {
setTimeouts(transportConfig);
}
@Override
public void bind(DataInputStream in, OutputStream rawOut) {
// http, we don't bind to anything as we're stateless
}
@Override
public boolean switchUri(String uri) {
try {
// can't use getAuthority() here thanks to java 1.2. Ugh.
@ -105,9 +107,11 @@ public class HttpTransport extends Transport {
return this.customHeaders;
}
@Override
public void disconnect() {
}
@Override
protected boolean tryConnect(Meterpreter met) throws IOException {
URLConnection conn = this.createConnection();
@ -143,6 +147,7 @@ public class HttpTransport extends Transport {
return false;
}
@Override
public TLVPacket readPacket() throws IOException {
URLConnection conn = this.createConnection();
@ -163,6 +168,7 @@ public class HttpTransport extends Transport {
return null;
}
@Override
public void writePacket(TLVPacket packet, int type) throws IOException {
URLConnection conn = this.createConnection();
@ -188,6 +194,7 @@ public class HttpTransport extends Transport {
}
}
@Override
public boolean dispatch(Meterpreter met) {
long lastPacket = System.currentTimeMillis();
long ecount = 0;

View File

@ -37,6 +37,7 @@ public class TcpTransport extends Transport {
this.out = out;
}
@Override
public void run() {
if (this.in != null) {
try {
@ -95,16 +96,19 @@ public class TcpTransport extends Transport {
this.host = url.substring(url.lastIndexOf("/") + 1, portStart);
}
@Override
public void bind(DataInputStream in, OutputStream rawOut) {
this.inputStream = in;
this.outputStream = new DataOutputStream(rawOut);
}
@Override
public boolean switchUri(String uri) {
// tcp transports don't support URL switching
return false;
}
@Override
public void disconnect() {
SocketDisposer s = new SocketDisposer(this.sock, this.inputStream, this.outputStream);
this.sock = null;
@ -114,6 +118,7 @@ public class TcpTransport extends Transport {
s.start();
}
@Override
protected boolean tryConnect(Meterpreter met) throws IOException {
if (this.inputStream != null) {
// we're already connected
@ -142,14 +147,17 @@ public class TcpTransport extends Transport {
return false;
}
@Override
public TLVPacket readPacket() throws IOException {
return this.readAndDecodePacket(this.inputStream);
}
@Override
public void writePacket(TLVPacket packet, int type) throws IOException {
this.encodePacketAndWrite(packet, type, this.outputStream);
}
@Override
public boolean dispatch(Meterpreter met) {
long lastPacket = System.currentTimeMillis();
int result = 0;

View File

@ -11,6 +11,7 @@ import com.metasploit.meterpreter.command.Command;
public class core_transport_change extends core_transport_add {
@Override
public int execute(Meterpreter meterpreter, TLVPacket request, TLVPacket response) throws Exception {
int result = super.execute(meterpreter, request, response);

View File

@ -31,6 +31,7 @@ public class DatagramSocketChannel extends Channel {
new AcceptThread().start();
}
@Override
public void write(byte[] data, int length, TLVPacket request) throws IOException {
String remoteHostName = (String) request.getValue(TLVType.TLV_TYPE_PEER_HOST, null);
InetAddress remoteHost = null;
@ -51,6 +52,7 @@ public class DatagramSocketChannel extends Channel {
datagramSocket.send(dp);
}
@Override
public void close() throws IOException {
closed = true;
datagramSocket.close();
@ -62,6 +64,7 @@ public class DatagramSocketChannel extends Channel {
}
private class AcceptThread extends Thread {
@Override
public void run() {
try {
byte[] datagram = new byte[65536];

View File

@ -38,6 +38,7 @@ public class ProcessChannel extends Channel {
* @param maxLength The maximum number of bytes to read.
* @return The bytes read, or <code>null</code> if the end of the stream has been reached.
*/
@Override
public synchronized byte[] read(int maxLength) throws IOException, InterruptedException {
if (closed)
return null;
@ -50,6 +51,7 @@ public class ProcessChannel extends Channel {
return super.read(maxLength);
}
@Override
public void close() throws IOException {
process.destroy();
inputStream.close();
@ -66,6 +68,7 @@ public class ProcessChannel extends Channel {
this.stderrThread = stderrThread;
}
@Override
public void run() {
try {
stdinThread.start();

View File

@ -30,6 +30,7 @@ public class ServerSocketChannel extends Channel {
new AcceptThread().start();
}
@Override
public void close() throws IOException {
closed = true;
serverSocket.close();
@ -41,6 +42,7 @@ public class ServerSocketChannel extends Channel {
}
private class AcceptThread extends Thread {
@Override
public void run() {
try {
while (true) {

View File

@ -23,6 +23,7 @@ public class SocketChannel extends Channel {
this.socket = socket;
}
@Override
public void close() throws IOException {
socket.close();
super.close();

View File

@ -4,6 +4,7 @@ import java.io.File;
public class stdapi_fs_file_expand_path_V1_5 extends stdapi_fs_file_expand_path {
@Override
protected String getShellPath() {
String result;
if (File.pathSeparatorChar == ';')

View File

@ -1,6 +1,7 @@
package com.metasploit.meterpreter.stdapi;
public class stdapi_fs_md5 extends HashCommand {
@Override
protected String getAlgorithm() {
return "MD5";
}

View File

@ -1,6 +1,7 @@
package com.metasploit.meterpreter.stdapi;
public class stdapi_fs_sha1 extends HashCommand {
@Override
protected String getAlgorithm() {
return "SHA-1";
}

View File

@ -4,6 +4,7 @@ import java.io.File;
public class stdapi_fs_stat_V1_6 extends stdapi_fs_stat {
@Override
protected boolean canExecute(File file) {
return file.canExecute();
}

View File

@ -15,6 +15,7 @@ import com.metasploit.meterpreter.TLVType;
public class stdapi_net_config_get_interfaces_V1_6 extends stdapi_net_config_get_interfaces_V1_4 {
@Override
public Address[] getAddresses(NetworkInterface iface) throws IOException {
List/* <Address> */result = new ArrayList();
List addresses = iface.getInterfaceAddresses();
@ -46,6 +47,7 @@ public class stdapi_net_config_get_interfaces_V1_6 extends stdapi_net_config_get
return (Address[]) result.toArray(new Address[result.size()]);
}
@Override
protected void addMTU(TLVPacket ifaceTLV, NetworkInterface iface) throws IOException {
ifaceTLV.add(TLVType.TLV_TYPE_MTU, iface.getMTU());
}

View File

@ -5,6 +5,7 @@ import java.net.Socket;
public class stdapi_net_socket_tcp_shutdown_V1_3 extends stdapi_net_socket_tcp_shutdown {
@Override
protected void shutdown(Socket socket, int how) throws IOException {
switch (how) {