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.
Configure Your Bash Profile
$ touch ~/.bash_profile
export PATH=${PATH}:/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/:~/GIT/git-repo/
export EDITOR=vim # designates editor for input when a command line tool requests an editor
export CLICOLOR=1 # command line color set
export LSCOLORS=dxfxcxdxbxegedabagacad # LS command line color set
#The following are GITSource code management software command line completions (optional but suggeted
. /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash
. /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh
GIT_PS1_SHOWUNTRACKEDFILES=1 #... untracked files(
PS1='\u@\h:\W\[\033[31m\]$(__git_ps1 "(%s)")\[\033[0m\]\$ '
# The following are Make file completions suggested but optional
_complete_make() { COMPREPLY=($(compgen -W "$(make -pRrq : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($1 !~ "^[#.]") {print $1}}' | egrep -v '^[^[:alnum:]]' | sort | xargs)" -- "${COMP_WORDS[$COMP_CWORD]}")); }
complete -F _complete_make make
export CODESIGN_ALLOCATE=$(xcrun -f codesign_allocate) # used by the coding command needs to know where coding alloc is located in Xcode
export ZOO_IPSW_PATH=~/Work/ios-files/ # used for make files and IOSApple operating system for small devices build processes
export GHIDRA_PATH=~/Work/ghidra_6.0.10 # used for make files and IOSApple operating system for small devices build processes
Either log out and log in again or source .bash_profile as needed.
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
Create a folder in ~/GIT for git-repo
from GITSource code management software run "git clone ssh//stash/gitrepo/git-repo.git"
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)
Add Entries to Hosts File
The JIRAUser Managment Software (Atlassian) and PyPi servers are not currently registered with our DNSDomain Name System servers. Manually add them to your hosts file. See lines 10 and 11.
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
172.31.1.2 jira.ioc.local jira
10.3.2.212 pypi.python.org
Install GHUnit
git clone ssh://git@stash.devlan.net:7999/ios/gh-unit.git
cd gh-unit/Project-iOS
make default
sudo make install
Optional Cool Stuff
Download the following and install
Install Sublime from : file:///Volumes/share/MDB/OSX/Software/FreeSoftware/Editor/Sublime/
Install 010 editor from : file:///Volumes/share/MDB/OSX/Software/FreeSoftware/Editor/010Editor/
Setup python Devlan simple pip index
Click on the pip hyperlink located on the page linked above to download the binaries (from http://10.3.2.212/packages/). Open Finder to the downloaded python installer. In a terminal change directory to the folder containing the setup file (Can be done by entering Cd in the terminal window and dragging the folder from finder to the terminal window). Run "sudo python setup.py install" to install pip. Be sure to set the URLUniform Resource Locator directory as directed on the linked page. The URLUniform Resource Locator can be set permanently for your user by creating the file ~/.pip/pip.conf with the following contents:
[global]
index-url = http://pypi.python.org/simple/
Note that you must have added pypi.python.org to your hosts files (IP is 10.3.2.212).
Once pip is installed run "sudo pip install PYcrypto" to install the PYcrypto python suite.
Install Java (necessary requirement for ghidra) from
/Volumes/share/MDB/OSX/Software/FreeSoftware/System/Java/ double click the idk-8u25 or newer version and follow prompts to install. This is oracles Java
Install / Setup Ghidra from: https://confluence.devlan.net/x/RoKR (Ghidra is a NSANational Security Agency app and is located in the /volumes/share/NSA folder)
Xcode Docsets
Copy docsets from
/Volumes/share/MDB/OSX/software/DevTools/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/System/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 #77103 Create a pull request from 'myBranch' into 'master' with 'User #77102' 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!