Вы находитесь на странице: 1из 10

AccessingPhoneDatabyPerl andBluetooth

DetlevHauschildt

Why? Lotsofdataonmobilephones:

addresses SMS'es calllog ... fiddlytoeditwithphonekeys... phonescomewithclumsydataexchange packages

But:

Couldthisbetrue...? Widelyreported Dutchsurvey:


(August2008;1017respondentsbetween 16and30)

Apparently,1in3women handcopySMS'esbefore deletingthem... Apparently,17%ofmen keepSMS'esthatcanbe usedtoblackmail somebody!

Source:http://www.nu.nl/internet/1721108/jongerenkoesteren oudesmsberichtenvideo.html

BluetoothSerialPort
Conventionalserialports:

looklike: havenameslike: /dev/ttyS0,/dev/ttyS1...orCOM1,COM2...

Bluetoothserialports:

niceexerciseinbackwardscompatibility nameslike/dev/rfcomm0,/dev/rfcomm1...orCOM5,COM6... makeBluetoothconnectionslooklikeanyconventionalserialportto softwareaccessingthem

HowtogetaBluetoothserialport?

Localdevice(ifpresent)canalwaysdoit Remotedevicemustofferit,butGSMsusuallyshould Creatingtheconnectionisataskoftheoperatingsystem,forexample: Ubuntu/Debian: sudoaptgetinstallbluetooth sudohcitoolscan (findblutoothaddrofdevice) sdptoolbrowse00::11::22:33:44:55 locatechannelnrforSerialPort rfcommconnect/dev/rfcomm0 00:11::22:33:44:552

Windows: InstallWidcommBluetoothStack FindRemoteDeviceunderEntire BluetoothNeighborhood Clickonit,toseewhetheritsays SerialPorton<device> Rightclick,connect

ChecktheCOMportunderProperties (portnrchosenabove)

Queryphoneinterminalprogram
#Queryaphoneinteractivelyinterminalprogram'minicom': #(Windows:hyperterminal) #Firstsetitupproperly CUbuntu:/home/detlev>sudominicoms #interactively: #Serialportsetup #SerialDevice: /dev/rfcomm0 #Bps/Par/Bis: 96008N1 #Savesetupasdfl #ExitfromMinicom CUbuntu:/home/detlev>minicom Welcometominicom2.3 [...] OK AT+CGMM SAMSUNGSGHG600

OK
>minicom_log_00

HowtodothisinPerl?
Threelayers: Device::SerialPort(nonWindows)or Win32::SerialPort(Windows)

replacestheterminalprogram, i.e.writesrawbytestoandreadsrawbytesfromtheserialport

Device::Modem

communicatesthroughDevice::SerialPortorWin32::SerialPort handlesanyATcommands, i.e.sendsthemtotheportandkeepscheckingforanswersuntilOKorERRORis found alsokeepstrackoftimeouts

Device::Gsm

subclassofDevice::Modem parsestheanswerstoGSMspecificATcommandsandprocessesthemintomoreuser friendlydatastructures

DemoofDevice::Modem
ShortscriptthatsendsAT+CCLK?tothephoneandshowstheanswer

assumesthatphoneisconnectedto/dev/rfcomm0

$perlmodem.plp0cAT+CCLK? question:'AT+CCLK?' +CCLK:"09/03/05,18:47:56+00" OK >sourceofmodem.pl

DemoofDevice::Gsm
ShortscriptthatshowstheanswertoAT+CCLK?,thecurrentnetworkandlistsunpacked SMSmessages:
$perlgsm.plp0cAT+CCLK? [...]sameasbefore $perlgsm.plp0cnetwork question:'network' NLKPN $perlgsm.plp0cmessagesbME "","POSTBANK","TotaalbedragoverboekingenE363,00..Volgnummer97;TANcode 737308.","29/06/0823:36:4004","0" "+33686811111","","Mijxussendismsgon...Detlev@","","1"

>sourceofgsm.pl

Summary
Steps:

TurnonBluetoothonPCandphone Associateaserialport(/dev/rfcomm0,COM5...)withthephone Toqueryphoneinteractivelystartupterminalprogramlike

minicomorhyperterminal

ToqueryphonefromPerluse Device::SerialPortorWin32::SerialPort TomakeexchangingATcommandsabiteasieruse...::SerialPortindirectly via: Device::Modem ForGSMphones,addevenmoreconveniencebyusingsubclassof Device::Modem Device::Gsm


Questions...?

Вам также может понравиться