Vault7: CIA Hacking Tools Revealed
Navigation: » Latest version
iOS Developer Setup Guide
Mount Network Share
In Finder, hit Command-k to bring up the "Connect to Server" dialog box. Enter "smb://fs-01.devlan.net" for the "Server Address". Select the "share" volume and hit "OK". Enter your devlan credentials when prompted for a username and password. Once "share" is open in Finder, bookmark the "MDB" folder since you will need access to it often.
Install Xcode
Install Xcode from smb://fs-01.devlan.net/share/share-udb-net/public/osx/software/Xcode.
IRC
Follow the instructions at Internet Relay Chat (IRC) to set up an IRCInternet Relay Chat client. Join the rooms #mdb and #mdb-ios.
Set Up SSHSecure Shell key pair
Using ssh-keygen, create a private/public key pair:
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (~/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in ~/.ssh/id_rsa.
Your public key has been saved in ~/.ssh/id_rsa.pub.
The key fingerprint is:
...
Set up Stash
On Stash, go to "Manage Account" under the user menu icon on the upper right (it may have a non-image display). On the left, navigate to "SSH Keys," and then click "Add Key." On the command line, type:
$ pbcopy < ~/.ssh/id_rsa.pub
This copies the key into the bin. Paste it into the text field on Stash and click "Add Key."
Configure SSH
Open (or create) ~/.ssh/config and add the following:
host stash
hostname stash.devlan.net
port 7999
user git
SSH will determine your username from the key you created. Test this by checking out a
project from git (try "git clone ssh://stash/dto/dto_logger").
Install Repo
Download Repo from the link and place it in either /usr/local/bin or /usr/bin
If you already have repo installed, check that the REPO_URL points to the following url:
REPO_URL = 'ssh://git@stash.devlan.net:7999/gitrepo/git-repo.git'
It is located at the top of the repo script.
Test Repo checkout
$ mkdir early
$ cd early
$ repo init --no-repo-verify -u ssh://git@stash.devlan.net:7999/ios/early_manifest.git
$ repo sync
Fix Xcode
Run the following commands to disable code signing and entitlements and to enable ad hoc code signing. The script also creates a link to IOKit.
$ git clone ssh://stash/ios/xcode_fixes.git
$ cd xcode_fixes; python fix_xcode.py $(xcrun --sdk iphoneos --show-sdk-version)
In your project
$ cd <your project>
$ python <path to xcode fixes>/fix_build_location -c .
Configure Your Bash Profile
$ touch ~/.bash_profile
export PATH=$PATH:/usr/local/arm-elf/bin:~/bin/
export ZOO_IOS_FILES=/Volumes/share/MDB/iOS/iOSFiles
export ZOO_IPSW_PATH=$ZOO_IOS_FILES
export ZOO_IOS_SDK_VERSION=$(xcrun --sdk iphoneos --show-sdk-version)
export ZOO_OSX_SDK_VERSION=$(xcrun --sdk macosx --show-sdk-version)
export IPSW_PATH=/Volumes/share/MDB/iOS/iOSFiles
export MYIP=<MY_IP>
Either log out and log in again or source .bash_profile as needed.
Optional Cool Stuff
Setup python Devlan simple pip index
Install the DTOData Transfer Object Logger
Check out the DTOData Transfer Object Logger project:
$ git clone ssh://stash/dto/dto_logger
See DTO Logging for detailled instructions on how to use the logger. Copying or making a symbolic link to the logger in ~/bin (assuming you have it set in your path) will allow you to run the logger from any directory.
$ ln -s <FULL_PATH_TO_DTO_LOGGER_PY> ~/bin/
Xcode Docsets
Copy docsets from
cifs://fs-01.devlan.net/share/share-udb-net/public/osx/software/Xcode/docsets , or linked to cifs://fs-01.devlan.net/share/mdb/Software/FreeSoftware/Xcode/docsets
to
copy these to ~/Library/Developer/Shared/Documentation/DocSets
To download them, you must download the *.dmg from https://developer.apple.com/library/downloads/docset-index.dvtdownloadableindex, unpackage the .pkg using:
- xar -xf to unxar it
- gunzip -dc | cpio -i on the "Payload" file
Create Stash Pull Requests From the Command Line (atlassian-stash)
To install Atlassian Stash Command Line Tool:
- Download gems from /Volumes/share/MDB/OSX/Software/FreeSoftware/gems
- sudo gem install everything except for atlassian-stash-0.1.9.gem, json-1.8.1.gem
- sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install json-1.8.1.gem
- sudo gem install atlassian-stash-0.1.9.gem
Now that the gem is installed, run the stash configure command. This will prompt for details about your Stash instance.
Creating a pull request
Use the pull-request command to create a pull request in Stash. E.g:
1 2 |
$ stash pull-request myBranch master @User #77794 Create a pull request from 'myBranch' into 'master' with 'User #77793' as a reviewer |
or
1 2 |
$ stash pull-request master Create a pull request from the current branch into 'master' |
During the configuration stage, the script prompts the user to add a convenient git alias to create a pull request, so that the following command can be executed:
1 |
$ git create-pull-request master |
How does it work
It’s a ruby gem which is built using Jeweler. The command handling is done using Commander, so it’s very extensible and easy to write.
Configuration data is written to and read out of a YAML file, ~/.stashconfig.yml which is chmod to 0600 as we need to store the Stash username and password in plain text. If you enter an empty password when configuring the script, you’ll be prompted for your password on every Stash command which is run (some of us don’t like storing our passwords in plain text files).
When creating a pull request, the script extracts the Stash project key and repository slug from the remote by parsing git remote -v. The pull request title is generated by using the first commit to the source branch, by running git log –reverse –format=%s target..source.
We’ll be continuing to improve these tools, some improvement in the pipeline include:
- Allow the user to set the title and description of a PR
- Pulling out a pull request description from the commit message body
- Checking that the source branch is fully pushed to the server, and providing an option to do so if not
- Create a host of new commands, such as:
- Listing all/my pull requests for the current repo
- Switch to the source branch for a particular repo (so that I can review the code with my local clone)
However, we need you! If you’re a ruby wizard and use Stash, fork the project on Bitbucket and create a pull request to contribute back. You can be awesome too!