hw-1

itunes auth

1
2
3
4
5
6
7
8
9
10
11
itunes auth 

key=GetValue string=FairPlayCertificate --> cert
generate grappaID grappaData
Grappa(grappaData) --> afsync.rq
cert rq --> rsbuffer
rsbuffer GrappaID --> sigBuffer (afsync.rs)

/AirFair/sync/afsync.rq
/AirFair/sync/afsync.rs

libimobiledevice install

1
2
3
4
5
brew update
brew uninstall --ignore-dependencies libimobiledevice
brew uninstall --ignore-dependencies usbmuxd
brew install --HEAD usbmuxd
brew install --HEAD libimobiledevice

libtoolize: command not found

1
2
3
4
5
6
7
8
./autogen.sh: line 6: libtoolize: command not found
./autogen.sh: line 8: aclocal: command not found
./autogen.sh: line 9: autoheader: command not found
./autogen.sh: line 10: automake: command not found
./autogen.sh: line 11: autoconf: command not found

brew install libtool
brew install automake

usbmux debug

usbmux debug

1
2
3
4
5
sudo mv /var/run/usbmuxd /var/run/usbmux_real
sudo socat -t100 -x -v UNIX-LISTEN:/var/run/usbmuxd,mode=777,reuseaddr,fork UNIX-CONNECT:/var/run/usbmux_real

sudo mv /var/run/usbmux_real /var/run/usbmuxd

pyenv

pyenv

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
pyenv

prepare
sudo apt-get install -y git
sudo apt-get install -y build-essential libbz2-dev libssl-dev libreadline-dev \
libffi-dev libsqlite3-dev tk-dev

# optional scientific package headers (for Numpy, Matplotlib, SciPy, etc.)
sudo apt-get install -y libpng-dev libfreetype6-dev

install
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash

env
export PATH="~/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

create env
pyenv install 3.7.0
pyenv virtualenv 3.7.0 general
pyenv activate general


#virtualenv
install
sudo apt-get install python3 python3-pip virtualenvwrapper
pip install --upgrade virtualenv

env
virtualenv -p python3 env
source ./env/bin/activate
deactivate


#pip use tsinghua
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt

swift Localizable strings

swift Localizable strings

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#fastlane 
AppleLocale
FASTLANE_SNAPSHOT

#get current language code
Locale.current.languageCode

#swift
NSLocalizedString("Enter the file pssword", comment: "")
#objc
NSLocalizedString(@"Close", nil)


extension String {
var localized: String {
return NSLocalizedString(self, tableName: nil, bundle: Bundle.main, value: "", comment: "")
}
}

tempfile=$(mktemp -t 1234)
find . \( -name "*.swift" ! -path "./Carthage/*" ! -path "./Pods/*" ! -name String+ext.swift \)| while read var
do
genstrings "$var"
[ -e Localizable.strings ] && cat Localizable.strings >> $tempfile && rm -rf Localizable.strings
done
cp $tempfile Localizable.strings


Use your XCode "Find and Replace" option based on the regular expression. As for the given example (if you have no comments) the regular expression will be:

NSLocalizedString\((.*)\, comment:\ \"(.*)\"\)
and replace it with
$1.localized