Skip to content

Commit

Permalink
- Fixed bug, caused by sending payloads to device but not triggering it
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Rekun committed Jul 9, 2018
1 parent 2a4916d commit d9f196d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
7 changes: 3 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "com.pavelrekun.rekado"
minSdkVersion minimumSDKVersion
targetSdkVersion currentSDKVersion
versionCode 10
versionName "1.1"
versionCode 11
versionName "1.1.1"

externalNativeBuild {
cmake {
Expand Down Expand Up @@ -43,9 +43,8 @@ android {
}

lintOptions {
checkReleaseBuilds false
abortOnError false
}

}

kotlin {
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>
<meta-data
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
<meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="@xml/device_filter" />
</activity>

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/cpp/native-lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

extern "C" JNIEXPORT jint
JNICALL
Java_com_pavelrekun_rekado_services_usb_USBLoader_nativeTriggerExploit(
Java_com_pavelrekun_rekado_services_payloads_PayloadLoader_nativeTriggerExploit(
JNIEnv *env,
jobject /* this */,
jint fd,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ import java.nio.ByteOrder
class PayloadLoader : USBHandler {

companion object {
init {
System.loadLibrary("native-lib")
}

private const val RCM_PAYLOAD_ADDR = 0x40010000
private const val INTERMEZZO_LOCATION = 0x4001F000
private const val PAYLOAD_LOAD_BLOCK = 0x40020000
private const val MAX_LENGTH = 0x30298

init {
System.loadLibrary("native-lib")
}
}

override fun handleDevice(device: UsbDevice) {
Expand Down Expand Up @@ -77,6 +77,7 @@ class PayloadLoader : USBHandler {
}

payload.put(intermezzo)

payload.put(ByteArray(PAYLOAD_LOAD_BLOCK - INTERMEZZO_LOCATION - intermezzo.size))

try {
Expand Down Expand Up @@ -136,5 +137,5 @@ class PayloadLoader : USBHandler {
* A native method that is implemented by the 'native-lib' native library,
* which is packaged with this application.
*/
private external fun nativeTriggerExploit(fd: Int, length: Int): Int
external fun nativeTriggerExploit(fd: Int, length: Int): Int
}
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources>
<string name="app_name" translatable="false">Rekado</string>
<string name="app_version" translatable="false">1.1</string>
<string name="app_version" translatable="false">1.1.1</string>

<!-- Strings for Navigation -->
<string name="navigation_payloads">Payloads</string>
Expand Down

0 comments on commit d9f196d

Please sign in to comment.