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
ed6e6e57
Commit
ed6e6e57
authored
Jul 30, 2008
by
Matt Colyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added beginnings of a fuse fs, right now it's read only and terribly fragile.
parent
3dc130f3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
140 additions
and
7 deletions
+140
-7
AFC.h
src/AFC.h
+1
-4
Makefile.am
src/Makefile.am
+4
-3
ifuse.c
src/ifuse.c
+135
-0
No files found.
src/AFC.h
View file @
ed6e6e57
...
...
@@ -10,6 +10,7 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
typedef
struct
{
//const uint32 header1 = 0x36414643; // '6AFC' or 'CFA6' when sent ;)
...
...
@@ -38,10 +39,6 @@ typedef struct __AFCToken {
char
*
token
;
}
AFCToken
;
enum
{
S_IFREG
=
0
,
S_IFDIR
=
1
};
enum
{
AFC_FILE_READ
=
0x00000002
,
...
...
src/Makefile.am
View file @
ed6e6e57
AM_CFLAGS
=
`
xml2-config
--cflags
`
AM_LDFLAGS
=
`
xml2-config
--libs
`
-lusb
-lgnutls
AM_CFLAGS
=
`
xml2-config
--cflags
`
`
pkg-config fuse
--cflags
`
`
pkg-config glib-2.0
--cflags
`
-g
AM_LDFLAGS
=
`
xml2-config
--libs
`
`
pkg-config fuse
--libs
`
`
pkg-config glib-2.0
--libs
`
-lusb
-lgnutls
bin_PROGRAMS
=
iphoneclient
bin_PROGRAMS
=
iphoneclient
ifuse
iphoneclient_SOURCES
=
usbmux.c main.c iphone.c plist.c lockdown.c AFC.c
ifuse_SOURCES
=
ifuse.c usbmux.c iphone.c plist.c lockdown.c AFC.c
src/ifuse.c
0 → 100644
View file @
ed6e6e57
#define FUSE_USE_VERSION 26
#include <fuse.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <usb.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <glib.h>
#include "usbmux.h"
#include "iphone.h"
#include "plist.h"
#include "lockdown.h"
#include "AFC.h"
AFClient
*
afc
;
GHashTable
*
file_handles
;
int
fh_index
=
0
;
int
debug
=
0
;
static
int
ifuse_getattr
(
const
char
*
path
,
struct
stat
*
stbuf
)
{
int
res
=
0
;
AFCFile
*
file
;
memset
(
stbuf
,
0
,
sizeof
(
struct
stat
));
file
=
afc_get_file_info
(
afc
,
path
);
if
(
!
file
){
res
=
-
ENOENT
;
}
stbuf
->
st_mode
=
file
->
type
|
0444
;
stbuf
->
st_size
=
file
->
size
;
//stbuf->st_nlink = 2;
return
res
;
}
static
int
ifuse_readdir
(
const
char
*
path
,
void
*
buf
,
fuse_fill_dir_t
filler
,
off_t
offset
,
struct
fuse_file_info
*
fi
)
{
int
i
;
char
**
dirs
,
**
filename
;
dirs
=
afc_get_dir_list
(
afc
,
path
);
for
(
i
=
0
;
strcmp
(
dirs
[
i
],
""
);
i
++
)
{
filler
(
buf
,
dirs
[
i
],
NULL
,
0
);
}
free_dictionary
(
dirs
);
return
0
;
}
static
int
ifuse_open
(
const
char
*
path
,
struct
fuse_file_info
*
fi
)
{
AFCFile
*
file
;
if
((
fi
->
flags
&
3
)
!=
O_RDONLY
)
return
-
EACCES
;
file
=
afc_open_file
(
afc
,
path
,
AFC_FILE_READ
);
fh_index
++
;
fi
->
fh
=
fh_index
;
g_hash_table_insert
(
file_handles
,
&
fh_index
,
file
);
return
0
;
}
static
int
ifuse_read
(
const
char
*
path
,
char
*
buf
,
size_t
size
,
off_t
offset
,
struct
fuse_file_info
*
fi
)
{
int
bytes
;
AFCFile
*
file
;
file
=
g_hash_table_lookup
(
file_handles
,
&
(
fi
->
fh
));
if
(
!
file
){
return
-
ENOENT
;
}
bytes
=
afc_read_file
(
afc
,
file
,
buf
,
size
);
return
bytes
;
}
void
ifuse_init
(
struct
fuse_conn_info
*
conn
)
{
char
*
response
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
2048
);
int
bytes
=
0
,
port
=
0
,
i
=
0
;
file_handles
=
g_hash_table_new
(
g_int_hash
,
g_int_equal
);
iPhone
*
phone
=
get_iPhone
();
if
(
!
phone
){
fprintf
(
stderr
,
"No iPhone found, is it connected?
\n
"
);
return
-
1
;
}
lockdownd_client
*
control
=
new_lockdownd_client
(
phone
);
if
(
!
lockdownd_hello
(
control
))
{
fprintf
(
stderr
,
"Something went wrong in the lockdownd client.
\n
"
);
return
-
1
;
}
//if (!lockdownd_start_SSL_session(control, "29942970-207913891623273984")) {
fprintf
(
stderr
,
"Something went wrong in GnuTLS.
\n
"
);
return
-
1
;
}
port
=
lockdownd_start_service
(
control
,
"com.apple.afc"
);
if
(
!
port
)
{
fprintf
(
stderr
,
"Something went wrong when starting AFC."
);
}
afc
=
afc_connect
(
phone
,
3432
,
port
);
}
void
ifuse_cleanup
()
{
afc_disconnect
(
afc
);
}
static
struct
fuse_operations
ifuse_oper
=
{
.
getattr
=
ifuse_getattr
,
.
readdir
=
ifuse_readdir
,
.
open
=
ifuse_open
,
.
read
=
ifuse_read
,
.
init
=
ifuse_init
,
.
destroy
=
ifuse_cleanup
};
int
main
(
int
argc
,
char
*
argv
[])
{
return
fuse_main
(
argc
,
argv
,
&
ifuse_oper
,
NULL
);
}
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