Android Open Source - AndroidWifiCracker Survey






From Project

Back to project page AndroidWifiCracker.

License

The source code is released under:

MIT License

If you think the Android project AndroidWifiCracker listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.department13.skryfi;
// ww  w  .j a  v a  2s.c  om
import org.json.JSONException;
import org.json.JSONObject;

import android.database.Cursor;
import android.net.wifi.ScanResult;

public class Survey {
  public long timestamp;
  public String bssid;
  public String ssid;
  public double latitude;
  public double longitude;
  public double altitude;
  public int level;
  public int channel;
  public double frequency;
  
  public static enum EncryptionType{ OPEN, WEP, WPA, WPA2 };
  public EncryptionType encryption = EncryptionType.OPEN;
  
  public static enum CipherType { NONE, UNKNOWN, WEP40, WEP104, CCMP, WRAP, TKIP };
  public CipherType cipher = CipherType.NONE;
  
  public static enum AuthType { NONE, UNKNOWN, PSK, SKA, MGT, OPEN };
  public AuthType authentication = AuthType.UNKNOWN;
  // human readable version of the security features 
  public String security = "";
  
  public Survey(Cursor cursor) 
  {
    // TODO Auto-generated constructor stub
  }
  
  public Survey(String bssid, String ssid, double freq, int level, String sec)
  {
    this.timestamp = System.currentTimeMillis();
    this.bssid = bssid;
    this.ssid = ssid;
    this.frequency = freq;
    this.level = level;
    this.channel = FrequencyToChannel(this.frequency);
    
    this.security = sec;
    if (security.contains("WEP"))
      encryption = EncryptionType.WEP;
    else if (security.contains("WPA2"))
      encryption = EncryptionType.WPA2;
    else if (security.contains("WPA"))
      encryption = EncryptionType.WPA;
    else if ((security.contains("OPEN")) || (security.contains("OPN")))
      encryption = EncryptionType.OPEN;
  }
  
  public Survey(ScanResult result)
  {
    this.timestamp = System.currentTimeMillis();
    this.bssid = result.BSSID;
    this.ssid = result.SSID;
    this.level = result.level;
    this.frequency = result.frequency;
    this.channel = FrequencyToChannel(this.frequency);
    this.security = result.capabilities.toUpperCase();
    
    if (security.contains("WEP"))
      encryption = EncryptionType.WEP;
    else if (security.contains("WPA2"))
      encryption = EncryptionType.WPA2;
    else if (security.contains("WPA"))
      encryption = EncryptionType.WPA;
    else if ((security.contains("OPEN")) || (security.contains("OPN")))
      encryption = EncryptionType.OPEN;
  }
  
  public Survey(JSONObject obj) throws JSONException
  {
    this.timestamp = System.currentTimeMillis();
    this.bssid = obj.getString("mac");
    this.ssid = obj.getString("essid");
    this.level = obj.getInt("power");
    this.channel = obj.getInt("channel");
    this.frequency = ChannelToFrequency(this.channel);
    String priv = obj.getString("privacy");
    String cip = obj.getString("cipher");
    String auth = obj.getString("auth");
    this.security = priv + ", " + cip + ", " + auth;
    
    if (priv.equalsIgnoreCase("WEP"))
      encryption = EncryptionType.WEP;
    else if (priv.equalsIgnoreCase("WPA"))
      encryption = EncryptionType.WPA;
    else if (priv.equalsIgnoreCase("WPA2"))
      encryption = EncryptionType.WPA2;
    else if ((priv.equalsIgnoreCase("OPEN"))||(priv.equalsIgnoreCase("OPN")))
      encryption = EncryptionType.OPEN;
    
    if ((cip.equalsIgnoreCase("WEP"))||(cip.equalsIgnoreCase("WEP104")))
      cipher = CipherType.WEP104;
    else if (cip.equalsIgnoreCase("WEP40"))
      cipher = CipherType.WEP40;
    else if (cip.equalsIgnoreCase("CCMP"))
      cipher = CipherType.CCMP;
    else if (cip.equalsIgnoreCase("TKIP"))
      cipher = CipherType.TKIP;
    else if (cip.equalsIgnoreCase("WRAP"))
      cipher = CipherType.WRAP;
    
    if ((cip.equalsIgnoreCase("OPN"))||(cip.equalsIgnoreCase("OPEN")))
      authentication = AuthType.OPEN;
    else if (cip.equalsIgnoreCase("MGT"))
      authentication = AuthType.MGT;
    else if (cip.equalsIgnoreCase("SKA"))
      authentication = AuthType.SKA;
    else if (cip.equalsIgnoreCase("PSK"))
      authentication = AuthType.PSK;
  }


  public void updatePosition(double lat, double lng, double alt)
  {
    latitude = lat;
    longitude = lng;
    altitude = alt;
  }
  
  static public int FrequencyToChannel(double freq)
  {
    double delta = freq - 2.407;
    return (int)(delta/0.005);
  }
  
  static public double ChannelToFrequency(int channel)
  {
    return ((double)channel * 0.005) + 2.407;
  }
}




Java Source Code List

com.d13.harris.video.Splash.java
com.d13.harris.video.Video.java
com.department13.skryfi.CrackerListener.java
com.department13.skryfi.Cracker.java
com.department13.skryfi.HomeScreen.java
com.department13.skryfi.MoreInfoScreen.java
com.department13.skryfi.NetworkDatabase.java
com.department13.skryfi.NetworkDevice.java
com.department13.skryfi.NetworkListScreen.java
com.department13.skryfi.Network.java
com.department13.skryfi.NodesScreen.java
com.department13.skryfi.SortEncryption.java
com.department13.skryfi.SortName.java
com.department13.skryfi.SortOptions.java
com.department13.skryfi.SortSignalStrength.java
com.department13.skryfi.SortingNetworkObject.java
com.department13.skryfi.SurveyListScreen.java
com.department13.skryfi.SurveyListener.java
com.department13.skryfi.SurveyManagerService.java
com.department13.skryfi.SurveyManager.java
com.department13.skryfi.Survey.java