diff options
| author | 2008-07-29 01:13:51 -0700 | |
|---|---|---|
| committer | 2008-07-29 01:13:51 -0700 | |
| commit | 0f4aeb11abce2f36d840b19d028e5aa34ccf5aba (patch) | |
| tree | 978d11b1f46fb323db044fa76e2020c09aab89d4 /main.c | |
| parent | e2ff1128351d75eafd5426af7f96f9719c1af3e6 (diff) | |
| download | libimobiledevice-0f4aeb11abce2f36d840b19d028e5aa34ccf5aba.tar.gz libimobiledevice-0f4aeb11abce2f36d840b19d028e5aa34ccf5aba.tar.bz2 | |
Version 0.09, added ability to talk to 2.0 firmware.
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 25 |
1 files changed, 23 insertions, 2 deletions
| @@ -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 { |
