From b74e7b28c1cb8152abde42604d66e25460cfb9fe Mon Sep 17 00:00:00 2001 From: lex Date: Thu, 25 Jul 2019 22:37:21 +0000 Subject: [PATCH] added linux gui --- building.txt | 9 ++ buildscripts/clean.sh | 0 buildscripts/linuxcli.sh | 0 buildscripts/linuxgui.sh | 28 +++++ buildscripts/linuxgui.sh~ | 27 +++++ buildscripts/linuxramdisk.sh | 0 buildscripts/maccli.sh | 0 buildscripts/macgui.sh | 0 buildscripts/macramdisk.sh | 0 buildscripts/windowscli.bat | 0 ziphone-linux-gui/zgui.c | 209 +++++++++++++++++++++++++++++++++++ 11 files changed, 273 insertions(+) mode change 100644 => 100755 buildscripts/clean.sh mode change 100644 => 100755 buildscripts/linuxcli.sh create mode 100755 buildscripts/linuxgui.sh create mode 100755 buildscripts/linuxgui.sh~ mode change 100644 => 100755 buildscripts/linuxramdisk.sh mode change 100644 => 100755 buildscripts/maccli.sh mode change 100644 => 100755 buildscripts/macgui.sh mode change 100644 => 100755 buildscripts/macramdisk.sh mode change 100644 => 100755 buildscripts/windowscli.bat create mode 100644 ziphone-linux-gui/zgui.c diff --git a/building.txt b/building.txt index b9357f6..d58dd9b 100644 --- a/building.txt +++ b/building.txt @@ -27,6 +27,15 @@ Install all required packages to build ZiPhone on Linux. Execute the command: -Cd into the "build scripts" directory. -Execute the command "./linuxcli.sh". +--Build ZiPhone Linux GUI-- + +Install all required packages to build ZiPhone Linux GUI. Execute the command: +"apt-get install build-essential libusb-dev zip gnome-devel" + +-Open the Terminal app. +-Cd into the "build scripts" directory. +-Execute the command "./linuxgui.sh". + --Build ZiPhone GUI on Mac OS X-- -Requires Mac OS X 10.4-10.8. diff --git a/buildscripts/clean.sh b/buildscripts/clean.sh old mode 100644 new mode 100755 diff --git a/buildscripts/linuxcli.sh b/buildscripts/linuxcli.sh old mode 100644 new mode 100755 diff --git a/buildscripts/linuxgui.sh b/buildscripts/linuxgui.sh new file mode 100755 index 0000000..0bd2b67 --- /dev/null +++ b/buildscripts/linuxgui.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +echo "Building Linux GUI..." +cd ../ +cd ziphone-linux-gui +gcc zgui.c -o zgui $(pkg-config --cflags --libs gtk+-3.0) +echo "Building Linux CLI..." +cd ../ +rm -rf ZiPhone ziphone-3.5a-linux-cli.zip ziphone-3.5a-linux-cli +mkdir ZiPhone +mkdir ZiPhone/ZiPhone +cd ziphone-linux-cli +make +cp build/ziphone ../ZiPhone/ZiPhone/ziphone +make clean +cd ../ +cp dfu.dat ZiPhone/ZiPhone/ +cp zibri.dat ZiPhone/ZiPhone/ +cp igor.dat ZiPhone/ZiPhone/ +cp victor.dat ZiPhone/ZiPhone/ +cp -r docs ZiPhone/docs +cp ziphone-linux-gui/zgui ZiPhone/ZiPhone/ +rm -f ziphone-linux-gui/zgui +mv ZiPhone ziphone-3.5a-linux-gui +zip -r ziphone-3.5a-linux-gui.zip ziphone-3.5a-linux-gui +rm -rf ziphone-3.5a-linux-gui + + diff --git a/buildscripts/linuxgui.sh~ b/buildscripts/linuxgui.sh~ new file mode 100755 index 0000000..2459c7a --- /dev/null +++ b/buildscripts/linuxgui.sh~ @@ -0,0 +1,27 @@ +#!/bin/sh + +echo "Building Linux GUI..." +cd ../ +cd ziphone-linux-gui +gcc zgui.c -o zgui $(pkg-config --cflags --libs gtk+-3.0) +echo "Building Linux CLI..." +cd ../ +rm -rf ZiPhone ziphone-3.5a-linux-cli.zip ziphone-3.5a-linux-cli +mkdir ZiPhone +mkdir ZiPhone/ZiPhone +cd ziphone-linux-cli +make +cp build/ziphone ../ZiPhone/ZiPhone/ziphone +make clean +cd ../ +cp dfu.dat ZiPhone/ZiPhone/ +cp zibri.dat ZiPhone/ZiPhone/ +cp igor.dat ZiPhone/ZiPhone/ +cp victor.dat ZiPhone/ZiPhone/ +cp -r docs ZiPhone/docs +cp ziphone-linux-gui/zgui ZiPhone/ZiPhone/ +mv ZiPhone ziphone-3.5a-linux-gui +zip -r ziphone-3.5a-linux-gui.zip ziphone-3.5a-linux-gui +rm -rf ziphone-3.5a-linux-gui + + diff --git a/buildscripts/linuxramdisk.sh b/buildscripts/linuxramdisk.sh old mode 100644 new mode 100755 diff --git a/buildscripts/maccli.sh b/buildscripts/maccli.sh old mode 100644 new mode 100755 diff --git a/buildscripts/macgui.sh b/buildscripts/macgui.sh old mode 100644 new mode 100755 diff --git a/buildscripts/macramdisk.sh b/buildscripts/macramdisk.sh old mode 100644 new mode 100755 diff --git a/buildscripts/windowscli.bat b/buildscripts/windowscli.bat old mode 100644 new mode 100755 diff --git a/ziphone-linux-gui/zgui.c b/ziphone-linux-gui/zgui.c new file mode 100644 index 0000000..efa1e5d --- /dev/null +++ b/ziphone-linux-gui/zgui.c @@ -0,0 +1,209 @@ +#include +#include +#include +#include + +static void +jailbreak (GtkWidget *widget, + gpointer data) +{ + g_print ("Jailbreak clicked...\n"); + char jailbreak[50]; + strcpy( jailbreak, "./ziphone -j" ); + system(jailbreak); + +} + +static void +activation (GtkWidget *widget, + gpointer data) +{ + g_print ("Activate clicked...\n"); + char activation[50]; + strcpy( activation, "./ziphone -a" ); + system(activation); + +} + +static void +unlock (GtkWidget *widget, + gpointer data) +{ + g_print ("Unlock clicked...\n"); + char unlock[50]; + strcpy( unlock, "./ziphone -u" ); + system(unlock); + +} + +static void +erase (GtkWidget *widget,gpointer data) +{ + g_print ("Erase Baseband clicked...\n"); + char erase[50]; + strcpy( erase, "./ziphone -e" ); + system(erase); +} + +static void +downgradebl (GtkWidget *widget,gpointer data) +{ + g_print ("Downgrade Bootloader clicked...\n"); + char downgradebl[50]; + strcpy( downgradebl, "./ziphone -b" ); + system(downgradebl); +} + +static void +debugboot (GtkWidget *widget,gpointer data) +{ + g_print ("Debug Boot clicked...\n"); + char debugboot[50]; + strcpy( debugboot, "./ziphone -v" ); + system(debugboot); +} + +static void +exitrecovery (GtkWidget *widget,gpointer data) +{ + g_print ("Exit Recovery clicked...\n"); + char exitrecovery[50]; + strcpy( exitrecovery, "./ziphone -N" ); + system(exitrecovery); +} + +static void +enterdfu (GtkWidget *widget,gpointer data) +{ + g_print ("Enter DFU Mode clicked...\n"); + char enterdfu[50]; + strcpy( enterdfu, "./ziphone -D" ); + system(enterdfu); +} + +static void +jailbreak_and_activation (GtkWidget *widget,gpointer data) +{ + g_print ("Jailbreak and Activate clicked...\n"); + char jailbreak_and_activation[50]; + strcpy( jailbreak_and_activation, "./ziphone -j -a" ); + system(jailbreak_and_activation); + +} + +static void +jailbreak_activation_unlock (GtkWidget *widget,gpointer data) +{ + g_print ("Jailbreak, Activate, and Unlock clicked...\n"); + char jailbreak_activation_unlock[50]; + strcpy( jailbreak_activation_unlock, "./ziphone -j -a -u" ); + system(jailbreak_activation_unlock); + +} + +static void +kill_ziphone (GtkWidget *widget,gpointer data) +{ + g_print ("Kill ZiPhone clicked...\n"); + char kill_ziphone[50]; + strcpy( kill_ziphone, "killall ziphone" ); + system(kill_ziphone); + +} + +static void +activate (GtkApplication *app, gpointer user_data) +{ + GtkWidget *window; + GtkWidget *grid; + GtkWidget *image; + GtkWidget *button; + + window = gtk_application_window_new (app); + gtk_window_set_title (GTK_WINDOW (window), "ZiPhone"); + gtk_container_set_border_width (GTK_CONTAINER (window), 100); + + grid = gtk_grid_new (); + gtk_grid_set_row_spacing (GTK_GRID (grid), 6); + gtk_grid_set_column_spacing (GTK_GRID (grid), 6); + gtk_container_add (GTK_CONTAINER (window), grid); + + GdkColor color; + if (gdk_color_parse("#000000", &color)) + { + gtk_widget_modify_bg(window, GTK_STATE_NORMAL, &color); + } + + button = gtk_button_new_with_label ("Jailbreak"); + g_signal_connect (button, "clicked", G_CALLBACK (jailbreak), NULL); + + gtk_grid_attach (GTK_GRID (grid), button, 0, 0, 1, 1); + + button = gtk_button_new_with_label ("Activate"); + g_signal_connect (button, "clicked", G_CALLBACK (activation), NULL); + gtk_grid_attach (GTK_GRID (grid), button, 1, 0, 1, 1); + + button = gtk_button_new_with_label ("Unlock"); + g_signal_connect (button, "clicked", G_CALLBACK (unlock), NULL); + gtk_grid_attach (GTK_GRID (grid), button, 2, 0, 1, 1); + + button = gtk_button_new_with_label ("Jailbreak and Activate"); + g_signal_connect (button, "clicked", G_CALLBACK (jailbreak_and_activation), NULL); + gtk_grid_attach (GTK_GRID (grid), button, 0, 1, 2, 1); + + button = gtk_button_new_with_label ("Jailbreak, Activate, and Unlock"); + g_signal_connect (button, "clicked", G_CALLBACK (jailbreak_activation_unlock), NULL); + gtk_grid_attach (GTK_GRID (grid), button, 0, 2, 3, 1); + + button = gtk_button_new_with_label ("Erase Baseband"); + g_signal_connect (button, "clicked", G_CALLBACK (erase), NULL); + gtk_grid_attach (GTK_GRID (grid), button, 0, 3, 1, 1); + + button = gtk_button_new_with_label ("Downgrade Bootloader"); + g_signal_connect (button, "clicked", G_CALLBACK (downgradebl), NULL); + + gtk_grid_attach (GTK_GRID (grid), button, 1, 3, 1, 1); + + button = gtk_button_new_with_label ("Debug Boot"); + g_signal_connect (button, "clicked", G_CALLBACK (debugboot), NULL); + gtk_grid_attach (GTK_GRID (grid), button, 0, 4, 1, 1); + + button = gtk_button_new_with_label ("Exit Recovery"); + g_signal_connect (button, "clicked", G_CALLBACK (exitrecovery), NULL); + gtk_grid_attach (GTK_GRID (grid), button, 1, 4, 1, 1); + + button = gtk_button_new_with_label ("Enter DFU"); + g_signal_connect (button, "clicked", G_CALLBACK (enterdfu), NULL); + gtk_grid_attach (GTK_GRID (grid), button, 2, 4, 1, 1); + + button = gtk_button_new_with_label ("Kill ZiPhone"); + g_signal_connect_swapped (button, "clicked", G_CALLBACK (kill_ziphone), window); + gtk_grid_attach (GTK_GRID (grid), button, 0, 5, 3, 1); + + button = gtk_button_new_with_label ("Exit GUI"); + g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window); + gtk_grid_attach (GTK_GRID (grid), button, 0, 6, 3, 1); + + gtk_widget_show_all (window); +} + +int main (int argc,char **argv) +{ + GtkApplication *app; + int status; + +if(geteuid() != 0) +{ + printf("You must run ./zgui as root or with sudo.\n"); + exit(1); +} + +printf("Starting GUI...\n"); + + app = gtk_application_new ("com.zibriandlex.ziphone", G_APPLICATION_FLAGS_NONE); + g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); + status = g_application_run (G_APPLICATION (app), argc, argv); + g_object_unref (app); + + return status; +}