The method introduced here is illustrated on a Linux box, you may do the same on BSD, OS X, or any other OS’es as long as wget is installed.
Why Simulate MobileSafari ?
Because I’d like to download the applications using PC/Mac, then transfer to iPhone through SSH, this is much faster than installing directly on iPhone using the Installer (the Installer download is painful due to my bad route).
However, some sites restrict the access, only access from iPhones are allowed, the smxy’s repository is such an example, I can’t download the packages on my laptop. When I use wget on my laptop to get a file from smxy’s site, I always get the 403 error:
george@swaux /tmp $ wget http://smxy.exploit.org/iphone-apps/zips/openssh-4.6p1-1.zip
--12:09:47-- http://smxy.exploit.org/iphone-apps/zips/openssh-4.6p1-1.zip
=> `openssh-4.6p1-1.zip.1'
Resolving smxy.exploit.org... 208.113.190.146
Connecting to smxy.exploit.org|208.113.190.146|:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
12:09:49 ERROR 403: Forbidden.
This is because the site checks the browser (User-Agent) and rejects any requests not coming from iPhone Safari, this is annoying.
How to Simulate ?
The basic idea is to supply a fake User-Agent to the site. The wget offers a –header option to supply customized header which is very useful here. Now I can successfully get the file using the following command:
george@swaux /tmp $ wget --header "User-Agent: CFNetwork/152.4" \
> http://smxy.exploit.org/iphone-apps/zips/openssh-4.6p1-1.zip
--12:05:16-- http://smxy.exploit.org/iphone-apps/zips/openssh-4.6p1-1.zip
=> `openssh-4.6p1-1.zip'
Resolving smxy.exploit.org... 208.113.190.146
Connecting to smxy.exploit.org|208.113.190.146|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 713,039 (696K) [application/zip]
100%[===========================================================>] 713,039 6.65K/s ETA 00:00
12:06:43 (8.16 KB/s) - `openssh-4.6p1-1.zip' saved [713039/713039]
Notice the –header “User-Agent: CFNetwork/152.4″ in the command, which is the point to the success. It cheats the site this is a MobileSafari on an iPhone 1.1.1, as you have seen, it works.
There’s another famous tool netcat, which can simulate the browser as well. Here’s an example to retrieve the Nullriver’s repository file (you can’t get this file using a PC/Mac browser, the site checks the browser, if the browser is not iPhone Safari, you’ll be redirected to the main page):
george@swaux /tmp $ nc
Cmd line: iphone.nullriver.com 80
GET / HTTP/1.0
Host: iphone.nullriver.com
User-Agent: CFNetwork/152.4
HTTP/1.1 200 OK
Date: Fri, 14 Dec 2007 04:33:11 GMT
Server: Apache/1.3.33 (Darwin) PHP/5.2.0 mod_jk/1.2.6 mod_ssl/2.8.24 OpenSSL/0.9.7l
Cache-Control: max-age=60
Expires: Fri, 14 Dec 2007 04:34:11 GMT
X-Powered-By: PHP/5.2.0
Connection: close
Content-Type: application/x-apptapp-repository
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>info</key>
<dict>
<key>name</key>
<string>Nullriver Software</string>
<key>maintainer</key>
<string>Nullriver, Inc.</string>
<key>contact</key>
<string>apptapp@nullriver.com</string>
<key>url</key>
<string>http://iphone.nullriver.com/beta/</string>
<key>category</key>
<string>Nullriver</string>
<key>description</key>
<string>Please upgrade Installer!</string>
</dict>
<key>packages</key>
<array><dict>
<key>bundleIdentifier</key>
<string>com.nullriver.iphone.Installer</string>
<key>name</key>
<string>Installer</string>
<key>version</key>
<string>3.0b8</string>
<key>location</key>
<string>http://repository.apptapp.com/packages/System/Installer.zip</string>
<key>size</key>
<string>116589</string>
<key>url</key>
<string>http://iphone.nullriver.com/beta/</string>
<key>description</key>
<string>A greatly improved version of AppTapp Installer.</string>
<key>restartInstaller</key>
<true/>
<key>restartSpringBoard</key>
<true/>
<key>scripts</key>
<dict>
<key>install</key>
<array>
<array>
<string>CopyPath</string>
<string>Installer.app</string>
<string>/Applications/Installer.app</string>
</array>
</array>
</dict>
<key>category</key><string>System</string><key>date</key><string>1193840186</string></dict></array>
</dict>
</plist>
Of course, you may also use wget to do the same trick.

4 Comments
i restore my ipod due to malfunction of screen but after that my installer application is gone iwant it to how am i going to do pls.help me!!
i restore my ipod due to malfunction of screen but after that my installer application is gone iwant it to back how am i going to do?pls. help me!
Nice trick!
You can also use Firefox + UserAgentSwitcher extension to achive this. Just add one of the following user agents to your list.
1. ———————-
Description: iPhone Safari
User Agent: Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en)
App Name: AppleWebKit/420+ (KHTML, like Gecko)
App Version: Version/3.0
Platform: Mobile/1A542a Safari/419.3
2.———————–
Description: iPhone
User Agent: CFNetwork/152.4
Both agents work for me.
Cheers
Vic
Hallo, ich habe ein iPhone 3G, was kann ich machen dass ich mms oder Fotos empfangen oder versenden kann? Danke für eine Antwort.