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
aed2c025
Commit
aed2c025
authored
Nov 25, 2008
by
Jonathan Beck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix some warnings and indent
parent
0bca81e7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
294 additions
and
274 deletions
+294
-274
lckdclient.c
dev/lckdclient.c
+1
-0
main.c
dev/main.c
+1
-1
plutil.c
dev/plutil.c
+113
-106
plist.c
src/plist.c
+172
-163
plist.h
src/plist.h
+7
-4
No files found.
dev/lckdclient.c
View file @
aed2c025
...
...
@@ -20,6 +20,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <readline/readline.h>
...
...
dev/main.c
View file @
aed2c025
...
...
@@ -87,7 +87,7 @@ int main(int argc, char *argv[])
iphone_afc_get_file_attr
(
afc
,
"/iTunesOnTheGoPlaylist.plist"
,
&
stbuf
);
if
(
IPHONE_E_SUCCESS
==
iphone_afc_open_file
(
afc
,
"/iTunesOnTheGoPlaylist.plist"
,
IPHONE_AFC_FILE_READ
,
&
my_file
)
&&
my_file
)
{
printf
(
"A file size: %i
\n
"
,
stbuf
.
st_size
);
printf
(
"A file size: %i
\n
"
,
(
int
)
stbuf
.
st_size
);
char
*
file_data
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
stbuf
.
st_size
);
iphone_afc_read_file
(
afc
,
my_file
,
file_data
,
stbuf
.
st_size
,
&
bytes
);
if
(
bytes
>=
0
)
{
...
...
dev/plutil.c
View file @
aed2c025
...
...
@@ -5,23 +5,27 @@
#include "../src/plist.h"
#include "plutil.h"
#include <glib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
int
debug
=
0
;
void
print_nodes
(
bplist_node
*
root_node
)
{
void
print_nodes
(
bplist_node
*
root_node
)
{
// Yay, great. Let's print the list of nodes recursively...
int
i
=
0
;
if
(
!
root_node
)
return
;
// or not, because the programmer's stupid.
if
(
!
root_node
)
return
;
// or not, because the programmer's stupid.
switch
(
root_node
->
type
)
{
case
BPLIST_DICT
:
printf
(
"Dictionary node.
\n
Length %i
\n
"
,
root_node
->
length
);
for
(
i
=
0
;
i
<
(
root_node
->
length
*
2
);
i
+=
2
)
{
printf
(
"Dictionary node.
\n
Length %lu
\n
"
,
(
long
unsigned
int
)
root_node
->
length
);
for
(
i
=
0
;
i
<
(
root_node
->
length
*
2
);
i
+=
2
)
{
// HI!
printf
(
"Key: "
);
print_nodes
(
root_node
->
subnodes
[
i
]);
printf
(
"Value: "
);
print_nodes
(
root_node
->
subnodes
[
i
+
1
]);
print_nodes
(
root_node
->
subnodes
[
i
+
1
]);
}
printf
(
"End dictionary node.
\n\n
"
);
break
;
...
...
@@ -53,7 +57,7 @@ void print_nodes(bplist_node *root_node) {
case
BPLIST_DATA
:
printf
(
"Data: "
);
char
*
data
=
g_base64_encode
(
root_node
->
strval
,
root_node
->
length
);
char
*
data
=
g_base64_encode
(
root_node
->
strval
,
root_node
->
length
);
fwrite
(
format_string
(
data
,
60
,
0
),
sizeof
(
char
),
strlen
(
data
),
stdout
);
fflush
(
stdout
);
printf
(
"
\n
"
);
...
...
@@ -80,13 +84,14 @@ void print_nodes(bplist_node *root_node) {
break
;
default:
printf
(
"oops
\n
Type set to %x and length is %i
\n
"
,
root_node
->
type
,
root_node
->
length
);
printf
(
"oops
\n
Type set to %x and length is %lu
\n
"
,
root_node
->
type
,
(
long
unsigned
int
)
root_node
->
length
);
break
;
}
}
int
main
(
int
argc
,
char
*
argv
[])
{
struct
stat
*
filestats
=
(
struct
stat
*
)
malloc
(
sizeof
(
struct
stat
));
int
main
(
int
argc
,
char
*
argv
[])
{
struct
stat
*
filestats
=
(
struct
stat
*
)
malloc
(
sizeof
(
struct
stat
));
uint32_t
position
=
0
;
Options
*
options
=
parse_arguments
(
argc
,
argv
);
int
argh
=
0
;
...
...
@@ -98,14 +103,14 @@ int main(int argc, char *argv[]) {
return
0
;
}
debug
=
options
->
debug
;
iphone_set_debug
(
options
->
debug
)
;
FILE
*
bplist
=
fopen
(
options
->
in_file
,
"r"
);
stat
(
options
->
in_file
,
filestats
);
printf
(
"here?
\n
"
);
char
*
bplist_entire
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
(
filestats
->
st_size
+
1
));
char
*
bplist_entire
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
(
filestats
->
st_size
+
1
));
//argh = fgets(bplist_entire, filestats->st_size, bplist);
argh
=
fread
(
bplist_entire
,
sizeof
(
char
),
filestats
->
st_size
,
bplist
);
printf
(
"read %i bytes
\n
"
,
argh
);
...
...
@@ -115,38 +120,39 @@ int main(int argc, char *argv[]) {
bplist_node
*
root_node
;
root_node
=
parse_nodes
(
bplist_entire
,
filestats
->
st_size
,
&
position
);
printf
(
"plutil debug mode
\n\n
"
);
printf
(
"file size %i
\n\n
"
,
filestats
->
st_size
);
printf
(
"file size %i
\n\n
"
,
(
int
)
filestats
->
st_size
);
if
(
!
root_node
)
{
printf
(
"Invalid binary plist (or some other error occurred.)
\n
"
);
return
0
;
}
print_nodes
(
root_node
);
return
0
;
}
}
Options
*
parse_arguments
(
int
argc
,
char
*
argv
[])
{
Options
*
parse_arguments
(
int
argc
,
char
*
argv
[])
{
int
i
=
0
;
Options
*
options
=
(
Options
*
)
malloc
(
sizeof
(
Options
));
Options
*
options
=
(
Options
*
)
malloc
(
sizeof
(
Options
));
memset
(
options
,
0
,
sizeof
(
Options
));
for
(
i
=
1
;
i
<
argc
;
i
++
)
{
if
(
!
strcmp
(
argv
[
i
],
"--infile"
)
||
!
strcmp
(
argv
[
i
],
"-i"
))
{
if
((
i
+
1
)
==
argc
)
{
if
((
i
+
1
)
==
argc
)
{
free
(
options
);
return
NULL
;
}
options
->
in_file
=
argv
[
i
+
1
];
options
->
in_file
=
argv
[
i
+
1
];
i
++
;
continue
;
}
if
(
!
strcmp
(
argv
[
i
],
"--outfile"
)
||
!
strcmp
(
argv
[
i
],
"-o"
))
{
if
((
i
+
1
)
==
argc
)
{
if
((
i
+
1
)
==
argc
)
{
free
(
options
);
return
NULL
;
}
options
->
out_file
=
argv
[
i
+
1
];
options
->
out_file
=
argv
[
i
+
1
];
i
++
;
continue
;
}
...
...
@@ -161,7 +167,7 @@ Options *parse_arguments(int argc, char *argv[]) {
}
}
if
(
!
options
->
in_file
/*|| !options->out_file
*/
)
{
if
(
!
options
->
in_file
/*|| !options->out_file
*/
)
{
free
(
options
);
return
NULL
;
}
...
...
@@ -169,7 +175,8 @@ Options *parse_arguments(int argc, char *argv[]) {
return
options
;
}
void
print_usage
()
{
void
print_usage
()
{
printf
(
"Usage: plistutil -i|--infile in_file.plist -o|--outfile out_file.plist [--debug]
\n
"
);
printf
(
"
\n
"
);
printf
(
"
\t
-i or --infile: The file to read in.
\n
"
);
...
...
src/plist.c
View file @
aed2c025
This diff is collapsed.
Click to expand it.
src/plist.h
View file @
aed2c025
...
...
@@ -31,6 +31,7 @@
#include <sys/stat.h>
#include <unistd.h>
char
*
format_string
(
const
char
*
buf
,
int
cols
,
int
depth
);
xmlNode
*
add_key_dict_node
(
xmlDocPtr
plist
,
xmlNode
*
dict
,
const
char
*
key
,
const
char
*
value
,
int
depth
);
xmlNode
*
add_key_str_dict_element
(
xmlDocPtr
plist
,
xmlNode
*
dict
,
const
char
*
key
,
const
char
*
value
,
int
depth
);
xmlNode
*
add_key_data_dict_element
(
xmlDocPtr
plist
,
xmlNode
*
dict
,
const
char
*
key
,
const
char
*
value
,
int
depth
);
...
...
@@ -73,4 +74,6 @@ typedef struct _bplist_node {
wchar_t
*
unicodeval
;
}
bplist_node
;
bplist_node
*
parse_nodes
(
const
char
*
bpbuffer
,
uint32_t
bplength
,
uint32_t
*
position
);
#endif
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