Vault7: CIA Hacking Tools Revealed
Navigation: » Latest version
iOS Developer Setup Guide
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.
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 ~/.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 ssh://stash/dto/dto_logger).
Test Repo checkout
$ mkdir early
$ cd early
$ repo init -u ssh://git@stash.devlan.net:7999/ios/early_manifest.git
$ repo sync
Fix Xcode
$ 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)
Either log out and log in again or source .bash_profile as needed.
Set Up LaunchCTL with Your Environment Variables
Create the file ~/.launchd.conf and add in the following (substituting your IP Address for MY_IP and your local path to the IPSW files path if not using the share drive instead of /Volumes/share/MDB/iOS/iOSFiles - this is in three lines)
setenv IOS_SDK_VERSION 7.1
setenv ZOO_IOS_SDK_VERSION 7.1
setenv ZOO_OSX_SDK_VERSION 10.9
setenv MYIP MY_IP
setenv ZOO_IOS_FILES /Volumes/share/MDB/iOS/iOSFiles
setenv IPSW_PATH /Volumes/share/MDB/iOS/iOSFiles
setenv ZOO_IPSW_PATH /Volumes/share/MDB/iOS/iOSFiles
Then run this from bash: launchctl < ~/.launchd.conf
This allows XCode to know about key environment variables.
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 ~/PATH_TO_DTO_LOGGER ~/bin/dto_logger
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
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 #78000 Create a pull request from 'myBranch' into 'master' with 'User #77999' 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!