pax_global_header00006660000000000000000000000064151721040650014513gustar00rootroot0000000000000052 comment=f7eac74184ff240c8ba9cf9b413eed75968a462a ifuse-1.2.1/000077500000000000000000000000001517210406500126275ustar00rootroot00000000000000ifuse-1.2.1/.github/000077500000000000000000000000001517210406500141675ustar00rootroot00000000000000ifuse-1.2.1/.github/workflows/000077500000000000000000000000001517210406500162245ustar00rootroot00000000000000ifuse-1.2.1/.github/workflows/build.yml000066400000000000000000000035561517210406500200570ustar00rootroot00000000000000name: build on: [push] jobs: build-linux-ubuntu: runs-on: ubuntu-latest steps: - name: install dependencies run: | sudo apt-get update sudo apt-get install libfuse3-dev - name: prepare environment run: | echo "target_triplet=`gcc -dumpmachine`" >> $GITHUB_ENV - name: fetch libplist uses: dawidd6/action-download-artifact@v6 with: github_token: ${{secrets.GITHUB_TOKEN}} workflow: build.yml name: libplist-latest_${{env.target_triplet}} repo: libimobiledevice/libplist - name: fetch libusbmuxd uses: dawidd6/action-download-artifact@v6 with: github_token: ${{secrets.GITHUB_TOKEN}} workflow: build.yml name: libusbmuxd-latest_${{env.target_triplet}} repo: libimobiledevice/libusbmuxd - name: fetch libimobiledevice-glue uses: dawidd6/action-download-artifact@v6 with: github_token: ${{secrets.GITHUB_TOKEN}} workflow: build.yml name: libimobiledevice-glue-latest_${{env.target_triplet}} repo: libimobiledevice/libimobiledevice-glue - name: fetch libimobiledevice uses: dawidd6/action-download-artifact@v6 with: github_token: ${{secrets.GITHUB_TOKEN}} workflow: build.yml name: libimobiledevice-latest_${{env.target_triplet}} repo: libimobiledevice/libimobiledevice - name: install external dependencies run: | mkdir extract for I in *.tar; do tar -C extract -xvf $I done rm -rf extract/lib sudo cp -r extract/* / sudo ldconfig - uses: actions/checkout@v4 with: fetch-depth: 0 - name: autogen run: ./autogen.sh PKG_CONFIG_PATH=/usr/local/lib/pkgconfig - name: make run: make - name: make install run: sudo make install ifuse-1.2.1/.gitignore000066400000000000000000000003611517210406500146170ustar00rootroot00000000000000*.[oa] *~ *.po *.lo *.la .*.swp */.deps/* *.patch Makefile Makefile.in aclocal.m4 autom4te.cache compile config.guess config.h config.h.in config.log config.status config.sub configure depcomp install-sh ltmain.sh missing src/ifuse stamp-h1 ifuse-1.2.1/AUTHORS000066400000000000000000000002021517210406500136710ustar00rootroot00000000000000Zach C. Jonathan Beck Matt Colyer Martin Aumueller Christophe Fergeau Paul Sladen Zoltan Balaton Nikias Bassen Fernando Silveira ifuse-1.2.1/COPYING000066400000000000000000000635021517210406500136700ustar00rootroot00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! ifuse-1.2.1/Makefile.am000066400000000000000000000004301517210406500146600ustar00rootroot00000000000000AUTOMAKE_OPTIONS = foreign SUBDIRS = docs src EXTRA_DIST = \ README.md DISTCHECK_CONFIGURE_FLAGS = --disable-root-sbin indent: indent -kr -ut -ts4 -l120 src/*.c release: git archive --format=tar --prefix=ifuse-${RELEASE}/ tags/${RELEASE} | bzip2 > ifuse-${RELEASE}.tar.bz2 ifuse-1.2.1/NEWS000066400000000000000000000055731517210406500133400ustar00rootroot00000000000000Version 1.2.1 ~~~~~~~~~~~~~ Bugfix Release * Changes: - Fix FUSE capability flags set during initialization causing data corruption Version 1.2.0 ~~~~~~~~~~~~~ * Changes: - Switch to libfuse 3 - Require libimobiledevice 1.4.0 Version 1.1.4 ~~~~~~~~~~~~~ * Changes: - Use automake silent rules if available - Add helpful message when mounting an app document folder fails - Add new "--list-apps" option to print list of apps with file sharing enabled - Remove length check on UDID argument to support newer devices - Add "--network" option to allow connecting to network devices - Add title row and use double quotes for "--list-apps" output - Drop support for older versions of libimobiledevice - Bump libimobiledevice dependency to 1.3.0 - Bump libplist dependency to 2.2.0 - Improve README.md with project description, installation, contributing and usage sections Version 1.1.3 ~~~~~~~~~~~~~ * Changes: - Updated to compile with latest libimobiledevice - New command line options --documents and --container (obsoletes --appid) - Handle error condition caused by pending iOS7+ trust dialog - Minor fixes and changes Version 1.1.2 ~~~~~~~~~~~~~ * Changes: - Add direct linking with libplist to fix build issues - Add basic manpage - Use UDID instead of UUID as it is the correct term for it - Remove obsolete glib and gthread dependencies Version 1.1.1 ~~~~~~~~~~~~~ * Changes: - Fix compilation without "house_arrest" support Version 1.1.0 ~~~~~~~~~~~~~ * Changes: - Add "house_arrest" support when compiled with libimobiledevice >= 1.1.0 - Add --appid option for document/filesharing using "house_arrest" service - FreeBSD doesn't have ENODATA, so fake it as EIO - Make COPYING contain correct license - Add NEWS file and update README - Minor bugfixes Version 1.0.0 ~~~~~~~~~~~~~ * Changes: - Return correct exit codes - Adopt code from libiphone API to the libimobiledevice API - Add trademark and disclaimer to README Version 0.9.6 (RC1) ~~~~~~~~~~~~~~~~~~~ * Changes: - Port to libiphone 0.9.6 API - Report error if a passcode is set on the device - Remove hardcoded "allow_other" fuse argument Version 0.9.5 ~~~~~~~~~~~~~ * Changes: - Support for file modification times with iOS 3.1+ Version 0.9.4 ~~~~~~~~~~~~~ * Changes: - Remove obsolete HAL fdi rules - Rename binary to "ifuse" again - Allow mounting a specific device using UUID option Version 0.9.3 ~~~~~~~~~~~~~ * Changes: - Fix deletion of non empty directories (recursive delete) Version 0.9.2 ~~~~~~~~~~~~~ * Changes: - Add iPhone 3GS support - Use file handles - Add hard/symlink support for AFC - Added --debug option - Improve error messages Version 0.9.1 ~~~~~~~~~~~~~ * Changes: - A bunch of autotools fixes Version 0.9.0 ~~~~~~~~~~~~~ * First public release * Changes: - AFC and AFC2 filesystem access - Correctly handle file modes ifuse-1.2.1/README.md000066400000000000000000000226331517210406500141140ustar00rootroot00000000000000# ifuse *A fuse filesystem implementation to access the contents of iOS devices.* ![](https://github.com/libimobiledevice/ifuse/actions/workflows/build.yml/badge.svg) :warning: **Version 1.2.0 has a serious bug that results in data corruption. Regression was introduced in commit [36956a](/../../commit/36956a5179e224f57ebb9d0f01314c09c8bf0f97) and fixed in Version 1.2.1 with commit [903a29](/../../commit/903a29c7424028304aeef137d7c24e176b73fccf).** ## Table of Contents - [Features](#features) - [Building](#building) - [Prerequisites](#prerequisites) - [Linux (Debian/Ubuntu based)](#linux-debianubuntu-based) - [macOS](#macos) - [Configuring the source tree](#configuring-the-source-tree) - [Building and installation](#building-and-installation) - [Usage](#usage) - [Contributing](#contributing) - [Links](#links) - [License](#license) - [Credits](#credits) ## Features This project allows mounting various directories of an iOS device locally using the [FUSE file system interface](https://github.com/libfuse/libfuse). Some key features are: - **Media**: Mount media directory of an iOS device locally - **Apps**: Mount sandbox container or document directory of an app - **Jailbreak**: Mount root filesystem on jailbroken devices *(requires AFC2 service)* - **Browse**: Allows to retrieve a list of installed file-sharing enabled apps - **Implementation**: Uses [libimobiledevice](https://github.com/libimobiledevice/libimobiledevice) for communication with the device ## Building ### Prerequisites You need to have a working compiler (gcc/clang) and development environent available. This project uses autotools for the build process, allowing to have common build steps across different platforms. Only the prerequisites differ and they are described in this section. #### Linux (Debian/Ubuntu based) * Install all required dependencies and build tools: ```shell sudo apt-get install \ build-essential \ pkg-config \ checkinstall \ git \ autoconf \ automake \ libtool-bin \ libplist-dev \ libimobiledevice-dev \ libfuse3-dev \ usbmuxd ``` * [usbmuxd](https://github.com/libimobiledevice/usbmuxd) must be properly installed for `ifuse` to be able to communicate with devices. * Note: On some systems, you may have to load the `fuse` kernel module first and to ensure that you are a member of the `fuse` group: ```shell sudo modprobe fuse sudo adduser $USER fuse ``` You can check your membership of the `fuse` group with: ```shell id | grep fuse && echo yes! || echo not yet... ``` If you have just added yourself, you will need to logout and log back in for the group change to become visible. #### macOS * Make sure the Xcode command line tools are installed. Use either [MacPorts](https://www.macports.org/) or [Homebrew](https://brew.sh/) to install `automake`, `autoconf`, and `libtool`. Using MacPorts: ```shell sudo port install libtool autoconf automake ``` Using Homebrew: ```shell brew install libtool autoconf automake ``` `ifuse` has a few dependencies from the libimobiledevice project. You will have to build and install the following: * [libplist](https://github.com/libimobiledevice/libplist) * [libimobiledevice-glue](https://github.com/libimobiledevice/libimobiledevice-glue) * [libusbmuxd](https://github.com/libimobiledevice/libusbmuxd) * [libimobiledevice](https://github.com/libimobiledevice/libimobiledevice) Check their `README.md` for building and installation instructions. * Download [macFUSE](https://github.com/macfuse/macfuse/releases/) dmg, mount it, and double click the `Install macFUSE` installer. This will also install the libfuse library and development files. Note: For macFUSE to work, you need to allow the macFUSE system extension in *Settings* -> *Privacy & Security* -> *Security*. Note that changes will require a system restart. ### Configuring the source tree You can build the source code from a git checkout, or from a `.tar.bz2` release tarball from [Releases](https://github.com/libimobiledevice/ifuse/releases). Before we can build it, the source tree has to be configured for building. The steps depend on where you got the source from. * **From git** If you haven't done already, clone the actual project repository and change into the directory. ```shell git clone https://github.com/libimobiledevice/ifuse.git cd ifuse ``` Configure the source tree for building: ```shell ./autogen.sh ``` * **From release tarball (.tar.bz2)** When using an official [release tarball](https://github.com/libimobiledevice/ifuse/releases) (`ifuse-x.y.z.tar.bz2`) the procedure is slightly different. Extract the tarball: ```shell tar xjf ifuse-x.y.z.tar.bz2 cd ifuse-x.y.z ``` Configure the source tree for building: ```shell ./configure ``` Both `./configure` and `./autogen.sh` (which generates and calls `configure`) accept a few options, for example `--prefix` to allow building for a different target folder. You can simply pass them like this: ```shell ./autogen.sh --prefix=/usr/local ``` or ```shell ./configure --prefix=/usr/local ``` Once the command is successful, the last few lines of output will look like this: ``` [...] config.status: creating config.h config.status: config.h is unchanged config.status: executing depfiles commands config.status: executing libtool commands Configuration for ifuse 1.2.0: ------------------------------------------- Install prefix: .........: /usr/local Now type 'make' to build ifuse 1.2.0, and then 'make install' for installation. ``` ### Building and installation If you followed all the steps successfully, and `autogen.sh` or `configure` did not print any errors, you are ready to build the project. This is simply done with ```shell make ``` If no errors are emitted you are ready for installation. Depending on whether the current user has permissions to write to the destination directory or not, you would either run ```shell make install ``` _OR_ ```shell sudo make install ``` ## Usage To mount the media partition from the device run: ```shell ifuse ``` **HINT:** *If you mount your device as regular user, the system might complain that the file `/etc/fuse.conf` is not readable. It means you do not belong to the `fuse` group (see below).* To unmount as a regular user you must run: ```shell fusermount -u ``` By default, ifuse (via the AFC protocol) gives access to the `/var/mobile/Media/` chroot on the device (containing music/pictures). This is the right and safe way to access the device. However, if the device has been jailbroken, a full view of the device's filesystem might be available using the following command when mounting: ```shell ifuse --root ``` Note that only older jailbreak software installed the necessary AFC2 service on the device to enable root filesystem usage. For instance blackra1n does not install it and thus does not enable root filesystem access by default! Use with care as the AFC protocol was not made to access the root filesystem. **ifuse** can also be used with the iTunes file/document sharing feature. It allows you to exchange files with an application on the device directly through it's documents folder by specifing the application identifier like this: ```shell ifuse --documents ``` The following example mounts the documents folder of the VLC app to `/mnt`: ```shell ifuse --documents org.videolan.vlc-ios /mnt ``` It is also possible to mount the sandboxed root folder of an application using the `--container` parameter: ```shell ifuse --container ``` The `` (bundle identifier) of an app can be obtained using: ```shell ifuse --list-apps ``` Please consult the usage information or manual page for a full documentation of available command line options: ```shell ifuse --help man ifuse ``` ## Contributing We welcome contributions from anyone and are grateful for every pull request! If you'd like to contribute, please fork the `master` branch, change, commit and send a pull request for review. Once approved it can be merged into the main code base. If you plan to contribute larger changes or a major refactoring, please create a ticket first to discuss the idea upfront to ensure less effort for everyone. Please make sure your contribution adheres to: * Try to follow the code style of the project * Commit messages should describe the change well without being too short * Try to split larger changes into individual commits of a common domain * Use your real name and a valid email address for your commits We are still working on the guidelines so bear with us! ## Links * Homepage: https://libimobiledevice.org/ * Repository: https://github.com/libimobiledevice/ifuse.git * Repository (Mirror): https://git.libimobiledevice.org/ifuse.git * Issue Tracker: https://github.com/libimobiledevice/ifuse/issues * Mailing List: https://lists.libimobiledevice.org/mailman/listinfo/libimobiledevice-devel * Twitter: https://twitter.com/libimobiledev ## License This software is licensed under the [GNU Lesser General Public License v2.1](https://www.gnu.org/licenses/lgpl-2.1.en.html), also included in the repository in the `COPYING` file. ## Credits Apple, iPhone, iPad, iPod, iPod Touch, Apple TV, Apple Watch, Mac, iOS, iPadOS, tvOS, watchOS, and macOS are trademarks of Apple Inc. This project is an independent software application and has not been authorized, sponsored, or otherwise approved by Apple Inc. README Updated on: 2026-04-22 ifuse-1.2.1/autogen.sh000077500000000000000000000005471517210406500146360ustar00rootroot00000000000000#!/bin/sh olddir=`pwd` srcdir=`dirname $0` test -z "$srcdir" && srcdir=. ( cd "$srcdir" gprefix=`which glibtoolize 2>&1 >/dev/null` if [ $? -eq 0 ]; then glibtoolize --force else libtoolize --force fi aclocal autoheader automake --add-missing autoconf cd "$olddir" ) if [ -z "$NOCONFIGURE" ]; then $srcdir/configure "$@" fi ifuse-1.2.1/configure.ac000066400000000000000000000031141517210406500151140ustar00rootroot00000000000000# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.68) AC_INIT([ifuse], [m4_esyscmd(./git-version-gen $RELEASE_VERSION)], [https://github.com/libimobiledevice/ifuse/issues],, [https://libimobiledevice.org]) AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip check-news]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) AC_CONFIG_SRCDIR([src/]) AC_CONFIG_HEADERS([config.h]) # Check if we have a version defined if test -z $PACKAGE_VERSION; then AC_MSG_ERROR([PACKAGE_VERSION is not defined. Make sure to configure a source tree checked out from git or that .tarball-version is present.]) fi # Checks for programs. AC_PROG_CC AM_PROG_CC_C_O LT_INIT # Checks for libraries. PKG_CHECK_MODULES(libimobiledevice, libimobiledevice-1.0 >= 1.4.0) PKG_CHECK_MODULES(libfuse, fuse3 >= 3.0.0) PKG_CHECK_MODULES(libplist, libplist-2.0 >= 2.3.0) # Checks for header files. AC_CHECK_HEADERS([stdint.h stdlib.h string.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_SIZE_T AC_TYPE_SSIZE_T AC_TYPE_UINT16_T AC_TYPE_UINT32_T AC_TYPE_UINT8_T # Checks for library functions. AC_FUNC_MALLOC AC_FUNC_REALLOC AC_CHECK_FUNCS([strcasecmp strdup strerror strndup]) m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) AC_CONFIG_FILES([ Makefile src/Makefile docs/Makefile ]) AC_OUTPUT echo " Configuration for $PACKAGE $VERSION: ------------------------------------------- Install prefix: .........: $prefix Now type 'make' to build $PACKAGE $VERSION, and then 'make install' for installation. " ifuse-1.2.1/docs/000077500000000000000000000000001517210406500135575ustar00rootroot00000000000000ifuse-1.2.1/docs/Makefile.am000066400000000000000000000000551517210406500156130ustar00rootroot00000000000000man_MANS = ifuse.1 EXTRA_DIST = $(man_MANS) ifuse-1.2.1/docs/ifuse.1000066400000000000000000000026311517210406500147560ustar00rootroot00000000000000.TH "ifuse" 1 .SH NAME ifuse \- Mount directories of an iOS device locally using fuse. .SH SYNOPSIS .B ifuse MOUNTPOINT [OPTIONS] .SH DESCRIPTION Mount directories of an iOS device locally using fuse. By default the media directory is mounted, options allow to also mount the sandbox container of an app, an app's documents folder or even the root filesystem on jailbroken devices. Example: $ ifuse /media/iPhone \-\-root This mounts the root filesystem of the first attached device on this computer in the directory /media/iPhone. Regular users are able to unmount fuse mounts using "fusermount -u MOUNTPOINT". .SH OPTIONS .TP .B \-o opt,[opt...] mount options. .TP .B \-u, \-\-udid UDID mount specific device by UDID. .TP .B \-n, \-\-network connect to network device. .TP .B \-h, \-\-help print usage information. .TP .B \-V, \-\-version print version. .TP .B \-d, \-\-debug enable libimobiledevice communication debugging. .TP .B \-\-documents APPID mount 'Documents' folder of app identified by APPID. .TP .B \-\-container APPID mount sandbox root of an app identified by APPID. .TP .B \-\-list-apps list installed apps that have file sharing enabled. .TP .B \-\-root mount root file system (jailbroken device required). .SH AUTHOR Julien Lavergne (man page) Martin Szulecki Matt Colyer Nikias Bassen .SH SEE ALSO fusermount(1) .SH ON THE WEB https://libimobiledevice.org https://github.com/libimobiledevice/ifuse ifuse-1.2.1/git-version-gen000077500000000000000000000011031517210406500155650ustar00rootroot00000000000000#!/bin/sh SRCDIR=`dirname $0` if test -n "$1"; then VER=$1 else if test -r "${SRCDIR}/.git" && test -x "`which git`" ; then git update-index -q --refresh if ! VER=`git describe --tags --dirty 2>/dev/null`; then COMMIT=`git rev-parse --short HEAD` DIRTY=`git diff --quiet HEAD || echo "-dirty"` VER=`sed -n '1,/RE/s/Version \(.*\)/\1/p' ${SRCDIR}/NEWS`-git-${COMMIT}${DIRTY} fi else if test -f "${SRCDIR}/.tarball-version"; then VER=`cat "${SRCDIR}/.tarball-version"` fi fi fi VER=`printf %s "$VER" | head -n1` printf %s "$VER" ifuse-1.2.1/src/000077500000000000000000000000001517210406500134165ustar00rootroot00000000000000ifuse-1.2.1/src/Makefile.am000066400000000000000000000003701517210406500154520ustar00rootroot00000000000000AM_CFLAGS = \ $(libfuse_CFLAGS) \ $(libimobiledevice_CFLAGS) \ $(libplist_CFLAGS) \ -g AM_LDFLAGS = \ $(libfuse_LIBS) \ $(libimobiledevice_LIBS) \ $(libplist_LIBS) bin_PROGRAMS = ifuse ifuse_SOURCES = ifuse.c ifuse_LDADD = $(AM_LDFLAGS) ifuse-1.2.1/src/ifuse.c000066400000000000000000000577471517210406500147210ustar00rootroot00000000000000/* * ifuse.c * A Fuse filesystem which exposes the iPhone's filesystem. * * Copyright (c) 2008 Matt Colyer All Rights Reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #define FUSE_USE_VERSION 30 #define FUSE_DARWIN_ENABLE_EXTENSIONS 0 #ifdef HAVE_CONFIG_H #include #endif /* HAVE_CONFIG_H */ #include #include #include #include #include #include #include #include #define AFC_SERVICE_NAME "com.apple.afc" #define AFC2_SERVICE_NAME "com.apple.afc2" #define HOUSE_ARREST_SERVICE_NAME "com.apple.mobile.house_arrest" #include #include #include #include #include /* FreeBSD and others don't have ENODATA, so let's fake it */ #ifndef ENODATA #define ENODATA EIO #endif house_arrest_client_t house_arrest = NULL; /* assume this is the default block size */ int g_blocksize = 4096; idevice_t device = NULL; lockdownd_client_t control = NULL; int debug = 0; static struct { char *mount_point; char *device_udid; char *appid; int use_container; int should_list_apps; char *service_name; lockdownd_service_descriptor_t service; int use_network; } opts; enum { KEY_HELP = 1, KEY_VERSION, KEY_ROOT, KEY_UDID, KEY_UDID_LONG, KEY_NETWORK, KEY_NETWORK_LONG, KEY_VENDOR_DOCUMENTS_LONG, KEY_VENDOR_CONTAINER_LONG, KEY_LIST_APPS_LONG, KEY_DEBUG, KEY_DEBUG_LONG }; static struct fuse_opt ifuse_opts[] = { FUSE_OPT_KEY("-V", KEY_VERSION), FUSE_OPT_KEY("--version", KEY_VERSION), FUSE_OPT_KEY("-h", KEY_HELP), FUSE_OPT_KEY("--help", KEY_HELP), FUSE_OPT_KEY("-u %s", KEY_UDID), FUSE_OPT_KEY("--udid %s", KEY_UDID_LONG), FUSE_OPT_KEY("-n", KEY_NETWORK), FUSE_OPT_KEY("--network", KEY_NETWORK_LONG), FUSE_OPT_KEY("--root", KEY_ROOT), FUSE_OPT_KEY("-d", KEY_DEBUG), FUSE_OPT_KEY("--debug", KEY_DEBUG_LONG), FUSE_OPT_KEY("--documents %s", KEY_VENDOR_DOCUMENTS_LONG), FUSE_OPT_KEY("--container %s", KEY_VENDOR_CONTAINER_LONG), FUSE_OPT_KEY("--list-apps", KEY_LIST_APPS_LONG), FUSE_OPT_END }; static void free_dictionary(char **dictionary) { int i = 0; if (!dictionary) return; for (i = 0; dictionary[i]; i++) { free(dictionary[i]); } free(dictionary); } struct afc_error_mapping { afc_error_t from; int to; } static afc_error_to_errno_map[] = { {AFC_E_SUCCESS , 0}, {AFC_E_OP_HEADER_INVALID , EIO}, {AFC_E_NO_RESOURCES , EMFILE}, {AFC_E_READ_ERROR , ENOTDIR}, {AFC_E_WRITE_ERROR , EIO}, {AFC_E_UNKNOWN_PACKET_TYPE , EIO}, {AFC_E_INVALID_ARG , EINVAL}, {AFC_E_OBJECT_NOT_FOUND , ENOENT}, {AFC_E_OBJECT_IS_DIR , EISDIR}, {AFC_E_DIR_NOT_EMPTY , ENOTEMPTY}, {AFC_E_PERM_DENIED , EPERM}, {AFC_E_SERVICE_NOT_CONNECTED , ENXIO}, {AFC_E_OP_TIMEOUT , ETIMEDOUT}, {AFC_E_TOO_MUCH_DATA , EFBIG}, {AFC_E_END_OF_DATA , ENODATA}, {AFC_E_OP_NOT_SUPPORTED , ENOSYS}, {AFC_E_OBJECT_EXISTS , EEXIST}, {AFC_E_OBJECT_BUSY , EBUSY}, {AFC_E_NO_SPACE_LEFT , ENOSPC}, {AFC_E_OP_WOULD_BLOCK , EWOULDBLOCK}, {AFC_E_IO_ERROR , EIO}, {AFC_E_OP_INTERRUPTED , EINTR}, {AFC_E_OP_IN_PROGRESS , EALREADY}, {AFC_E_INTERNAL_ERROR , EIO}, {-1} }; /** * Tries to convert the AFC error value into a meaningful errno value. * * @param client AFC client to retrieve status value from. * * @return errno value. */ static int get_afc_error_as_errno(afc_error_t error) { int i = 0; int res = -1; while (afc_error_to_errno_map[i++].from != -1) { if (afc_error_to_errno_map[i].from == error) { res = afc_error_to_errno_map[i++].to; break; } } if (res == -1) { fprintf(stderr, "Unknown AFC status %d.\n", error); res = EIO; } return res; } static int get_afc_file_mode(afc_file_mode_t *afc_mode, int flags) { switch (flags & O_ACCMODE) { case O_RDONLY: *afc_mode = AFC_FOPEN_RDONLY; break; case O_WRONLY: if ((flags & O_TRUNC) == O_TRUNC) { *afc_mode = AFC_FOPEN_WRONLY; } else if ((flags & O_APPEND) == O_APPEND) { *afc_mode = AFC_FOPEN_APPEND; } else { *afc_mode = AFC_FOPEN_RW; } break; case O_RDWR: if ((flags & O_TRUNC) == O_TRUNC) { *afc_mode = AFC_FOPEN_WR; } else if ((flags & O_APPEND) == O_APPEND) { *afc_mode = AFC_FOPEN_RDAPPEND; } else { *afc_mode = AFC_FOPEN_RW; } break; default: *afc_mode = 0; return -1; } return 0; } static int ifuse_getattr(const char *path, struct stat *stbuf, struct fuse_file_info *fi) { int res = 0; plist_t info = NULL; afc_client_t afc = fuse_get_context()->private_data; afc_error_t ret = afc_get_file_info_plist(afc, path, &info); memset(stbuf, 0, sizeof(struct stat)); if (ret != AFC_E_SUCCESS) { int e = get_afc_error_as_errno(ret); return -e; } else if (!info) { return -1; } stbuf->st_size = plist_dict_get_uint(info, "st_size"); stbuf->st_blocks = plist_dict_get_uint(info, "st_blocks"); const char* s_ifmt = plist_get_string_ptr(plist_dict_get_item(info, "st_ifmt"), NULL); if (s_ifmt) { if (!strcmp(s_ifmt, "S_IFREG")) { stbuf->st_mode = S_IFREG; } else if (!strcmp(s_ifmt, "S_IFDIR")) { stbuf->st_mode = S_IFDIR; } else if (!strcmp(s_ifmt, "S_IFLNK")) { stbuf->st_mode = S_IFLNK; } else if (!strcmp(s_ifmt, "S_IFBLK")) { stbuf->st_mode = S_IFBLK; } else if (!strcmp(s_ifmt, "S_IFCHR")) { stbuf->st_mode = S_IFCHR; } else if (!strcmp(s_ifmt, "S_IFIFO")) { stbuf->st_mode = S_IFIFO; } else if (!strcmp(s_ifmt, "S_IFSOCK")) { stbuf->st_mode = S_IFSOCK; } } stbuf->st_nlink = plist_dict_get_uint(info, "st_nlink"); stbuf->st_mtime = (time_t)(plist_dict_get_uint(info, "st_mtime") / 1000000000); #ifdef _DARWIN_FEATURE_64_BIT_INODE /* available on iOS 7+ */ stbuf->st_birthtime = (time_t)(plist_dict_get_uint(info, "st_birthtime") / 1000000000); #endif plist_free(info); // set permission bits according to the file type if (S_ISDIR(stbuf->st_mode)) { stbuf->st_mode |= 0755; } else if (S_ISLNK(stbuf->st_mode)) { stbuf->st_mode |= 0777; } else { stbuf->st_mode |= 0644; } // and set some additional info stbuf->st_uid = getuid(); stbuf->st_gid = getgid(); stbuf->st_blksize = g_blocksize; return res; } static int ifuse_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi, enum fuse_readdir_flags flags) { int i; char **dirs = NULL; afc_client_t afc = fuse_get_context()->private_data; afc_read_directory(afc, path, &dirs); if (!dirs) return -ENOENT; for (i = 0; dirs[i]; i++) { filler(buf, dirs[i], NULL, 0, 0); } free_dictionary(dirs); return 0; } static int ifuse_open(const char *path, struct fuse_file_info *fi) { afc_client_t afc = fuse_get_context()->private_data; afc_error_t err; afc_file_mode_t mode = 0; err = get_afc_file_mode(&mode, fi->flags); if (err != AFC_E_SUCCESS || (mode == 0)) { return -EPERM; } err = afc_file_open(afc, path, mode, &fi->fh); if (err != AFC_E_SUCCESS) { int res = get_afc_error_as_errno(err); return -res; } return 0; } static int ifuse_create(const char *path, mode_t mode, struct fuse_file_info *fi) { return ifuse_open(path, fi); } static int ifuse_read(const char *path, char *buf, size_t size, off_t offset, struct fuse_file_info *fi) { uint32_t bytes = 0; afc_client_t afc = fuse_get_context()->private_data; if (size == 0) return 0; afc_error_t err = afc_file_seek(afc, fi->fh, offset, SEEK_SET); if (err != AFC_E_SUCCESS) { int res = get_afc_error_as_errno(err); return -res; } err = afc_file_read(afc, fi->fh, buf, size, &bytes); if (err != AFC_E_SUCCESS) { int res = get_afc_error_as_errno(err); return -res; } return bytes; } static int ifuse_write(const char *path, const char *buf, size_t size, off_t offset, struct fuse_file_info *fi) { uint32_t bytes = 0; afc_client_t afc = fuse_get_context()->private_data; if (size == 0) return 0; afc_error_t err = afc_file_seek(afc, fi->fh, offset, SEEK_SET); if (err != AFC_E_SUCCESS) { int res = get_afc_error_as_errno(err); return -res; } err = afc_file_write(afc, fi->fh, buf, size, &bytes); if (err != AFC_E_SUCCESS) { int res = get_afc_error_as_errno(err); return -res; } return bytes; } static int ifuse_utimens(const char *path, const struct timespec tv[2], struct fuse_file_info *fi) { afc_client_t afc = fuse_get_context()->private_data; uint64_t mtime = (uint64_t)tv[1].tv_sec * (uint64_t)1000000000 + (uint64_t)tv[1].tv_nsec; afc_error_t err = afc_set_file_time(afc, path, mtime); if (err == AFC_E_UNKNOWN_PACKET_TYPE) { /* ignore error for pre-3.1 devices as they do not support setting file modification times */ return 0; } if (err != AFC_E_SUCCESS) { int res = get_afc_error_as_errno(err); return -res; } return 0; } static int ifuse_fsync(const char *path, int datasync, struct fuse_file_info *fi) { return 0; } static int ifuse_release(const char *path, struct fuse_file_info *fi) { afc_client_t afc = fuse_get_context()->private_data; afc_file_close(afc, fi->fh); return 0; } void *ifuse_init(struct fuse_conn_info *conn, struct fuse_config *cfg) { afc_client_t afc = NULL; conn->want &= ~FUSE_CAP_ASYNC_READ; if (house_arrest) { afc_client_new_from_house_arrest_client(house_arrest, &afc); } else { afc_client_new(device, opts.service, &afc); } lockdownd_client_free(control); control = NULL; if (afc) { // get file system block size plist_t info = NULL; if ((AFC_E_SUCCESS == afc_get_device_info_plist(afc, &info)) && info) { g_blocksize = plist_dict_get_uint(info, "FSBlockSize"); } } return afc; } void ifuse_cleanup(void *data) { afc_client_t afc = (afc_client_t) data; afc_client_free(afc); if (control) { lockdownd_client_free(control); } idevice_free(device); } int ifuse_flush(const char *path, struct fuse_file_info *fi) { return 0; } int ifuse_chmod(const char *path, mode_t mode, struct fuse_file_info *fi) { return 0; } int ifuse_chown(const char *file, uid_t user, gid_t group, struct fuse_file_info *fi) { return 0; } int ifuse_statfs(const char *path, struct statvfs *stats) { afc_client_t afc = fuse_get_context()->private_data; char **info_raw = NULL; uint64_t totalspace = 0, freespace = 0; int i = 0, blocksize = 0; afc_error_t err = afc_get_device_info(afc, &info_raw); if (err != AFC_E_SUCCESS) { int res = get_afc_error_as_errno(err); return -res; } if (!info_raw) return -ENOENT; for (i = 0; info_raw[i]; i++) { if (!strcmp(info_raw[i], "FSTotalBytes")) { totalspace = strtoull(info_raw[i + 1], (char **) NULL, 10); } else if (!strcmp(info_raw[i], "FSFreeBytes")) { freespace = strtoull(info_raw[i + 1], (char **) NULL, 10); } else if (!strcmp(info_raw[i], "FSBlockSize")) { blocksize = atoi(info_raw[i + 1]); } } free_dictionary(info_raw); stats->f_bsize = stats->f_frsize = blocksize; stats->f_blocks = totalspace / blocksize; stats->f_bfree = stats->f_bavail = freespace / blocksize; stats->f_namemax = 255; stats->f_files = stats->f_ffree = 1000000000; return 0; } int ifuse_truncate(const char *path, off_t size, struct fuse_file_info *fi) { afc_client_t afc = fuse_get_context()->private_data; afc_error_t err = afc_truncate(afc, path, size); if (err != AFC_E_SUCCESS) { int res = get_afc_error_as_errno(err); return -res; } return 0; } int ifuse_readlink(const char *path, char *linktarget, size_t buflen) { int i, ret; char **info = NULL; if (!path || !linktarget || (buflen == 0)) { return -EINVAL; } linktarget[0] = '\0'; // in case the link target cannot be determined afc_client_t afc = fuse_get_context()->private_data; afc_error_t err = afc_get_file_info(afc, path, &info); if ((err == AFC_E_SUCCESS) && info) { ret = -1; for (i = 0; info[i]; i+=2) { if (!strcmp(info[i], "LinkTarget")) { strncpy(linktarget, info[i+1], buflen-1); linktarget[buflen-1] = '\0'; ret = 0; } } free_dictionary(info); } else { ret = get_afc_error_as_errno(err); return -ret; } return ret; } int ifuse_symlink(const char *target, const char *linkname) { afc_client_t afc = fuse_get_context()->private_data; afc_error_t err = afc_make_link(afc, AFC_SYMLINK, target, linkname); if (err == AFC_E_SUCCESS) return 0; return -get_afc_error_as_errno(err); } int ifuse_link(const char *target, const char *linkname) { afc_client_t afc = fuse_get_context()->private_data; afc_error_t err = afc_make_link(afc, AFC_HARDLINK, target, linkname); if (err == AFC_E_SUCCESS) return 0; return -get_afc_error_as_errno(err); } int ifuse_unlink(const char *path) { afc_client_t afc = fuse_get_context()->private_data; afc_error_t err = afc_remove_path(afc, path); if (err == AFC_E_SUCCESS) return 0; return -get_afc_error_as_errno(err); } int ifuse_rename(const char *from, const char *to, unsigned int flags) { afc_client_t afc = fuse_get_context()->private_data; afc_error_t err = afc_rename_path(afc, from, to); if (err == AFC_E_SUCCESS) return 0; return -get_afc_error_as_errno(err); } int ifuse_mkdir(const char *dir, mode_t ignored) { afc_client_t afc = fuse_get_context()->private_data; afc_error_t err = afc_make_directory(afc, dir); if (err == AFC_E_SUCCESS) return 0; return -get_afc_error_as_errno(err); } static struct fuse_operations ifuse_oper = { .getattr = ifuse_getattr, .statfs = ifuse_statfs, .readdir = ifuse_readdir, .mkdir = ifuse_mkdir, .rmdir = ifuse_unlink, .create = ifuse_create, .open = ifuse_open, .read = ifuse_read, .write = ifuse_write, .truncate = ifuse_truncate, .readlink = ifuse_readlink, .symlink = ifuse_symlink, .link = ifuse_link, .unlink = ifuse_unlink, .rename = ifuse_rename, .utimens = ifuse_utimens, .fsync = ifuse_fsync, .chmod = ifuse_chmod, .chown = ifuse_chown, .release = ifuse_release, .init = ifuse_init, .destroy = ifuse_cleanup }; static void print_usage() { fprintf(stderr, "Usage: " PACKAGE_NAME " MOUNTPOINT [OPTIONS]\n"); fprintf(stderr, "\n"); fprintf(stderr, "Mount directories of an iOS device locally using fuse.\n"); fprintf(stderr, "\n"); fprintf(stderr, "OPTIONS:\n"); fprintf(stderr, " -o opt,[opt...]\tmount options\n"); fprintf(stderr, " -u, --udid UDID\tmount specific device by UDID\n"); fprintf(stderr, " -n, --network\t\tconnect to network device\n"); fprintf(stderr, " -h, --help\t\tprint usage information\n"); fprintf(stderr, " -V, --version\t\tprint version\n"); fprintf(stderr, " -d, --debug\t\tenable libimobiledevice communication debugging\n"); fprintf(stderr, " --documents APPID\tmount 'Documents' folder of app identified by APPID\n"); fprintf(stderr, " --container APPID\tmount sandbox root of an app identified by APPID\n"); fprintf(stderr, " --list-apps\t\tlist installed apps that have file sharing enabled\n"); fprintf(stderr, " --root\t\tmount root file system (jailbroken device required)\n"); fprintf(stderr, "\n"); fprintf(stderr, "Example:\n"); fprintf(stderr, "\n"); fprintf(stderr, " $ ifuse /media/iPhone --root\n\n"); fprintf(stderr, " This mounts the root filesystem of the first attached device on\n"); fprintf(stderr, " this computer in the directory /media/iPhone.\n"); fprintf(stderr, "\n"); fprintf(stderr, "Homepage: <" PACKAGE_URL ">\n"); fprintf(stderr, "Bug Reports: <" PACKAGE_BUGREPORT ">\n"); } static int ifuse_opt_proc(void *data, const char *arg, int key, struct fuse_args *outargs) { static int option_num = 0; int res = 1; switch (key) { case KEY_UDID_LONG: opts.device_udid = strdup(arg+6); res = 0; break; case KEY_UDID: opts.device_udid = strdup(arg+2); res = 0; break; case KEY_NETWORK: case KEY_NETWORK_LONG: opts.use_network = 1; res = 0; break; case KEY_VENDOR_CONTAINER_LONG: opts.use_container = 1; opts.appid = strdup(arg+11); opts.service_name = HOUSE_ARREST_SERVICE_NAME; res = 0; break; case KEY_VENDOR_DOCUMENTS_LONG: opts.appid = strdup(arg+11); opts.service_name = HOUSE_ARREST_SERVICE_NAME; res = 0; break; case KEY_DEBUG: case KEY_DEBUG_LONG: idevice_set_debug_level(1); res = 0; break; case KEY_ROOT: opts.service_name = AFC2_SERVICE_NAME; res = 0; break; case KEY_HELP: print_usage(); exit(EXIT_SUCCESS); case KEY_VERSION: fprintf(stderr, "%s %s\n", PACKAGE_NAME, PACKAGE_VERSION); exit(EXIT_SUCCESS); case KEY_LIST_APPS_LONG: opts.should_list_apps = 1; break; case FUSE_OPT_KEY_OPT: /* ignore other options and pass them to fuse_main later */ break; case FUSE_OPT_KEY_NONOPT: if(option_num == 0) { opts.mount_point = strdup(arg); } if(option_num == 1) { /* compatibility to older style which passed a device file option first */ free(opts.mount_point); opts.mount_point = strdup(arg); } option_num++; break; } return res; } static void list_available_apps(idevice_t dev) { instproxy_client_t ip = NULL; if (instproxy_client_start_service(dev, &ip, "ifuse") != INSTPROXY_E_SUCCESS) { fprintf(stderr, "ERROR: Couldn't connect to installation proxy on device\n"); goto leave_cleanup; } plist_t client_opts = instproxy_client_options_new(); instproxy_client_options_add(client_opts, "ApplicationType", "Any", NULL); instproxy_client_options_set_return_attributes(client_opts, "CFBundleIdentifier", "CFBundleDisplayName", "CFBundleVersion", "UIFileSharingEnabled", NULL ); plist_t apps = NULL; instproxy_browse(ip, client_opts, &apps); if (!apps || (plist_get_node_type(apps) != PLIST_ARRAY)) { fprintf(stderr, "ERROR: instproxy_browse returned an invalid plist?!\n"); goto leave_cleanup; } /* output colum titles */ printf("\"%s\",\"%s\",\"%s\"\n", "CFBundleIdentifier", "CFBundleVersion", "CFBundleDisplayName"); /* output rows with app information */ uint32_t i = 0; for (i = 0; i < plist_array_get_size(apps); i++) { plist_t node = plist_array_get_item(apps, i); if (node && plist_get_node_type(node) == PLIST_DICT) { uint8_t sharing_enabled = 0; plist_t val = plist_dict_get_item(node, "UIFileSharingEnabled"); if (val && plist_get_node_type(val) == PLIST_BOOLEAN) { plist_get_bool_val(val, &sharing_enabled); } if (sharing_enabled) { char *bid = NULL; char *ver = NULL; char *name = NULL; val = plist_dict_get_item(node, "CFBundleIdentifier"); if (val) { plist_get_string_val(val, &bid); } val = plist_dict_get_item(node, "CFBundleVersion"); if (val) { plist_get_string_val(val, &ver); } val = plist_dict_get_item(node, "CFBundleDisplayName"); if (val) { plist_get_string_val(val, &name); } printf("\"%s\",\"%s\",\"%s\"\n", bid, ver, name); free(bid); free(ver); free(name); } } } plist_free(apps); leave_cleanup: instproxy_client_free(ip); idevice_free(dev); } int main(int argc, char *argv[]) { int res = EXIT_FAILURE; struct fuse_args args = FUSE_ARGS_INIT(argc, argv); struct stat mst; idevice_error_t err = IDEVICE_E_UNKNOWN_ERROR; lockdownd_error_t ret = LOCKDOWN_E_UNKNOWN_ERROR; enum idevice_options lookup_opts = IDEVICE_LOOKUP_USBMUX | IDEVICE_LOOKUP_NETWORK; memset(&opts, 0, sizeof(opts)); opts.service_name = AFC_SERVICE_NAME; if (fuse_opt_parse(&args, NULL, ifuse_opts, ifuse_opt_proc) == -1) { return EXIT_FAILURE; } if (opts.device_udid && !*opts.device_udid) { fprintf(stderr, "ERROR: UDID must not be empty\n"); return EXIT_FAILURE; } if (!opts.should_list_apps) { if (!opts.mount_point) { fprintf(stderr, "ERROR: No mount point specified\n"); return EXIT_FAILURE; } if (stat(opts.mount_point, &mst) < 0) { if (errno == ENOENT) { fprintf(stderr, "ERROR: the mount point specified does not exist\n"); return EXIT_FAILURE; } fprintf(stderr, "There was an error accessing the mount point: %s\n", strerror(errno)); return EXIT_FAILURE; } } err = idevice_new_with_options(&device, opts.device_udid, (opts.use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX); if (err != IDEVICE_E_SUCCESS) { if (opts.device_udid) { printf("ERROR: Device %s not found!\n", opts.device_udid); } else { printf("ERROR: No device found!\n"); } fprintf(stderr, "Ensure that the device is connected and usbmuxd is properly installed.\n"); return EXIT_FAILURE; } if (!device) { return EXIT_FAILURE; } if (opts.should_list_apps) { list_available_apps(device); return EXIT_SUCCESS; } ret = lockdownd_client_new_with_handshake(device, &control, "ifuse"); if (ret != LOCKDOWN_E_SUCCESS) { idevice_free(device); if (ret == LOCKDOWN_E_PASSWORD_PROTECTED) { fprintf(stderr, "Please disable the password protection on your device and try again.\n"); fprintf(stderr, "The device does not allow pairing as long as a password has been set.\n"); fprintf(stderr, "You can enable it again after the connection succeeded.\n"); #ifdef LOCKDOWN_E_PAIRING_DIALOG_PENDING } else if (ret == LOCKDOWN_E_PAIRING_DIALOG_PENDING) { fprintf(stderr, "Please dismiss the trust dialog on your device and try again.\n"); fprintf(stderr, "The device does not allow pairing as long as the dialog has not been accepted.\n"); #endif } else { fprintf(stderr, "Failed to connect to lockdownd service on the device.\n"); fprintf(stderr, "Try again. If it still fails try rebooting your device.\n"); } return EXIT_FAILURE; } if ((lockdownd_start_service(control, opts.service_name, &opts.service) != LOCKDOWN_E_SUCCESS) || !opts.service) { lockdownd_client_free(control); idevice_free(device); fprintf(stderr, "Failed to start AFC service '%s' on the device.\n", opts.service_name); if (!strcmp(opts.service_name, AFC2_SERVICE_NAME)) { fprintf(stderr, "This service enables access to the root filesystem of your device.\n"); fprintf(stderr, "Your device needs to be jailbroken and have the AFC2 service installed.\n"); } return EXIT_FAILURE; } if (!strcmp(opts.service_name, HOUSE_ARREST_SERVICE_NAME)) { house_arrest_client_new(device, opts.service, &house_arrest); if (!house_arrest) { fprintf(stderr, "Could not start document sharing service!\n"); return EXIT_FAILURE; } /* FIXME: iOS 3.x house_arrest does not know about VendDocuments yet, thus use VendContainer and chroot manually with fuse subdir module */ if (house_arrest_send_command(house_arrest, opts.use_container ? "VendContainer": "VendDocuments", opts.appid) != HOUSE_ARREST_E_SUCCESS) { fprintf(stderr, "Could not send house_arrest command!\n"); goto leave_err; } plist_t dict = NULL; if (house_arrest_get_result(house_arrest, &dict) != HOUSE_ARREST_E_SUCCESS) { fprintf(stderr, "Could not get result from document sharing service!\n"); goto leave_err; } plist_t node = plist_dict_get_item(dict, "Error"); if (node) { char *str = NULL; plist_get_string_val(node, &str); fprintf(stderr, "ERROR: %s\n", str); if (str && !strcmp(str, "InstallationLookupFailed")) { fprintf(stderr, "The App '%s' is either not present on the device, or the 'UIFileSharingEnabled' key is not set in its Info.plist. Starting with iOS 8.3 this key is mandatory to allow access to an app's Documents folder.\n", opts.appid); } free(str); goto leave_err; } plist_free(dict); if (opts.use_container == 0) { fuse_opt_add_arg(&args, "-omodules=subdir"); fuse_opt_add_arg(&args, "-osubdir=Documents"); } } res = fuse_main(args.argc, args.argv, &ifuse_oper, NULL); leave_err: if (house_arrest) { house_arrest_client_free(house_arrest); } return res; }