After writing about some Arcade games, and Puzzle games I used on my iPod Touch, I remembered that at some point I installed a web server and made a small “statistics” website.
Warning!
Because I did this more than 3 years ago, some of the packages might not work, or might be superseded by other packages.
Additionally, this is made for the Original iPod Touch, limited to iOS 3.1.3, so the approach might work for newer devices, but using different methods and software.
1. Jailbreak the device
The first step is to jailbreak your device. Make sure to do a backup if you have data that you don’t want to lose. I used JailbreakMe 2.0 service from jailbreakme.com, which is pretty straightforward. You just visit an url which I might have mentioned and you follow the instructions on the screen. Be sure to choose to install Cydia
2. Change your iPod IP address to static
Go to Settings -> Networks, tap on the arrow to the right of your preferred network. Choose “Static”, enter your IP address and gateway. This will ensure you’ll always be able to find your ipod
3. Install OpenSSH
Once the jailbreak has completed successfully, you should have Cydia installed. Open it and install the OpenSSH package. Once this is installed, you can use PuTTY or your favourite ssh client and connect to the iPod
1
|
ssh mobile@192.168.0.69
|
or whatever IP you chose.
4. Secure your iPod
Use password alpine
to log in, and make sure to change it by typing passwd
1
2
|
Andreis-iPod:~ mobile$ passwd
Changing password for mobile.
|
Also type su
, to log in as root and change that password as well
5. Install some web server
Because it works out of the box, I installed lighthttpd, because it was the best working solution at some time
1
|
apt-get install ios-lighttpd-php-mysql
|
It automatically installs
- PHP56 v5.6.*
- Lighttpd-atv v1.4.*
- MySQL-atv v5.1.*
The location of the web files is /var/www but if you’re encountering errors, you need to
change the owner to ‘daemon:_www’
1
|
chown -R daemon:_www /var/www
|
You can install stuff that will make your life easier on managing this small server, like Midnight Commander, cURL, wget, vim. This is done easily, by logging in as root and using
1
|
apt-get install <packagename>
|
Also you might want to install cron, as it doesn’t come out of the box.
6. Serving a statistics page
I wanted to create a page that shows some server info and stats, and I made it to look similar to the iOS 3.1.3 interface. Take the contents of the file below, save it as makeindex.sh
to your home folder (or wherever else, using whatever name you want). Then run chmod +x makeindex.sh
to be able to run it with ./makeindex.sh
You have the code and an example html below, and you can also see the output by following this link. The moment I find out how to bypass my home connection, I will send the iPod online (it has connectivity, but only outbound, not inbound)
The code for the .sh file
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#!/bin/bash
function show_time () {
num=$1
min=0
hour=0
day=0
if((num>59));then
((sec=num%60))
((num=num/60))
if((num>59));then
((min=num%60))
((num=num/60))
if((num>23));then
((hour=num%24))
((day=num/24))
else
((hour=num))
fi
else
((min=num))
fi
else
((sec=num))
fi
echo "$day"d "$hour"h "$min"m "$sec"s
}
echo '<!DOCTYPE html><html lang="en-US"><head><meta charset="UTF-8"><meta name="viewport" content="initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"><title>iPod Touch System Info</title><style type="text/css">body{background:#000;color:#0f0;font-family: "Menlo", "Lucida Console", Courier, monospace;}h1,h2{text-align: left;font-family: "Helvetica Neue", Arial, sans-serif}.box{margin: 65px 20px 20px;position:relative;border-radius: 10px;}.box-content{padding:3px 20px 20px;white-space:pre-wrap}h2{padding: 0px 20px 0;text-transform:capitalize;margin:0;position:absolute;top: -40px;color: #53596b;text-shadow: 1px 1px #fff;}body{background: url("data:image/gif;base64,R0lGODlhBwABAIAAAMzS28XM1CH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxMTEgNzkuMTU4MzI1LCAyMDE1LzA5LzEwLTAxOjEwOjIwICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxNSAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo4MDE1NDZGOTUzQTgxMUU5ODVFRTkyMjY2NkMxQTI3MCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo4MDE1NDZGQTUzQTgxMUU5ODVFRTkyMjY2NkMxQTI3MCI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjgwMTU0NkY3NTNBODExRTk4NUVFOTIyNjY2QzFBMjcwIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjgwMTU0NkY4NTNBODExRTk4NUVFOTIyNjY2QzFBMjcwIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Af/+/fz7+vn49/b19PPy8fDv7u3s6+rp6Ofm5eTj4uHg397d3Nva2djX1tXU09LR0M/OzczLysnIx8bFxMPCwcC/vr28u7q5uLe2tbSzsrGwr66trKuqqainpqWko6KhoJ+enZybmpmYl5aVlJOSkZCPjo2Mi4qJiIeGhYSDgoGAf359fHt6eXh3dnV0c3JxcG9ubWxramloZ2ZlZGNiYWBfXl1cW1pZWFdWVVRTUlFQT05NTEtKSUhHRkVEQ0JBQD8+PTw7Ojk4NzY1NDMyMTAvLi0sKyopKCcmJSQjIiEgHx4dHBsaGRgXFhUUExIREA8ODQwLCgkIBwYFBAMCAQAAIfkEAAAAAAAsAAAAAAcAAQAAAgOMDVAAOw==");color: #111;margin: 0;text-align: left;-webkit-font-smoothing: antialiased;}.box{background: #fff;}h1{font-size:170%;color: #fff;background: url("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3MCI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjgwMTU0NkZCNTNBODExRTk4NUVFOTIyNjY2QzFBMjcwIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjgwMTU0NkZDNTNBODExRTk4NUVFOTIyNjY2QzFBMjcwIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Af/+/fz7+vn49/b19PPy8fDv7u3s6+rp6Ofm5eTj4uHg397d3Nva2djX1tXU09LR0M/OzczLysnIx8bFxMPCwcC/vr28u7q5uLe2tbSzsrGwr66trKuqqainpqWko6KhoJ+enZybmpmYl5aVlJOSkZCPjo2Mi4qJiIeGhYSDgoGAf359fHt6eXh3dnV0c3JxcG9ubWxramloZ2ZlZGNiYWBfXl1cW1pZWFdWVVRTUlFQT05NTEtKSUhHRkVEQ0JBQD8+PTw7Ojk4NzY1NDMyMTAvLi0sKyopKCcmJSQjIiEgHx4dHBsaGRgXFhUUExIREA8ODQwLCgkIBwYFBAMCAQAAIfkEAAAAAAAsAAAAAAEALAAABinAUKmQ6BgIn4nlIdFQPCBF5AAJiCob0gCFWmQwDMcplQIIRg2E6cIJAgA7");padding: 0px 25px;margin-top: 0;height: 44px;text-align: center;font-size: 23px;line-height: 44px;text-shadow: -1px -1px #555c6a;}h2{}body::after{content:"";clear:both;display:table}</style></head><body><h1>System Info</h1>' > /var/www/index.html
echo "<div class='box'><h2>Version</h2><div class='box-content' id='box-cpuinfo'>" >> "/var/www/index.html"; echo "$(uname -a)</div></div>" >> "/var/www/index.html";
echo "<div class='box'><h2>Uptime</h2><div class='box-content' id='box-uptime'>" >> "/var/www/index.html"; uptime | tr "," " " | cut -f5-8 -d" " >> "/var/www/index.html"; echo "</div></div>" >> "/var/www/index.html"
printf "<div class='box'><h2>Hardware</h2><div class='box-content'>\nHardware: $(uname -n)\n$(sw_vers)\nCPU Speed: $(($(sysctl -n hw.cpufrequency)/1000000))MHz\nRAM: $(($(sysctl -n hw.physmem)/1048576))MB" >> "/var/www/index.html"; echo "</div></div>" >> "/var/www/index.html"
printf "<div class='box'><h2>Server</h2><div class='box-content'>\nServer: lighttpd/1.4.36 (ssl)\nVisits: $(($(grep -ri 'GET / HTTP/1.1' /var/log/lighttpd/lighttpd.log | grep -v '192.168.0.4' | wc -l)-1))</div></div>" >> /var/www/index.html
echo "<div class='box'><h2>Partitions</h2><div class='box-content' id='box-partitions'>" >> "/var/www/index.html"; echo "$(df -h)" >> "/var/www/index.html"; echo "</div></div>" >> "/var/www/index.html"
echo "</html></body>" >> /var/www/index.html
|
The HTML output of the .sh file
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
<!DOCTYPE html><html lang="en-US"><head><meta charset="UTF-8"><meta name="viewport" content="initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"><title>iPod Touch System Info</title><style type="text/css">body{background:#000;color:#0f0;font-family: "Menlo", "Lucida Console", Courier, monospace;}h1,h2{text-align: left;font-family: "Helvetica Neue", Arial, sans-serif}.box{margin: 65px 20px 20px;position:relative;border-radius: 10px;}.box-content{padding:3px 20px 20px;white-space:pre-wrap}h2{padding: 0px 20px 0;text-transform:capitalize;margin:0;position:absolute;top: -40px;color: #53596b;text-shadow: 1px 1px #fff;}body{background: url("data:image/gif;base64,R0lGODlhBwABAIAAAMzS28XM1CH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxMTEgNzkuMTU4MzI1LCAyMDE1LzA5LzEwLTAxOjEwOjIwICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93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DMyMTAvLi0sKyopKCcmJSQjIiEgHx4dHBsaGRgXFhUUExIREA8ODQwLCgkIBwYFBAMCAQAAIfkEAAAAAAAsAAAAAAcAAQAAAgOMDVAAOw==");color: #111;margin: 0;text-align: left;-webkit-font-smoothing: antialiased;}.box{background: #fff;}h1{font-size:170%;color: #fff;background: url("data:image/gif;base64,R0lGODlhAQAsANUAAHOHqY2dt3KHqICSraq4yrG8y6y4ypChunCDoLC7zJWjvHyPrnmMqXCGpHmLqKKwxo6euJOiu5+txKSyx5qqv4OVsKOxxXOEnXqNqnuOrZyswYGTrik3S625y5mowKe2x5alvc3W4YmZs3GGp4KUr7O8yXKEn3eKpn6QrXaJqAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxMTEgNzkuMTU4MzI1LCAyMDE1LzA5LzEwLTAxOjEwOjIwICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxNSAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo4MDE1NDZGRDUzQTgxMUU5ODVFRTkyMjY2NkMxQTI3MCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo4MDE1NDZGRTUzQTgxMUU5ODVFRTkyMjY2NkMxQTI3MCI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjgwMTU0NkZCNTNBODExRTk4NUVFOTIyNjY2QzFBMjcwIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjgwMTU0NkZDNTNBODExRTk4NUVFOTIyNjY2QzFBMjcwIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Af/+/fz7+vn49/b19PPy8fDv7u3s6+rp6Ofm5eTj4uHg397d3Nva2djX1tXU09LR0M/OzczLysnIx8bFxMPCwcC/vr28u7q5uLe2tbSzsrGwr66trKuqqainpqWko6KhoJ+enZybmpmYl5aVlJOSkZCPjo2Mi4qJiIeGhYSDgoGAf359fHt6eXh3dnV0c3JxcG9ubWxramloZ2ZlZGNiYWBfXl1cW1pZWFdWVVRTUlFQT05NTEtKSUhHRkVEQ0JBQD8+PTw7Ojk4NzY1NDMyMTAvLi0sKyopKCcmJSQjIiEgHx4dHBsaGRgXFhUUExIREA8ODQwLCgkIBwYFBAMCAQAAIfkEAAAAAAAsAAAAAAEALAAABinAUKmQ6BgIn4nlIdFQPCBF5AAJiCob0gCFWmQwDMcplQIIRg2E6cIJAgA7");padding: 0px 25px;margin-top: 0;height: 44px;text-align: center;font-size: 23px;line-height: 44px;text-shadow: -1px -1px #555c6a;}h2{}body::after{content:"";clear:both;display:table}</style></head><body><h1>System Info</h1>
<div class='box'><h2>Version</h2><div class='box-content' id='box-cpuinfo'>
Darwin Andreis-iPod 10.0.0d3 Darwin Kernel Version 10.0.0d3: Fri Dec 18 01:26:55 PST 2009; root:xnu-1357.5.30~6/RELEASE_ARM_S5L8900X iPod1,1 arm N45AP Darwin</div></div>
<div class='box'><h2>Uptime</h2><div class='box-content' id='box-uptime'>
19:39
</div></div>
<div class='box'><h2>Hardware</h2><div class='box-content'>
Hardware: Andreis-iPod
ProductName: iPhone OS
ProductVersion: 3.1.3
BuildVersion: 7E18
CPU Speed: 412MHz
RAM: 116MB</div></div>
<div class='box'><h2>Server</h2><div class='box-content'>
Server: lighttpd/1.4.36 (ssl)
Visits: 5</div></div><div class='box'><h2>Partitions</h2><div class='box-content' id='box-partitions'>
Filesystem Size Used Avail Use% Mounted on
/dev/disk0s1 500M 399M 97M 81% /
devfs 17K 17K 0 100% /dev
/dev/disk0s2 7.1G 273M 6.9G 4% /private/var
</div></div>
</html></body>
|
If you get to this point, sky is the limit. What would you add to your portable server?
May 2023 Update
After keeping it alive and online for 408 days, I’ve decided it’s time to retire the small iPod server and let it rest. After all, after more than a year, it’s earned some big achievements, getting more update than my home server. The last mirror of the server can be
found here.