summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/main.c b/main.c
index 4cde3d9..d5c2dfa 100644
--- a/main.c
+++ b/main.c
@@ -36,12 +36,13 @@ int main(int argc, char *argv[]) {
36 } 36 }
37 37
38 printf("Now starting SSL.\n"); 38 printf("Now starting SSL.\n");
39 if (!lockdownd_start_SSL_session(control, "29942970-207913891623273984")) { 39// if (!lockdownd_start_SSL_session(control, "29942970-207913891623273984")) {
40 if (!lockdownd_start_SSL_session(control, "2994593482385678618538736")) {
40 printf("Error happened in GnuTLS...\n"); 41 printf("Error happened in GnuTLS...\n");
41 } else { 42 } else {
42 printf("... we're in SSL with the phone... !?\n"); 43 printf("... we're in SSL with the phone... !?\n");
44 port = lockdownd_start_service(control, "com.apple.afc");
43 } 45 }
44 port = lockdownd_start_service(control, "com.apple.afc");
45 if (port) { 46 if (port) {
46 printf("Start Service successful -- connect on port %i\n", port); 47 printf("Start Service successful -- connect on port %i\n", port);
47 AFClient *afc = afc_connect(phone, 3432, port); 48 AFClient *afc = afc_connect(phone, 3432, port);
@@ -69,6 +70,26 @@ int main(int argc, char *argv[]) {
69 free(my_file); 70 free(my_file);
70 free(file_data); 71 free(file_data);
71 } else printf("couldn't open a file\n"); 72 } else printf("couldn't open a file\n");
73
74 my_file = afc_open_file(afc, "/readme.libiphone.fx", AFC_FILE_WRITE);
75 if (my_file) {
76 char *outdatafile = strdup("this is a bitchin text file\n");
77 bytes = afc_write_file(afc, my_file, outdatafile, strlen(outdatafile));
78 free(outdatafile);
79 if (bytes > 0) printf("Wrote a surprise. ;)\n");
80 else printf("I wanted to write a surprise, but... :(\n");
81 afc_close_file(afc, my_file);
82 free(my_file);
83 }
84 printf("Deleting a file...\n");
85 bytes = afc_delete_file(afc, "/delme");
86 if (bytes) printf("Success.\n");
87 else printf("Failure.\n");
88
89 printf("Renaming a file...\n");
90 bytes = afc_rename_file(afc, "/renme", "/renme2");
91 if (bytes > 0) printf("Success.\n");
92 else printf("Failure.\n");
72 } 93 }
73 afc_disconnect(afc); 94 afc_disconnect(afc);
74 } else { 95 } else {