You are on page 1of 12

HackingWithAndroid RichHoggan Introduction IwaswatchingtheYahoo/SymantecinternetmovieCybergeddonwhenitcameoutandwasintrigued bythemaincharacterChloeJocelyn,aspecialagentwiththeFBIsCyberDivision.Hollywoodhasa historyofhackermovies,yettheyalsohaveahistoryofdevelopingscenesthatfocusoncoolfactor ratherthanrealism.Asaresult,itshardtobelievethatChloeJocelynwouldbeabletoactuallyhack intoanythingwithacellphone.AndwhilethismightbethecaseforHollywood,Ifeltinspiredtofindthe tangibleinbeingabletohackwithacellphone.Withthatsaid,thisarticlewillfocusonthedevelopment ofatoolforscanninglocalWIFIaccesspointsonanAndroid. GettingStarted InordertowritesoftwarefortheAndroidplatform,wehaveacoupleofchoices. First,wecouldwriteafullblownAndroidapplicationusingJavaandAndroidsdevelopmentkit.Orfor fasterresults,wecouldwritescriptsusingPythonandSL4AorScriptingLayer4Android.

Indoingso, weareabletousetheSL4AAPIwhichincludesphonelevelaccesstobasicfeaturesthatcouldbeof interesttothoseofusinterestedinhackingwithourphones.Forexample,theAPIgivesusaccessto thephonesBlueToothsensor,theWIFIantenna,GPS,andmostothercommonsensorsandoperating systemcomponents.AnotherreasonforusingSL4Aisthefactthatitincludesmultiplescriptinglayer interpreterswhichmeanswecanpickthebestlanguagebasedonanynumberofgivenfactors. Currently,SL4AsupportsHTML,JavaScript,Python,Perl,andPHPjusttonameafew.Withthis ability,wecanpicklanguagesfortheirstrengthswithouthavingtobeconfinedtoonelanguage.Wewill beusingPythonduetothefactthatitsapowerfulscriptinglanguagebutisalsoeasytogetstartedwith. (Italsoseemedtobethelanguagewiththemostsupport).Lastly,itwillbehelpfultounderstandPython fairlywell,becausewhiletheAPIdoesgiveenoughaccessthatmostoftheunderlyingcodecanbe ignored,itsstillanAPImeantfordevelopers.ThisessentiallymeansthatwhatsreturnedfromanAPI callmightnotbecompletelyuseableandmightrequirefurthercodeinordertomakesenseofthe output. Onafinalnotebeforewegetstarted,installingSL4Acanbeaccomplishedbygoing totheassociatedGoogleCodewebsitewhichcanbefoundathttp://code.google.com/ p/androidscripting/.SimplyclickDownloadswhileinyourAndroidsbrowseranddownloadtheSL4A applicationtoyourphone.Oncedownloadedandinstalled,downloadthedesiredinterpretersandinstall

thoseaswellthesecanbefoundontheDownloadspageaswell.Withthesedownloaded,the interpretersinstallerswillappearinyourapplicationsmenu.Atthispoint,taponthemandtapInstallto ensurethattheinterpretersareinstalledandreadyforusewithinSL4A.StarttheSL4Aapplication,and ifeverythingwasinstalledsuccessfully,thedemoscriptswillappearinthemainwindow.Tryanyof thesetodetermineifeverythingisrunningasitshould.Ifnot,doublebackthroughyourinstallation process.Finally,figure1isanexampleofwhatSL4Alookslikewhenrunning. [Figure1SL4A]DevelopingAWIFIScanner

LookingattheSL4AAPI(http://code.google.com/p/androidscripting/wiki/ApiReference)wecometo asectionentitledWifiFacade.WhenIstumbleduponthissectionoftheAPI,Iimmediatelyrealized thataWIFIscannercouldbedevelopedwithverylittlecode.Andtomyamazement,Iwasright becausemostoftheunderlyingcodeishandledintheAPIcalls.Moreover,thescanresultsreturnthe levelofencryptiondeployedontheaccesspointwhichmakesiteasytoseewhichareusingWEPand, betteryet,whichhavenoencryptionatall.Unfortunatelythough,thisisoneofthosecaseswherethe outputreturnedisnotextremelyusefulmainlybecauseitsabloboftextthatisnoteasilyread.

However,inordertodevelopthistoolwehavetouseafewAPIcallsincludingcheckWifiState(), wifiStartScan(),andwifiGetScanResults(). [Figure2WIFIScannerSourceCodeSeeApendix] Figure2isalistingofthesourcecodeforWifiFinder.Thetooliscomprisedofafewbasicfunctions, scanningforaccesspoints,displayingtheclosestaccesspointtothescreen,andwritingallthereturned accesspointstoanXMLfileforlateranalysis.TheapplicationfirstcheckswhetherornottheWIFI antennaisactive.ThischeckisperformedbythecheckWifiState()function,andiftheantennaisnt activethenscanningwontbestartedandanerrormessageisdisplayedtotheuser.If,however,the antennaisactive,scanningstartsbycallingthewifiStartScan()functionwhichhasasimilarcheckin placetomakesurethescanreturnedwithouterrors.Ifthescanreturnssuccessfully,theresultsarethen returnedfromwifiGetScanResults()andstoredinappropriatedatastructuresbeforebeingpushedtothe screenandwrittentotheXMLfile. [Figure3wifiGetScanResults()defaultoutput]

[Figure4DataStructures] forcurrentinaccessPointTokensString: #StoreeachaccesspointintheaccessPointsArrayfor#furtherprocessing accessPointsArray.append(current) totalAccessPoints=totalAccessPoints+1

Figure3showswhatthedefaultoutputlookslikewhenreturnedbythewifiGetScanResults()APIcall. Ascanbeseen,itwouldtakefartoolongtounderstandtheoutputandalsotheoutputisdisplayedina Dictionaryformat.Essentially,thismeansthatthereturnedoutputisaccessiblethroughakey/valuepair relationship.Forexample,wecouldaccesseachoftheaccesspointscomponentsbyreferencingthe appropriatekeysuchasssid,capabilities,orfrequency. [Figure5ClosestAccessPoint] forcurrentinaccessPointsArray: #IteratethroughaccessPointsArrayanddeterminewhichlevelreading #wastheclosest currentLevel=current['level'] levels.append(currentLevel) #Determineifthelevelslisthasanyvalues iflen(levels)>0: lowestLevel=max(levels) else: printError("noValues") #IteratethroughaccessPointsArrayandmatchlowestLevel #tocurrent['level'] forcurrentinaccessPointsArray: ifcurrent['level']==lowestLevel: #Printaccesspoint'sdatatothescreenprint"['ssid']:",current['ssid'] print"['capabilities']:",current['capabilities']print"['frequency']",current['frequency'] print"['bssid']:",current['bssid'] print"['level']:",current['level'] Withtheabilitytoaccesseachcomponentoftheaccesspointseparately,weareabletoisolatecertain piecesofinformationforfurtherprocessing.Forexample,wecaniteratethroughthelevelcomponentof eachaccesspointandcalculatewhichaccesspointwasclosestatthetimeofscanning,orwecould iteratethroughthecapabilitiesofeachaccesspointanddeterminewhichisusingWEPauthentication. Figure5illustrateshowwecangoaboutcalculatingtheclosestaccesspoint.Thefirstthingthecode doesiscopyeachsignallevelvalueintoanarray.Atthispoint,wecheck todetermineifthereareanylevelsstoredinthearray,andifso,wecansetthelowestLevelvariableto thevaluereturnedbythemax()function.Finally,wecaniterateoverthearraylistandprintoutthe

accesspointdataassociatedwiththesignallevelwhichinturnistheclosestaccesspoint.Nowthis wouldseemtobecounterintuitive,butwhendealingwithsignallevelssuchasthoseassociatedwith routers,thecloserthenumberisto0,intheory,thecloseritistothephonesWIFIantenna.Itshould benotedhoweverthatthisisnotasurefirewayoffindingtheclosestaccesspointinthatits merelyprovidingaroughestimateandisnotintendedforprecision.

[Figure6XMLOutputFormat] #Writeaccesspointstoafileonthesdcardanddeterminewhich#authenticationmeasuresarebeing implementedforcurrentinaccessPointsArray: #IteratethroughaccessPointsArray,accesseachdictionary#andprintouteachaccesspointcomponent """ GenerateXMLstringsusingthefollowingformat:<accesspoint> <ssid></ssid> <bssid></bssid> <capabilities></capabilities><currentfrequency></currentfrequency><currentlevel></currentlevel> </accesspoint> """ currentSSID="\t\t<ssid>"+str(current['ssid'])+"</ssid>\n" currentBSSID="\t\t<bssid>"+str(current['bssid'])+"</bssid>\n" currentCapabilities="\t\t<capabilities>"+str(current['capabilities'])+"</capabilities>\n" currentFrequency="\t\t<frequency>"+str(current['frequency'])+"</frequency>\n" currentLevel="\t\t<level>"+str(current['level'])+"</level>\n" #WritexmlstringstothefilefileWriter.write("\t<accesspoint>\n")file Writer.write(currentSSID)fileWriter.write(currentBSSID)fileWriter.write(currentCapabilities) fileWriter.write(currentFrequency)fileWriter.write(currentLevel)fileWriter.write("\t</accesspoint>\n") #Writetheendofthexmlfilefile Writer.write("</accesspoints>\n") ThelastfunctionalitywewilltalkaboutiswritingthereturnedaccesspointstoanXMLfile.Thereis nothingspecialaboutwritingtheXMLfileaswearemerelydevelopingXMLtagsfordescribingeach accesspointscomponents.Andwhilethiscanbeusefulforanalyzingcaptureddatausingothertools, wecouldwritetoatextfileaswellwhichmakesforeasierviewingofalltheaccesspoints.Butbecause wearewritingfiles,itsimportanttotakeamomentanddiscusshowfilesarestoredinSL4A.Atypical filepathtowherescriptsarestoredissl4a/scripts/.ThiswillusuallybeestablishedwhenSL4Ais

installed,yetanotheroptionistoinstallSL4AontoanSDcardwhichwillkeepeverythingportable especiallybecauseitspossibletowritePythoncodeinastandardIDEortexteditorandhavepure Pythoncoderunfortestingpurposesonthenativemachine(thisisnotsoforanySL4AAPIcalls, however,inthattheyhavetoruninSL4Aunlessemulated).Inthiscase,thefilepathwillbe sdcard/sl4a/scripts.Therearenohardandfastrulesaboutwheretokeepscriptsasidefromthebase filepathaspreviouslydescribed.Keepingyourscriptsorganizedwillbehelpfulwhendeterminingwhere tostoreoutputfilesthough.Figure6showsanexampleofXMLoutput. [Figure7XMLoutput]

[Figure8WIFIFinderRunning]

Finally,infigure7weseeanexampleofournewlymintedtoolupandrunning.Asyoucanseethereis nofancyuserinterface,andtheredoesntneedtobe.Theonlythingonthescreenisinformation.Inits currentstate,theapplicationdoesntconstantlyreturntheclosestaccesspoint,norconstantlyscanfor accesspointswhichcould beconsideredasetbackseeingashowyoullhavetokeeprunningtheapplicationtorefreshscan results.Whichbringsustoourlastpointusability.Currently,theapplicationhasbugsinitsuchas inconsistentresultsfromtheWIFIantennainthatitwouldscanandsometimesitwouldnt.Ontopof that,wearerunningadevelopmentplatformthatitself,neverleftAlpha.AndfromwhatIveseen,there hasntbeenthatmuchforwardmovementonfurtheringSL4A.Whatdoesthisallmean?Thismeansthat thetoolsbeingdevelopedrunandhaveanactualpurpose,buttheyarebeingdevelopedandrunonan experimentalplatform.Similarly,noguaranteescanbegiventhattheywillrunoneveryAndroidphone thatcouldbeencountered.Butthereisalightattheendofthetunnelbecausetheyweretestedon newerphonesandseemedtorunwithoutincident. Conclusions Aswehaveseeninthisarticle,itspossibletodeveloptoolsusingSL4AandPythonthatcanrunon Andrioddevices.Similarly,itspossibletohaveaccesstostandardPythonprogrammingfunctionality withinSL4Awhichallowsformorepowerfulmobileapplications.Moreso,wehavedevelopedafully mobileapplication.Thismeansthatwecanruntheappwhileridingonabus.Itsalsoquiteeasytosee thepotentialindevelopingtoolsonthisplatformbecauseattheendoftheday,itlookslikeweare

simplyplayingonourphones.Anddetectionisthenameofthegamewhenattemptingtoeffectively defensivelyoroffensivelyassesssecurity. Itdoesntlooklikemuchrightnow,andobviouslymorecommerciallyavailableoptionsarestillthemost effective,butthemobileplatformissurelybecomingtheprimarymeansofstayingproductiveinsociety andthismeansadvancingallaspectsoftechnologyincludingsecuritytoolsespeciallywheretheyrun.In otherwords,thisisnttheendinasmuchasitsthebeginning. ApendixAFullSourceCode


# A p p l i c a t i o n : W I F I F i n d e r # D e v e l o p e r : R i c h H o g g a n # C r e a t i o n D a t e : 1 0 0 3 2 0 1 2 " " " D e s c r i p t i o n : W I F I F i n d e r s c a n s f o r W I F I a c c e s s p o i n t s a n d p r i n t s d a t a a b o u t t h e c l o s e s t a c c e s s p o i n t a s w e l l a s s c a n s t a t i s t i c s . L a s t M o d i f i c a t i o n D a t e : 1 0 2 7 2 0 1 2 M o d i f i c a t i o n D e s c r i p t i o n s : 1 0 0 5 2 0 1 2 A d d e d c o d e f o r r e a d i n g G P S s e n s o r w h e n c l o s e s t a c c e s s p o i n t i s f o u n d . 1 0 2 7 2 0 1 2 O u t p u t n o w w r i t e s t o a n X M L f i l e . A l s o o p t i m i z e d f i l e h a n d l i n g . " " " # C o m p a t i b i l i t y : # O p e r a t i n g S y s t e m : A n d r o i d 2 . 2 + ( W / S L 4 A I n s t a l l e d ) # P y t h o n V e r s i o n : 2 . 6 # P y t h o n I s s u e s : N / A # # # I m p o r t D i r e c t i v e s # # # i m p o r t s y s i m p o r t p l a t f o r m i m p o r t a n d r o i d " " " F u n c t i o n C o d e " " " # F u n c t i o n N a m e : p r i n t P r o g r a m I n f o r m a t i o n ( ) # F u n c t i o n D e s c r i p t i o n : P r i n t s t h e p r o g r a m ' s i n i t i a l i n f o r m a t i o n d e f p r i n t P r o g r a m I n f o r m a t i o n ( ) : p r i n t " W i f i F i n d e r " p r i n t " D e v e l o p e d B y : R i c h H o g g a n C 2 0 1 2 " " " " F u n c t i o n N a m e : p r i n t E r r o r ( ) F u n c t i o n D e s c r i p t i o n : P r i n t s a n e r r o r m e s s a g e b a s e d o n t h e e r r o r f l a g

A l l o w e d a r u g m e n t s : i n p u t E r r o r c h e c k S t a t e F a i l e d c o n n e c t i o n I n f o F a i l e d s c a n F a i l e d " " " d e f p r i n t E r r o r ( e r r o r F l a g ) : i f e r r o r F l a g = = " i n p u t E r r o r " : p r i n t " I n v a l i d i n p u t . D o u b l e c h e c k y o u r i n p u t a n d t r y a g a i n . " e l i f e r r o r F l a g = = " c h e c k S t a t e F a i l e d " : p r i n t " W I F I s t a t e c h e c k f a i l e d . T r y a g a i n l a t e r . " e l i f e r r o r F l a g = = " c o n n e c t i o n I n f o F a i l e d " : p r i n t " C o u l d n o t r e t r e i v e c o n n e c t i o n i n f o r m a t i o n . " e l i f e r r o r F l a g = = " s c a n F a i l e d " : p r i n t " W I F I s c a n c o u l d n o t b e c o m p l e t e d . T r y a g a i n l a t e r . " e l i f e r r o r F l a g = = " n o V a l u e s " : p r i n t " N o a c c e s s p o i n t l e v e l s w e r e f o u n d . " e l s e : p r i n t " I n v a l i d a r g u m e n t w a s p a s s e d t o p r i n t E r r o r ( ) f u n c t i o n . " " " " F u n c t i o n N a m e : p r i n t S t a t u s ( ) F u n c t i o n D e s c r i p t i o n : P r i n t s a s t a t u s m e s s a g e b a s e d o n t h e s t a t u s f l a g A l l o w e d a r u g m e n t s : c h e c k i n g W i f i S t a t e s t a r t i n g S c a n a c c e s s P o i n t s F o u n d " " " d e f p r i n t S t a t u s ( s t a t u s F l a g ) : i f s t a t u s F l a g = = " c h e c k i n g W i f i S t a t e " : p r i n t " " p r i n t " C h e c k i n g p h o n e ' s W I F I s t a t e . . . " e l i f s t a t u s F l a g = = " s t a r t i n g S c a n " : p r i n t " S t a r t i n g a c c e s s p o i n t s c a n . . . " e l i f s t a t u s F l a g = = " a c c e s s P o i n t s F o u n d " : p r i n t " A c c e s s p o i n t s w e r e f o u n d . . . " p r i n t " D i s p l a y i n g p o s s i b l e a c c e s s p o i n t s " e l s e : p r i n t " I n v a l i d a r g u m e n t w a s p a s s e d t o p r i n t S t a t u s ( ) f u n c t i o n . " " " " A p p l i c a t i o n C o d e " " " # V a r i a b l e a n d o b j e c t d e c l a r a t i o n s g e t W i f i S t a t e = " " g e t S c a n R e s u l t s = " " s c a n S t a r t = " " e r r o r F l a g = " "

a c c e s s P o i n t T o k e n s S t r i n g = " " a c c e s s P o i n t s A r r a y = [ ] s p l i t = " " c u r r e n t = " " t o t a l A c c e s s P o i n t s = 0 c o u n t e r = 0 c l o s e s t A c c e s s P o i n t = 0 a c c e s s P o i n t G e o L o c a t i o n = " " l o w e s t L e v e l = 0 l e v e l s = [ ] t e s t i n g = " " # F i l e v a r i a b l e s c u r r e n t S S I D = " " c u r r e n t C a p a b i l i t i e s = " " c u r r e n t F r e q u e n c y = " " c u r r e n t B S S I D = " " c u r r e n t L e v e l = " " # A n d r o i d o b j e c t v a r i a b l e s d r o i d = a n d r o i d . A n d r o i d ( ) p r i n t P r o g r a m I n f o r m a t i o n ( ) # C r e a t e f i l e o b j e c t f i l e W r i t e r = o p e n ( " / s d c a r d / s l 4 a / s c r i p t s / d e v e l o p m e n t / M o b i l e D e v e l o p m e n t / W I F I F i n d e r / a c c e s s _ p o i n t s . x m l " , " w " ) # D e t e r m i n e t h e p h o n e ' s w i f i s t a t e p r i n t S t a t u s ( " c h e c k i n g W i f i S t a t e " ) g e t W i f i S t a t e = d r o i d . c h e c k W i f i S t a t e ( ) i f g e t W i f i S t a t e : # I f s t a t e c h e c k p a s s e s , p r i n t m e s s a g e a n d s t a r t # s c a n n i n g f o r w i f i n e t w o r k s p r i n t S t a t u s ( " s t a r t i n g S c a n " ) s c a n S t a r t = d r o i d . w i f i S t a r t S c a n ( ) i f s c a n S t a r t : # I f w i f i s c a n p a s s e d , p r i n t m e s s a g e a n d f o r m a t # o u t p u t f o r v i e w i n g p r i n t S t a t u s ( " a c c e s s P o i n t s F o u n d " ) # P a s s g e t S c a n R e s u l t s t o a c c e s s P o i n t T o k e n s S t r i n g a r r a y g e t S c a n R e s u l t s = d r o i d . w i f i G e t S c a n R e s u l t s ( ) a c c e s s P o i n t T o k e n s S t r i n g = g e t S c a n R e s u l t s [ 1 ] # B u i l d d a t a s t r u c t u r e f o r s t o r i n g a c c e s s p o i n t i n f o r m a t i o n p r i n t " A l l A c c e s s P o i n t s R e t u r n e d F r o m S c a n : "

f o r c u r r e n t i n a c c e s s P o i n t T o k e n s S t r i n g : # S t o r e e a c h a c c e s s p o i n t i n t h e a c c e s s P o i n t s A r r a y f o r # f u r t h e r p r o c e s s i n g a c c e s s P o i n t s A r r a y . a p p e n d ( c u r r e n t ) t o t a l A c c e s s P o i n t s = t o t a l A c c e s s P o i n t s + 1 p r i n t " " # B e g i n X M L f i l e f i l e W r i t e r . w r i t e ( " < ? x m l v e r s i o n = ' 1 . 0 ' ? > \ n " ) f i l e W r i t e r . w r i t e ( " < a c c e s s p o i n t s > \ n " ) # W r i t e a c c e s s p o i n t s t o a f i l e o n t h e s d c a r d a n d d e t e r m i n e w h i c h # a u t h e n t i c a t i o n m e a s u r e s a r e b e i n g i m p l e m e n t e d f o r c u r r e n t i n a c c e s s P o i n t s A r r a y : # I t e r a t e t h r o u g h a c c e s s P o i n t s A r r a y , a c c e s s e a c h d i c t i o n a r y # a n d p r i n t o u t e a c h a c c e s s p o i n t c o m p o n e n t " " " G e n e r a t e X M L s t r i n g s u s i n g t h e f o l l o w i n g f o r m a t : < a c c e s s p o i n t > < s s i d > < / s s i d > < b s s i d > < / b s s i d > < c a p a b i l i t i e s > < / c a p a b i l i t i e s > < c u r r e n t f r e q u e n c y > < / c u r r e n t f r e q u e n c y > < c u r r e n t l e v e l > < / c u r r e n t l e v e l > < / a c c e s s p o i n t > " " " c u r r e n t S S I D = " \ t \ t < s s i d > " + s t r ( c u r r e n t [ ' s s i d ' ] ) + " < / s s i d > \ n " c u r r e n t B S S I D = " \ t \ t < b s s i d > " + s t r ( c u r r e n t [ ' b s s i d ' ] ) + " < / b s s i d > \ n " c u r r e n t C a p a b i l i t i e s = " \ t \ t < c a p a b i l i t i e s > " + s t r ( c u r r e n t [ ' c a p a b i l i t i e s ' ] ) + " < / c a p a b i l i t i e s > \ n " c u r r e n t F r e q u e n c y = " \ t \ t < f r e q u e n c y > " + s t r ( c u r r e n t [ ' f r e q u e n c y ' ] ) + " < / f r e q u e n c y > \ n " c u r r e n t L e v e l = " \ t \ t < l e v e l > " + s t r ( c u r r e n t [ ' l e v e l ' ] ) + " < / l e v e l > \ n " # W r i t e x m l s t r i n g s t o t h e f i l e f i l e W r i t e r . w r i t e ( " \ t < a c c e s s p o i n t > \ n " ) f i l e W r i t e r . w r i t e ( c u r r e n t S S I D ) f i l e W r i t e r . w r i t e ( c u r r e n t B S S I D ) f i l e W r i t e r . w r i t e ( c u r r e n t C a p a b i l i t i e s ) f i l e W r i t e r . w r i t e ( c u r r e n t F r e q u e n c y ) f i l e W r i t e r . w r i t e ( c u r r e n t L e v e l ) f i l e W r i t e r . w r i t e ( " \ t < / a c c e s s p o i n t > \ n " ) # W r i t e t h e e n d o f t h e x m l f i l e

f i l e W r i t e r . w r i t e ( " < / a c c e s s p o i n t s > \ n " ) # D e t e r m i n e w h i c h a c c e s s p o i n t i s t h e c l o s e s t p r i n t " C l o s e s t A c c e s s P o i n t : " p r i n t " " f o r c u r r e n t i n a c c e s s P o i n t s A r r a y : # I t e r a t e t h r o u g h a c c e s s P o i n t s A r r a y a n d d e t e r m i n e w h i c h l e v e l r e a d i n g # w a s t h e c l o s e s t c u r r e n t L e v e l = c u r r e n t [ ' l e v e l ' ] l e v e l s . a p p e n d ( c u r r e n t L e v e l ) # D e t e r m i n e i f t h e l e v e l s l i s t h a s a n y v a l u e s i f l e n ( l e v e l s ) > 0 : l o w e s t L e v e l = m a x ( l e v e l s ) e l s e : p r i n t E r r o r ( " n o V a l u e s " ) # I t e r a t e t h r o u g h a c c e s s P o i n t s A r r a y a n d m a t c h l o w e s t L e v e l # t o c u r r e n t [ ' l e v e l ' ] f o r c u r r e n t i n a c c e s s P o i n t s A r r a y : i f c u r r e n t [ ' l e v e l ' ] = = l o w e s t L e v e l : # W h e n t h e c l o s e t a c c e s s p o i n t i s f o u n d , r e a d t h e G P S s e n s o r ' s # c u r r e n t l o c a t i o n # a c c e s s P o i n t G e o L o c a t i o n = d r o i d . r e a d L o c a t i o n ( ) # P r i n t a c c e s s p o i n t ' s d a t a t o t h e s c r e e n p r i n t " [ ' s s i d ' ] : " , c u r r e n t [ ' s s i d ' ] p r i n t " [ ' c a p a b i l i t i e s ' ] : " , c u r r e n t [ ' c a p a b i l i t i e s ' ] p r i n t " [ ' f r e q u e n c y ' ] " , c u r r e n t [ ' f r e q u e n c y ' ] p r i n t " [ ' b s s i d ' ] : " , c u r r e n t [ ' b s s i d ' ] p r i n t " [ ' l e v e l ' ] : " , c u r r e n t [ ' l e v e l ' ] # p r i n t " L a s t k n o w n l o c a t i o n : " , a c c e s s P o i n t G e o L o c a t i o n # C l o s e f i l e o b j e c t s f i l e W r i t e r . c l o s e ( ) e l s e : p r i n t E r r o r ( " s c a n F a i l e d " ) e l s e : p r i n t E r r o r ( " c h e c k S t a t e F a i l e d " )

You might also like