Skip to content

Commit

Permalink
Add xpwn
Browse files Browse the repository at this point in the history
This commit adds xpwn, a tool used by iExtractor-manager.
The commit also solves this issue [1].
[1] planetbeing/xpwn#13

Signed-off-by: David Bors <daviddvd267@gmail.com>
  • Loading branch information
davidxbors authored and razvand committed Mar 5, 2023
1 parent 66ee317 commit 46019bb
Show file tree
Hide file tree
Showing 767 changed files with 368,932 additions and 0 deletions.
92 changes: 92 additions & 0 deletions xpwn/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
INSTRUCTIONS FOR BUILDING XPWN
------------------------------

These are very basic instructions on how to build xpwn related projects, they
are tailored to Debian based systems. They are not meant to be a substitute
for experience in programming in GNU/Linux environments, but it should be a
good starting point.

1. Install a basic build environment (compilers, etc.):

sudo apt-get install build-essential

2. Install some prerequisites libraries required by xpwn:

sudo apt-get install libcrypt-dev libz-dev libbz2-dev3 libusb-dev

3. Install cmake. It is recommended you download and build it from the
official cmake website, since versions >= 2.6.0 are recommended.

wget http://www.cmake.org/files/v2.6/cmake-2.6.2.tar.gz
tar zxvf cmake-2.6.2.tar.gz
cd cmake-2.6.2
./configure
make
sudo make install

Now you are ready to build xpwn. It is highly recommended that you build
out-of-source (that is, the build products are not placed into the same
folders as the sources). This is much neater and cleaning up is as simple as
deleting the build products folder.

Assuming xpwn sources are in ~/xpwn:

4. Create a build folder

cd ~
mkdir build
cd build

5. Create Makefiles

cmake ~/xpwn

6. Build

make

7. Package

make package

BUILDING USEFUL LIBRARIES
-------------------------

These command-lines can be substituted in for step 6. The products are in the
subfolders (make package will not include them).

xpwn library (for IPSW generation)

make libXPwn.a

Windows pwnmetheus library (for QuickPwn)

make libpwnmetheus.dll

HELPFUL MAKEFILE GENERATION COMMAND-LINES
-----------------------------------------

These command-lines can be substituted in for step 5.

Add debugging symbols:

cmake ~/xpwn -DCMAKE_C_FLAGS=-g

Try to only use static libraries:

cmake ~/xpwn -DBUILD_STATIC=YES


CROSS-COMPILING
---------------

This is a complex and advanced topic, but it is possible with the appropriate
CMake toolchain files and properly configured build environment. I have
crossbuilt Windows, OS X, Linux x86, Linux x64, and iPhone binaries from one
Ubuntu machine. The source trees are properly configured for this task.

MORE HELP
---------

Consult the CMake documentation and wiki and look in the CMakeLists.txt files
for hints on how things are supposed to work.
53 changes: 53 additions & 0 deletions xpwn/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
cmake_minimum_required(VERSION 2.6)

project (XPwn)

# We want win32 executables to build staticly by default, since it's more difficult to keep the shared libraries straight on Windows
IF(WIN32)
SET(BUILD_STATIC ON CACHE BOOL "Force compilation with static libraries")
ELSE(WIN32)
SET(BUILD_STATIC OFF CACHE BOOL "Force compilation with static libraries")
ENDIF(WIN32)

IF(BUILD_STATIC)
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
ENDIF(BUILD_STATIC)

include_directories (${PROJECT_SOURCE_DIR}/includes)

add_subdirectory (common)
add_subdirectory (minizip)
add_subdirectory (dmg)
add_subdirectory (hdutil)
add_subdirectory (hfs)
add_subdirectory (ipsw-patch)
add_subdirectory (dfu-util)
add_subdirectory (xpwn)
add_subdirectory (idevice)
add_subdirectory (pwnmetheus2)
add_subdirectory (dripwn)

install(FILES README.markdown DESTINATION . RENAME README.txt)
install(FILES LICENSE DESTINATION . RENAME LICENSE.txt)

IF(WIN32 OR APPLE)
SET(CPACK_GENERATOR "ZIP")
ELSE(WIN32 OR APPLE)
SET(CPACK_GENERATOR "TBZ2")
ENDIF(WIN32 OR APPLE)

SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "XPwn")
SET(CPACK_PACKAGE_VENDOR "iPhone Dev Team")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/README.markdown")
SET(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/README.markdown")
SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
SET(CPACK_PACKAGE_VERSION_MAJOR "0")
SET(CPACK_PACKAGE_VERSION_MINOR "5")
SET(CPACK_PACKAGE_VERSION_PATCH "8")
SET(CPACK_PACKAGE_EXECUTABLES "xpwn" "XPwn Pwner")
SET(CPACK_PACKAGE_EXECUTABLES "ipsw" "IPSW Tool")
SET(CPACK_PACKAGE_EXECUTABLES "hdutil" "Apple disk image utility")
SET(CPACK_PACKAGE_EXECUTABLES "dmg" "Apple DMG utility")
SET(CPACK_PACKAGE_EXECUTABLES "hfsplus" "Apple HFS+ utility")
INCLUDE(CPack)

67 changes: 67 additions & 0 deletions xpwn/FindUSB.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# - Try to find USB
# Once done this will define
#
# USB_FOUND - system has USB
# USB_INCLUDE_DIRS - the USB include directory
# USB_LIBRARIES - Link these to use USB
# USB_DEFINITIONS - Compiler switches required for using USB
#
# Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#


if (USB_LIBRARIES AND USB_INCLUDE_DIRS)
# in cache already
set(USB_FOUND TRUE)
else (USB_LIBRARIES AND USB_INCLUDE_DIRS)
find_path(USB_INCLUDE_DIR
NAMES
usb.h
PATHS
/usr/include
/usr/local/include
/opt/local/include
/sw/include
)

find_library(USB_LIBRARY
NAMES
usb
PATHS
/usr/lib
/usr/local/lib
/opt/local/lib
/sw/lib
)

set(USB_INCLUDE_DIRS
${USB_INCLUDE_DIR}
)
set(USB_LIBRARIES
${USB_LIBRARY}
)

if (USB_INCLUDE_DIRS AND USB_LIBRARIES)
set(USB_FOUND TRUE)
endif (USB_INCLUDE_DIRS AND USB_LIBRARIES)

if (USB_FOUND)
if (NOT USB_FIND_QUIETLY)
message(STATUS "Found USB: ${USB_LIBRARIES}")
endif (NOT USB_FIND_QUIETLY)
else (USB_FOUND)
if (USB_FIND_REQUIRED)
message(FATAL_ERROR "Could not find USB")
endif (USB_FIND_REQUIRED)
endif (USB_FOUND)

# show the USB_INCLUDE_DIRS and USB_LIBRARIES variables only in the advanced view
mark_as_advanced(USB_INCLUDE_DIRS USB_LIBRARIES)

endif (USB_LIBRARIES AND USB_INCLUDE_DIRS)


0 comments on commit 46019bb

Please sign in to comment.