├── .gitignore ├── AndroidManifest.xml ├── README.md ├── build.xml ├── libs ├── android-support-v4.jar └── google-play-services.jar ├── proguard-project.txt ├── project.properties ├── res ├── drawable-hdpi │ ├── ic_action_usbdev.png │ ├── ic_arrow_down_blue.png │ ├── ic_arrow_down_green.png │ ├── ic_arrow_down_orange.png │ ├── ic_arrow_right_blue.png │ ├── ic_arrow_right_green.png │ ├── ic_arrow_right_orange.png │ ├── ic_arrow_up_blue.png │ ├── ic_arrow_up_green.png │ ├── ic_arrow_up_orange.png │ ├── ic_bars_blue.png │ ├── ic_bars_four.png │ ├── ic_bars_green.png │ ├── ic_bars_none.png │ ├── ic_bars_one.png │ ├── ic_bars_orange.png │ ├── ic_bars_red.png │ ├── ic_bars_three.png │ ├── ic_bars_two.png │ ├── ic_launcher.png │ ├── ic_stat_usbdev.png │ ├── ic_wifi_blue.png │ ├── ic_wifi_green.png │ ├── ic_wifi_orange.png │ └── ic_wifi_red.png ├── drawable-ldpi │ ├── ic_action_usbdev.png │ ├── ic_arrow_down_blue.png │ ├── ic_arrow_down_green.png │ ├── ic_arrow_down_orange.png │ ├── ic_arrow_right_blue.png │ ├── ic_arrow_right_green.png │ ├── ic_arrow_right_orange.png │ ├── ic_arrow_up_blue.png │ ├── ic_arrow_up_green.png │ ├── ic_arrow_up_orange.png │ ├── ic_bars_blue.png │ ├── ic_bars_four.png │ ├── ic_bars_green.png │ ├── ic_bars_none.png │ ├── ic_bars_one.png │ ├── ic_bars_orange.png │ ├── ic_bars_red.png │ ├── ic_bars_three.png │ ├── ic_bars_two.png │ ├── ic_launcher.png │ ├── ic_stat_usbdev.png │ ├── ic_wifi_blue.png │ ├── ic_wifi_green.png │ ├── ic_wifi_orange.png │ └── ic_wifi_red.png ├── drawable-mdpi │ ├── ic_action_usbdev.png │ ├── ic_arrow_down_blue.png │ ├── ic_arrow_down_green.png │ ├── ic_arrow_down_orange.png │ ├── ic_arrow_right_blue.png │ ├── ic_arrow_right_green.png │ ├── ic_arrow_right_orange.png │ ├── ic_arrow_up_blue.png │ ├── ic_arrow_up_green.png │ ├── ic_arrow_up_orange.png │ ├── ic_bars_blue.png │ ├── ic_bars_four.png │ ├── ic_bars_green.png │ ├── ic_bars_none.png │ ├── ic_bars_one.png │ ├── ic_bars_orange.png │ ├── ic_bars_red.png │ ├── ic_bars_three.png │ ├── ic_bars_two.png │ ├── ic_launcher.png │ ├── ic_stat_usbdev.png │ ├── ic_wifi_blue.png │ ├── ic_wifi_green.png │ ├── ic_wifi_orange.png │ └── ic_wifi_red.png ├── drawable-xhdpi │ ├── ic_action_usbdev.png │ ├── ic_arrow_down_blue.png │ ├── ic_arrow_down_green.png │ ├── ic_arrow_down_orange.png │ ├── ic_arrow_right_blue.png │ ├── ic_arrow_right_green.png │ ├── ic_arrow_right_orange.png │ ├── ic_arrow_up_blue.png │ ├── ic_arrow_up_green.png │ ├── ic_arrow_up_orange.png │ ├── ic_bars_blue.png │ ├── ic_bars_four.png │ ├── ic_bars_green.png │ ├── ic_bars_none.png │ ├── ic_bars_one.png │ ├── ic_bars_orange.png │ ├── ic_bars_red.png │ ├── ic_bars_three.png │ ├── ic_bars_two.png │ ├── ic_launcher.png │ ├── ic_stat_usbdev.png │ ├── ic_wifi_blue.png │ ├── ic_wifi_green.png │ ├── ic_wifi_orange.png │ └── ic_wifi_red.png ├── drawable │ ├── ic_arrow_blue.xml │ ├── ic_arrow_green.xml │ └── ic_arrow_orange.xml ├── layout │ ├── activity_main.xml │ ├── expandlist_child_item.xml │ ├── expandlist_group_item.xml │ ├── fragment_historical.xml │ ├── fragment_overview.xml │ └── wifiscanresult_list_row.xml ├── menu │ └── activity_main.xml ├── values-v11 │ └── styles.xml ├── values-v14 │ └── styles.xml └── values │ ├── attrs.xml │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ ├── styles.xml │ └── text.xml └── src └── com └── blueodin └── wifisniffer ├── MainActivity.java ├── adapters └── NetworkExpandableListAdapter.java ├── fragments ├── HistoricalFragment.java ├── MainDetailFragment.java ├── MapDetailFragment.java ├── OverviewFragment.java └── WifiListFragment.java ├── helpers ├── DBHelper.java └── WifiScanResultAdapter.java └── providers ├── ScanResultsProvider.java ├── WifiScanContract.java └── WifiScanResult.java /.gitignore: -------------------------------------------------------------------------------- 1 | # built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # files for the dex VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # generated files 12 | bin/ 13 | gen/ 14 | 15 | # Local configuration files (sdk path, etc) 16 | local.properties 17 | 18 | # Eclipse project files 19 | .classpath 20 | .project 21 | .settings/ 22 | 23 | # VIM swap files 24 | .*.sw[po] 25 | _*.sw[po] 26 | 27 | # Old source files 28 | old/ 29 | -------------------------------------------------------------------------------- /AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 24 | 25 | 26 | 27 | 30 | 31 | 36 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 50 | 51 | 52 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | WifiSniffer 2 | ======== 3 | 4 | Overview 5 | ---------- 6 | 7 | A tool providing a graphical representation of collected wireless data. Still in the early stages of development, this application hopes to one day provide security analysts with a means to process large amounts of wireless network data and generate meaningful statistics and graphs. 8 | 9 | 10 | Thanks To 11 | ---------- 12 | 13 | - [Jonas Gehring](https://github.com/jjoe64) For his work creating the Android [GraphView](https://github.com/jjoe64/GraphView) library 14 | - [Mark Wei](https://github.com/pingpongboss) For his work on the amazing [StandOut](https://github.com/pingpongboss/StandOut) library 15 | 16 | Contributing 17 | ---------- 18 | 19 | Have an idea? I would love to hear any feedback or ideas anyone might have. 20 | 21 | This project is available on [GitHub](https://github.com/jhannah01/WifiSniffer). 22 | -------------------------------------------------------------------------------- /build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 29 | 30 | 31 | 35 | 36 | 37 | 38 | 39 | 40 | 49 | 50 | 51 | 52 | 56 | 57 | 69 | 70 | 71 | 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/libs/android-support-v4.jar -------------------------------------------------------------------------------- /libs/google-play-services.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/libs/google-play-services.jar -------------------------------------------------------------------------------- /proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=Google Inc.:Google APIs:17 15 | android.library.reference.1=../git/GraphView 16 | -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_action_usbdev.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-hdpi/ic_action_usbdev.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_arrow_down_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-hdpi/ic_arrow_down_blue.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_arrow_down_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-hdpi/ic_arrow_down_green.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_arrow_down_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-hdpi/ic_arrow_down_orange.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_arrow_right_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-hdpi/ic_arrow_right_blue.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_arrow_right_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-hdpi/ic_arrow_right_green.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_arrow_right_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-hdpi/ic_arrow_right_orange.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_arrow_up_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-hdpi/ic_arrow_up_blue.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_arrow_up_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-hdpi/ic_arrow_up_green.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_arrow_up_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-hdpi/ic_arrow_up_orange.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_bars_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-hdpi/ic_bars_blue.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_bars_four.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-hdpi/ic_bars_four.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_bars_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-hdpi/ic_bars_green.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_bars_none.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-hdpi/ic_bars_none.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_bars_one.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-hdpi/ic_bars_one.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_bars_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-hdpi/ic_bars_orange.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_bars_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-hdpi/ic_bars_red.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_bars_three.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-hdpi/ic_bars_three.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_bars_two.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-hdpi/ic_bars_two.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_stat_usbdev.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-hdpi/ic_stat_usbdev.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_wifi_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-hdpi/ic_wifi_blue.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_wifi_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-hdpi/ic_wifi_green.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_wifi_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-hdpi/ic_wifi_orange.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_wifi_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-hdpi/ic_wifi_red.png -------------------------------------------------------------------------------- /res/drawable-ldpi/ic_action_usbdev.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-ldpi/ic_action_usbdev.png -------------------------------------------------------------------------------- /res/drawable-ldpi/ic_arrow_down_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-ldpi/ic_arrow_down_blue.png -------------------------------------------------------------------------------- /res/drawable-ldpi/ic_arrow_down_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-ldpi/ic_arrow_down_green.png -------------------------------------------------------------------------------- /res/drawable-ldpi/ic_arrow_down_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-ldpi/ic_arrow_down_orange.png -------------------------------------------------------------------------------- /res/drawable-ldpi/ic_arrow_right_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-ldpi/ic_arrow_right_blue.png -------------------------------------------------------------------------------- /res/drawable-ldpi/ic_arrow_right_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-ldpi/ic_arrow_right_green.png -------------------------------------------------------------------------------- /res/drawable-ldpi/ic_arrow_right_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-ldpi/ic_arrow_right_orange.png -------------------------------------------------------------------------------- /res/drawable-ldpi/ic_arrow_up_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-ldpi/ic_arrow_up_blue.png -------------------------------------------------------------------------------- /res/drawable-ldpi/ic_arrow_up_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-ldpi/ic_arrow_up_green.png -------------------------------------------------------------------------------- /res/drawable-ldpi/ic_arrow_up_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-ldpi/ic_arrow_up_orange.png -------------------------------------------------------------------------------- /res/drawable-ldpi/ic_bars_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-ldpi/ic_bars_blue.png -------------------------------------------------------------------------------- /res/drawable-ldpi/ic_bars_four.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-ldpi/ic_bars_four.png -------------------------------------------------------------------------------- /res/drawable-ldpi/ic_bars_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-ldpi/ic_bars_green.png -------------------------------------------------------------------------------- /res/drawable-ldpi/ic_bars_none.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-ldpi/ic_bars_none.png -------------------------------------------------------------------------------- /res/drawable-ldpi/ic_bars_one.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-ldpi/ic_bars_one.png -------------------------------------------------------------------------------- /res/drawable-ldpi/ic_bars_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-ldpi/ic_bars_orange.png -------------------------------------------------------------------------------- /res/drawable-ldpi/ic_bars_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-ldpi/ic_bars_red.png -------------------------------------------------------------------------------- /res/drawable-ldpi/ic_bars_three.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-ldpi/ic_bars_three.png -------------------------------------------------------------------------------- /res/drawable-ldpi/ic_bars_two.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-ldpi/ic_bars_two.png -------------------------------------------------------------------------------- /res/drawable-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-ldpi/ic_stat_usbdev.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-ldpi/ic_stat_usbdev.png -------------------------------------------------------------------------------- /res/drawable-ldpi/ic_wifi_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-ldpi/ic_wifi_blue.png -------------------------------------------------------------------------------- /res/drawable-ldpi/ic_wifi_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-ldpi/ic_wifi_green.png -------------------------------------------------------------------------------- /res/drawable-ldpi/ic_wifi_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-ldpi/ic_wifi_orange.png -------------------------------------------------------------------------------- /res/drawable-ldpi/ic_wifi_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-ldpi/ic_wifi_red.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_action_usbdev.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-mdpi/ic_action_usbdev.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_arrow_down_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-mdpi/ic_arrow_down_blue.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_arrow_down_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-mdpi/ic_arrow_down_green.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_arrow_down_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-mdpi/ic_arrow_down_orange.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_arrow_right_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-mdpi/ic_arrow_right_blue.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_arrow_right_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-mdpi/ic_arrow_right_green.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_arrow_right_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-mdpi/ic_arrow_right_orange.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_arrow_up_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-mdpi/ic_arrow_up_blue.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_arrow_up_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-mdpi/ic_arrow_up_green.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_arrow_up_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-mdpi/ic_arrow_up_orange.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_bars_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-mdpi/ic_bars_blue.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_bars_four.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-mdpi/ic_bars_four.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_bars_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-mdpi/ic_bars_green.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_bars_none.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-mdpi/ic_bars_none.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_bars_one.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-mdpi/ic_bars_one.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_bars_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-mdpi/ic_bars_orange.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_bars_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-mdpi/ic_bars_red.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_bars_three.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-mdpi/ic_bars_three.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_bars_two.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-mdpi/ic_bars_two.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_stat_usbdev.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-mdpi/ic_stat_usbdev.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_wifi_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-mdpi/ic_wifi_blue.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_wifi_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-mdpi/ic_wifi_green.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_wifi_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-mdpi/ic_wifi_orange.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_wifi_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-mdpi/ic_wifi_red.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_action_usbdev.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-xhdpi/ic_action_usbdev.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_arrow_down_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-xhdpi/ic_arrow_down_blue.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_arrow_down_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-xhdpi/ic_arrow_down_green.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_arrow_down_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-xhdpi/ic_arrow_down_orange.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_arrow_right_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-xhdpi/ic_arrow_right_blue.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_arrow_right_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-xhdpi/ic_arrow_right_green.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_arrow_right_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-xhdpi/ic_arrow_right_orange.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_arrow_up_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-xhdpi/ic_arrow_up_blue.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_arrow_up_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-xhdpi/ic_arrow_up_green.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_arrow_up_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-xhdpi/ic_arrow_up_orange.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_bars_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-xhdpi/ic_bars_blue.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_bars_four.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-xhdpi/ic_bars_four.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_bars_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-xhdpi/ic_bars_green.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_bars_none.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-xhdpi/ic_bars_none.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_bars_one.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-xhdpi/ic_bars_one.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_bars_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-xhdpi/ic_bars_orange.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_bars_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-xhdpi/ic_bars_red.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_bars_three.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-xhdpi/ic_bars_three.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_bars_two.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-xhdpi/ic_bars_two.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_stat_usbdev.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-xhdpi/ic_stat_usbdev.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_wifi_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-xhdpi/ic_wifi_blue.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_wifi_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-xhdpi/ic_wifi_green.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_wifi_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-xhdpi/ic_wifi_orange.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_wifi_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jhannah01/WifiSniffer/ae8bc5360a388abb3d10d5ecfdfc864477493f20/res/drawable-xhdpi/ic_wifi_red.png -------------------------------------------------------------------------------- /res/drawable/ic_arrow_blue.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /res/drawable/ic_arrow_green.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /res/drawable/ic_arrow_orange.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 16 | 17 | 22 | 23 | -------------------------------------------------------------------------------- /res/layout/expandlist_child_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 15 | 16 | 22 | 23 | 30 | 31 | 32 | 38 | 39 | 45 | 46 | 53 | 54 | 55 | 62 | 63 | 69 | 70 | 77 | 78 | 79 | 87 | 88 | -------------------------------------------------------------------------------- /res/layout/expandlist_group_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 18 | 19 | 29 | 30 | 40 | 41 | 47 | 48 | 52 | 53 | 60 | 61 | 68 | 69 | 73 | 80 | 81 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /res/layout/fragment_historical.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 11 | 12 | -------------------------------------------------------------------------------- /res/layout/fragment_overview.xml: -------------------------------------------------------------------------------- 1 | 13 | 14 | 25 | 26 | 35 | 36 | 44 | 45 | 54 | 55 | 64 | 65 | 74 | 75 | 83 | 84 | 93 | 94 | 102 | 103 | -------------------------------------------------------------------------------- /res/layout/wifiscanresult_list_row.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 18 | 19 | 24 | 25 | 33 | 34 | 43 | 44 | 45 | 46 | 54 | 55 | 65 | 66 | -------------------------------------------------------------------------------- /res/menu/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 10 | -------------------------------------------------------------------------------- /res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | -------------------------------------------------------------------------------- /res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | AIzaSyAFdUv2yIMJAXPw6Pbtm7JnGEjfva3KL7Y 5 | -------------------------------------------------------------------------------- /res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #aa1c1c1c 4 | #80323232 5 | -------------------------------------------------------------------------------- /res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 35dp 4 | 25dp 5 | 30dp 6 | 10sp 7 | 20sp 8 | 8sp 9 | 2dp 10 | 11 | -------------------------------------------------------------------------------- /res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WifiSniffer 5 | Settings 6 | WifiSniffer 7 | 00:de:ad:be:ef:11 8 | wifiSSID 9 | Timestamp: Jan 12th 08:45 PM 10 | Level: -35 dBm 11 | Security: [WPA2-PSK-TKIP][WPA][ESS] 12 | Frequency: 2530 MHz 13 | 6 14 | Wireless Security Indiciator 15 | Signal indicator 16 | Results Overview: 17 | Records: 18 | Last Seen: 19 | Signal Strength: 20 | Frequency: 21 | Security: 22 | Seen at: 23 | Results: 24 | 25 | -------------------------------------------------------------------------------- /res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | -------------------------------------------------------------------------------- /res/values/text.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | @android:color/primary_text_dark 4 | @android:color/holo_blue_dark 5 | @android:color/holo_green_light 6 | #ff000000 7 | 8 | 11 | 14 | 17 | 20 | 21 | 22 | 25 | 28 | 31 | 34 | 35 | 39 | 42 | 45 | 48 | 49 | 53 | 56 | 59 | 62 | -------------------------------------------------------------------------------- /src/com/blueodin/wifisniffer/MainActivity.java: -------------------------------------------------------------------------------- 1 | 2 | package com.blueodin.wifisniffer; 3 | 4 | import android.app.ActionBar; 5 | import android.app.FragmentTransaction; 6 | import android.net.Uri; 7 | import android.os.Bundle; 8 | import android.os.Parcelable; 9 | import android.app.Fragment; 10 | import android.app.Activity; 11 | import android.view.Menu; 12 | import android.view.MenuItem; 13 | import android.widget.Toast; 14 | 15 | import com.blueodin.wifisniffer.fragments.HistoricalFragment; 16 | import com.blueodin.wifisniffer.fragments.MainDetailFragment; 17 | import com.blueodin.wifisniffer.fragments.MapDetailFragment; 18 | import com.blueodin.wifisniffer.fragments.OverviewFragment; 19 | import com.blueodin.wifisniffer.fragments.WifiListFragment.IClickHandler; 20 | import com.blueodin.wifisniffer.providers.ScanResultsProvider; 21 | import com.blueodin.wifisniffer.providers.WifiScanContract; 22 | import com.blueodin.wifisniffer.providers.WifiScanResult; 23 | import com.blueodin.wifisniffer.R; 24 | 25 | public class MainActivity extends Activity implements ActionBar.TabListener, IClickHandler { 26 | private static final String STATE_SELECTED_NAVIGATION_ITEM = "selected_navigation_item"; 27 | private static final int TAB_OVERVIEW = 0; 28 | private static final int TAB_MAP = 1; 29 | private static final int TAB_HISTORY = 2; 30 | 31 | private WifiScanResult mItem; 32 | 33 | public interface IUpdateFragment { 34 | void updateSelectedItem(WifiScanResult result); 35 | void parseArguments(Bundle arguments); 36 | } 37 | 38 | @Override 39 | protected void onCreate(Bundle savedInstanceState) { 40 | super.onCreate(savedInstanceState); 41 | 42 | setContentView(R.layout.activity_main); 43 | 44 | final ActionBar actionBar = getActionBar(); 45 | actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); 46 | 47 | actionBar.addTab(actionBar.newTab().setText("Overview").setTabListener(this)); 48 | actionBar.addTab(actionBar.newTab().setText("Map").setTabListener(this)); 49 | actionBar.addTab(actionBar.newTab().setText("History").setTabListener(this)); 50 | } 51 | 52 | @Override 53 | public void onRestoreInstanceState(Bundle savedInstanceState) { 54 | if (savedInstanceState.containsKey(STATE_SELECTED_NAVIGATION_ITEM)) 55 | getActionBar().setSelectedNavigationItem(savedInstanceState.getInt(STATE_SELECTED_NAVIGATION_ITEM)); 56 | } 57 | 58 | @Override 59 | public void onSaveInstanceState(Bundle outState) { 60 | outState.putInt(STATE_SELECTED_NAVIGATION_ITEM,getActionBar().getSelectedNavigationIndex()); 61 | } 62 | 63 | @Override 64 | public boolean onCreateOptionsMenu(Menu menu) { 65 | getMenuInflater().inflate(R.menu.activity_main, menu); 66 | return true; 67 | } 68 | 69 | @Override 70 | public boolean onOptionsItemSelected(MenuItem item) { 71 | switch(item.getItemId()) { 72 | case R.id.menu_add_entries: 73 | addFakeEntries(); 74 | return true; 75 | case R.id.menu_exit: 76 | finish(); 77 | return true; 78 | } 79 | 80 | return super.onOptionsItemSelected(item); 81 | } 82 | 83 | private void addFakeEntries() { 84 | WifiScanResult[] results = { 85 | new WifiScanResult("00:11:22:33:44:55", "fakeAP", -45, 2505, "[WEP][ESS]", System.currentTimeMillis()), 86 | new WifiScanResult("ba:db:ee:fd:ea:d1", "myWiFi", -32, 2100, "[WPA2-PSK-TKIP][WPS][ESS]", System.currentTimeMillis() - (30*1000)), 87 | new WifiScanResult("fe:f0:dd:00:44:11", "wireless", -55, 2350, "[WPA2-PSK-TKIP][ESS]", System.currentTimeMillis() - (40*1000)), 88 | new WifiScanResult("00:11:22:33:44:55", "fakeAP", -45, 2505, "[WEP][ESS]", System.currentTimeMillis() - (5*60*1000)), 89 | new WifiScanResult("ba:db:ee:fd:ea:d1", "myWiFi", -32, 2100, "[WPA2-PSK-TKIP][WPS][ESS]", System.currentTimeMillis() - (6*60*1000)), 90 | new WifiScanResult("fe:f0:dd:00:44:11", "wireless", -55, 2350, "[WPA2-PSK-TKIP][ESS]", System.currentTimeMillis() - (7*60*1000)) 91 | }; 92 | 93 | for(WifiScanResult r : results) 94 | getContentResolver().insert(WifiScanContract.ScanResult.CONTENT_URI, r.getContentValues()); 95 | } 96 | 97 | @Override 98 | public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { 99 | Fragment f; 100 | 101 | switch(tab.getPosition()) { 102 | case TAB_OVERVIEW: 103 | f = new OverviewFragment(); 104 | break; 105 | case TAB_MAP: 106 | f = new MapDetailFragment(); 107 | break; 108 | case TAB_HISTORY: 109 | f = new HistoricalFragment(); 110 | break; 111 | default: 112 | throw new IllegalArgumentException("Invalid Tab Position: #" + tab.getPosition()); 113 | } 114 | 115 | Bundle args = new Bundle(); 116 | args.putParcelable(MainDetailFragment.ARG_ITEM, mItem); 117 | f.setArguments(args); 118 | 119 | getFragmentManager().beginTransaction() 120 | .replace(R.id.container, f) 121 | .commit(); 122 | } 123 | 124 | @Override 125 | public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { 126 | } 127 | 128 | @Override 129 | public void onTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { 130 | } 131 | 132 | @Override 133 | public void onItemSelected(WifiScanResult result) { 134 | IUpdateFragment f = (IUpdateFragment)getFragmentManager().findFragmentById(R.id.container); 135 | f.updateSelectedItem(result); 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /src/com/blueodin/wifisniffer/adapters/NetworkExpandableListAdapter.java: -------------------------------------------------------------------------------- 1 | 2 | package com.blueodin.wifisniffer.adapters; 3 | 4 | import android.content.Context; 5 | import android.content.res.Resources; 6 | import android.text.format.DateUtils; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | import android.widget.BaseExpandableListAdapter; 11 | import android.widget.ImageView; 12 | import android.widget.LinearLayout; 13 | import android.widget.TextView; 14 | 15 | import com.blueodin.wifisniffer.R; 16 | import com.blueodin.wifisniffer.providers.WifiScanResult; 17 | import com.jjoe64.graphview.GraphView.GraphViewData; 18 | import com.jjoe64.graphview.GraphViewSeries; 19 | import com.jjoe64.graphview.GraphViewStyle; 20 | import com.jjoe64.graphview.LineGraphView; 21 | 22 | import java.util.ArrayList; 23 | import java.util.List; 24 | 25 | public class NetworkExpandableListAdapter extends BaseExpandableListAdapter { 26 | private Context mContext; 27 | private final WifiScanResult mPrimaryResult; 28 | private final List mResults; 29 | private List mGroups = new ArrayList(); 30 | 31 | public class ListGroup { 32 | private WifiScanResult mResult; 33 | private final ListChild mChild; 34 | 35 | public ListGroup(WifiScanResult result) { 36 | mResult = result; 37 | mChild = new ListChild(this); 38 | } 39 | 40 | public ListChild getChild() { 41 | return mChild; 42 | } 43 | 44 | public WifiScanResult getResult() { 45 | return mResult; 46 | } 47 | 48 | public void drawView(Context context, View view, ViewGroup parent) { 49 | ImageView imageGroupIcon = (ImageView) view.findViewById(R.id.imageview_group_icon); 50 | TextView textBSSID = (TextView) view.findViewById(R.id.textview_group_bssid); 51 | TextView textSSID = (TextView) view.findViewById(R.id.textview_group_ssid); 52 | TextView textTimestamp = (TextView) view.findViewById(R.id.textview_group_lastseen); 53 | 54 | imageGroupIcon.setImageResource(mResult.getSecurityIcon()); 55 | textBSSID.setText(mResult.bssid); 56 | textSSID.setText(mResult.ssid); 57 | textTimestamp.setText(mResult.getFormattedTimestamp()); 58 | } 59 | } 60 | 61 | public class ListChild { 62 | private final ListGroup mParent; 63 | private final GraphViewSeries mGraphSeries; 64 | private final LineGraphView mGraph; 65 | 66 | public ListChild(ListGroup parent) { 67 | mParent = parent; 68 | mGraphSeries = new GraphViewSeries(getSignalData(mResults)); 69 | mGraph = buildGraph(); 70 | } 71 | 72 | public ListGroup getParent() { 73 | return mParent; 74 | } 75 | 76 | private LineGraphView buildGraph() { 77 | LineGraphView graphView = new LineGraphView(mContext, "Historical Graph for " + mPrimaryResult.ssid) { 78 | protected String formatLabel(double value, boolean isValueX) { 79 | if (!isValueX) { 80 | return String.format("%.02f dBm", value); 81 | } else { 82 | return (String)DateUtils.formatElapsedTime((long)value); 83 | } 84 | } 85 | }; 86 | 87 | Resources res = mContext.getResources(); 88 | 89 | GraphViewStyle graphViewStyle = graphView.getGraphViewStyle(); 90 | graphViewStyle.setGridColor(res.getColor(R.color.bar_background_color)); 91 | graphView.setBackgroundColor(res.getColor(R.color.primary_bg_color)); 92 | graphView.getGraphViewStyle().setHorizontalLabelsColor(res.getColor(R.color.secondary_text_color)); 93 | graphView.getGraphViewStyle().setVerticalLabelsColor(res.getColor(R.color.alt_text_color)); 94 | graphView.setDrawBackground(true); 95 | 96 | double size = (5*60)*1000; 97 | double start = System.currentTimeMillis()-((15*60)*1000); 98 | 99 | graphView.addSeries(mGraphSeries); 100 | 101 | graphView.setScalable(true); 102 | graphView.setViewPort(start, size); 103 | 104 | return graphView; 105 | } 106 | 107 | public void drawView(Context context, View view, ViewGroup parent) { 108 | TextView textViewLevel = (TextView) view.findViewById(R.id.textview_child_level); 109 | TextView textViewFrequency = (TextView) view.findViewById(R.id.textview_child_frequency); 110 | TextView textViewCapabilities = (TextView) view.findViewById(R.id.textview_child_capabilities); 111 | 112 | textViewLevel.setText(String.format("%d dBm", mPrimaryResult.level)); 113 | textViewFrequency.setText(String.format("%d MHz", mPrimaryResult.frequency)); 114 | textViewCapabilities.setText(mPrimaryResult.getFormattedCapabilities()); 115 | 116 | ((LinearLayout)view.findViewById(R.id.layout_child_graph)).addView(this.mGraph); 117 | } 118 | 119 | 120 | private GraphViewData[] getSignalData(List results) { 121 | int idx; 122 | 123 | if(results.size() < 1) 124 | idx = 1; 125 | else 126 | idx = results.size(); 127 | 128 | GraphViewData[] signalData = new GraphViewData[idx]; 129 | 130 | int i=0; 131 | for(WifiScanResult result : results) 132 | signalData[i++] = new GraphViewData(result.timestamp, result.level); 133 | 134 | return signalData; 135 | } 136 | } 137 | 138 | public NetworkExpandableListAdapter(Context context, WifiScanResult primaryResult, List results) { 139 | mContext = context; 140 | mPrimaryResult = primaryResult; 141 | mResults = results; 142 | } 143 | 144 | @Override 145 | public int getGroupCount() { 146 | return mResults.size(); 147 | } 148 | 149 | @Override 150 | public int getChildrenCount(int groupPosition) { 151 | if (groupPosition < mResults.size()) 152 | return 1; 153 | 154 | return 0; 155 | } 156 | 157 | @Override 158 | public ListGroup getGroup(int groupPosition) { 159 | return mGroups.get(groupPosition); 160 | } 161 | 162 | @Override 163 | public ListChild getChild(int groupPosition, int childPosition) { 164 | return getGroup(groupPosition).getChild(); 165 | } 166 | 167 | @Override 168 | public long getGroupId(int groupPosition) { 169 | return groupPosition; 170 | } 171 | 172 | @Override 173 | public long getChildId(int groupPosition, int childPosition) { 174 | if (groupPosition < mResults.size()) 175 | return childPosition; 176 | 177 | return 0; 178 | } 179 | 180 | @Override 181 | public boolean hasStableIds() { 182 | return true; 183 | } 184 | 185 | @Override 186 | public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { 187 | ListGroup group = (ListGroup) getGroup(groupPosition); 188 | 189 | if (convertView == null) 190 | convertView = ((LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.expandlist_group_item, null, false); 191 | 192 | group.drawView(this.mContext, convertView, parent); 193 | 194 | return convertView; 195 | 196 | } 197 | 198 | @Override 199 | public View getChildView(int groupPosition, int childPosition, boolean isLastChild, 200 | View convertView, ViewGroup parent) { 201 | ListChild child = (ListChild) getChild(groupPosition, childPosition); 202 | 203 | if (convertView == null) 204 | convertView = ((LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.expandlist_child_item, null, false); 205 | 206 | child.drawView(this.mContext, convertView, parent); 207 | 208 | return convertView; 209 | 210 | } 211 | 212 | @Override 213 | public boolean isChildSelectable(int groupPosition, int childPosition) { 214 | return true; 215 | } 216 | } 217 | -------------------------------------------------------------------------------- /src/com/blueodin/wifisniffer/fragments/HistoricalFragment.java: -------------------------------------------------------------------------------- 1 | 2 | package com.blueodin.wifisniffer.fragments; 3 | 4 | import android.app.Fragment; 5 | import android.database.Cursor; 6 | import android.database.DataSetObserver; 7 | import android.os.Bundle; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.ExpandableListAdapter; 12 | import android.widget.ExpandableListView; 13 | import android.widget.ListAdapter; 14 | 15 | import com.blueodin.wifisniffer.MainActivity; 16 | import com.blueodin.wifisniffer.R; 17 | import com.blueodin.wifisniffer.adapters.NetworkExpandableListAdapter; 18 | import com.blueodin.wifisniffer.providers.WifiScanContract; 19 | import com.blueodin.wifisniffer.providers.WifiScanResult; 20 | 21 | import java.util.ArrayList; 22 | import java.util.List; 23 | 24 | public class HistoricalFragment extends MainDetailFragment { 25 | private List mResults = new ArrayList(); 26 | private NetworkExpandableListAdapter mListAdapter; 27 | 28 | public HistoricalFragment() { 29 | 30 | } 31 | 32 | @Override 33 | public void onCreate(Bundle savedInstanceState) { 34 | super.onCreate(savedInstanceState); 35 | 36 | if (mItem != null) 37 | mListAdapter = new NetworkExpandableListAdapter(getActivity(), mItem, mResults); 38 | } 39 | 40 | private void updateListAdapter(WifiScanResult item, boolean clean) { 41 | if(clean) 42 | mResults.clear(); 43 | 44 | Cursor c = getActivity().getContentResolver().query( 45 | WifiScanContract.ScanResult.CONTENT_URI, 46 | WifiScanContract.ScanResult.DEFAULT_PROJECTION, 47 | WifiScanContract.ScanResult.COLUMN_NAME_BSSID + " = '?'", 48 | new String[] { item.bssid }, 49 | WifiScanContract.ScanResult.DEFAULT_ORDER_BY); 50 | 51 | if ((c.getCount() > 0) && (c.moveToFirst())) { 52 | while (!c.isAfterLast()) { 53 | mResults.add(WifiScanResult.fromCursor(c)); 54 | c.moveToNext(); 55 | } 56 | } 57 | this.mListAdapter.notifyDataSetChanged(); 58 | c.close(); 59 | } 60 | 61 | @Override 62 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 63 | View v = inflater.inflate(R.layout.fragment_historical, container, false); 64 | 65 | ((ExpandableListView) v.findViewById(R.id.listview_historical)).setAdapter(mListAdapter); 66 | 67 | return v; 68 | } 69 | 70 | @Override 71 | public void updateSelectedItem(WifiScanResult result) { 72 | updateListAdapter(result, true); 73 | 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/com/blueodin/wifisniffer/fragments/MainDetailFragment.java: -------------------------------------------------------------------------------- 1 | package com.blueodin.wifisniffer.fragments; 2 | 3 | import android.app.Fragment; 4 | import android.os.Bundle; 5 | 6 | import com.blueodin.wifisniffer.MainActivity; 7 | import com.blueodin.wifisniffer.MainActivity.IUpdateFragment; 8 | import com.blueodin.wifisniffer.providers.WifiScanResult; 9 | 10 | public abstract class MainDetailFragment extends Fragment implements IUpdateFragment { 11 | protected WifiScanResult mItem; 12 | 13 | public static final String ARG_ITEM = "arg_item"; 14 | 15 | @Override 16 | public void onCreate(Bundle savedInstanceState) { 17 | super.onCreate(savedInstanceState); 18 | parseArguments(getArguments()); 19 | } 20 | 21 | @Override 22 | public void parseArguments(Bundle arguments) { 23 | if(arguments == null) 24 | return; 25 | 26 | if(arguments.containsKey(ARG_ITEM)) 27 | mItem = arguments.getParcelable(ARG_ITEM); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/com/blueodin/wifisniffer/fragments/MapDetailFragment.java: -------------------------------------------------------------------------------- 1 | package com.blueodin.wifisniffer.fragments; 2 | 3 | import android.os.Bundle; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | 8 | import com.google.android.gms.maps.CameraUpdate; 9 | import com.google.android.gms.maps.CameraUpdateFactory; 10 | import com.google.android.gms.maps.GoogleMap; 11 | import com.google.android.gms.maps.MapFragment; 12 | import com.google.android.gms.maps.model.BitmapDescriptorFactory; 13 | import com.google.android.gms.maps.model.LatLng; 14 | import com.google.android.gms.maps.model.MarkerOptions; 15 | import com.google.android.gms.maps.model.PolygonOptions; 16 | 17 | import com.blueodin.wifisniffer.MainActivity; 18 | import com.blueodin.wifisniffer.providers.WifiScanResult; 19 | 20 | public class MapDetailFragment extends MapFragment implements MainActivity.IUpdateFragment { 21 | protected WifiScanResult mItem; 22 | private GoogleMap mMap = null; 23 | 24 | public MapDetailFragment() { 25 | 26 | } 27 | 28 | public void onCreate(Bundle savedInstanceState) { 29 | super.onCreate(savedInstanceState); 30 | parseArguments(getArguments()); 31 | } 32 | 33 | private void setUpMap() { 34 | LatLng myLocation = new LatLng(39.780899, -75.881798); 35 | mMap.addMarker(new MarkerOptions().title("Hiya").icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_ORANGE)).position(myLocation)); 36 | mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(myLocation, 15)); 37 | 38 | } 39 | 40 | @Override 41 | public void updateSelectedItem(WifiScanResult result) { 42 | mItem = result; 43 | 44 | mMap = this.getMap(); 45 | 46 | if(mMap != null) 47 | setUpMap(); 48 | } 49 | 50 | @Override 51 | public void parseArguments(Bundle arguments) { 52 | if(arguments == null) 53 | return; 54 | 55 | if(arguments.containsKey(MainDetailFragment.ARG_ITEM)) 56 | mItem = arguments.getParcelable(MainDetailFragment.ARG_ITEM); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/com/blueodin/wifisniffer/fragments/OverviewFragment.java: -------------------------------------------------------------------------------- 1 | package com.blueodin.wifisniffer.fragments; 2 | 3 | import android.os.Bundle; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.ImageView; 8 | import android.widget.TextView; 9 | 10 | import com.blueodin.wifisniffer.R; 11 | import com.blueodin.wifisniffer.providers.WifiScanResult; 12 | 13 | public class OverviewFragment extends MainDetailFragment { 14 | public OverviewFragment() { 15 | 16 | } 17 | 18 | @Override 19 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 20 | Bundle savedInstanceState) { 21 | View v = inflater.inflate(R.layout.fragment_overview, container, false); 22 | 23 | if(mItem == null) 24 | return v; 25 | 26 | updateItemDetails(v); 27 | 28 | return v; 29 | } 30 | 31 | private void updateItemDetails(View v) { 32 | ((TextView)v.findViewById(R.id.text_details_BSSID)).setText("BSSID: " + mItem.bssid); 33 | ((TextView)v.findViewById(R.id.text_details_SSID)).setText(mItem.ssid); 34 | ((TextView)v.findViewById(R.id.text_details_Level)).setText(String.format("Level: %d dBm", mItem.level)); 35 | ((TextView)v.findViewById(R.id.text_details_Frequency)).setText(String.format("Frequency: %d MHz", mItem.frequency)); 36 | ((TextView)v.findViewById(R.id.text_details_Capabilities)).setText("Security: " + mItem.getFormattedCapabilities()); 37 | ((TextView)v.findViewById(R.id.text_details_Timestamp)).setText(mItem.getFormattedTimestamp()); 38 | ((ImageView)v.findViewById(R.id.image_details_Signal)).setImageResource(mItem.getSignalIcon()); 39 | ((ImageView)v.findViewById(R.id.image_details_Security)).setImageResource(mItem.getSecurityIcon()); 40 | } 41 | 42 | @Override 43 | public void updateSelectedItem(WifiScanResult result) { 44 | this.mItem = result; 45 | updateItemDetails(getView()); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/com/blueodin/wifisniffer/fragments/WifiListFragment.java: -------------------------------------------------------------------------------- 1 | package com.blueodin.wifisniffer.fragments; 2 | 3 | import android.app.Activity; 4 | import android.app.ListFragment; 5 | import android.app.LoaderManager; 6 | import android.content.Context; 7 | import android.content.CursorLoader; 8 | import android.content.Loader; 9 | import android.database.Cursor; 10 | import android.os.Bundle; 11 | import android.text.format.DateUtils; 12 | import android.util.Log; 13 | import android.view.LayoutInflater; 14 | import android.view.View; 15 | import android.view.ViewGroup; 16 | import android.widget.ArrayAdapter; 17 | import android.widget.CursorAdapter; 18 | import android.widget.ImageView; 19 | import android.widget.ListView; 20 | import android.widget.SimpleCursorAdapter; 21 | import android.widget.TextView; 22 | 23 | import com.blueodin.wifisniffer.R; 24 | import com.blueodin.wifisniffer.providers.WifiScanResult; 25 | import com.blueodin.wifisniffer.providers.WifiScanContract; 26 | 27 | public class WifiListFragment extends ListFragment 28 | implements LoaderManager.LoaderCallbacks { 29 | private static final String STATE_ACTIVATED_POSITION = "activated_position"; 30 | private static final int LOADER_ID = 0x01; 31 | private int mActivatedPosition = ListView.INVALID_POSITION; 32 | private IClickHandler mCallbacks = mDefaultClickHandler; 33 | private ArrayAdapter mAdapter; 34 | 35 | public interface IClickHandler { 36 | public void onItemSelected(WifiScanResult result); 37 | } 38 | 39 | private static IClickHandler mDefaultClickHandler = new IClickHandler() { 40 | @Override 41 | public void onItemSelected(WifiScanResult result) { 42 | } 43 | }; 44 | 45 | 46 | public WifiListFragment() { 47 | 48 | } 49 | 50 | public class ScanResultsAdapter extends ArrayAdapter { 51 | private Context mContext; 52 | 53 | public ScanResultsAdapter(Context context) { 54 | super(context, R.layout.wifiscanresult_list_row, R.id.textSSID); 55 | mContext = context; 56 | } 57 | 58 | @Override 59 | public View getView(int position, View convertView, ViewGroup parent) { 60 | LayoutInflater inflater = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 61 | View v = inflater.inflate(R.layout.wifiscanresult_list_row, parent, false); 62 | 63 | WifiScanResult item = (WifiScanResult)this.getItem(position); 64 | 65 | ((TextView)v.findViewById(R.id.textSSID)).setText(item.ssid); 66 | ((TextView)v.findViewById(R.id.textBSSID)).setText(item.bssid); 67 | ((TextView)v.findViewById(R.id.textLevel)).setText(String.format("Level: %d dBm", item.level)); 68 | ((TextView)v.findViewById(R.id.textTimestamp)).setText("Timestamp: " + DateUtils.getRelativeTimeSpanString(item.timestamp)); 69 | ((ImageView)v.findViewById(R.id.imageViewIcon)).setImageResource(item.getSecurityIcon()); 70 | 71 | return v; 72 | } 73 | } 74 | 75 | 76 | @Override 77 | public void onCreate(Bundle savedInstanceState) { 78 | super.onCreate(savedInstanceState); 79 | 80 | getLoaderManager().initLoader(LOADER_ID, null, this); 81 | mAdapter = new ScanResultsAdapter(getActivity()); 82 | 83 | setListAdapter(mAdapter); 84 | } 85 | 86 | @Override 87 | public void onViewCreated(View view, Bundle savedInstanceState) { 88 | super.onViewCreated(view, savedInstanceState); 89 | 90 | // Restore the previously serialized activated item position. 91 | if (savedInstanceState != null 92 | && savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) { 93 | setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION)); 94 | } 95 | 96 | setEmptyText("No entries..."); 97 | } 98 | 99 | @Override 100 | public void onAttach(Activity activity) { 101 | super.onAttach(activity); 102 | 103 | if (!(activity instanceof IClickHandler)) 104 | throw new IllegalStateException("Activity must implement fragment's callbacks."); 105 | 106 | mCallbacks = (IClickHandler) activity; 107 | } 108 | 109 | @Override 110 | public void onDetach() { 111 | super.onDetach(); 112 | mCallbacks = mDefaultClickHandler; 113 | } 114 | 115 | @Override 116 | public void onListItemClick(ListView listView, View view, int position, long id) { 117 | super.onListItemClick(listView, view, position, id); 118 | mCallbacks.onItemSelected(mAdapter.getItem(position)); 119 | } 120 | 121 | @Override 122 | public void onSaveInstanceState(Bundle outState) { 123 | super.onSaveInstanceState(outState); 124 | if (mActivatedPosition != ListView.INVALID_POSITION) 125 | outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition); 126 | } 127 | 128 | public void setActivateOnItemClick(boolean activateOnItemClick) { 129 | getListView().setChoiceMode(activateOnItemClick ? ListView.CHOICE_MODE_SINGLE : ListView.CHOICE_MODE_NONE); 130 | } 131 | 132 | private void setActivatedPosition(int position) { 133 | if (position == ListView.INVALID_POSITION) 134 | getListView().setItemChecked(mActivatedPosition, false); 135 | else 136 | getListView().setItemChecked(position, true); 137 | 138 | mActivatedPosition = position; 139 | } 140 | 141 | @Override 142 | public Loader onCreateLoader(int id, Bundle args) { 143 | return (new CursorLoader(getActivity(), WifiScanContract.ScanResult.CONTENT_URI, 144 | WifiScanContract.ScanResult.DEFAULT_PROJECTION, null, null, null)); 145 | } 146 | 147 | @Override 148 | public void onLoadFinished(Loader loader, Cursor data) { 149 | if((data == null) || (data.getCount() <= 1)) 150 | return; 151 | 152 | data.moveToFirst(); 153 | while(!data.isAfterLast()) { 154 | mAdapter.add(WifiScanResult.fromCursor(data)); 155 | data.moveToNext(); 156 | } 157 | 158 | mAdapter.notifyDataSetChanged(); 159 | } 160 | 161 | @Override 162 | public void onLoaderReset(Loader loader) { 163 | 164 | } 165 | } 166 | -------------------------------------------------------------------------------- /src/com/blueodin/wifisniffer/helpers/DBHelper.java: -------------------------------------------------------------------------------- 1 | package com.blueodin.wifisniffer.helpers; 2 | 3 | import android.content.Context; 4 | import android.database.sqlite.SQLiteDatabase; 5 | import android.database.sqlite.SQLiteOpenHelper; 6 | 7 | import com.blueodin.wifisniffer.providers.WifiScanContract; 8 | 9 | public class DBHelper extends SQLiteOpenHelper { 10 | private static final String DATABASE_FILENAME = "wifisniffer.db"; 11 | private static final int DATABASE_VERSION = 4; 12 | 13 | private static final String _SQL_CREATE_RESULTS_TABLE = 14 | "CREATE TABLE IF NOT EXISTS " + WifiScanContract.ScanResult.TABLE_NAME + " (" 15 | + WifiScanContract.ScanResult._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " 16 | + WifiScanContract.ScanResult.COLUMN_NAME_BSSID + " TEXT NOT NULL," 17 | + WifiScanContract.ScanResult.COLUMN_NAME_SSID + " TEXT, " 18 | + WifiScanContract.ScanResult.COLUMN_NAME_LEVEL + " INTEGER, " 19 | + WifiScanContract.ScanResult.COLUMN_NAME_FREQUENCY + " INTEGER, " 20 | + WifiScanContract.ScanResult.COLUMN_NAME_CAPABILITIES + " TEXT, " 21 | + WifiScanContract.ScanResult.COLUMN_NAME_LAT + " REAL, " 22 | + WifiScanContract.ScanResult.COLUMN_NAME_LON + " REAL, " 23 | + WifiScanContract.ScanResult.COLUMN_NAME_GEOHASH + " TEXT, " 24 | + WifiScanContract.ScanResult.COLUMN_NAME_TIMESTAMP + " INTEGER);"; 25 | 26 | private static final String _SQL_CREATE_LOCATION_TABLE = 27 | "CREATE TABLE IF NOT EXISTS " + WifiScanContract.ScanLocation.TABLE_NAME + " (" 28 | + WifiScanContract.ScanLocation._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " 29 | + WifiScanContract.ScanLocation.COLUMN_NAME_FK_RESULT + " TEXT, " 30 | + WifiScanContract.ScanLocation.COLUMN_NAME_LAT + " REAL, " 31 | + WifiScanContract.ScanLocation.COLUMN_NAME_LON + " REAL, " 32 | + WifiScanContract.ScanLocation.COLUMN_NAME_ALT + " REAL, " 33 | + WifiScanContract.ScanLocation.COLUMN_NAME_GEOHASH + " TEXT, " 34 | + WifiScanContract.ScanLocation.COLUMN_NAME_TIMESTAMP + " INTEGER, " 35 | + WifiScanContract.ScanLocation.COLUMN_NAME_LEVEL + " INTEGER);"; 36 | 37 | private static final String _SQL_DROP_TABLES = 38 | "DROP TABLE IF EXISTS " + WifiScanContract.ScanResult.TABLE_NAME + ";" + 39 | "DROP TABLE IF EXISTS " + WifiScanContract.ScanLocation.TABLE_NAME + ";"; 40 | 41 | public DBHelper(Context context) 42 | { 43 | super(context, DATABASE_FILENAME, null, DATABASE_VERSION); 44 | } 45 | 46 | @Override 47 | public void onCreate(SQLiteDatabase db) 48 | { 49 | db.execSQL(_SQL_CREATE_RESULTS_TABLE); 50 | db.execSQL(_SQL_CREATE_LOCATION_TABLE); 51 | } 52 | 53 | @Override 54 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) 55 | { 56 | db.execSQL(_SQL_DROP_TABLES); 57 | onCreate(db); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/com/blueodin/wifisniffer/helpers/WifiScanResultAdapter.java: -------------------------------------------------------------------------------- 1 | 2 | package com.blueodin.wifisniffer.helpers; 3 | 4 | import android.content.Context; 5 | import android.text.format.DateUtils; 6 | import android.util.Log; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | import android.widget.ArrayAdapter; 11 | import android.widget.CursorAdapter; 12 | import android.widget.ImageView; 13 | import android.widget.TextView; 14 | 15 | import com.blueodin.wifisniffer.R; 16 | import com.blueodin.wifisniffer.providers.WifiScanResult; 17 | 18 | public class WifiScanResultAdapter extends ArrayAdapter { 19 | private Context mContext; 20 | 21 | public WifiScanResultAdapter(Context context) { 22 | super(context, R.layout.wifiscanresult_list_row, 23 | CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER); 24 | mContext = context; 25 | } 26 | 27 | @Override 28 | public View getView(int position, View convertView, ViewGroup parent) { 29 | View v = convertView; 30 | 31 | if (v == null) { 32 | Log.i("TESTING", "I had to re-inflate myself"); 33 | LayoutInflater inflater = (LayoutInflater) mContext 34 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE); 35 | v = inflater.inflate(R.layout.wifiscanresult_list_row, null, false); 36 | } 37 | 38 | WifiScanResult item = (WifiScanResult) this.getItem(position); 39 | 40 | ((TextView) v.findViewById(R.id.textSSID)).setText(item.ssid); 41 | ((TextView) v.findViewById(R.id.textBSSID)).setText(item.bssid); 42 | ((TextView) v.findViewById(R.id.textLevel)).setText(String.format("Level: %d dBm", 43 | item.level)); 44 | ((TextView) v.findViewById(R.id.textTimestamp)).setText("Timestamp: " 45 | + DateUtils.getRelativeTimeSpanString(item.timestamp)); 46 | ((ImageView) v.findViewById(R.id.imageViewIcon)).setImageResource(item.getSecurityIcon()); 47 | 48 | return v; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/com/blueodin/wifisniffer/providers/ScanResultsProvider.java: -------------------------------------------------------------------------------- 1 | package com.blueodin.wifisniffer.providers; 2 | 3 | import android.content.ContentProvider; 4 | import android.content.ContentUris; 5 | import android.content.ContentValues; 6 | import android.content.UriMatcher; 7 | import android.database.Cursor; 8 | import android.database.SQLException; 9 | import android.database.sqlite.SQLiteDatabase; 10 | import android.database.sqlite.SQLiteQueryBuilder; 11 | import android.net.Uri; 12 | import android.text.TextUtils; 13 | 14 | import com.blueodin.wifisniffer.helpers.DBHelper; 15 | import com.blueodin.wifisniffer.providers.WifiScanContract; 16 | 17 | import java.util.HashMap; 18 | 19 | public class ScanResultsProvider extends ContentProvider { 20 | private static final HashMap sProjectionMap = new HashMap(); 21 | private static final HashMap sProjectionMapLocations = new HashMap(); 22 | 23 | private static final UriMatcher sUriMatcher; 24 | 25 | private static final int URIMATCH_SCANRESULTS = 0x01; 26 | private static final int URIMATCH_SCANRESULT_BYID = 0x02; 27 | private static final int URIMATCH_SCANLOCATIONS = 0x03; 28 | private static final int URIMATCH_SCANLOCATION_BYID = 0x04; 29 | 30 | static { 31 | sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH); 32 | sUriMatcher.addURI(WifiScanContract.AUTHORITY, WifiScanContract.ScanResult.PATH, URIMATCH_SCANRESULTS); 33 | sUriMatcher.addURI(WifiScanContract.AUTHORITY, WifiScanContract.ScanResult.PATH_BYID + "#", URIMATCH_SCANRESULT_BYID); 34 | sUriMatcher.addURI(WifiScanContract.AUTHORITY, WifiScanContract.ScanLocation.PATH, URIMATCH_SCANLOCATIONS); 35 | sUriMatcher.addURI(WifiScanContract.AUTHORITY, WifiScanContract.ScanLocation.PATH_BYID + "#", URIMATCH_SCANLOCATION_BYID); 36 | 37 | sProjectionMap.put(WifiScanContract.ScanResult._ID, WifiScanContract.ScanResult._ID); 38 | sProjectionMap.put(WifiScanContract.ScanResult.COLUMN_NAME_BSSID, WifiScanContract.ScanResult.COLUMN_NAME_BSSID); 39 | sProjectionMap.put(WifiScanContract.ScanResult.COLUMN_NAME_SSID, WifiScanContract.ScanResult.COLUMN_NAME_SSID); 40 | sProjectionMap.put(WifiScanContract.ScanResult.COLUMN_NAME_LEVEL, WifiScanContract.ScanResult.COLUMN_NAME_LEVEL); 41 | sProjectionMap.put(WifiScanContract.ScanResult.COLUMN_NAME_FREQUENCY, WifiScanContract.ScanResult.COLUMN_NAME_FREQUENCY); 42 | sProjectionMap.put(WifiScanContract.ScanResult.COLUMN_NAME_CAPABILITIES, WifiScanContract.ScanResult.COLUMN_NAME_CAPABILITIES); 43 | //sProjectionMap.put(WifiScanContract.ScanResult.COLUMN_NAME_LAT, WifiScanContract.ScanResult.COLUMN_NAME_LAT); 44 | //sProjectionMap.put(WifiScanContract.ScanResult.COLUMN_NAME_LON, WifiScanContract.ScanResult.COLUMN_NAME_LON); 45 | //sProjectionMap.put(WifiScanContract.ScanResult.COLUMN_NAME_ALT, WifiScanContract.ScanResult.COLUMN_NAME_ALT); 46 | //sProjectionMap.put(WifiScanContract.ScanResult.COLUMN_NAME_GEOHASH, WifiScanContract.ScanResult.COLUMN_NAME_GEOHASH); 47 | sProjectionMap.put(WifiScanContract.ScanResult.COLUMN_NAME_TIMESTAMP, WifiScanContract.ScanResult.COLUMN_NAME_TIMESTAMP); 48 | 49 | sProjectionMapLocations.put(WifiScanContract.ScanLocation._ID, WifiScanContract.ScanLocation._ID); 50 | sProjectionMapLocations.put(WifiScanContract.ScanLocation.COLUMN_NAME_FK_RESULT, WifiScanContract.ScanLocation.COLUMN_NAME_FK_RESULT); 51 | sProjectionMapLocations.put(WifiScanContract.ScanLocation.COLUMN_NAME_LAT, WifiScanContract.ScanLocation.COLUMN_NAME_LAT); 52 | sProjectionMapLocations.put(WifiScanContract.ScanLocation.COLUMN_NAME_LON, WifiScanContract.ScanLocation.COLUMN_NAME_LON); 53 | sProjectionMapLocations.put(WifiScanContract.ScanLocation.COLUMN_NAME_ALT, WifiScanContract.ScanLocation.COLUMN_NAME_ALT); 54 | sProjectionMapLocations.put(WifiScanContract.ScanLocation.COLUMN_NAME_GEOHASH, WifiScanContract.ScanLocation.COLUMN_NAME_GEOHASH); 55 | sProjectionMapLocations.put(WifiScanContract.ScanLocation.COLUMN_NAME_TIMESTAMP, WifiScanContract.ScanLocation.COLUMN_NAME_TIMESTAMP); 56 | sProjectionMapLocations.put(WifiScanContract.ScanLocation.COLUMN_NAME_LEVEL, WifiScanContract.ScanLocation.COLUMN_NAME_LEVEL); 57 | } 58 | 59 | private DBHelper mDbHelper; 60 | 61 | @Override 62 | public boolean onCreate() { 63 | mDbHelper = new DBHelper(getContext()); 64 | return true; 65 | } 66 | 67 | @Override 68 | public void shutdown() { 69 | super.shutdown(); 70 | mDbHelper.close(); 71 | } 72 | 73 | @Override 74 | public String getType(Uri uri) 75 | { 76 | switch (sUriMatcher.match(uri)) 77 | { 78 | case URIMATCH_SCANRESULTS: 79 | return WifiScanContract.ScanResult.CONTENT_TYPE; 80 | case URIMATCH_SCANRESULT_BYID: 81 | return WifiScanContract.ScanResult.CONTENT_ITEM_TYPE; 82 | case URIMATCH_SCANLOCATIONS: 83 | return WifiScanContract.ScanLocation.CONTENT_TYPE; 84 | case URIMATCH_SCANLOCATION_BYID: 85 | return WifiScanContract.ScanLocation.CONTENT_ITEM_TYPE; 86 | default: 87 | throw new IllegalArgumentException("Unknown URI: " + uri); 88 | } 89 | } 90 | 91 | @Override 92 | public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { 93 | String orderBy; 94 | SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder(); 95 | 96 | switch(sUriMatcher.match(uri)) { 97 | case URIMATCH_SCANRESULT_BYID: 98 | queryBuilder.appendWhere(WifiScanContract.ScanResult._ID + "=" + uri.getPathSegments().get(WifiScanContract.ScanResult.PATH_BYID_IDPOSITION)); 99 | case URIMATCH_SCANRESULTS: 100 | queryBuilder.setTables(WifiScanContract.ScanResult.TABLE_NAME); 101 | queryBuilder.setProjectionMap(sProjectionMap); 102 | orderBy = WifiScanContract.ScanResult.DEFAULT_ORDER_BY; 103 | break; 104 | 105 | case URIMATCH_SCANLOCATION_BYID: 106 | queryBuilder.appendWhere(WifiScanContract.ScanLocation._ID + "=" + uri.getPathSegments().get(WifiScanContract.ScanLocation.PATH_BYID_IDPOSITION)); 107 | case URIMATCH_SCANLOCATIONS: 108 | queryBuilder.setTables(WifiScanContract.ScanLocation.TABLE_NAME); 109 | queryBuilder.setProjectionMap(sProjectionMapLocations); 110 | orderBy = WifiScanContract.ScanLocation.DEFAULT_ORDER_BY; 111 | break; 112 | default: 113 | throw new IllegalArgumentException("Unknown URI: " + uri); 114 | } 115 | 116 | 117 | if(!TextUtils.isEmpty(sortOrder)) 118 | orderBy = sortOrder; 119 | 120 | SQLiteDatabase db = mDbHelper.getReadableDatabase(); 121 | 122 | Cursor c = queryBuilder.query(db, projection, selection, selectionArgs, null, null, orderBy); 123 | c.setNotificationUri(getContext().getContentResolver(), uri); 124 | 125 | return c; 126 | } 127 | 128 | @Override 129 | public Uri insert(Uri uri, ContentValues values) 130 | { 131 | int uriMatch = sUriMatcher.match(uri); 132 | Uri baseUri; 133 | String tableName; 134 | 135 | switch(uriMatch) { 136 | case URIMATCH_SCANRESULTS: 137 | baseUri = WifiScanContract.ScanResult.CONTENT_ID_URI_BASE; 138 | tableName = WifiScanContract.ScanResult.TABLE_NAME; 139 | break; 140 | case URIMATCH_SCANLOCATIONS: 141 | baseUri = WifiScanContract.ScanLocation.CONTENT_ID_URI_BASE; 142 | tableName = WifiScanContract.ScanLocation.TABLE_NAME; 143 | break; 144 | default: 145 | throw new IllegalArgumentException("Invalid URI: " + uri); 146 | } 147 | 148 | if(values == null) 149 | values = new ContentValues(); 150 | 151 | SQLiteDatabase db = mDbHelper.getWritableDatabase(); 152 | 153 | long rowId = db.insert(tableName, null, values); 154 | 155 | if (rowId < 1) 156 | throw new SQLException("Failed to insert row for URI: " + uri); 157 | 158 | Uri insertedUri = ContentUris.withAppendedId(baseUri, rowId); 159 | 160 | getContext().getContentResolver().notifyChange(insertedUri, null); 161 | 162 | return insertedUri; 163 | 164 | } 165 | 166 | @Override 167 | public int delete(Uri uri, String where, String[] whereArgs) { 168 | SQLiteDatabase db = mDbHelper.getWritableDatabase(); 169 | int count; 170 | String finalWhere; 171 | 172 | switch(sUriMatcher.match(uri)) { 173 | case URIMATCH_SCANRESULTS: 174 | count = db.delete(WifiScanContract.ScanResult.TABLE_NAME, where, whereArgs); 175 | break; 176 | case URIMATCH_SCANRESULT_BYID: 177 | finalWhere = (WifiScanContract.ScanResult._ID + " = " + uri.getPathSegments().get(WifiScanContract.ScanResult.PATH_BYID_IDPOSITION)); 178 | if(!TextUtils.isEmpty(where)) 179 | finalWhere = finalWhere + " AND " + where; 180 | 181 | count = db.delete(WifiScanContract.ScanResult.TABLE_NAME, finalWhere, whereArgs); 182 | break; 183 | case URIMATCH_SCANLOCATIONS: 184 | count = db.delete(WifiScanContract.ScanLocation.TABLE_NAME, where, whereArgs); 185 | break; 186 | case URIMATCH_SCANLOCATION_BYID: 187 | finalWhere = (WifiScanContract.ScanLocation._ID + " = " + uri.getPathSegments().get(WifiScanContract.ScanLocation.PATH_BYID_IDPOSITION)); 188 | if(!TextUtils.isEmpty(where)) 189 | finalWhere = finalWhere + " AND " + where; 190 | 191 | count = db.delete(WifiScanContract.ScanLocation.TABLE_NAME, finalWhere, whereArgs); 192 | break; 193 | default: 194 | throw new IllegalArgumentException("Unsupported URI: " + uri); 195 | } 196 | 197 | if(count > 0) 198 | getContext().getContentResolver().notifyChange(uri, null); 199 | 200 | return count; 201 | } 202 | 203 | @Override 204 | public int update(Uri uri, ContentValues values, String where, 205 | String[] whereArgs) { 206 | SQLiteDatabase db = mDbHelper.getWritableDatabase(); 207 | int count; 208 | String finalWhere; 209 | 210 | switch(sUriMatcher.match(uri)) { 211 | case URIMATCH_SCANRESULTS: 212 | count = db.update(WifiScanContract.ScanResult.TABLE_NAME, values, where, whereArgs); 213 | break; 214 | case URIMATCH_SCANRESULT_BYID: 215 | finalWhere = (WifiScanContract.ScanResult._ID + " = " + uri.getPathSegments().get(WifiScanContract.ScanResult.PATH_BYID_IDPOSITION)); 216 | if(!TextUtils.isEmpty(where)) 217 | finalWhere = finalWhere + " AND " + where; 218 | 219 | count = db.update(WifiScanContract.ScanResult.TABLE_NAME, values, finalWhere, whereArgs); 220 | break; 221 | case URIMATCH_SCANLOCATIONS: 222 | count = db.update(WifiScanContract.ScanLocation.TABLE_NAME, values, where, whereArgs); 223 | break; 224 | case URIMATCH_SCANLOCATION_BYID: 225 | finalWhere = (WifiScanContract.ScanLocation._ID + " = " + uri.getPathSegments().get(WifiScanContract.ScanLocation.PATH_BYID_IDPOSITION)); 226 | if(!TextUtils.isEmpty(where)) 227 | finalWhere = finalWhere + " AND " + where; 228 | 229 | count = db.update(WifiScanContract.ScanLocation.TABLE_NAME, values, finalWhere, whereArgs); 230 | break; 231 | default: 232 | throw new IllegalArgumentException("Unsupported URI: " + uri); 233 | } 234 | 235 | if(count > 0) 236 | getContext().getContentResolver().notifyChange(uri, null); 237 | 238 | return count; 239 | } 240 | } 241 | -------------------------------------------------------------------------------- /src/com/blueodin/wifisniffer/providers/WifiScanContract.java: -------------------------------------------------------------------------------- 1 | package com.blueodin.wifisniffer.providers; 2 | 3 | import android.net.Uri; 4 | import android.provider.BaseColumns; 5 | 6 | public class WifiScanContract { 7 | // Unique identifier for this contract of content provider. 8 | public static final String AUTHORITY = "com.blueodin.wifisniffer.provider.results"; 9 | 10 | // URI for the content provider. 11 | public static final String BASE_URI = "content://" + AUTHORITY + "/"; 12 | 13 | public static final class ScanResult implements BaseColumns 14 | { 15 | public static final String TABLE_NAME = "results"; 16 | 17 | public static final String PATH = "results"; 18 | public static final String PATH_BYID = "result/"; 19 | 20 | // Position in the path (0-index based) where to find the ID 21 | public static final int PATH_BYID_IDPOSITION = 1; 22 | 23 | // Static URIs and utility methods for creating them 24 | public static final Uri CONTENT_URI = Uri.parse(BASE_URI + PATH); 25 | public static final Uri CONTENT_ID_URI_BASE = Uri.parse(BASE_URI + PATH_BYID); 26 | public static final Uri CONTENT_ID_URI_PATTERN = Uri.parse(BASE_URI + PATH_BYID + "#"); 27 | 28 | public static Uri uriById(long id) { 29 | return Uri.parse(BASE_URI + PATH_BYID + id); 30 | } 31 | 32 | // Type for directory of all results 33 | public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd." + AUTHORITY + "." + TABLE_NAME; 34 | 35 | // Type for a single result 36 | public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd." + AUTHORITY + "." + TABLE_NAME; 37 | 38 | // Columns 39 | public static final String COLUMN_NAME_BSSID = "bssid"; 40 | public static final String COLUMN_NAME_SSID = "ssid"; 41 | public static final String COLUMN_NAME_LEVEL = "level"; 42 | public static final String COLUMN_NAME_FREQUENCY = "frequency"; 43 | public static final String COLUMN_NAME_CAPABILITIES = "capabilities"; 44 | public static final String COLUMN_NAME_LAT = "lat"; 45 | public static final String COLUMN_NAME_LON = "lon"; 46 | public static final String COLUMN_NAME_ALT = "alt"; 47 | public static final String COLUMN_NAME_GEOHASH = "geohash"; 48 | public static final String COLUMN_NAME_TIMESTAMP = "timestamp"; 49 | 50 | // Default order 51 | public static final String DEFAULT_ORDER_BY = COLUMN_NAME_TIMESTAMP + " DESC"; 52 | 53 | public static final String[] DEFAULT_PROJECTION = { 54 | COLUMN_NAME_BSSID, 55 | COLUMN_NAME_SSID, 56 | COLUMN_NAME_LEVEL, 57 | COLUMN_NAME_FREQUENCY, 58 | COLUMN_NAME_CAPABILITIES, 59 | //COLUMN_NAME_LAT, 60 | //COLUMN_NAME_LON, 61 | //COLUMN_NAME_ALT, 62 | //COLUMN_NAME_GEOHASH, 63 | COLUMN_NAME_TIMESTAMP 64 | }; 65 | } 66 | 67 | public static final class ScanLocation implements BaseColumns 68 | { 69 | public static final String TABLE_NAME = "location"; 70 | 71 | public static final String PATH = "locations"; 72 | public static final String PATH_BYID = "location/"; 73 | 74 | // Position in the path (0-index based) where to find the ID 75 | public static final int PATH_BYID_IDPOSITION = 1; 76 | 77 | // Static URIs and utility methods for creating them 78 | public static final Uri CONTENT_URI = Uri.parse(BASE_URI + PATH); 79 | public static final Uri CONTENT_ID_URI_BASE = Uri.parse(BASE_URI + PATH_BYID); 80 | public static final Uri CONTENT_ID_URI_PATTERN = Uri.parse(BASE_URI + PATH_BYID + "#"); 81 | 82 | public static Uri uriById(long id) { 83 | return Uri.parse(BASE_URI + PATH_BYID + id); 84 | } 85 | 86 | // Type for directory of all locations 87 | public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd." + AUTHORITY + "." + TABLE_NAME; 88 | 89 | // Content type of a single location 90 | public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd." + AUTHORITY + "." + TABLE_NAME; 91 | 92 | // Columns 93 | public static final String COLUMN_NAME_FK_RESULT = "fk_result"; 94 | public static final String COLUMN_NAME_LAT = "lat"; 95 | public static final String COLUMN_NAME_LON = "lon"; 96 | public static final String COLUMN_NAME_ALT = "alt"; 97 | public static final String COLUMN_NAME_GEOHASH = "geohash"; 98 | public static final String COLUMN_NAME_TIMESTAMP = "timestamp"; 99 | public static final String COLUMN_NAME_LEVEL = "level"; 100 | 101 | // Order by default 102 | public static final String DEFAULT_ORDER_BY = COLUMN_NAME_TIMESTAMP + " DESC"; 103 | 104 | public static final String[] DEFAULT_PROJECTION = { 105 | COLUMN_NAME_FK_RESULT, 106 | COLUMN_NAME_LAT, 107 | COLUMN_NAME_LON, 108 | COLUMN_NAME_ALT, 109 | COLUMN_NAME_GEOHASH, 110 | COLUMN_NAME_TIMESTAMP 111 | }; 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /src/com/blueodin/wifisniffer/providers/WifiScanResult.java: -------------------------------------------------------------------------------- 1 | 2 | package com.blueodin.wifisniffer.providers; 3 | 4 | import android.annotation.SuppressLint; 5 | import android.content.ContentValues; 6 | import android.database.Cursor; 7 | import android.os.Parcel; 8 | import android.os.Parcelable; 9 | import android.text.format.DateFormat; 10 | import android.util.Log; 11 | 12 | import com.blueodin.wifisniffer.R; 13 | import com.blueodin.wifisniffer.providers.WifiScanContract; 14 | 15 | import java.util.ArrayList; 16 | import java.util.Arrays; 17 | import java.util.List; 18 | 19 | public class WifiScanResult implements Parcelable 20 | { 21 | public String bssid; 22 | public String ssid; 23 | public int level; 24 | public int frequency; 25 | public String capabilities; 26 | public long timestamp; 27 | 28 | private static final String TAG = WifiScanResult.class.toString(); 29 | 30 | public WifiScanResult() { 31 | } 32 | 33 | public WifiScanResult(String bssid, String ssid, int level, int frequency, String capabilities, 34 | long timestamp) 35 | { 36 | this.bssid = bssid; 37 | this.ssid = ssid; 38 | this.level = level; 39 | this.frequency = frequency; 40 | this.capabilities = capabilities; 41 | this.timestamp = timestamp; 42 | } 43 | 44 | public static final Parcelable.Creator CREATOR = new Parcelable.Creator() 45 | { 46 | @Override 47 | public WifiScanResult createFromParcel(Parcel parcel) 48 | { 49 | return new WifiScanResult(parcel); 50 | } 51 | 52 | @Override 53 | public WifiScanResult[] newArray(int i) 54 | { 55 | return new WifiScanResult[i]; 56 | } 57 | }; 58 | 59 | private WifiScanResult(Parcel in) 60 | { 61 | bssid = in.readString(); 62 | ssid = in.readString(); 63 | level = in.readInt(); 64 | frequency = in.readInt(); 65 | capabilities = in.readString(); 66 | timestamp = in.readLong(); 67 | } 68 | 69 | public String getFormattedTimestamp() { 70 | return (String) DateFormat.format("MMM dd, yyyy h:mmaa", this.timestamp); 71 | } 72 | 73 | public String getFormattedCapabilities() { 74 | List securities = new ArrayList(); 75 | 76 | if(capabilities.contains("[WPA2-")) 77 | securities.add("WPA2"); 78 | 79 | if(capabilities.contains("[WPA-")) 80 | securities.add("WPA"); 81 | 82 | if(capabilities.contains("[WPS]")) 83 | securities.add("WPS"); 84 | 85 | if(capabilities.contains("[WEP]")) 86 | securities.add("WEP"); 87 | 88 | return Arrays.toString(securities.toArray()); 89 | } 90 | 91 | @Override 92 | public int describeContents() { 93 | return 0; 94 | } 95 | 96 | @Override 97 | public void writeToParcel(Parcel parcel, int i) 98 | { 99 | parcel.writeString(bssid); 100 | parcel.writeString(ssid); 101 | parcel.writeInt(level); 102 | parcel.writeInt(frequency); 103 | parcel.writeString(capabilities); 104 | parcel.writeLong(timestamp); 105 | } 106 | 107 | public static WifiScanResult fromCursor(Cursor cursor) { 108 | WifiScanResult entry = null; 109 | 110 | try { 111 | entry = new WifiScanResult( 112 | cursor.getString(cursor.getColumnIndex(WifiScanContract.ScanResult.COLUMN_NAME_BSSID)), // BSSID 113 | cursor.getString(cursor.getColumnIndex(WifiScanContract.ScanResult.COLUMN_NAME_SSID)), // SSID 114 | cursor.getInt(cursor.getColumnIndex(WifiScanContract.ScanResult.COLUMN_NAME_LEVEL)), // Level 115 | cursor.getInt(cursor.getColumnIndex(WifiScanContract.ScanResult.COLUMN_NAME_FREQUENCY)), // Frequency 116 | cursor.getString(cursor.getColumnIndex(WifiScanContract.ScanResult.COLUMN_NAME_CAPABILITIES)), // Capabilities 117 | cursor.getLong(cursor.getColumnIndex(WifiScanContract.ScanResult.COLUMN_NAME_TIMESTAMP))); // Timestamp 118 | } catch (Exception ex) { 119 | Log.e(TAG, "Unable to parse cursor to retrieve network entry: '" + ex.toString() + "'"); 120 | return null; 121 | } 122 | 123 | return entry; 124 | } 125 | 126 | public ContentValues getContentValues() { 127 | ContentValues values = new ContentValues(); 128 | values.put(WifiScanContract.ScanResult.COLUMN_NAME_BSSID, bssid); 129 | values.put(WifiScanContract.ScanResult.COLUMN_NAME_SSID, ssid); 130 | values.put(WifiScanContract.ScanResult.COLUMN_NAME_LEVEL, level); 131 | values.put(WifiScanContract.ScanResult.COLUMN_NAME_FREQUENCY, frequency); 132 | values.put(WifiScanContract.ScanResult.COLUMN_NAME_CAPABILITIES, capabilities); 133 | values.put(WifiScanContract.ScanResult.COLUMN_NAME_TIMESTAMP, timestamp); 134 | return values; 135 | } 136 | 137 | @SuppressLint("DefaultLocale") 138 | @Override 139 | public String toString() 140 | { 141 | return String.format("ScannedResult(bssid=%s,ssid=%s,level=%d,frequency=%d,capabilities=%s,timestamp=%d)", 142 | bssid, ssid, level, frequency, capabilities, timestamp); 143 | } 144 | 145 | public int getSignalIcon() { 146 | if(level >= -30) 147 | return R.drawable.ic_bars_four; 148 | 149 | if(level >= -60) 150 | return R.drawable.ic_bars_three; 151 | 152 | if(level >= -70) 153 | return R.drawable.ic_bars_two; 154 | 155 | if(level >= -80) 156 | return R.drawable.ic_bars_one; 157 | 158 | return R.drawable.ic_bars_none; 159 | } 160 | 161 | public int getSecurityIcon() { 162 | if(capabilities.contains("[WPA2-")) 163 | return R.drawable.ic_wifi_green; 164 | 165 | if(capabilities.contains("[WPA-")) 166 | return R.drawable.ic_wifi_blue; 167 | 168 | if(capabilities.contains("[WEP]")) 169 | return R.drawable.ic_wifi_orange; 170 | 171 | return R.drawable.ic_wifi_red; 172 | } 173 | } 174 | --------------------------------------------------------------------------------