|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object Activity com.wjholden.nmap.NmapSubnet
public class NmapSubnet
Shows information about the subnet the device is currently connected to via
802.11. This class includes a number of methods handling the confusing world
of byte ordering with IP's in Java. There is no 'unsigned byte' in Java so
portions of this were (very) frustrating to write, but it's been fun and
educational.
TODO:
- save output to XML
- enable/disable debugging from here
Nested Class Summary | |
---|---|
private class |
NmapSubnet.PollWifiChanges
|
Field Summary | |
---|---|
private int |
base
|
private int[] |
broadcast
|
private java.lang.String |
classfulness
|
private int[] |
dns1
|
private int[] |
dns2
|
private EditText |
editBC
|
private EditText |
editClass
|
private EditText |
editDG
|
private EditText |
editDns1
|
private EditText |
editDns2
|
private EditText |
editHosts
|
private EditText |
editIP
|
private EditText |
editNet
|
private EditText |
editSM
|
private EditText |
editSSID
|
private int[] |
gateway
|
(package private) static Handler |
handler
|
private int[] |
ip
|
private int[] |
mask
|
private int[] |
network
|
(package private) static NmapSubnet.PollWifiChanges |
poller
|
private java.lang.String |
ssid
|
(package private) static boolean |
subnetActivityClosing
|
Fields inherited from interface com.wjholden.nmap.NmapConstants |
---|
BUFFER_SIZE, FORCE_RESTART, INSTALL_ERROR, INSTALL_FILENAMES, INSTALL_GOOD, INSTALL_NO_ROOT, INSTALL_RESOURCES, MG_DEBUG, MG_DEFAULT, MG_SUBNET, MI_BIN, MI_DEBUG_EMAIL, MI_DEBUG_ENABLE, MI_DEC, MI_EMAIL_SUBNET, MI_EXIT, MI_HEX, MI_MORE_HELP, MI_REINSTALL, MI_SUBNET, MI_SURVEY, RUN_COMPLETE, RUN_ERROR, RUN_SUCCESS_NO_FILE, SCANTYPE_NCAT, SCANTYPE_NDIFF, SCANTYPE_NMAP_5_30, SCANTYPE_NMAP_5_50, SCANTYPE_NPING, SET_TITLE, SUBNET_CONNECTED, SUBNET_DISCONNECTED, SUBNET_POLL_INTERVAL, TAG, THREAD_ERROR |
Constructor Summary | |
---|---|
NmapSubnet()
|
Method Summary | |
---|---|
private int[] |
broadcast(int[] network,
int subnet)
Calculates the broadcast address for given network using given subnet. |
private int |
cidr(int subnet)
Calculates the number of bits used for the network+subnet based off of given subnet mask. |
private void |
clearView()
Clears all fields in the viewport. |
private java.lang.String |
findNetworkClass(int[] ip,
int subnet)
Finds the network class of a network given network address and subnet mask. |
private java.lang.String |
getWifiInfo()
This method calls other methods, as appropriate, to gather and calculate information on the subnet the handset it currently connected to via 802.11. |
private int |
ipArrayToInt(int[] input)
Converts an integer-array IPv4 address back to an integer representation. |
private int[] |
ipToArray(int ip)
This is some good stuff I borrowed from this guy, who in turn says it came from Limewire. |
private java.lang.String |
ipToString(int[] ip,
java.nio.ByteOrder endianness,
int base)
Converts an IP address in integer-array form to a String. |
private java.lang.String |
networkClassfulness(char classChar,
int cidr)
Basic logic to determine, given class and CIDR, whether a network is classful or classless. |
protected void |
onCreate(Bundle savedInstanceState)
|
protected void |
onDestroy()
|
boolean |
onMenuItemSelected(int featureId,
MenuItem item)
|
boolean |
onPrepareOptionsMenu(Menu menu)
|
private int |
subnetNumberOfHosts(int subnet)
Uses the CIDR method to calculate the number of hosts available based off of the provided subnet mask. |
private int |
subnetNumberOfOnes(int octet)
Counts the number of ones in the binary representation of a single octet of your subnet mask. Note that this was not designed for wildcard masks (i.e. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private transient int base
private transient int[] broadcast
private transient java.lang.String classfulness
private transient int[] dns1
private transient int[] dns2
private transient EditText editBC
private transient EditText editClass
private transient EditText editDG
private transient EditText editDns1
private transient EditText editDns2
private transient EditText editHosts
private transient EditText editIP
private transient EditText editNet
private transient EditText editSM
private transient EditText editSSID
private transient int[] gateway
static Handler handler
private transient int[] ip
private transient int[] mask
private transient int[] network
static NmapSubnet.PollWifiChanges poller
private transient java.lang.String ssid
static boolean subnetActivityClosing
Constructor Detail |
---|
public NmapSubnet()
Method Detail |
---|
private int[] broadcast(int[] network, int subnet)
network
- Integer-array formed network address.subnet
- Subnet provided by DhcpInfo.netmask.
private int cidr(int subnet)
subnet
- Host byte representation of the subnet mask.
private void clearView()
private java.lang.String findNetworkClass(int[] ip, int subnet)
ip
- Network-order IP address of the network IP.subnet
- Host-order IP in integer format.
private java.lang.String getWifiInfo()
private int ipArrayToInt(int[] input)
input
- Integer-array IPv4 address in network byte order.
private int[] ipToArray(int ip)
ip
- Integer representation in host byte order to be converted.
private java.lang.String ipToString(int[] ip, java.nio.ByteOrder endianness, int base)
ip
- Integer-array IPv4 address.endianness
- ByteOrder.LITTLE_ENDIAN or ByteOrder.BIG_ENDIAN.base
- Indicates what base to output in (options are MI_DEC, MI_HEX, and MI_BIN,
as defined in NmapConstants interface).
private java.lang.String networkClassfulness(char classChar, int cidr)
classChar
- Character representation of class ('A', 'B', or 'C').cidr
- Number of bits used for subnet/network address (i.e. 192.168.1.1/xx <- xx is the CIDR).
protected void onCreate(Bundle savedInstanceState)
protected void onDestroy()
public boolean onMenuItemSelected(int featureId, MenuItem item)
public boolean onPrepareOptionsMenu(Menu menu)
private int subnetNumberOfHosts(int subnet)
subnet
- Host byte representation of the subnet mask.
private int subnetNumberOfOnes(int octet)
octet
- An IPv4-style octet values 0 to 255.
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |