Skip to content

Instantly share code, notes, and snippets.

View omarzl's full-sized avatar

Omar Zúñiga omarzl

View GitHub Profile
@omarzl
omarzl / slack_debugging.sh
Created July 1, 2024 17:48
slack_debugging.sh
# 1.- Download an unsigned IPA. I got it from https://decrypt.day
# 2.- Create and download a provisioning profile in App Store Connect
# 3.- Replace the bundle identifier in the Info.plist
plutil -replace CFBundleIdentifier -string TEAMID.com.debugging.slack Slack.app/Info.plist
# 4.- Get the entitlements from the original binary and save them to /path/to/entitlement.xml
codesign -d --entitlements :/some/path/entitlement.xml Slack.app/Slack
# 5.- Get the xml representation from the provisioning profile
security cms -D -i "/path/to/provisioning_profile.mobileprovision" > /path/to/provisioning_profile.xml
# Note: It is important that it has the entitlement "get-task-allow" so the debugger can attach to the app
@omarzl
omarzl / sign_here_example.sh
Created June 5, 2024 17:35
sign_here_example.sh
#!/bin/zsh
# Installs bazelisk in case it isn't installed
if ! command -v bazelisk &> /dev/null; then
HOMEBREW_NO_AUTO_UPDATE=true brew install bazelisk
fi
# If you already have a registered certificate in the App Store Connect, you can
# export the private key from the Keychain (without a password). It will be saved
# in p12 format, you need to convert it to pem:
# `openssl pkcs12 -in key.p12 -out key.pem -nocerts -nodes`
# Then write the path to the key.pem in this variable
@omarzl
omarzl / mergeable_libraries.sh
Last active May 30, 2024 18:48
Mergeable libraries
# Section 1
# Create a class
echo "class MyClass {}" > file.swift
# Compile a static library
swiftc file.swift -static -emit-library -o libStaticExample.a
# Compile a dynamic library
swiftc file.swift -emit-library -o libDynamicExample.dylib
# Compile a mergeable library
swiftc file.swift -emit-library -Xlinker -make_mergeable -o libMergeableExample.dylib
@omarzl
omarzl / modifying_settings_app_with_lldb
Last active May 23, 2024 02:58
Modifying Settings app with LLDB
# Launch the simulator
open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app
# Get the identifier of the running simulator
sim_id=$(xcrun simctl list | grep Booted | cut -d ' ' -f7 | sed -e 's/(//' -e 's/)//')
# Launch the Preferences app
xcrun simctl launch $sim_id com.apple.Preferences
# Attach LLDB to the process
- Pluginfile
gem 'xcode-install'
- Fastfile
platform :ios do
desc "Xcode install"
lane :install_xcode do
xcode_install(
# List all available installers
softwareupdate --list-full-installers
# In this case we are installing macOS Monterey 12.1
softwareupdate --fetch-full-installer --full-installer-version 12.1
installer_directory="/Applications/Install macOS Monterey.app"
# A + ↵ to accept the agreement
printf 'A\n' | sudo $installer_directory/Contents/Resources/startosinstall
# Validating that it was installed correctly
sw_vers
# Simulator creation
sim_name="PR-23175-rappi"
create_output=$(xcrun simctl create $sim_name com.apple.CoreSimulator.SimDeviceType.iPhone-8-Plus)
echo $create_output
simulator_id=$(echo $create_output | tail -1)
# Simulator validation
xcrun simctl list devices $simulator_id
# Xcode test
xcodebuild test -destination "platform=iOS Simulator,id=$simulator_id" ...
# Simulator deletion
# Worldwide Developer Relations Certificate - G3 (Expiring 02/20/2030 00:00:00 UTC)
apple_cert_name=AppleWWDRCAG3.cer
# Cert url taken from: https://www.apple.com/certificateauthority
wget https://www.apple.com/certificateauthority/$apple_cert_name
# Cert installation to system keychain
echo $LOGIN_PASSWORD | sudo -S security import $apple_cert_name -k $SYSTEM_KEYCHAIN -A
RAPPI_KEYCHAIN=$HOME/Library/Keychains/rappi.keychain-db
# Keychain creation
security -v create-keychain -p $KEYCHAIN_PWD $RAPPI_KEYCHAIN
# Sets the new keychain as the default one
security -v default-keychain -s $RAPPI_KEYCHAIN
# Allows Apple tools and codesign command to use the keychain
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PWD $RAPPI_KEYCHAIN
# Unlocks the keychain
security -v unlock-keychain -p $KEYCHAIN_PWD $RAPPI_KEYCHAIN
# Private key import
security import $PRIVATE_KEY_FILE -k $RAPPI_KEYCHAIN -f pkcs12 -P $KEYCHAIN_PWD -A
# Private key to pem
openssl pkcs12 -in $PRIVATE_KEY_FILE -out $PRIVATE_KEY_FILE.pem -nocerts -nodes -passin pass:$PRIVATE_KEY_PWD
# Key modulus
key_modulus=$(openssl rsa -noout -modulus -in $PRIVATE_KEY_FILE.pem | openssl md5)
for cert in $certs_dir/*; do
# Cert verification
security verify-cert -c $cert