Procmail
So we have postfix, fetchmail and now procmail :)
iPhone:~ root# file procmail
procmail: Mach-O executable acorn
iPhone:~ root# ./procmail -v
procmail v3.22 2001/09/10
Copyright (c) 1990-2001, Stephen R. van den Berg
Copyright (c) 1997-2001, Philip A. Guenther
Submit questions/answers to the procmail-related mailinglist by sending to:
And of course, subscription and information requests for this list to:
Locking strategies: dotlocking, fcntl(), lockf(), flock()
Default rcfile: $HOME/.procmailrc
Your system mailbox: /var/spool/mail/root
The Onion Router
put the tor.tgz in /var/root/tor/
iPhone:~/tor root# ./bin/tor &
Mar 02 18:21:57.616 [notice] Tor v0.2.0.20-rc (r13715). This is experimental software. Do not rely on it for
strong anonymity. (Running on Darwin iPhone1,1)
Mar 02 18:21:57.630 [notice] Configuration file "/var/root/tor//etc/tor/torrc" not present, using reasonable defaults.
Mar 02 18:21:57.634 [notice] Initialized libevent version 1.4.2-rc using method select. Good.
Mar 02 18:21:57.634 [notice] Opening Socks listener on 127.0.0.1:9050
Mar 02 18:21:57.640 [warn] You are running Tor as root. You don't need to, and you probably shouldn't.
Mar 02 18:22:09.705 [notice] We now have enough directory information to build circuits.
Mar 02 18:22:16.788 [notice] Tor has successfully opened a circuit. Looks like client functionality is working.
iPhone:~/tor/bin root# ./tor-resolve www.google.com
209.85.135.99
wget resolver with cnames
update - this only seems to work on F/W 1.1.2, fails on 1.1.1 lord knows what is going on in System.dylib
Evil hacks - you need to force configure to use getaddrinfo and not gethostbyname. My config.h was:
/* Define to 1 if you have the `getaddrinfo' function. */
#define HAVE_GETADDRINFO 1
/* Define to 1 if you have the `gethostbyname' function. */
/* #undef HAVE_GETHOSTBYNAME */
Then hard link with the libresolv.a we built previously:
imac /src/ arm-apple-darwin-cc -o wget cmpt.o connect.o convert.o cookies.o
ftp.o ftp-basic.o ftp-ls.o ftp-opie.o hash.o host.o html-parse.o html-url.o
http.o http-ntlm.o init.o log.o main.o gen-md5.o netrc.o progress.o ptimer.o
recur.o res.o retr.o safe-ctype.o snprintf.o openssl.o url.o utils.o version.o
xmalloc.o ./libresolv.a -lssl -lcrypto
then it will work (binary is above wget.NewResolv.gz):
# ./wget www.yahoo.com
--11:34:36-- http://www.yahoo.com/
=> `index.html'
Resolving www.yahoo.com... 69.147.114.210
Connecting to www.yahoo.com|69.147.114.210|:80... connected.
HTTP request sent, awaiting response... 200 OK
The old one did:
# wget www.yahoo.com
--11:34:47-- http://www.yahoo.com/
=> `index.html.1'
Resolving www.yahoo.com... failed: Non-recoverable failure in name resolution.
News group reader
See tin.gz above:
# ./tin -g pubnews.gradwell.net
tin 1.9.2 release 20070201 ("Dalaruan") [UNIX] (c) Copyright 1991-2007 Iain Lea.
*** Posting not allowed ***
pubnews.gradwell.net NNRP Service Ready - newsmaster@gradwell.net (no posting).
Reading keymap file...
Reading input history file...
Reading groups from active file.../
Reading global attributes file...
Reading attributes file...
Reading newsgroups file...\
One liner tether!
imac /~/ ssh -D 3210 root@iphone
OK, so you also have to config and setup first (4 lines ;-)):
imac /~/ sudo port install tsocks
imac:~ root# echo "server = localhost" > /opt/local/etc/tsocks.conf
imac:~ root# echo "server_port = 3210" >> /opt/local/etc/tsocks.conf
imac:~ root# echo "tordns_enable = false" >> /opt/local/etc/tsocks.conf
Now do the one liner:
imac /~/ tsocks lynx -dump http://www.bbc.co.uk > bbc
imac /~/ head bbc
[1]Skip to main content [2]Access keys help [3]A-Z index
[4]BBC logo
* [5]Home
* [6]News
* [7]Sport
DONE!!!
nsgn did not believe me so:
imac /~/ tsocks open /Applications/Firefox.app
and it works to lookup http://nsgn.net/better_iphone_tethering/connect.htm:
debug2: channel 3: dynamic request: socks4 host 64.233.161.164 port 80 command 1
debug2: channel 5: open confirm rwindow 131072 rmax 32768
You can make this tsocks stick so you don't have to type "tsocks" all the time
infront of network apps with the following:
imac /~/ setenv DYLD_INSERT_LIBRARIES /opt/local/lib/libtsocks.dylib
imac /~/ setenv DYLD_FORCE_FLAT_NAMESPACE 1
(note: the debug here is from my ssh -vvv to make sure it is working via the proxy)
imac /~/ ftp ftp.ncbi.nlm.nih.gov
debug1: Connection to port 3210 forwarding to socks port 0 requested.
debug2: fd 6 setting TCP_NODELAY
debug3: fd 6 is O_NONBLOCK
debug3: fd 6 is O_NONBLOCK
debug1: channel 2: new [dynamic-tcpip]
debug2: channel 2: pre_dynamic: have 0
debug2: channel 2: pre_dynamic: have 15
debug2: channel 2: decode socks4
debug2: channel 2: decode socks4: user core/6
debug2: channel 2: dynamic request: socks4 host 130.14.29.30 port 21 command 1
debug2: channel 2: open confirm rwindow 131072 rmax 32768
Connected to ftp.ncbi.nih.gov.
220-
Warning Notice!
This is a U.S. Government computer system, which may be accessed and used
only for authorized Government business by authorized personnel.
Unauthorized access or use of this computer system may subject violators to
criminal, civil, and/or administrative action.
[SNIP]
Name (ftp.ncbi.nlm.nih.gov:core): ftp
331 Anonymous login ok, send your complete email address as your password.
Password:
230 Anonymous access granted, restrictions apply.
Remote system type is UNIX.
Using binary mode to transfer files.
>ls
150 Opening ASCII mode data connection for file list
dr-xr-xr-x 8 ftp anonymous 4096 Sep 29 2004 blast
dr-xr-xr-x 3 ftp anonymous 4096 Sep 13 2004 cgap
dr-xr-xr-x 4 ftp anonymous 4096 Sep 14 2004 cn3d
dr-xr-xr-x 10 ftp anonymous 4096 Sep 19 16:09 dbgap
dr-xr-xr-x 11 ftp anonymous 4096 Jun 4 2006 entrez
dr-xr-xr-x 6 ftp anonymous 4096 Aug 4 2006 fa2htgs
TINYPROXY UPDATE
Oh dear - still not sure why we bothered with all that tinyproxy / srelay nonsense. We had this all the time...
imac /~/ ssh -vv -D 3210 root@iphone
Proxy connections via ssh! I had totally missed the obvious and simple things in life.
# debug1: Connection to port 3210 forwarding to socks port 0 requested.
debug2: fd 9 setting TCP_NODELAY
debug1: channel 3: new [dynamic-tcpip]
debug2: channel 3: pre_dynamic: have 0
debug2: channel 3: pre_dynamic: have 350
doh!
IRSSI finally up native on the iphone!!!
much glib fights but we have a native irssi on the iphone.
perl some time soon once I get the modules to work other than
just the binary! :)
enjoy!
the terminal works a treat
here is the -d output:
23:19 < core> # ./irssi -d -c 195.228.156.223 -n coretest
23:19 < core> 23:18 -!- Irssi: Looking up 195.228.156.223
23:19 < core> 23:18 -!- Irssi: Connecting to 195.228.156.223 [195.228.156.223] port 6667
23:19 < core> 23:18 -!- Irssi: Connection to 195.228.156.223 established
23:19 < core> 23:18 !attila.osx86.hu *** Looking up your hostname...
23:19 < core> 23:18 !attila.osx86.hu *** Found your hostname
23:19 < core> 23:18 -!- Welcome to the Freedom IRC Network coretest!root@wickedpsyched.net
23:30 < pumpkin> irssi v0.8.11 - running on Darwin iPhone1,1
BitchX - running native on iPhone with Terminal.app v135
Native Links web browser with ssl why ever use safari again :-)
srelay with working DNS
First set up firefox:
# ./srelay -f
/usr/local/etc/srelay.conf: line 0: no valid entries found. using default.
Starting: MAX_TH(64)
192.168.1.127 connected192.168.1.127:62041 5-CON 72.14.205.99:80(ipv4)
direct-:-.192.168.1.127 connected192.168.1.127:62042 5-CON 72.3.246.59:80(ipv4)
direct-:-.192.168.1.127 connected192.168.1.127:62043 5-CON 72.3.246.59:80(ipv4)
direct-:-.192.168.1.127 connected192.168.1.127:62044 5-CON 72.3.246.59:80(ipv4)
working ping
# ./ping www.yahoo.com
a.out: cannot resolve www.yahoo.com: Unknown server error
# ./ping www.yahoo.com
PING www.yahoo-ht3.akadns.net (69.147.114.210): 56 data bytes
64 bytes from 69.147.114.210: icmp_seq=0 ttl=58 time=24.670 ms
64 bytes from 69.147.114.210: icmp_seq=1 ttl=58 time=181.092 ms
Firewall
There is no firewall on the iphone:
# /usr/sbin/sysctl -a | grep net.inet | grep fw
kern.exec: unknown type returned
inet is there:
# /usr/sbin/sysctl -a | grep net.inet | head -4
kern.exec: unknown type returned
net.inet.ip.portrange.first: 49152
net.inet.ip.portrange.hifirst: 49152
net.inet.ip.portrange.hilast: 65535
net.inet.ip.portrange.last: 65535
Final truth
ipfw compiled native:
# ./ipfw -h
ipfw syntax summary (but please do read the ipfw(8) manpage):
ipfw [-acdeftTnNpqS] where is one of:
add [num] [set N] [prob x] RULE-BODY
{pipe|queue} N config PIPE-BODY
[pipe|queue] {zero|delete|show} [N{,N}]
set [disable N... enable N...] | move [rule] X to Y | swap X Y | show
# ./ipfw list
ipfw: getsockopt(IP_FW_GET): Protocol not available
this also means we can't use natd as below:
# ./ipfw add divert natd all from any to any via en0
ipfw: getsockopt(IP_FW_ADD): Protocol not available
# ./ipfw add pass all from any to any
ipfw: getsockopt(IP_FW_ADD): Protocol not available
NATD
# /usr/sbin/sysctl -w net.inet.ip.forwarding=1
net.inet.ip.forwarding: 0 -> 1
# /sbin/ifconfig -a
lo0: flags=8049 mtu 16384
inet 127.0.0.1 netmask 0xff000000
en0: flags=8863 mtu 1500
inet 192.168.1.130 netmask 0xfffffc00 broadcast 192.168.1.255
ether 00:1b:65:dd:a8:dd
ip1: flags=8010 mtu 1450
ip2: flags=8010 mtu 1450
# ./natd -v -interface en0
natd[743]: Aliasing to 192.168.1.130, mtu 1500 bytes
Untested, but looks promising...
Turns out it does not work:
16:24 < tangra> core,
16:24 < tangra> "The following options must be in the kernel configuration file:
16:24 < tangra> options IPFIREWALL
16:24 < tangra> options IPDIVERT
16:24 < tangra> so the natd thing wont fly
Thanks for testing this tangra!
This is the same issue as ipfw
But maybe we can use this???
# ./slirp
Slirp v1.0.16 (BETA)
Copyright (c) 1995,1996 Danny Gasparovski and others.
All rights reserved.
This program is copyrighted, free software.
Please read the file COPYRIGHT that came with the Slirp
package for the terms and conditions of the copyright.
More info here:
http://www.ibiblio.org/pub/Linux/docs/HOWTO/unmaintained/Dip+SLiRP+CSLIP
Also need this on OSX:
http://www.breuninger.org/files/distfiles/cotty-0.4c.c.gz
WGET
bash-3.2# wget http://www.google.com/
--00:36:38-- http://www.google.com/
=> `index.html'
Resolving www.google.com... 72.14.205.103, 72.14.205.104, 72.14.205.147, ...
Connecting to www.google.com|72.14.205.103|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
[ <=> ] 5,135 --.--K/s
00:36:38 (2.86 MB/s) - `index.html' saved [5135]
RSYNC
[imac:~/toolchain/src/rsync-2.6.9] % history
1 20:07 cd toolchain/src/
2 20:08 curl http://samba.anu.edu.au/ftp/rsync/rsync-2.6.9.tar.gz > rsync.tgz
3 20:08 tar zxvf rsync.tgz
4 20:08 cd rsync-2.6.9/
5 20:08 setenv CC arm-apple-darwin-cc
6 20:09 ./configure --host=arm-apple-darwin
7 20:10 make
8 20:11 file rsync
9 20:11 scp rsync root@iphone:/usr/bin
Running:
imac:/root# rsync -av root@iphone:/ ./IPHONEBACKUP
BETTER STILL use this to stop pulling 7GB of itunes back over :) :
sudo rsync --exclude private/var/root/Media/iTunes_Control/Music/ -av root@iphone:/ ./
BSFLITE
-bash-3.2# bsflite
:: bsflite 0.82 started.
>> Enter screen name: someAOLdude
>> Enter password: ............
:: (01:46:59) Authentication succeeded.
:: (01:46:59) Connected.
:: (01:46:59) dudel has signed off.
:: (01:46:59) otherdudel has signed off.
>> ?
bsflite commands:
h............: what you see right now
w............: show buddy list
ws...........: show buddy list, sorted (default)
wf...........: show buddy list, unsorted
l[sn]........: show last 20 lines from
L............: show last 20 lines from last buddy
m[sn] [msg]..: send msg to sn
r[msg].......: reply to the last msg received/sent
p[sn]........: paste to sn
a[sn]........: add buddy
d[sn]........: delete buddy
g[msg].......: set away message
g............: unset away message
G............: display pre-defined away messages
G[num].......: set pre-defined away message
i[sn]........: get profile and away message
A[sn]........: get away message
P[sn]........: get profile
R![sn].......: manually reconnect [as [sn]]
z!...........: reload profile and away messages
q!...........: quit