Hey, heute mal ein kleines "Tutorial" wie ihr Kommandos an iOS Geräten im Recovery Mode sendet.
Da das ganze iBoot(iBec image - iBSS) ist, hat es ein interaktives Interface was per serial oder USB angesprochen werden kann.
Wir senden keine Datein oder rufen den Status ab, nein wie senden einfach mal Kommandos.
Wir arbeiten heute mit LibUSB (C) und PYUSB(Python) damit C und Python Entwickler etwas davon haben.
Es ist aber sehr einfach das ganze in vb.net, c++, c# etc zu porten da man nur die Funtkion wissen muss.
Hiermit senden wir ein Kommando:
PHP Code:
usb_control_msg(device_handle, 0x40, 0, 0, 0, buf, strlen(buf), 1000);
Das ganze würde dann in LIBUSB C Code so aussehen:
PHP Code:
libusb_control_transfer(device_handle, 0x40, 0, 0, 0, command[0], (strlen(command[0]) + 1), 1000)
Erstmal aber wie wir device_handle richtig konfigurieren:
PHP Code:
struct libusb_device_handle *handle;
handle = libusb_open_device_with_vid_pid(NULL, 0x05AC, 0x1281);
Davor dann halt noch das bekannte libusb_init setzen:
PHP Code:
libusb_init(NULL);
VID und PID für die Kontrolle des Recovery Modes:
Wen wir dann am Ende alles mal zusammen fassen um ein Kommando zu senden, dann könnte das so aussehen:
PHP Code:
#include <stdlib.h>
#include <stdio.h>
#include <libusb-1.0/libusb.h>
#include <usb.h>
int cmd();
struct libusb_device_handle *device_handle;
int main() {
libusb_init(NULL);
device_handle = libusb_open_device_with_vid_pid(NULL, 0x05AC, 0x1281);
libusb_control_transfer(device_handle, 0x40, 0, 0, 0, "reboot", (strlen("reboot") + 1), 1000);
return 1;
}
Mit einer Abfrage ob das ganze erfolgreich oder nicht war sieht der Code so aus:
PHP Code:
#include <stdlib.h>
#include <stdio.h>
#include <libusb-1.0/libusb.h>
#include <usb.h>
int cmd();
struct libusb_device_handle *device_handle;
int main() {
libusb_init(NULL);
device_handle = libusb_open_device_with_vid_pid(NULL, 0x05AC, 0x1281);
if (libusb_control_transfer(device_handle, 0x40, 0, 0, 0, "reboot", (strlen("reboot") + 1), 1000)) {
printf("[*] Successfully sent command.\r\n");
return 0;
} else {
printf("[*] Error with sending the Command");
return 0;
}
return 1;
}
Mit gcc könnt ihr dass z.b. für Mac so kompilieren:
PHP Code:
cal0x:~ cal0x$ gcc -o send_cmd send_cmd.c -lusb-1.0 -framework IOKit
In Python ein Send Command Beispiel:
PHP Code:
import usb.core
import usb.util
import sys
dev = usb.core.find(idVendor=0x05AC, idProduct=0x1281)
cmd = "reboot" # Add any command here.
ret = dev.ctrl_transfer(0x40, 0, 0, 0, cmd, 1000)
Mit einer Abfrage ob ein Gerät verbunden ist, auch noch mal:
PHP Code:
import usb.core
import usb.util
import sys
dev = usb.core.find(idVendor=0x05AC, idProduct=0x1281)
if (dev):
print 'Device in recovery Mode connected.'
cmd = "reboot" # Add any command here.
ret = dev.ctrl_transfer(0x40, 0, 0, 0, cmd, 1000)
else:
print 'No device in recovery mode found.'
Ein Utility in C ist selbstverständlich auch verfügbar.
Es heißt OpeniSenc_rec und ist im OpenSun-C Paket oder alleine verfügbar:
Das Python Beispiel ist auch auf meinem Github Account verfügbar:
P.S: Ein Thx tut keinem weh

. Aber wayne

.