Monday, October 31, 2011

Getting into a symbian mobile device using Python.(Bluetoothinteractive console using pyS60)

Like any other computing device, playing with mobile devices is always a great fun for me.
It’s almost 5-6 year’s I've been playing around with series 60 mobile devices. Previously i was using Nokia N72.
Nokia N72 has built in Symbian 2nd Edition operating system in it.
py
For last 5-6 months i am using Nokia C6-00.and believe me, It’s really a great piece of technology.
It has built in Symbian OS v9.4, Series 60 rel. 5.So it just really rocksssss.

Now lets come to the point. If you are using any series 60 device => v2.And if you are lazy enough( like me :P :P :P like Sit python, Stand Python Eat Python, Sleep python)
Then there is good news for you. Like your Linux/Windows PCs you can also run python script on your series 60 device to automate job you want. Not only automation
you can even write fully featured GUI application using for your series 60 device.


In this article i am not going to teach you how to write python script for your series 60 devices, bcoz if you already know python, there is nothing new in it.

Here i will tell you how you can execute "python shell command" on your series 60 device from your PC via Bluetooth.

So to do this you must have following things.. :P :P

1>A series S60 device With PyS60 installed in it (I will tell you how to get PyS60 later on)
2>A PC with Bluetooth connectivity.


Getting Python interpreter for your Series 60 Device:
In this link you will get all version of Pys60.Choose whatever version you want depending upon your Series 60 version.
[python]
http://www.python.org/getit/other/
https://garage.maemo.org/frs/?group_id=854
[/python]
Preparing your PC to receive python reverse shell form the mobile device:
I am assuming that you already have a working Bluetooth device attached to your PC with all the Device drivers installed.
To test if your Bluetooth device is working or not i suggest to transfer anything between your PC and Mobile Device.
And also find that both devices are discoverable.

Now go to control panel
Select Phones and Modem Option


Go to Modems Tab
Select the modem you are going to USE.



Here you will get the virtual com port through which your PC will be communicating with your Series 60 device.
In this case I will be using COM5.


Now go to start -- > Accessories --> Communications --> Hyper Terminal

Now Hyper Terminal widow should open up.



Now go to File -- > Properties



Now Select the COM port. Here I will select COM5.


Now save this setting by pressing OK
Now go to 'call" Tab and select Wait for a Call.



Now you have to enter the connection Name. Enter whatever you want and press OK.



If everything is fine you should see "Connected" and a timer in the Lower Left corner of the Hyper Terminal window.



By doing this you have successfully configured you PC to accept connection form your series 60 device.

Now in your Series 60 Device

Go to Menu open up Python.In my case i will be using Python 1.9.7.



If python is successfully installed you should get following window.



Now Go to Options and Select "Bluetooth Console".



Now you have to search for your PC and selcet your PC form the Device List.



After selecting your PC from the list if everything configured well you should see the following in your series 60 Device.



And in the Hyper Terminal Window you should get the Python Shell of your series S60 device.



BINGO!!!
Now you can execute whatever python shell command you want in your S60 device just entering the command in the hyperlink window.
Now to test the connection type these lines in Hyper Terminal:
import audio
audio.say("Hello")
If every thing is fine you should hear a voice from your phone saying "Helloooo!!!"