Android ASE: WiFi Scan with UI

Playing more with the Android Scripting Environment, I wrote a simple script to display any access points in wifi range. Once you select an SSID, it will display some basic info on that AP, such as the MAC address and encryption type. If you have a rooted phone, you could theoretically brute force an APs password using *nix iwconfig commands. The next post I will show some quick and dirty code to brute force passwords. But for now here is the script for some UI WiFi scanning.

#imports and get an object of android
import android, time
droid = android.Android()

#scan the wifi and assign vars to hold the results
#this is dirty, making sure WiFi is on, and
#toggling on if not would be better; API Browser =)
droid.wifiStartScan()
ap = droid.wifiGetScanResults()
aps = ap.result

#lists to hold the data from scan
x = []
o = []

#loop through results and grab the data we are interested in
#format the strings to be displayed in the UI
for point in aps:
  x.append(point["ssid"])
  #capabilities are the encryption, if blank there is no encryption
  if point["capabilities"] == "":
    o.append("MAC: "+point["bssid"]+"\nFreq: "+str(point["frequency"])+"\nEencryp: [OPEN]")
  else:
    o.append("MAC: "+point["bssid"]+"\nFreq: "+str(point["frequency"])+"\nEencryp: "+point["capabilities"])

#set up UI dialog, populate, and present
droid.dialogCreateAlert("WiFi Scan", None)
droid.dialogSetItems(x)
droid.dialogShow()
#this grabs what the user has selected
result = droid.dialogGetResponse().result

#if selection not null, create new UI, populate, and present
if result.has_key("item"):
  item = result["item"]
  droid.dialogCreateAlert("Basic Info", o[item])
  droid.dialogShow()

=-=-=-EDIT-=-=-=

I just rooted my phone and turns out android doesn’t have iwconfig. They use the stack some how; didn’t find a whole lot of info on it. So no bruteforcing via the terminal… I am going to look into some other method. Anyway, I’ll at least post some code going over permutations.

Advertisements

About Tech B.

I am currently employed as a tech support rep for Frontier DSL internet and Dail-Up service. If you live on the East Coast and have Frontier or the old Verizon, you may have spoken with me at one point. I do side jobs programming and building things for people. I know Python better than any language in my toolbox. I can also develop Android Apps, which are Java based. Other languages include C , VB/VB.NET, some C#, PBASIC, Batch, Javascript, and some PHP. I love microcontrollers and interfacing with the outside world. I am currently working with Arduinos, which are amazing. Also I can work with the Basic Stamp family of microcontrollers; future development includes FPGA and embedded Linux. I was going to school, but have financial issues at the moment that are keeping me from the books. I plan on going back in the next couple semesters and finishing up my Associates in IT, then perusing a BS in computer science.
This entry was posted in Uncategorized and tagged , , , , , , , , , , , . Bookmark the permalink.

2 Responses to Android ASE: WiFi Scan with UI

  1. I leave a comment each time I especially enjoy a article on a site or I have something to valuable to contribute to the conversation.
    Usually it is a result of the fire displayed in the post I browsed.
    And on this post Android ASE: WiFi Scan with UI | Personal Project Blog.
    I was actually moved enough to drop a thought 🙂 I do have some questions for you if it’s allright.
    Is it just me or does it give the impression like some of the remarks look as if they are written
    by brain dead individuals? 😛 And, if you are posting at additional social sites,
    I would like to keep up with anything fresh you have
    to post. Would you list the complete urls of all your social sites like
    your linkedin profile, Facebook page or twitter feed?

  2. Limitless_ZA says:

    I’m having a little bit of trouble with the
    result.has_key(***)
    My interpreter states it doesn’t contain the attribute has_key

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s