IOS 6.2: hydrospanner

From wikinotes

General

Name Category Desc/Notes
iBooks books works great, can add books through Calibre. Wish it had a 'dark' theme.
Calendars calendar works with googleCalendar. Is fantastic.
Google Maps Maps Don't get lost.
SimpleNote Notes Integrates with vim. Use it to track tire rotations. Kind of slow...
What's App SMS Bought for James, never use it...
Steam Games For when I'm bored
Google Chrome Browser Best browser available for iOS. Annoying out-of-date popups...
Chrono Trigger Games When I can't sleep
Relax M.P. Sounds When I can't sleep, rain noises
Downcast Podcasts Everything you need.

Jailbreak

OS Communication with iphone:

For convenience sake, I wrote a couple of python2 scripts to connect to my iphone, and use sms-convo. These are meant to be aliased/doskeyed so they can be used as convenient single commmnands

~/progs/iphone/sms-convo.py sms-convo.py sms-convo alex initiates convo with alex
~/progs/iphone/ssh-iphone.py ssh-iphone.py ssh's into iphone for maintenance & scripting
~/progs/iphone/tcprelay.py tcprelay.py cross platform program to forward iphone ports to local ports
~/progs/iphone/usbmux.py usbmux.py cross platform program to allow port access for iphone via usb


ssh

/etc/ssh/sshd_config sshd configuration
/etc/services control over all ios ports

prerequisites:

  • Cydia: openssh, openssl
  • Windows: itunnel_mux, MySysGit
  • OSX: itunnel_mux, ssh client?
  • Linux: usbmuxd

          1. Installation

aptitude install openssh openssl autossh su -


          1. Publickey Authentication

ssh-keygen -t ecdsa -b 521 # generate eliptic curve keys

    1. on remote server's /etc/ssh/sshd_config, disable 'ChallengeResponse Authentication'
    2. service sshd restart

scp -P 8610 ~/.ssh/id_ecdsa.pub will@192.168.1.204:/home/will/ # copy public key to remote server ssh -p 8610 will@192.168.1.204 cat id_ecdsa.pub >> ~/.ssh/authorized_keys sudo chmod 600 ~/.ssh/authorized_keys exit

    1. on remote server's /etc/ssh/sshd_config, enable 'ChallengeResponse Authentication'
    2. service sshd restart


            1. SSHD config
        1. /etc/ssh/sshd_config (symlinked to /private/etc/ssh/sshd_config)

PermitRootLogin no Port 8610

        1. /etc/services

ssh 8610/tcp ssh 8610/udp

Windows:

There are two methods of connecting with ssh over usb in Windows. itunnel_mux.exe is the most reliable, but it requires that iTunes is installed.

  • usbmuxd* is another package that also works, it seems a bit pickier with it's connections

and sometimes seems to work better in certain usb ports over others. usbmuxd only requires python2.6 It seems to work most reliably through my USB3 port. or perhaps only after itunnel_mux.exe is used. Problems at work have nothing to do with different versions of openSSH.

  1. Connect over usb:
  2. default port for ssh is 22
  3. default port for vnc is 5900

itunnel_mux.exe -lport <port on pc> -iport <port on iphone> --or tcprelay -t 22:2200

  1. ssh:

itunnel_mux.exe -lport 9990 -iport 22 --or tcprelay -t 22:9990 ssh -p 9990 mobile@localhost


  1. vnc:
  2. make sure you don't have another instance of vnc-server running

itunnel_mux.exe -lport 5900 -iport 5900 in tightvnc enter: localhost


Linux:

      1. ***** NOTE ********
  1. the usbmuxd (iproxy) method has been failing me of late, but the python client
  2. tcprelay: http://www.hackthatphone.com/5x/open_ssh_usb.shtml
  3. seems to be working perfectly fine (provided I run it with python2)


  1. ssh
  2. you may need to unplug, then replug device in

iproxy 9990 22 & ssh -p 9990 mobile@localhost

  1. vnc

iproxy 5900 5900 & in tigervnc: localhost


  1. Connect over wifi:

ssh -p 22 mobile@hydrospanner




iTunnel_mux (win7)

Unfortunately, itunnel_mux will not run on a computer without iTunes installed. Fortunately itunnel_mux is opensource. It checks the registry (HKLM) for the location of the Apple Mobile Devices folder. C:/Program Files (x86)/Common Files/Apple/Mobile Device Support/


To recompile itunnel_mux with a correction, download Microsoft visual studio 2010 (C++). you can find the latest source code here: iphonetunnel-usbmuxconnectbyport.googlecode.com/svn-history/r20/trunk/intl/win32_project/ also:

  • copy and rename from DLL to LIB, saving to ./src/itunnel_mux:
    • iTunesMobiledevice.lib -- C:/Program Files (x86)/Common Files/Apple/Mobile Device Support/
    • libmobiledevice.lib -- comes with downloaded binary of itunnel_mux
    • corefoundation.lib -- C:/Program Files (x86)/Common Files/Apple/Apple Application Support/

I WAS UNABLE TO RECOMPILE iTUNNEL_MUX. Developper refused to help forum poster.


usbmuxd (win7, osx, linux)

Prerequisites: python2.6 (can use python portable) usbmuxd


For added convenience, you'll want to make sure that python is added to your %PATH% I also recommend creating a simple .bat file for when at work.

  1. SETUP:

chmod +x usbmuxd-1.0.8/python-client/tcprelay.py

  1. SSH:

python.exe usbmuxd-1.0.8/python-client/tcprelay.py -t 22:9990

  1. VNC:

python.exe usbmuxd-1.0.8/python-client/tcprelay.py -t 5900:5900



Anatomy of OS

Services

managing services manually on ios works as follows:mas launchctl load /Library/LaunchDaemons/com.openssh.sshd.plist # launch on boot launchctl unload /Library/LaunchDaemons/com.openssh.sshd.plist # do not launch on boot

launchctl start /Library/LaunchDaemons/com.cron.daily.plist # simply start service launchctl stop /Library/LaunchDaemons/com.cron.daily.plist # stop service

launchctl list # comlete list of all active services

Sources

You can add additional repos to cydia for more/more specialized selection when browsing for packages.

cydia.radare.org up to date, free *NIX applications


Add New Repository: Cydia > Sources Tab > Edit Add: http://cydia.radare.org

Terminal

  1. From cydia, install:

openssh, openssl, vim, aptitude, veency, bitesms, less, hostname, ps, sudo, git, gawk, coreutils, bc, bash, developer-cmds, llvm+clang

See above instructions to ssh into your iphone to perform the following configuration:

mterminal

The mobileterminal kind of sucks. Mterminal has much more useable gestures like tab, up,down,right,left, etc. This is definitely the terminal to go with.


bash

Installing bash is simple, but to make it your default shell you'll have to change /etc/master.passwd and replace /bin/sh with /bin/bash wherever you like.


vim

/var/mobile/.vimrc .vimrc vim configuration file

Install:

    1. Add cydia.radare.org source to cydia

download/upgrade vim download/upgrade git git config --global http.sslVerify false # no ca-certificates for curl in # ios, so github repos won't work # with ssl active

#make sure developer-cmds is installed (comes with ctags)

  1. mySysGit scp doesn't seem to work unless files are in the current windows directory

cd C:/users/will/ scp -P 9990 -r _vimrc mobile@localhost:/var/mobile


git

Install git from cydia:

cd ~ mkdir progs ssh git@192.168.1.202:8610/home/git/bash ssh git@192.168.1.202:8610/home/git/config

Note that cloning over https will fail because of SSL authentication. This can be solved by using git:// instead of https:// for a successful clone over https.


exuberant ctags

exuberant ctags is awesome, and different/better than the standard gnu ctags. Also, it lets you browse your code more simply in vim.

No binary package seems to be available for exuberant ctags, and sourceforge didn't seem to like me downloading with curl -L so I downloaded it on serenity, and then used scp to copy it to my phone.

sudo aptitude install iphone-gcc autoconf automake perl m4

scp -r -P 8610 will@serenity:/home/will/Downloads/ctags.tar.gz ~/src/ctags.tar.gz cd ~/src/ctags-x.x ./configure make

sudo make install

nano

/var/mobile/.nanorc .nanorc nano configuration

I'm using nano for text messages. I would like to have a vim-esque visual mode in nano for highlighting text and editing.


Sudo

su EDITOR=vim visudo mobile ALL=(ALL) ALL

exit


aptitude (and starting packages)

sudo aptitude update sudo aptitude install top sqlite3 nano


sqlite3

  1. open an sqlite3 database:

sqlite3 AddressBook.sqlitedb

  1. list all tables:

.tables

  1. switch mode to line (get column names)

.mode line

  1. list objects in a table

select * from <tablename>;


terminal-sms

/var/mobile/terminal-sms/sms-convo sms-convo chat-style sms conversation with one person
/var/mobile/terminal-sms/sms-snd sms-snd send single text message
/var/mobile/terminal-sms/sms-dbquery sms-snd queries sms.db for new messages related to sms-convo
/var/mobile/terminal-sms/README README instructions

This is actually one of my own. Conduct a two-way sms conversation from within a terminal while ssh'd into your phone. Pretty awesome.



bitesms

/var/mobile/biteSMS biteSMS personal script to send messages via ssh or mobileterminal.

Prerequisites:

  • biteSMS (sending messages)
  • sqlite3 (extracting message database)
  • nano (sending long messages)
  • less, hostname, ps, sudo


How it works: =
  • Sending Messages*

biteSMS has a cli interface for sending messages: /Applications/biteSMS.app/biteSMS -send -iMessage 16132667691 "message"


  • Reading Messages*

iOS stores it's SMS messages in a database: /private/var/mobile/Library/SMS/sms.db

you can extract messages from the database with the command: sqlite3 /private/var/mobile/Library/SMS/sms.db "select * from message;"

If you're trying to familiarize yourself with a new database, it maybe useful to use: sqlite3 sms.db .mode line select * from message;


Using msg

Now Send Messages with: msg alex "short message" OR msg alex and then you'll be brought into nano for a longer message.


Lynx

Lynx is a terminal web browser.


Core Utilities

aptitude install coreutils doesn't seem to actually install them. Instead from cydia, install the Utilities-CoreUtils package



Cron

iOS doesn't include an implementation of cron, and I haven't been able to find a repo that hosts one just yet. Fortunately, I found a website that describes how to recreate some basic cron functionality by creating a handful of service files, and some scripts to be run.

There don't appear to be hooks to tell if a program is already running, so I might need to use lockFiles in addition to checking the running processes order to determine if a program actually needs starting or not.

      1. Create the service files (need to link above), then add them to your startup:

sudo launchctl -w Library/LaunchDaemon/com.cron.seconds.plist

https://code.google.com/p/cydia-ios-lighttpd-php-mysql-web-stack/wiki/Cron


SSH over 3G

You can ssh into your iphone over a local network, or through the usb cable. SSH'ing over 3G is problematic, since your phone is behind the cell tower's NAT. You'll find that your IP changes frequently as you move from place to place.

Reverse SSH Tunnel It is possible to use a reverse-ssh-tunnel to ssh into your phone from behind the NAT. This involves ssh'ing from your phone into either the controlling pc, or an intermediary server, and creating a port to be used as an input to that tunnel. This works well if you are staying in a single place, but if it is not stable enough, it may be worth looking into 'authssh' (available in cydia), which keeps a persistent session when you're changing from IP to IP.

autossh


cron autocreate tunnel


Needs documenting, for the moment see freeBSD10 - profoak.

General UI

Android Lock XT

Lock screen with android dots option to show camera too!

SwipeSelection

  • Drag over keyboard to move select cursor
  • Drag from Shift or Delete to highlight text

Auxo

Task Manager and Settings Tweaks for iPhone

5 Column Springboard

Makes background with 5 columns.

5 Icon Dock

5 icons on the dock

Winterboard

Themes for your ui


Clock Hide

Hides Lockscreen Clock. Option for full date.

LS Lyra (unstable on ios6 w/ android lock)

A custom lockscreen window that displays temperature.

  • You will have to re-select your lockscreen wallpaper for it to be integrated into the new lockscreen.

Zeppelin

Replace Koodo text with a symbol

f.lux

Warms the screen temperature at night for easy reading. I have it set to 3700K at night.

ClockHide

Hides the clock overlay on my lock screen for LS Lyra and other lock screens.





Web Browser

Browser Changer

Allows me to use Atomic as my default browser

Nitrous

Allows any browser to use apple's java plugin. Not restricted to safari anymore.



Notification Center

Kamera

Access the camera from notification center

NCsettings

Access flashlight + other settings from notification center

SimpleDate

Adds the date to notifications center