Sunday, October 14, 2012

Retrieve credential values stored in WiFi device

Introduction

When setup a WiFi network using network appliances, an account credential is always required to logon to network services provided by ISP (Internet Service Provider).  For example, using modem router to access ISP’s broadband internet service. 

The ISP account credentials is usually enter once during configuration at first time and it should persist in the device’s RAM is ready to work for next power on.  Compare ISP account credential with the other account credentials like your email account or desktop OS account that use every day, the user tend to forget or lost the ISP account credential easily.  This happens when we upgrade to new WiFI device or hard reset the device due to some technical issues.

This article introduces some software tools to attempt recover the account credential values store in WiFi device.

Retrieve configuration file from WiFi device

Most WiFI devices allow user to backup the configuration in a file.  Read the user guides of the WiFi device to find out if it has the configuration backup option.

For example, most D-Link WiFi device supports configuration backup via HTTP URL.  Enter URL like:

http://192.168.1.1/config.bin

in browser to download the configuration file.  Most configuration are compressed and encrypted.  Some tools is needed to decode the information stored in the configuration file.

Router Pass View

RouterPassView is a software tool to decode the configuration file retrieved from WiFI router.  Please note that not all WiFi device is supported, refer to the web site for a list of supported device.

It is easy to use RouterPassView.  Download and launch the software, open the configuration file in the software and the configuration information should show in text format:

image

Monday, August 27, 2012

Turn a Windows 7 desktop to Wifi AP via Microsoft Virtual Wifi miniport adapter

Introduction

Windows 7 introduces a new virtual driver for WiFi network that create a virtual WiFi AP to share network / Internet connection for any WiFi device.  The network adapter is named as Microsoft Virtual Wifi miniport adapter.

Before Windows 7, Adhoc wireless connection is a common WiFi connection that may only connect to one WiFi device only.  The Windows Virtual WiFi connection may connect to up 8 WiFi devices.

Check support of Virtual Wifi

The virtual network adapter should install automatically in Device Manager once your WiFi adapter is activated:

image

A new Wireless Network Connection (e.g.: Wireless Network Connection 2 in the following example) should configure as well:

image

Everything is ready up to this stage, continue the configuration to turn on the virtual WiFi AP and start sharing your network connection.

Please note that there is no GUI tools to configure virtual WIFI connection.  All commands should type in command line console under Administrator privilege.

Configure Virtual WiFi connection

Choose a SSID to identify your virtual WIFI AP and set a password for it.  Type the following command in command line console running as administrator to start configure:

C:\Windows\system32>netsh wlan set hostednetwork mode=allow ssid=MyWifi key=password keyUsage=persistent
The hosted network mode has been set to allow.
The SSID of the hosted network has been successfully changed.
The user key passphrase of the hosted network has been successfully changed.

Make sure the physical Wifi adapter is enabled before start the Virtual WiFi connection:

C:\Windows\system32>netsh wlan start hostednetwork
The hosted network started.

The Virtual WiFi connection (MyWifi, in this example) is active:

image

The Virtual WiFi connection is ready to accept connection now.  Use any other WiFi device (Smartphone, other notebook, PC) to check if the MyWifi connection appears the WiFi connection list.

Please note that the virtual WiFi connection does not connect to any Internet connection yet.  All WiFi connection to MyWifi is isolated in the MyWifi network only.

Share Internet connection to Virtual WiFi connection

Enable Internet Connection Sharing for virtual WiFi connection allow Internet traffic be served for virtual WiFi client.  First, identify the network connection with Internet access:

image

Open properties page of the Network Connection with internet access and set the following:

  1. “Allow other network users to connect through this computer’s Internet connection.
  2. Set Home networking connection to “Wireless Network Connection 2” (The connection should be Virtual WiFi Connection).
  3. Click OK to commit changes.

image

The Virtual WiFi connection should have access to Internet now:

image

Other WiFi device connect to virtual WiFi connection should be able to access the Internet immediately.

Virtual Wifi AP not started after reboot

The Windows 7 Virtual WiFi connection is not persisted when machine reboot.  You should start the virtual WiFi connection each time machine has rebooted:

C:\>netsh wlan show hostednetwork

Hosted network settings
-----------------------
    Mode                   : Allowed
    SSID name              : "MyWifi"
    Max number of clients  : 8
    Authentication         : WPA2-Personal
    Cipher                 : CCMP

Hosted network status
---------------------
    Status                 : Not started


C:\>netsh wlan start hostednetwork
The hosted network started.

Stop virtual WiFi connection

Run the command to stop connection:

C:\>netsh wlan stop hostednetwork
The hosted network stopped.

Uninstall virtual WiFi adapter

It is not necessary to uninstall virtual WiFi adapter as the uninstall is not permanent.  The virtual WiFi adapter will be installed once your reboot machine.  If you mean to uninstall the virtual WiFi adapter for current session, try this:

C:\>netsh wlan set hostednetwork mode=disallow
The hosted network mode has been set to disallow.

Side Effect: Unable to access network share after update Microsoft Virtual WiFi Miniport Adapter

There is a side effect if Microsoft Virtual Wifi Miniport Adapter has been updated.  The network share may not be accessed and “0x8004005 Unspecified error” may prompt:

image

This is due to the “Client for Microsoft Networks” service is missing from the network connection.  Reinstall service “Client for Microsoft Networks” will solve the error:

Untitled

Thursday, May 24, 2012

Linux: Disable SELINUX

Introduction

SELINUX may cause some confusion and difficulties when configuring Linux. If any weird problems encounter while configure any of the Linux services (e.g.: Samba, Firewall, ...), we may disable the SELINUX first to check if the problems are related to it.

Fedora 16

In Fedora 16, selinux no longer mount to /selinux.  It has move to /sys/fs/selinux.

  1. Temporary disable SELINUX: echo 0 >/sys/fs/selinux/enforce
  2. Temporary enable SELINUX: echo 1 >/sys/fs/selinux/enforce
  3. Permanently disable SELINUX: edit /etc/selinux/config and change "SELINUX=enforcing" to "SELINUX=disabled"

Fedora 15 or below

  1. Temporary disable SELINUX: echo 0 >/selinux/enforce
  2. Temporary enable SELINUX: echo 1 >/selinux/enforce
  3. Permanently disable SELINUX: edit /etc/selinux/config and change "SELINUX=enforcing" to "SELINUX=disabled"
Reference: How to Disable SELinux

Wednesday, May 02, 2012

Migrate Windows 7 instance to iSCSI target

Introduction

It is straight forward to install a fresh new Windows 7 instance on iSCSI target.  However, there few tricks to migrate a Windows 7 instance to iSCSI target.  Migrating an existing Windows 7 instance is a time consuming process especially for large partition size.  Doing it right will save lot of time.

Prepare Windows 7 disk volume for migration

If a Windows 7 instance has larger partition size, e.g.: Few hundred Giga bytes or Tera bytes, migrate this instance will spend lot of time transfer Windows 7 instance to iSCSI target.  Before start migrate the instance, try shrink or extend the volume size suitable for usage in near future.  Use Extend Volume… and Shrink Volume… function in Disk Management to perform the task:

image

Update Windows 7 network driver

The iSCSI operation rely heavily on the network device.  Update the network driver to latest version is not always necessary but it is advisable to do so.  Some booting process of iSCSI operation may slow down due to network driver’s problem.

Disable LightWeight Filter (LWF)

Disable LightWeight Filter (LWF) is a crucial step to make sure the migration work.  This step must perform or else the SAN boot will fail in later stage.

A Microsoft knowledge article KB967042: Windows may fail to boot from an iSCSI drive if networking hardware is changed describe the cause and solution for the problem.

There is a quick solution to disable LWF by changing some registry setting:

  1. Identify the description of Network Adapter use for iSCSI network operation in later stage:

    image
  2. Start RegEdit in administrator account.
  3. Open HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ Class\{4D36E972-E325-11CE-BFC1-08002BE10318}. There are many subkeys underneath, find and open the subkey where the DriverDesc match the NIC’s description. e.g.: 0013

    image
  4. Open the subkey Linkage and edit FilterList value:

    image
  5. There are usually two lines in FilterList:
    {0B47BB2C-86FB-4699-8906-E08465757D92}-{B5F4D659-7DAA-4565-8E41-BE220ED60542}-0000
    {0B47BB2C-86FB-4699-8906-E08465757D92}-{B70D6460-3635-4D42-B866-B8AB1A24454C}-0000
  6. Delete the line that refer to LWF driver’s UUID: {B70D6460-3635-4D42-B866-B8AB1A24454C}.  In this case:
    {0B47BB2C-86FB-4699-8906-E08465757D92}-{B5F4D659-7DAA-4565-8E41-BE220ED60542}-0000
    {0B47BB2C-86FB-4699-8906-E08465757D92}-{B70D6460-3635-4D42-B866-B8AB1A24454C}-0000

Migrate Windows 7 disk image to iSCSI target

Next, the Windows 7 is ready to image and transfer to iSCSI target.  Boot into Linux and use command line utilities like fdisk and dd to image the Windows 7 partition.

First, decide the partition size:

# fdisk -lu /dev/sdb

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xdf70df70

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *     2099200   309299199   153600000    7  HPFS/NTFS
/dev/sdb2       718899200  1953521663   617311232    f  W95 Ext'd (LBA)
/dev/sdb5       718901248  1333301247   307200000    7  HPFS/NTFS
/dev/sdb6      1333303296  1435703295    51200000    7  HPFS/NTFS
/dev/sdb7      1435705344  1953521663   258908160    7  HPFS/NTFS

In above example, the windows 7 partition is /dev/sdb1.  The sector start from 209920 and end at 309299199.  However, sector from 1 to 2099199 is necessary too as it contain the MBR code to make Windows 7 boots properly.  The total size to of Windows 7 image should start from sector 1 to 309299199.  Each sector has size 512 bytes.

# dd if=/dev/sdb of=win7.img bs=512 count=309299199

The block size of 512 bytes of above example may be slow to image the partition.  Try switch the bs and count value may accelerate the imaging process:

# dd if=/dev/sdb of=win7.img bs=309299199 count=512

Transfer win7.img to iSCSI target and perform necessary setup.  The Windows 7 instance has successfully migrate to iSCSI target.  The iSCSI target is ready to SAN boot now.

Boot iSCSI target

Once the iSCSI target is setup, use iPXE or gPXE to SAN boot the iSCSI target:

dhcp net0
        sanboot iscsi:nas.example.com::::iqn.example.com:windows-7

Reference

  1. Diskless Windows 7 iSCSI boot from OpenSolaris 2009.06 ZFS Server. URL: http://blog.zorinaq.com/?e=41
  2. Transferring the disk image to a SAN target. URL: http://www.etherboot.org/wiki/sanboot/transfer

Sunday, April 22, 2012

Install Windows XP on iSCSI target

Introduction

Unlike Windows 7 installer, Windows XP installer doesn’t support sanboot iSCSI target access.  This is the most tricky part to install Windows XP on iSCSI target.  Other problem is identify a matched network driver as all traffic will transmit over network.

Prepare a iSCSI target

First, setup a new iSCSI target for the Windows XP instance.  The minimum disk size is 2GB.  For illustration purpose, the iSCSI target in this article is

iscsi:nas.example.com::::iqn.example.com:winxp

Setup iSCSI target

Next, the iSCSI target should be formatted to NTFS file system and mark active with Windows XP utilities and tools.  These tasks may perform in existing Windows XP system or virtual machine.

To connect to iSCSI target disk in Windows XP, download Microsoft iSCSI Software Initiator Software.  Install the software in Windows XP and connect the iSCSI target:

1

Start Control Panel | Administrative Tools | Computer Management | Disk Management, the new iSCSI target disk should appear in the disk array:

2

Setup a new primary partition on the disk:

3

Assign a drive letter to the partition:

5

and format to NTFS file system:

4

Remember to mark the partition active:

6

The new iSCSI disk E:\ is ready to use now.

Prepare Windows XP setup files

To prepare windows installation from iSCSI target disk itself, use winnt32.exe in the installation CD or ISO file:

Assume drive D:\ contain the Windows XP installer:

D:\I386>winnt32 /syspart:E /tempdrive:E /makelocalsource /noreboot

The command prepare a Windows XP installation in drive E.

The next screen prompt for Installation Type.  Chose New Installation (Advanced).

7

Follow the screen instruction to complete the initial setup.

Integrate iSCSI components

After finish Windows XP installer setup, the iSCSI target disk contain the necessary Windows XP setup files and it it ready to start setup soon.  However, the Windows XP installer do not have iSCSI initiator and sanboot service nor it has matched NIC network driver.  It still not ready yet for iSCSI booting.  Our next task is integrate iSCSI initiator, sanboot service and network driver into the Windows XP installation.

First, download a third party tools IntegrateDrv to perform integration.  Extract the tools and run the command in console to perform integration:

IntegrateDrv.exe /driver=..\Drivers\PRO100\win32\NDIS5x /driver=..\Drivers\iScsiPrt\x86 /driver=..\Drivers\sanbootconf /driver=..\Drivers\nicbootconf /target=E:\

The above command install a network driver from Intel Pro100.  IntegrateDrv provides very limited network driver.  It is usually not suitable for most situation.  You should supply a matched network driver in the integration.  Most problem happen in later boot up stage are mostly related to unmatched or incompatible network driver.  Perform this step with care to make sure the iSCSI boot up success in next stage.

A network configuration may prompt to specify IP address, network mask and default gateway IP at the end of integration.  You may ignore it if there is a DHCP service in the network:

image

If everything goes well, the iSCSI target is ready to boot up and perform actual Windows XP installation.  Remember to disconnect or logoff the iSCSI target disk before perform installation:

image

Boot iSCSI target to install Windows XP

The iSCSI target disk integrated with necessary iSCSI component may now boot from target computer to perform Windows XP installation now.  From iPXE prompt during network boot up, execute these:

dhcp net0
sanboot iscsi:nas.example.com::::iqn.example.com:winxp

The iSCSI target disk should boot up to perform familiar Windows XP installation.  Follow the screen instruction to finish the installation.  During installation, the installer may prompt for unsigned driver for both iSCSI initiator and network driver, press Yes to continue the installation:

After finish installation, use the above sanboot command to start the Windows XP instance for normal daily usage.

Reference

  1. Installing Windows XP \ 2003 directly to an iSCSI target. URL: http://ipxe.org/appnote/xp_2003_direct_install
  2. Integrate mass-storage text-mode or PNP drivers into windows 2000 \ XP \ 2003 setup. URL: http://iknowu.dnsalias.com/files/public/integratedrv/IntegrateDrv.htm

Monday, April 16, 2012

FireMonkey Development Setup for iOS: Delphi XE2 Update 4

Introduction

This topic shows how to setup FireMonkey Development environment for iOS – Apple’s mobile device platform for iPhone, iPAD or iPod touch.

To continue installation, Xcode 4.2 should be ready in Mac OS X machine.

Install FireMonkey – iOS SDK

The FireMonkey iOS SDK is available in Delphi XE2 folder FireMonkey-iOS.  The following folder is a shared folder from VMware machine: %ProgramFiles(x86)\Embarcadero\RAD Studio\9.0:

Screen Shot 2012-04-14 at 9.59.25 AM

Locate FireMonkey-iOS.dmg disk image in the folder:

Screen Shot 2012-04-14 at 9.59.38 AM

Open or mount the disk image:

Screen Shot 2012-04-14 at 9.59.49 AM

Install both packages in the following sequence:

  1. fpc-2.6.0.intel-macosx.pkg
  2. FireMonkey-iOS-XE2.pkg

A new folder: Embarcadero should be created in Developer folder:

Screen Shot 2012-04-14 at 10.12.39 AM

The FireMonkey iOS SDK is ready for Xcode to compile FireMonkey iOS project now.

Reference

  1. FireMonkey Development Setup for iOS. URL: http://docwiki.embarcadero.com/RADStudio/en/FireMonkey_Development_Setup_for_iOS

Install Xcode 4.2.1 on Mac OS X

Xcode install assistant

To install Xcode on Mac OS X, download a Xcode package from Apple developer site.

Screen Shot 2012-04-14 at 9.36.26 AM

Open the package InstallXCodeLion.pkg and follow the instruction to start the installation:

Screen Shot 2012-04-14 at 9.37.01 AM

Unmount Xcode installer package

The Xcode install assistant is an installer that copy Xcode installer files into hard drive and prepare an environment for Xcode installer.  The Xcode hasn’t install yet.  Continue the steps to perform actual Xcode install.

The mounted Xcode package installer is not necessary anymore.  You may eject the mounted package:

Screen Shot 2012-04-14 at 9.43.06 AM

Install Xcode

To continue Xcode installation, locate Install Xcode icon in Applications folder:

Screen Shot 2012-04-14 at 9.45.27 AM

Follow the instructions to finish the installation:

Screen Shot 2012-04-14 at 9.45.39 AM

After finish installation, the Xcode application will appear on the Dock area:

Screen Shot 2012-04-14 at 9.57.48 AM

A new folder Developer should appear in your hard disk:

Screen Shot 2012-04-14 at 10.12.11 AM

The Xcode is now finish install, you may now start using Xcode to develop application in Apple platform:

Screen Shot 2012-04-16 at 2.00.26 PM

Mac OS X on VMware: Update 10.7.1–10.7.3

Introduction

Install update via Mac OS X Software Update function may take some time to download the update package especially when the file size is over Gigabytes.  It is a good practice to download update package and perform offline update in later stage.  If anything happen during the update process, you may redo the update again if you have snapshot your Mac OS X machine instance.

Some update involve some tricky steps to make sure the Mac OS X continue function on VMware machine.

Mac OS X Update: 10.7.1

Download Mac OS X 10.7.1 update from apple web site.  Perform the update as usual:

Screen Shot 2012-04-16 at 1.33.18 PM

Mac OS X Update: 10.7.2

Mac OS X update 10.7.2 requires extra steps to works on VMware machine.  Follow the steps to perform update:

  1. Download Mac OX X 10.7.2 update from apple web site.
  2. Start Terminal application in Mac OS X
  3. Run a command to backup folder AppleLSIFusionMPT.kext:
    # cp -r /System/Library/Extensions/AppleLSIFusionMPT.kext .
  4. Apply Mac OS X Update 10.7.2
  5. When update is done, the update installer offer to reboot machine.  Don’t reboot first but execute the following two command to restore folder AppleLSIFusionMPT.kext:
    # sudo rm -rf /System/Library/Extensions/AppleLSIFusionMPT.kext
    
    # sudo cp -r AppleLSIFusionMPT.kext /System/Library/Extensions
  6. Reboot machine and enjoy the Mac OS X 10.7.2 update.

Screen Shot 2012-04-16 at 1.46.36 PM

Mac OS X Update: 10.7.3

Mac OS X update 10.7.3 share same update steps as 10.7.2.  However, the update from 10.7 to 10.7.3 must perform in the following sequence one at a time:

  1. 10.7.1
  2. 10.7.2
  3. 10.7.3

You can’t apply 10.7.3 on 10.7 directly.  Follow the steps to perform 10.7.3 update from 10.7.2:

  1. Download Mac OX X 10.7.3 update from apple web site.
  2. Start Terminal application in Mac OS X
  3. Run a command to backup folder AppleLSIFusionMPT.kext:
    # cp -r /System/Library/Extensions/AppleLSIFusionMPT.kext .
  4. Apply Mac OS X Update 10.7.3
  5. When update is done, the update installer offer to reboot machine. Don’t reboot first but execute the following two command to restore folder AppleLSIFusionMPT.kext:
    # sudo rm -rf /System/Library/Extensions/AppleLSIFusionMPT.kext
    
    # sudo cp -r AppleLSIFusionMPT.kext /System/Library/Extensions
  6. Reboot machine and enjoy the Mac OS X 10.7.3 update.

Screen Shot 2012-04-16 at 1.53.47 PM

Reference

  1. How To Install Fully Functional Mac OS X Lion Virtual Machine inside Windows 7 [UPDATE: 10.7.3]. URL:http://www.windows7hacker.com/index.php/2011/09/how-to-install-fully-functional-mac-os-x-lion-virtual-machine-inside-windows-7/

Running Mac OS X on VMware Workstation in Windows Platform

Introduction

This simple guide is for those who want to try out Apple’s Macintosh OS X on VMware Workstation in Windows platform.  The basic requirements are:
  1. A PC running Windows x86 or x64
  2. VMware Workstation 8
  3. Download the following files:
    1. Mac OS X Lion VMware Files.exe (Size: 2.42MB)
    2. Mac OS X Lion Retail Bootable .vmdk (For VMware) (A bit torrent of size 4.12GB)

Patch VMware Workstation 8 with VMware Workstation 8.0 Darwin Unlocker Windows

Before running Mac OS X on VMware workstation, a patch should apply to some binary files of VMware workstation.
For illustration purpose, the following example will attempt to patch VMware Workstation 8 binary files:
  1. First, extract the download file Mac OS X Lion VMware files.exe.using any file archive utility like 7-Zip or double click the .exe to extract the files.
  2. Open command prompt (cmd) in Administrator Account.
  3. Navigate to extracted folder “VMware Workstation Unlocker - Windows" and run install.cmd:
M:\>cd "VMware Workstation Unlocker - Windows"

M:\VMware Workstation Unlocker - Windows>install.cmd
VMware Unlocker 1.0.0
=====================
(c) Dave Parsons 2011
Stopping VMware services...
The VMware Workstation Server service is stopping.
The VMware Workstation Server service was stopped successfully.


The VMware Authorization Service service was stopped successfully.

Creating backup folders.
...
Starting VMware services...
The VMware Authorization Service service is starting.
The VMware Authorization Service service was started successfully.

The VMware Workstation Server service is starting.
The VMware Workstation Server service was started successfully.

M:\VMware Workstation Unlocker - Windows>
The VMware workstation 8 is now patched.  You may continue the next step to configure and run Mac OS X Lion on VMware workstation 8.

Install Mac OS X Lion on VMware Workstation

Prepare a Mac OS X machine

Extract pre-configure Mac OS X Lion VMware workstation files from Mac OS X Lion VMware Files.exe in a new folder:
1
Start the virtual machine Mac OS X Lion.vmx.  A dialog prompt for the virtual machine instance state: 
2
Press “I copied it” button to state the virtual machine is a cloned instance.

Prepare Mac OS X Installation

The machine setting may change to suit the environment.  e.g.: Memory size.
Next, add Mac OS X Lion Installer disk (Mac OS X Lion Installer.vmdk) by creating a new VMware hard disk.
2

Start Mac OS X Machine

Power on the virtual machine.  A Mac OS X installation screen should appear as follow:
5

Prepare a disk for Mac OS X installation

Next, start Disk Utility to prepare a disk for Mac OS X installation:
4
Create a new Mac OS X partition  by using the Erase option.  A label for the new disk may specify in the option:
6
Confirm the Erase operation:
7

Start Mac OS X Installation

Follow the screen instruction to continue Mac OS X installation:

9

Confirm the installation on the new disk created:

10

The installation may take a while to finish:
11

Finish Mac OS X Installation

Finally, the Mac OS X installed and the first screen appear as follow:

12

Install VMware tools

VMware tools provide few GUI enhancement experience for Mac OS X guest.  Download VMware tools ISO for OS X here.  Follow the following steps to install VMware tools in OS X:
  1. Extract a ISO file (darwin.iso) from the zip archive file
  2. Mount the ISO file to Mac OS X Guest operating system

    2
  3. Start Mac OS X guest system.
  4. Open Finder from OS X desktop and select CD/DVD ROM device.

    1
  5. Double click Install VMware Tools icon to start VMware tools installation
  6. Follow the screen instruction to complete installation.

Reference

  1. How To Install Fully Functional Mac OS X Lion Virtual Machine inside Windows 7 [UPDATE: 10.7.3]. URL: http://www.windows7hacker.com/index.php/2011/09/how-to-install-fully-functional-mac-os-x-lion-virtual-machine-inside-windows-7/