Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.
preface
One day when you tweak tweak to 100 iPhone machines you manage, the usual way of making package install, dpkg-i, becomes inefficient. Tweak to batch deploy solutions on devices by setting up a private Cydia source
~/ Cydia -m SimpleHTTPServer 8088
From cydia add corresponding source (http://192.168.2.189:8088/)
I. Cydia source server setup
Assuming our source URL address is 192.168.2.189/cydia, for a local cydia directory, the structure is as follows
Cydia/ --Release repo description file --Packages repO package manifest -- packs.gz Package manifest of the repo -- packs.bz2 Package manifest of the repo -- cydiaicon. PNG --debs/ actual package file --xxxx1.deb --xxxx2.debCopy the code
To build a software source, you must have at least two Release and Packages files, see auxiliary scripts
Download.csdn.net/download/u0…
Core building steps:
- Create a repository for deb packages
- Enable HTTPServer: ~/cydia execution
python -m SimpleHTTPServer 8088
- The corresponding source is added to the cydia in order to download the update deb package (http://192.168.2.189:8088/)
1.1 Use Bzip2 to generate a file format that Cydia can recognize and put into a specific directory as a repository for download
Making scripts to download
Download.csdn.net/download/u0…
PKG -scanpackages: info: Wrote 1 entries to output Packages file. Serving HTTP on 0.0.0.0 port 8088... [06/Feb/2018 18:50:04]"The HEAD/Packages..bz2 HTTP / 1.1"[06/Feb/2018 18:50:04] Code 404, message File Not found 192.168.2.156 - - [06/Feb/2018 18:50:04]"The HEAD/Packages. Gz HTTP / 1.1"[06/Feb/2018 18:50:09] Code 404, message File Not found 192.168.2.156 - - [06/Feb/2018 18:50:09]GET /. / InRelease HTTP / 1.1 ""[06/Feb/2018 18:50:09] Code 404, message File Not found 192.168.2.156 - - [06/Feb/2018 18:50:09]"GET /. / HTTP / 1.1 Release"[06/Feb/2018 18:50:09]"GET /. / Packages..bz2 HTTP / 1.1"200 - - [06/Feb/2018 18:52:20] Code 404, message File Not found 192.168.2.156 - - [06/Feb/2018 18:52:20]"GET /. / CydiaIcon. HTTP / 1.1 PNG"[06/Feb/2018 18:52:24] Code 404, message File not found 192.168.2.156 - - [06/Feb/2018 18:52:24]"GET /. / CydiaIcon. HTTP / 1.1 PNG"404 - - [06/Feb/2018 18:52:25] Code 404, message File Not found 192.168.2.156 - - [06/Feb/2018 18:52:25]GET /. / InRelease HTTP / 1.1 ""404 - - [06/Feb/2018 18:52:25] Code 404, message File Not found 192.168.2.156 - - [06/Feb/2018 18:52:25]"GET /. / HTTP / 1.1 Release"[06/Feb/2018 18:52:25]"GET /. / Packages..bz2 HTTP / 1.1"[06/Feb/2018 18:52:38] Code 404, message File not found 192.168.2.156 - - [06/Feb/2018 18:52:38]"The GET/CydiaIcon. HTTP / 1.1 PNG" 404 -
Copy the code
1.2 open the HTTPServer
python -m SimpleHTTPServer 8088
Tests can be used, this command simply opening a HTTPServer ~ / cydia python SimpleHTTPServer 8088 – m running under the corresponding to the original address: http://192.168.2.189:8088/cydia
1.3 Add your own source address to Cyida
Let’s start by looking at the configuration file that holds the source address in Cyida
iPhone:~ root# cat /var/mobile/Library/Caches/com.saurik.Cydia/sources.listDeb http://apt.saurik.com/ ios 1144.17 / main deb https://build.frida.re/ / deb http://cydia.zodttd.com/repo/cydia/ Stable main deb http://repo666.ultrasn0w.com/ / deb http://192.168.2.185/cydia/ / deb http://192.168.2.69:8088/ /Copy the code
Wl. list can be created in /etc/apt/sources.list.d or added directly to cydia.list
echo -e 'deb http://apt.saurik.com/ ios/1348.22 main \n' > /private/etc/apt/sources.list.d/cydia.list
Copy the code
Method 1: Add built-in sources with one line of command: Use the prints script to modify sources.list to add source addresses.
Let ordinary people do not know how to delete our source/private/etc/apt/sources list. D/wl. List;
Add the built-in source using the preinst script from the initial deb installation, and then deploy a new machine without adding multiple sources.
# Add in preinst script:
function kncydia {
echo "[Add your source address to Cyida]"
# install.exec "echo -e '127.0.0.1 localhost \n192.168.2.107 xx.com' > /etc/hosts"
echo -e 'deb http://192.168.2.69:8088/ /' > /private/etc/apt/sources.list.d/wl.listThe #-e argument is used to use the newline character \n
}
Copy the code
Check whether the modification is successful
/private/etc/apt/sources.list.d root# cat wl.listDeb http://192.168.2.69:8088/ / deb http://192.168.2.185/cydia/ /Copy the code
Mode 2: Manually add the source address in Cydia APP
Manually adding is equivalent to modifying the following files
/private/etc/apt/sources.list.d/cydia.list -> /var/mobile/Library/Caches/com.saurik.Cydia/sources.list
II. Knowledge supplement
2.1 Description of File directory Functions
Let’s review the directory structure of Cydia_repo
Deb source directory cydia is essentially require specific structure - | - debs - *. Deb | - Packages: DPKG -- scanpackages debs/dev/null > Packages; Packages files contained in the source of each packet of information, including the file path, size, dependence, architecture and calibration information | -- Packages..bz2: by compressed Packages files, command line: bzip2 Packages; | -- Packages. Gz | - Release: it is a plain text file, is used to describe the current source of information; This information is in the source list Cydia and Tweak search list | - the GPG: Package Signatures, the from our Release file. This file will be downloaded by the clients first and then is used to verify the validity of the Release file. gpg -abs -o Release.gpg Release Bz2 and debs are required. Other files are optional.Copy the code
- Release
Cydia source configuration file, the client by downloading this file to read Cydia source information;
There is little to change to the Release file, just prepare the deb file and generate Packages with dpkg-scanpackage
- Packages
1) Deb index file, save each DEB control file information, and each DEB file information.
2) This directory is generated by dpkg-scanpackages debs /dev/null > Packages
- Packages.bz2
Compressed from Packages files, command line: bzip2 Packages
- CydiaIcon.png
an icon named “CydiaIcon.png” in your root dir so the user finds your repo at a glance.
2.2 Deb package execution script
- Execute scripts before debian/ Preinst installation
- Run scripts after Debian/Postinst is installed
- Debian/PRERm Scripts are executed before uninstallation
- Run scripts after debian/ POstrm is uninstalled
2.3 Two distribution modes of tweak
- Package into deb format for batch installation on jailbroken devices
- Package the patch as ipA directly using the developer’s own certificate/enterprise certificate so it can be installed without jailbreaking.
- cydia
Developed by Jay Freeman (Saurik) and his company to install and manage third-party software and plug-ins on jailbroken devices. It ports the package manager DPKG on Debian and provides a graphical front end for ordinary users. Cydia also has a Cydia Store, which offers paid third-party apps.
- CydiaSubstrate
IOS7 was also previously called MobileSubstrate, which was also developed by Saurik. Cydia Substrate consists of 3 major components: MobileHooker, MobileLoader and safe mode.
- Electra
Tweak developer CoolStar developed the Electra jailbreak tool based on Async_awake and an open source alternative to CydiaSubstrate: Substitute developed by Comex. Supports all iOS devices from iOS11.0 to iOS 11.1.2
III. Other examples
Remove the built-in source, leaving only apt.saurik.com/
iPhone:~ root# find / -mmin -1
echo -e 'deb http://apt.saurik.com/ ios/1348.22 main \n' > /private/etc/apt/sources.list.d/cydia.list
echo -e 'deb http://apt.saurik.com/ ios/1348.22 main \n' > /var/mobile/Library/Caches/com.saurik.Cydia/sources.list
# deb http://apt.saurik.com/ ios/1348.22 main
echo -e 'deb http://apt.saurik.com/ ios/1348.22 main \n' > /private/var/mobile/Library/Caches/com.saurik.Cydia/sources.list
Copy the code
Clear V_P_N garbage log
echo "" > /private/var/log/ppp.log
Copy the code
IV、 see also
For more, check out # Applets: iOS Reverse, which presents valuable information only for you, focusing on the mobile technology research field.