ustwo / mastermind

Man in the middle testing
MIT License
385 stars 66 forks source link

Create automated process for installing certs into iOS Simulators #20

Open concertman opened 8 years ago

concertman commented 8 years ago

Charles proxy has an automated way of doing this that works pretty well. I'm not sure how they do it but it would be nice to have for mastermind.

arnau commented 8 years ago

Could you show me how it works?

Ashraf-Ali-aa commented 8 years ago

@arnau this is the bash script Charles proxy uses, it would nice if mastermind also supported it.

#/bin/bash
#
# Installs the Charles Root certificate into the iOS Simulators for the current user.

SHA1=$1
SUBJ=$2
TSET=$3
DATA=$4

install() {
if [ -f "$SQLITEDBPATH" ]; then
cp -n "$SQLITEDBPATH" "$SQLITEDBPATH.charlesbackup"
sqlite3 "$SQLITEDBPATH" <<EOF
INSERT INTO "tsettings" VALUES(X'$SHA1',X'$SUBJ',X'$TSET',X'$DATA');
EOF
fi
}

for SQLITEDBPATH in ~/Library/Application\ Support/iPhone\ Simulator/3.*/Library/Keychains/TrustStore.sqlite3
do install
done

for SQLITEDBPATH in ~/Library/Application\ Support/iPhone\ Simulator/4.*/Library/Keychains/TrustStore.sqlite3
do install
done

for SQLITEDBPATH in ~/Library/Developer/CoreSimulator/Devices/*/data/Library/Keychains/TrustStore.sqlite3
do install
done

SQLITEDBPATH=~/Library/Application\ Support/iPhone\ Simulator/User/Library/Keychains/TrustStore.sqlite3
install

echo "The Charles Root Certificate has been installed for the iPhone Simulator"
concertman commented 8 years ago

@Ashraf-Ali-aa Awesome! Thanks for sharing this!

arnau commented 8 years ago

@Ashraf-Ali-aa I'll plan it for the next release, thanks for sharing!

concertman commented 8 years ago

I think the next question for this would be the interface. What would be command used to install. I'm guessing a subcommand of mastermind might make since. sudo mastermind install-certs-ios-sim though that seems a bit wordy.

arnau commented 8 years ago

well yes, something like that. Given it is a one-time command it shouldn't be an issue that involves a bit of typing. Maybe something like:

mastermind install-certs --ios
concertman commented 8 years ago

How about:

mastermind install-certs --ios-sim

because you don't want to imply you're installing on the device.

arnau commented 8 years ago

Ah, sure

pr4bh4sh commented 7 years ago

@arnau Any updates on this feature?

arnau commented 7 years ago

@pr4bh4sh hi, sadly no. I can't work on this project right now.