2.25.2012

ssh into iPhone without password authentication

25 Feb 2012

To ssh into your iPhone without password authentication,

1.  add user on iPhone

# cat /etc/master.passwd > ~/master.passwd
# echo 'hoge:*:1001:1001::0:0:User:/var/hoge:/bin/sh' >> ~/master.passwd
# diff /etc/master.passwd ~/master.passwd
> hoge:*:1001:1001::0:0:User:/var/hoge:/bin/sh
# mv ~/master.passwd /etc/master.passwd
# passwd hoge
New password: (type password for hoge)
Retype new password: (retype password for hoge)
# cd /var; mkdir hoge; chown hoge hoge;

2 make identity.pub on Ubuntu

% ssh-keygen -t rsa -f ~/.ssh/identity -N ""
% scp ~/.ssh/identity.pub hoge@192.168.1.2
hoge@192.168.1.2's password: (type password for hoge)
% ssh hoge@192.168.1.2
hoge@192.168.1.2's password: (type password for hoge)

3 place identity.pub and modify sshd config on iPhone

# mkdir .ssh ; chmod 700 .ssh
# mv identity.pub .ssh/authorized_keys
# chmod 600 .ssh/authorized_keys
# su
Password: (type password for root)
# cat /etc/ssh/sshd_config > ~/sshd_config
# echo 'RSAAuthentication yes' >> ~/sshd_config
# echo 'PubkeyAuthentication yes' >> ~/sshd_config
# echo 'AuthorizedKeysFile .ssh/authorized_keys' >> ~/sshd_config
# diff /etc/ssh/sshd_config ~/sshd_config
> RSAAuthentication yes
> PubkeyAuthentication yes
> AuthorizedKeysFile .ssh/authorized_keys
# mv ~/sshd_config /etc/ssh/sshd_config
# reboot

4. now you can ssh with password authentication

Your-Ubuntu:~ hoge% ssh 192.168.1.2


2.23.2012

ssh into iPhone ~ iPhoneにsshして写真を取り出す ~

23 Feb 2012

そうまでしてsshしたいかはさて置き、写真が入ってるディレクトリを忘れてしまうので自分用にメモ。

1. CydiaからSBSettings、OpenSSHをインストールする
2. SBSettingsでWifi接続のIPを確認する(e.g. 192.168.1.30)
3. Terminalを開き、 ssh root@192.168.1.30 とコマンドを入力する
4. しばらく待つとpasswordを求められるので入力する(初期パスワードはalpine)
5. cd /User/Media/DCIM/100APPLE
sshして

ssh_exchange_identification: Connection closed by remote host

と表示される場合は、ワーム感染の可能性あり。
ワームが初期パスワードを使ってsshし、sshdを削除してしまうらしい。
iFileなどで以下2ファイルがあったら即delete。


/System/Library/LaunchDaemons/com.ikey.bbot.plist
/Bin/poc-bbot


初期パスワードの変更は、Terminal等でログインして

passwd

とコマンドを入力し、新しいパスワードを2回入力すればOK。

2.16.2012

Zend Framework ~ install & setup on Ubuntu

16 Feb 2012

1. install
Zend Framework 1.11.11 full をインストールする
(参考) http://tutology.net/category/zend-framework/how-install-zend-framework-ubuntu

2. Vitrual host 関連
2.1 enable mod_rewrite
$ cd /etc/apache2/mods-enabled
$ sudo vi rewrite.load
$ cat rewrite.load
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
$ sudo /etc/init.d/apache2 restart

2.2 add virtual host setting
$ cd /etc/apache2/sites-available
$ sudo cp default zf
$ sudo vi zf
$ cat zf

(snip)
<VirtualHost *:80>
 ServerAdmin webmaster@localhost
 DocumentRoot /var/www/zf
 ServerName zf.com

 <Directory /var/www/zf/>
  Options Indexes FollowSymLinks MultiViews
  AllowOverride All
  DirectoryIndex index.php
  Order allow,deny
  allow from all
 </Directory>

 RewriteEngine Off

 <Location />
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule !\.(js|ico|gif|jpg|png|css)$ /index.php
 </Location>
</VirtualHost>
$ sudo a2ensite zf
$ sudo /etc/init.d/apache2 restart
$ cd /var/www
$ sudo mkdir zf
$ cd zf
$ sudo vi index.php
$ cat index.php
<?php
echo 'hello';
?>
$ sudo vi /etc/hosts
$ cat /etc/hosts | grep zf
127.0.0.1 zf.com
これで準備完了で、いよいよZend Framework。
(参考) http://framework.zend.com/manual/en/learning.quickstart.html


2.09.2012

jailbreak & unlock ~ iPhone 3G iOS 4.2.1

Jan 2012

iPhone3G(iOS 4.2.1)をjailbreak & unlockし、Find My iPhoneを有効にする手順

- jailbreak
1. 念のためバックアップを取って、iTunesを閉じる
2. sn0wbreezeをダウンロードする → http://ih8sn0w.com/
3. ファームウェア「iPhone 3G(4.2.1/8C148)」をダウンロードする → http://www.felixbruns.de/iPod/firmware/
4. sn0wbreezeを起動し、3.でダウンロードしたファームウェアを選んで、Simple modeでカスタムファームウェアを作成する
5. カスタムファームウェアが出来上がったら、DFUモードにして次へ進む
6. iTunesを起動し(勝手に起動するかも)、Shiftキーを押しながら復元ボタンをクリック。さきほどのカスタムファームウェアを選んで復元開始。
7. 復元が完了するとホーム画面にCydiaが追加され、jailbreak完了


- unlock
※ basebandを6.15.00に上げる必要があればredsn0wで(上の手順内でも可能か?)
(add 23 Feb)  6.15.00に上げてiTunesで1015エラーが出たら、TinyUmbrellaを使ってrecovery modeからexitさせる

8. Cydiaからultrasn0wをインストールしたらunlock完了

- activate Find My iPhone
9. iPhoneのSettings > Mail, Contacts, Calendars > Add Account からMobileMeを選んでアップルIDを登録する
10. Settings > Mail, Contacts, CalendarsのAccountsにMobileMeが追加されているのでそれをクリック。Find My iPhoneをONにする(デフォルトONだったかも)

※ プッシュ通知が無効でFMiが機能しない場合は下記の手順へ

11. Cydiaのリポジトリにhttp://repo.bingner.comを追加し、SAM(Subscriber Artificial Module)をインストールする
12. Settings > SAM でDe-Activate iPhoneをクリック。続いてRevert Lockdownd to Stockをクリック
13. iTunesにつなぎiPhoneをActivateし、Settings > SAM でBackup Activationをクリック。続いてRestore Activationをクリック
14. iPhoneをリブートし、iTunesとSyncさせれば、FMiが機能する(はず)



- 参考サイト
http://jaxov.com/2011/05/how-to-use-sn0wbreeze-2-7-to-jailbreak-ios-4-3-3-on-windows-untethered/
http://forums.macrumors.com/showpost.php?p=13655766&postcount=9