2013年3月13日水曜日

Boot your USB Drive in VirtualBox

The GUI of VirtualBox does not have an option to boot a USB drive (Physical Drive) in a virtual machine.

However you can attach a physical drive to a virtual machine using a command line tool that is bundled with Virtual Box.You can then boot your virtual machine from the attached Physical drive.You need to use VirtualBox with Windows installed in order to use the software for a o2 mobile broadband dongle. As you are probably aware, you are unable to use it with Linux.

This is the continuation of my previous article Test bootable USB drive without restarting your computer.You can read more about bootable usb drives in that article.

Note:This tutorial has been updated for Virtualbox 4.

In this article I will show you how you can boot a bootable usb drive in Virtual Machine created by VirtualBox.You can easily test bootable USB drives within Windows or Linux and without restarting using this method.

Download and install Virtual Box and VirtualBox 4.0.2 Oracle VM VirtualBox Extension Pack from http://www.virtualbox.org/wiki/Downloads
The Extension pack adds support for USB 2.0 devices.

Attaching a Physical Disk to a Virtual Machine

Section 9.6 in the VirtualBox manual contains all the details required to attach a physical disk to a virtual machine.Using the vboxmanage.exe tool you can create a tiny vmdk file which points to your real USB drive (Physical Drive/Disk).You can attach this tiny vmdk to your virtual machine.A vmdk file is a virtual hard disk file which can be used with VirtualBox and VMWare.

The vboxmanage.exe tool is bundled with VirtualBox.You don't have to download it separately

Open Command Prompt

Navigate to your Virtual Box installation Directory.

cd "c:\Program Files\Oracle\VirtualBox"

Type the following command and press enter
Syntax of the command

VBoxManage internalcommands createrawvmdk -filename path\to\usb.vmdk -rawdisk \\.\PhysicalDrive1

You have to replace pathtousb.vmdk with the path of your choice

Example

VBoxManage internalcommands createrawvmdk -filename "%USERPROFILE%\usb.vmdk" -rawdisk \\.\PhysicalDrive1

createraw Boot your USB Drive in VirtualBox

In Windows your 1st Hard Disk will be \.PhysicalDrive0.Your 2nd Hard disk will be \.PhysicalDrive1.

Warning:Do not Attach your Primary hard disk to your Virtual Machine and Boot it in the Virtual machine

To find the correct number for your USB Drive

Right Click on My Computer-Manage-Disk Management

Here you can find the correct disk number of your USB Drive

15zi9s6 Boot your USB Drive in VirtualBox

You will have to replace \.PhysicalDrive1 with the correct drive number.

In this case there was only 1 hard disk and 1 USB disk.So the USB drive is referred by \.PhysicalDrive1

In linux you have to replace \.PhysicalDrive1 with the correct /dev/sdx reference.

Now you should have a tiny vmdk file.You can start your Virtual Machine with this tiny vmdk and boot from it.

  1. Start VirtualBox.
  2. Create a new Machine or Select an Existing Machine.
  3. Click on Settings
    vmsettings Boot your USB Drive in VirtualBox
  4. Storage-Add Hard Diskaddharddisk Boot your USB Drive in VirtualBox
  5. Select the vmdk file that you had created.selectharddisk Boot your USB Drive in VirtualBoxvmdkfile Boot your USB Drive in VirtualBox
  6. Make sure that usb.vmdk is your Primary Master.attachedusb Boot your USB Drive in VirtualBox
  7. System-Boot Order.Set your Hard Disk as the first boot device.
  8. Now start your Virtual Machine.

Your virtual machine will boot from your bootable physical USB Drive.

In this screenshot I have used a bootable Ubuntu USB drive created using Unetbootin.



Read more: http://agnipulse.com/2009/07/boot-your-usb-drive-in-virtualbox/#ixzz2NOzUM5JZ

Where in an Eclipse workspace is the list of projects stored?

<workspace>\.metadata\.plugins\org.eclipse.core.resources\projects\

Eclipse3.7のワークスペースの設定情報をシンボリックリンクで共有する

 

Eclipseはワークスペース単位で設定を区別している。
このおかげでプロジェクトの種類ごとに違う設定を適用できるので、規約の違う複数のプロジェクト群があるときには重宝するのだと思う。
 
しかし自分にはそういう要求はないので、ユーザーごとに同じ設定を使えるようにしてほしいと思う。が、Eclipseにそれを陽に実現する手段はないようだ。
非公式には何かやり方があるんじゃないかなと思ったけど、意外に見当たらない。


Clone workspace in eclipse - Stack Overflow

このページによると、
  • 設定を保存しているフォルダ「.metadata」はワークスペース直下から移動できない
  • 設定データに絶対パスが多く含まれている
といった問題があるので単純に設定フォルダを共有するだけでは無理みたい。
 
ここの2番目の回答によると、「.metadata/.plugins/org.eclipse.core.runtime/.settings」をコピーすればいいらしい。
さらにそれをDropboxを使ってシンボリックリンクを貼ることも可能。
が、上記のページでも指摘されているように、.settingsフォルダ内の設定ファイルにはところどころに絶対パスの設定が含まれている。設定の共有はローカル内にとどめておいた方がよさげ。
なので自分はDropboxは使わないでシンボリックリンクだけを使う方向でやることにした。
 
 
Eclipseを終了し、設定を共有したいワークスペースの\.plugins\org.eclipse.core.runtimeフォルダで、こんな感じに打てばいい(管理者権限が必要)
> move .settings .org.settings  > mklink /d .settings "共有設定情報があるフォルダ(共有したい.settingsフォルダを別の場所にコピーしたものがよさそう)"
 
バッチファイルはこれ。管理者権限と事前のディレクトリパスの入力が必要。あまり便利じゃないしもしかすると何かのデータを破壊するかもしれない。バッチわからん。。。
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
@echo off
setlocal
 
rem まずこのファイルパスを共有したい設定フォルダに変える
rem 例:"WORKSPACE_DIR\eclipse_workspace\.metadata\.plugins\org.eclipse.core.runtime\.settings"
set theSharedFolder="C:\Users\dai\Documents\eclipse_workspace\.metadata\.plugins\org.eclipse.core.runtime\.settings"
 
rem このファイルパスを共有させる設定フォルダの上フォルダに変えて実行!
rem 例:"WORKSPACE_DIR\eclipse_workspace\.metadata\.plugins\org.eclipse.core.runtime\"
set theSharingFolder="C:\Users\dai\Documents\eclipse_workspaces\swt\.metadata\.plugins\org.eclipse.core.runtime\"
 
set settingfolder=".settings"
set orgfolder=".org.settings"
 
cd %theSharingFolder%
echo pwd: %theSharingFolder%
 
if not exist %theSharedFolder% (
set mes=%theSharedFolder% ないよ
goto end
)
if not exist %theSharingFolder% (
set mes=%theSharingFolder% ないよ
goto end
)
if not exist %orgfolder% (
if not exist %settingfolder% (
set mes=%settingfolder%, %orgfolder% どっちもないよ
goto end
)
)
echo move %settingfolder% %orgfolder%
echo mklink /d %settingfolder% %theSharedFolder%
echo 上記のコマンド実行するけどいいですか? OKなら「y」と入力してください...
set /p conf="> "
if not %conf% == y (
set mes=canceled
goto end
)
move %settingfolder% %orgfolder%
mklink /d %settingfolder% %theSharedFolder%
echo k k thx bye.
pause
exit/b
 
:end
echo %mes%.
pause
 
今のところうまく動いている。パースペクティブの設定は共有されないみたいだけど、まあいいか。
パースペクティブの設定のコピーはFile→Switch Workspace→OtherでCopy SettingsのWorkbench layoutを選択すればいい。symlinkで共有してもいいのかな?

この作業で気づいたけどEclipseCoderってパスワード平文で保存してるんだね…酷いや。 
  

 
後になって気づいたけど、シンボリックリンクを使うよりも安全で簡単そうな設定管理方法があるらしい。
 
Pulseというサービスを使ってEclispeのプラグイン構成と設定をクラウド上で管理。個人なら無償。

2013年3月12日火曜日

スマートフォンを凍らせて暗号を解析する新ハッキング手法「フロスト」

スマートフォンを凍らせて暗号解析を行う手法が開発されたそうだ。

半導体を冷却するとその中に残っていた情報が削除されるまでは時間がかかる性質を利用しており、メモリ内に一時的に保存された暗号情報を復元してスマートフォン内の情報にアクセスしたそうだ。発見したドイツのフリードリヒアレクサンダー大学のセキュリティ研究チームはこの暗号解析の手法を「フロスト」と名付けたとしている。

http://ggsoku.com/2013/03/the-eternal-frost/
http://www.forbes.com/sites/andygreenberg/2013/02/14/frost-attack-unlocks-android-phones-data-by-chilling-its-memory-in-a-freezer/

2013年3月11日月曜日

Carrier Bundle Generator iPhone OS 3 - 3.1.2 (ipcc)

http://www.volkspost.info/ipcc_fw3/

Only for iPhone users with hacktivated or factory unlocked iPhones NOT using a legit Apple partner contract. DO NOT use it if you are on a legit contract!!!

Please read the complete text here first!!!

Fields in the form marked with a * are mandatory!!! NEEDED TO FUNCTION PROPERLY.

The PHP-driven service auto-creates custom carrier bundles in .ipcc format for use with iTunes. Works for iPhone 2G/3G/3GS, jailed and jailbroken, Mac & Windows. The solution is intended for users on non-Apple partner carriers. The ipcc file contains the custom carrier bundle and the symlink(s). The custom carrier bundles are made for iPhone OS 3 enabling MMS, Data & Tethering on iPhone 3G/GS. They can be used on iPhone 2G aswell but wont enable MMS/Tethering without further hacks.

Custom carrier bundels vs. unknown bundle and Mobileconf
The iPhone relies on carrier bundles, delivered by Apple with the firmware. Of cause Apple only delivers carrier bundles for their partners. If you use a hactivated iPhone or a factory unlocked one with a non-partner carrier, the "unknown bundle" is used. This one is made for roaming situations only, should not be played around with. Thats where custom carrier bundles come into action. You create a "real" carrier bundle, apply it to the iPhone and you're set.

For users on a legit iPhone contract wanting to enable Tethering. The best way to do so if you are on a jailbroken iPhone is to modify the type-mask setting of the carrier bundle your iPhone uses. There are some hacks around using modified mobileconfig files. This is theoretically a way to go but most ready-made files I have seen dont have the proper type-mask values. I am still investigating the combinations needed for the different Apple partner carriers. Will open a thread on this in a couple days - different story.

Preparations
Installing the custom bundle is easy via iTunes. Cause Apple broke the "injection" in iTunes you have to re-enable it first. Make sure to have iTunes latest version installed, quit the program if running.
On a Mac open the application Terminal (in Applications/Utilities) and type: 
defaults write com.apple.iTunes carrier-testing -bool TRUE 
on Windows open command prompt and type:
"%ProgramFiles%\iTunes\iTunes.exe" /setPrefInt carrier-testing 1 
Injecting the IPCC-Files is enabled again.

You need to have the MCC/MNC of your carrier handy aswell. If you dont know it do the following: Your iPhone is at OS 3.x. Start the Phone app, switch to the keypad and type *3001#12345#* tap the green dial button then. Field Test Application opens on the iPhone. Goto "MM Info" -> "Serving PLMN" and look for "Mobile Country Code" and "Mobile Network Code". If Mobile Country Code is 234 and Mobile Network Code is 15 your MCC/MNC is 23415. If Mobile Country Code is 234 and Mobile Network Code is 6 you have to add a 0 (zero) in front of MNC so your MCC/MNC reads 23406. Take a note.

For using the custom carrier logo you need one mandatory field in the form to be filled out properly (* First character/digit of carrier logo name). The following string is compared to the string your simcard/carrier issues when normally using (before using the custom carrier bundle). Main carriers like Vodafone issue "Vodafone UK" or so (to be read on the top left corner of the iPhone screen beside the bars). The value for "AllowPrefixMatching" has to match the string. Use the easy way and just type the first character (or if so digit) that is displayed, it works. In the above example it would be V. Write down the displayed name (only the first character/digit).

Apply the ipcc file to your iPhone
The script creates everything on the server, after all is complete, it's downloaded to your Windows-PC or Mac. Connect iPhone and PC/Mac, start up iTunes. Wait until iTunes "sees" the iPhone. Click on the iPhone in "Devices" (left program bar) 
On Windows shift-click "Update", on Mac option-click "Update" (NOT "Restore"). iTunes will pop up a dialog, selct the downloaded .ipcc file and click "OK". iTunes will "update your carrier settings".
Disconnect iPhone and PC, shut down the iPhone (red slider) and restart it - thats all!

Edit/Delete the custom carrier bundle
You can edit most of the settings after applying the ipcc on the iPhone. Goto "Settings > General > Network > Cellular Data Network".
You can create another ipcc and apply it. The new one will be used then. If you want to delete the carrier bundle and symlink you need a jailbroken iPhone. Both carrier bundle and symlink are in /private/var/mobile/Library/Carrier Bundles/. Use WinSCP or Cyberduck if OpenSSH is installed to delete both or grab the free too DiskAid (http://www.digidna.net/diskaid/download.php) to do the job.

Use of the service is free of cause. Thanks an credit to the Dev Team for making all that possible.


Information on fields and folders - please read first

a. Data for Info.plist

* Bundle Name (e.g. o2_UK, do NOT add .bundle!)
This field is mandatory. Will be the name of the bundle. Do not add .bundle, the script will do. Do not use any special character here (no spaces, no umlauts, no & aso)

b. carrier.plist - General data

* Carrier Name (e.g. o2 UK, Vodafone DE)
This field is mandatory. Will show up on the iPhone in "Settings > General > About > Carrier" along with the bundle version 5.0.

Account URL Title and Account URL
If set it will show up in "Settings > Phone" at the bottom as "Carrier Name Services" providing links.

Service Name 1 / Service Code 1 to Service Name 5 / Service Code 5 
If set you will find access to service numbers of your provider in "Settings > Phone" on the bottom as "Carrier Name Services". If you like to use one or more, please start with service 1 and continue then.

* Supported SIM (Your MCC/MNC e.g. 20622)
This field is mandatory. Fill in the MCC/MNC (you wrote it down).
The service supports more than one MCC/MNC associated to one carrier bundle. I have added two more (optional) fields for that. If you find out your carrier needs even more, just let me know. 
Every user still has to fill out the first field "* Supported SIM (Your MCC/MNC e.g. 20622)" (it's mandatory), the two others are just optional for those needing them.

1 st additional supported MCC/MNC - optional & 2nd additional supported MCC/MNC - optional
Only for those users with a carrier bundle that has associated more than one MCC/MNC

* First character/digit of carrier logo name
This field is mandatory. Type in the first character of the carriername that is displayed on the iPhones top left, right from the signal bars before you applied the custom carrier bundle.

Voicemail number
Type in the access numer for your voicemail here. No need anymore for the "*5005*86*xxx#"-hack. Type in the number here and it will work when hitting the voicemail-button in the Phone app. You can either use the local one or the complete (starting with +XXX > recommended!)

The following fields are set automatically: AllowEDGEEDiting (true), ShowCallForwarded (false), ShowCallForwarding (false), ShowDialAssist (false), ShowTTY (false), SupportsNITZ (true), MaxBluetoothModemConnections set to 3 (Apple recommended), GroupModeEnabled boolean/false (in MMS; Apple recommended).

c. carrier.plist - Data for Internet and Tethering

APN, Username, Password for Internet/Data
Type in APN, username and password for internet access on the iPhone (Mail, Web, Maps...). Some carriers only want APN, some dont want any data at all here. You can edit the entry later on the iPhone in "Settings > General > Network > Cellular Data Network"

APN, Username, Password for Tethering
This is just an option for those where the carrier wants different APN/username/password for tethering on the iPhone. In most cases this is not the case - same setting. Just leave it blank, the script will auto-fill the values of Internet/Data here - no action needed then.

d. Data for MMS

The important part is getting the data needed from your carrier and entering them. Values for Maximum Message Size and Maximum Video Bitrate are needed in most countries (Maximum Video Bitrate for MMS video from iPhone 3GS aswell). In most parts of Europe Maximum Message Size (size of a MMS message) is limited to 307200 (bytes = 300 KB), some allow bigger sizes. If you dont set a value here 307200 is automatically set. Video framerate for videos trasmitted via MMS is recommended by Apple to be set to 131072 (bits per second = 128 KBit/s). If you dont enter a value here 131072 is set automatically.
When entering MMSC dont forget http:// in front of the value!
Your carrier probably lists a "MMS Proxy" and a "mms proxy port" for example 98.111.34.123 and 8080. The form entry for "Proxy" then would be 98.111.34.123:8080 (no http:// in front this time.
The iPhone shows one more field called "MMS UA Prof URL". I am not aware of a provider needing an entry here, so you wont find the field in this form. If you need it, after applying the ipcc on the iPhone goto "Settings > General > Network > Cellular Data Network" and enter the values there

e. carrier logos

Width of carrier logo
Apples logosize is 60*20 (width*height). You may choose another, the logo pushes the display of WLAN and time to the right then.

Font type
Apple uses Helvetica 14 for displaying the carrier name. Helvetica is not free. I have been choosing the free font family "DejaVu", you can checkout/get it here http://dejavu.sourceforge.net/wiki/index.php/Main_Page. DejaVu Sans Condensed Bold looks best to me.

Font size
Apple uses helvetica 14, DejaVu Sans Condensed Bold 12 looks best to me.

Logo text
Type in the desired text. The cool thing about DejaVu is that it supports Latin, Greek, Cyrillic and Arabic. So just use the language of your choice.
Hint: Use a space here if you dont want any logo name to show up.
Attention: If you want more text to fit, choose a bigger logo-size. Standard logo size and standard font fits 8-10 characters only!

If you want custom logos with fency pictures instead of the once created by the web service, after applying the ipcc you may SFTP into the iPhone and replace the two png files. Just make sure to not edit the names of the png files!!!!

One last note: Using Internet/Tethering & MMS will add costs to your monthly phone bill!!!

Carrier Bundle

Carrier Bundles provide a way to organize all customizations related to carriers in one place. These include voice mail numbers, MMS and APN settings etc.

For users on carriers other than the Apple's official partners, carrier bundles allow to configure important settings such as APN and enable features like MMS and tethering.

On the device side, carrier bundles are stored in the following directories:

  • /var/mobile/Library/Carrier Bundles/ - bundles downloaded via iTunes.
  • /System/Library/Carrier Bundles/ - bundles provided with the firmware image. Starting with iOS 4.2, carrier bundles are stored in a subfolder of this path.

If two bundles with the same name exist in both paths, the one on user partition takes preference. This allows Apple to update carrier bundles without releasing a whole new OS.

On a computer that has downloaded carrier bundle updates, they are stored in the following directories:

  • ~/Library/iTunes/iPhone Carrier Support/ - this folder will not exist if iTunes hasn't downloaded any carrier updates
 

Structure

Carrier bundles are ZIP archives with .ipcc extension. They are named after the carrier and the country they are for (for example, MyCarrier_au.ipcc) They contain the mandatory Payload folder that includes the bundle itself and the symlink:

\Payload\          \MyCarrier_au.bundle\                           \carrier.plist - carrier settings go here                           \Default_CARRIER_MyCarrier.png - logo for grey status bar                           \FSO_CARRIER_MyCarrier.png - logo for black statusbar                           \Info.plist - bundle description                           \version.plist - bundle version (not always present)          \12345 - symlink to MyCarrier_au.bundle (12345 is MCC+MNC)  


Enabling .ipcc support in iTunes

By default, iTunes allows only carrier bundle updates from Apple. However, when the "carrier-testing" preference is enabled, .ipcc files can be loaded from the user's hard drive by clicking either "Check for Updates" or "Restore" button while holding Shift (on Windows) or Option key (on Mac).

Mac OS X

1. Quit iTunes.

2. Open Terminal and paste the following command:

defaults write com.apple.itunes carrier-testing -bool true  

Windows

Enter the following in a command line, the Start menu search box or the Run dialog:

"%ProgramFiles%\iTunes\iTunes.exe" /setPrefInt carrier-testing 1  

Note: this command just enables the preference and exits, so iTunes won't open if it's not already running.

iOS 3.1 Changes

As of iOS 3.1b1, APN settings are now being signed to prevent tampering/modification by users. This has been implemented to stop users bypassing the carrier's designated APN for tethering that may require payment for access. This is also a concern for users of carriers that do not officially offer MMS or Tethering services for users at all. This signature-check can be circumvented by patching commcenter.

Only the APN settings are being signed; other settings can still be modified without needing to patch commcenter.

iOS 4.x Changes

One of the new 'features' in iOS 4 is the addition of over-the-air carrier updates. Carriers can now push updated settings over the air without having to tether your device to a computer to poll for updates. All carrier bundle settings are now signed, not just the APN settings. To circumvent this, commcenter must now be patched. The bit-mask for APN settings has also changed quite significantly.

Type Mask

These flags are depreciated for iOS 4 and above. These will need to be updated for 4.0 onwards.  

Each APN in the carrier.plist has a numeric type-mask. It is bitmask (combination of flags) that designates what the APN should be used for (eg. phone data, tethering, visual voicemail, MMS, or a combination). This table shows what each-type mask designates an APN for.

Type Mask
Value Feature
0 Disabled
1 Data
2 Visual Voicemail (VVM)
4 MMS
48(0x30) Tethering

For example, 55 = 1+2+4+48 means "Tethering, MMS, VVM, Data"

External Links