Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libplist
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pwn
libplist
Commits
6b706ced
Commit
6b706ced
authored
Aug 21, 2008
by
Jonathan Beck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add get_device_uid function
Conflicts:
parent
bb496ff0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
5 deletions
+37
-5
lockdown.c
src/lockdown.c
+30
-5
lockdown.h
src/lockdown.h
+1
-0
main.c
src/main.c
+6
-0
No files found.
src/lockdown.c
View file @
6b706ced
...
...
@@ -214,13 +214,16 @@ int lockdownd_hello(lockdownd_client *control) {
free_dictionary
(
dictionary
);
return
0
;
}
/** Askes for the device's public key. Part of the lockdownd handshake.
/** Generic function to handle simple (key, value) requests.
*
* @note You most likely want lockdownd_init unless you are doing something special.
* @param control an initialized lockdownd client.
* @param key the key to request
* @param value a pointer to the requested value
*
* @return 1 on success and 0 on failure.
*/
int
lockdownd_ge
t_device_public_key
(
lockdownd_client
*
control
,
char
**
public_key
)
int
lockdownd_ge
neric_get_value
(
lockdownd_client
*
control
,
char
*
req_key
,
char
**
value
)
{
xmlDocPtr
plist
=
new_plist
();
xmlNode
*
dict
=
NULL
;
...
...
@@ -232,7 +235,7 @@ int lockdownd_get_device_public_key(lockdownd_client *control, char **public_key
/* Setup DevicePublicKey request plist */
dict
=
add_child_to_plist
(
plist
,
"dict"
,
"
\n
"
,
NULL
,
0
);
key
=
add_key_str_dict_element
(
plist
,
dict
,
"Key"
,
"DevicePublicKey"
,
1
);
key
=
add_key_str_dict_element
(
plist
,
dict
,
"Key"
,
req_key
,
1
);
key
=
add_key_str_dict_element
(
plist
,
dict
,
"Request"
,
"GetValue"
,
1
);
xmlDocDumpMemory
(
plist
,
(
xmlChar
**
)
&
XML_content
,
&
length
);
...
...
@@ -264,7 +267,7 @@ int lockdownd_get_device_public_key(lockdownd_client *control, char **public_key
success
=
1
;
}
if
(
!
strcmp
(
dictionary
[
i
],
"Value"
))
{
*
public_key
=
strdup
(
dictionary
[
i
+
1
]);
*
value
=
strdup
(
dictionary
[
i
+
1
]);
}
}
...
...
@@ -275,6 +278,28 @@ int lockdownd_get_device_public_key(lockdownd_client *control, char **public_key
return
success
;
}
/** Askes for the device's unique id. Part of the lockdownd handshake.
*
* @note You most likely want lockdownd_init unless you are doing something special.
*
* @return 1 on success and 0 on failure.
*/
int
lockdownd_get_device_uid
(
lockdownd_client
*
control
,
char
**
uid
)
{
return
lockdownd_generic_get_value
(
control
,
"UniqueDeviceID"
,
uid
);
}
/** Askes for the device's public key. Part of the lockdownd handshake.
*
* @note You most likely want lockdownd_init unless you are doing something special.
*
* @return 1 on success and 0 on failure.
*/
int
lockdownd_get_device_public_key
(
lockdownd_client
*
control
,
char
**
public_key
)
{
return
lockdownd_generic_get_value
(
control
,
"DevicePublicKey"
,
public_key
);
}
/** Completes the entire lockdownd handshake.
*
* @param phone The iPhone
...
...
src/lockdown.h
View file @
6b706ced
...
...
@@ -41,6 +41,7 @@ char *lockdownd_generate_hostid();
lockdownd_client
*
new_lockdownd_client
(
iPhone
*
phone
);
int
lockdownd_hello
(
lockdownd_client
*
control
);
int
lockdownd_get_device_uid
(
lockdownd_client
*
control
,
char
**
uid
);
int
lockdownd_get_device_public_key
(
lockdownd_client
*
control
,
char
**
public_key
);
int
lockdownd_gen_pair_cert
(
char
*
public_key_b64
,
char
**
device_cert_b64
,
char
**
host_cert_b64
,
char
**
root_cert_b64
);
int
lockdownd_pair_device
(
lockdownd_client
*
control
,
char
*
public_key
,
char
*
host_id
);
...
...
src/main.c
View file @
6b706ced
...
...
@@ -57,6 +57,12 @@ int main(int argc, char *argv[]) {
return
-
1
;
}
char
*
uid
=
NULL
;
if
(
lockdownd_get_device_uid
(
control
,
&
uid
))
{
printf
(
"DeviceUniqueID : %s
\n
"
,
uid
);
free
(
uid
);
}
port
=
lockdownd_start_service
(
control
,
"com.apple.afc"
);
if
(
port
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment