diff --git a/.circleci/config.yml b/.circleci/config.yml index c259ddc..83a5adc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2 jobs: build: docker: - - image: circleci/android:api-25-alpha + - image: circleci/android:api-29 environment: GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"' steps: @@ -15,7 +15,7 @@ jobs: name: Copy Environment Vars command: scripts/cp-env-to-properties.sh - # Decrypt any secret files / keys + # Decrypt any secret files / keys - run: name: Decrypt secret files command: scripts/decrypt-secrets.sh diff --git a/app/build.gradle b/app/build.gradle index 11a38af..b88df84 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -32,8 +32,11 @@ android { applicationId "com.stealthcotper.networktools" minSdkVersion minSdkVer targetSdkVersion targetSdkVer - versionName appVersionName - versionCode appVersionCode + + // When updating these, remember to update the vars in the root build.gradle + versionName "0.4.5" + versionCode 19 + archivesBaseName = "AndroidNetworkTools" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index fac6d7d..dc42b68 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -6,6 +6,7 @@ openPorts = PortScan.onAddress(ipAddress).setPort(21).setMethodTCP().doScan(); @@ -206,7 +262,7 @@ private void doPortScan() throws Exception { final long startTimeMillis = System.currentTimeMillis(); // Perform an asynchronous port scan - PortScan.onAddress(ipAddress).setPortsAll().setMethodTCP().doScan(new PortScan.PortListener() { + PortScan portScan = PortScan.onAddress(ipAddress).setPortsAll().setMethodTCP().doScan(new PortScan.PortListener() { @Override public void onResult(int portNo, boolean open) { if (open) appendResultsText("Open: " + portNo); @@ -216,17 +272,22 @@ public void onResult(int portNo, boolean open) { public void onFinished(ArrayList openPorts) { appendResultsText("Open Ports: " + openPorts.size()); appendResultsText("Time Taken: " + ((System.currentTimeMillis() - startTimeMillis)/1000.0f)); + setEnabled(portScanButton, true); } }); + // Below is example of how to cancel a running scan + // portScan.cancel(); } private void findSubnetDevices() { + setEnabled(subnetDevicesButton, false); + final long startTimeMillis = System.currentTimeMillis(); - SubnetDevices.fromLocalAddress().findDevices(new SubnetDevices.OnSubnetDeviceFound() { + SubnetDevices subnetDevices = SubnetDevices.fromLocalAddress().findDevices(new SubnetDevices.OnSubnetDeviceFound() { @Override public void onDeviceFound(Device device) { appendResultsText("Device: " + device.ip+" "+ device.hostname); @@ -237,8 +298,13 @@ public void onFinished(ArrayList devicesFound) { float timeTaken = (System.currentTimeMillis() - startTimeMillis)/1000.0f; appendResultsText("Devices Found: " + devicesFound.size()); appendResultsText("Finished "+timeTaken+" s"); + setEnabled(subnetDevicesButton, true); } }); + + // Below is example of how to cancel a running scan + // subnetDevices.cancel(); + } @Override diff --git a/app/src/main/res/layout/content_main.xml b/app/src/main/res/layout/content_main.xml index b0f2b76..ff6675e 100644 --- a/app/src/main/res/layout/content_main.xml +++ b/app/src/main/res/layout/content_main.xml @@ -84,6 +84,7 @@ Port Scan Github https://github.com/stealthcopter/AndroidNetworkTools - Subnet Devices + Subnet Devices + ** Timeout ** diff --git a/build.gradle b/build.gradle index 90c9eb9..56a4a02 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.1.3' + classpath 'com.android.tools.build:gradle:3.5.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } @@ -24,12 +24,13 @@ task clean(type: Delete) { } subprojects { - ext.compileSdkVer = 27 - ext.buildToolsVer = "27.0.3" + ext.compileSdkVer = 29 + ext.buildToolsVer = "29.0.1" ext.minSdkVer = 14 - ext.targetSdkVer = 27 + ext.targetSdkVer = 29 ext.supportLibVer = "27.1.1" - ext.appVersionName = "0.4.0" - ext.appVersionCode = 14 + // When updating these, remember to update the vars in app/build.gradle (for FDroid comptability) + ext.appVersionName = "0.4.5" + ext.appVersionCode = 19 } diff --git a/fastlane/metadata/android/en-GB/changelogs/19.txt b/fastlane/metadata/android/en-GB/changelogs/19.txt new file mode 100644 index 0000000..78a039b --- /dev/null +++ b/fastlane/metadata/android/en-GB/changelogs/19.txt @@ -0,0 +1 @@ +* Added fastlane structure for F-Droid inclusion diff --git a/fastlane/metadata/android/en-GB/full_description.txt b/fastlane/metadata/android/en-GB/full_description.txt new file mode 100644 index 0000000..08ea232 --- /dev/null +++ b/fastlane/metadata/android/en-GB/full_description.txt @@ -0,0 +1,11 @@ +This is a sample application from the open source project Android Network Tools. If you are looking for a more complete network scanning tool, please see my other app Portdroid. + +It demonstrates the following features of the library: + +• Pinging +• Port Scanning +• Finding devices on your network +• Wake-on-lan + +The project is hosted on github. Bug reports, feature requests and contributions are all welcome: +https://github.com/stealthcopter/AndroidNetworkTools diff --git a/fastlane/metadata/android/en-GB/images/icon.png b/fastlane/metadata/android/en-GB/images/icon.png new file mode 100644 index 0000000..1ed5e98 Binary files /dev/null and b/fastlane/metadata/android/en-GB/images/icon.png differ diff --git a/fastlane/metadata/android/en-GB/images/phoneScreenshots/1.png b/fastlane/metadata/android/en-GB/images/phoneScreenshots/1.png new file mode 100644 index 0000000..8e847ca Binary files /dev/null and b/fastlane/metadata/android/en-GB/images/phoneScreenshots/1.png differ diff --git a/fastlane/metadata/android/en-GB/images/phoneScreenshots/2.png b/fastlane/metadata/android/en-GB/images/phoneScreenshots/2.png new file mode 100644 index 0000000..8fc16f6 Binary files /dev/null and b/fastlane/metadata/android/en-GB/images/phoneScreenshots/2.png differ diff --git a/fastlane/metadata/android/en-GB/short_description.txt b/fastlane/metadata/android/en-GB/short_description.txt new file mode 100644 index 0000000..30ee507 --- /dev/null +++ b/fastlane/metadata/android/en-GB/short_description.txt @@ -0,0 +1 @@ +This is the sample application from Android Network Tools open source library diff --git a/fastlane/metadata/android/en-GB/title.txt b/fastlane/metadata/android/en-GB/title.txt new file mode 100644 index 0000000..b56ceb4 --- /dev/null +++ b/fastlane/metadata/android/en-GB/title.txt @@ -0,0 +1 @@ +Network Tools Library diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b5dcd6b..1433f15 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue May 01 19:31:51 BST 2018 +#Sun Nov 03 10:39:47 GMT 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml deleted file mode 100644 index 663b123..0000000 --- a/library/src/main/AndroidManifest.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - diff --git a/library/src/main/java/com/stealthcopter/networktools/MACTools.java b/library/src/main/java/com/stealthcopter/networktools/MACTools.java index 34ac4cc..85f01ac 100644 --- a/library/src/main/java/com/stealthcopter/networktools/MACTools.java +++ b/library/src/main/java/com/stealthcopter/networktools/MACTools.java @@ -17,7 +17,7 @@ private MACTools() { * Validates a provided MAC address * * @param macAddress - the MAC address to check - * @return - true if it is valid MAC address in IEEE802 format (either hyphen or colon seperated) + * @return - true if it is valid MAC address in IEEE802 format (either hyphen or colon separated) * eg: "01:23:45:67:89:AB" or "01-23-45-67-89-AB" */ public static boolean isValidMACAddress(final String macAddress) { @@ -28,7 +28,7 @@ public static boolean isValidMACAddress(final String macAddress) { /** * Convert a MAC string to bytes * - * @param macStr - MAC string in IEEE802 format (either hyphen or colon seperated) + * @param macStr - MAC string in IEEE802 format (either hyphen or colon separated) * eg: "01:23:45:67:89:AB" or "01-23-45-67-89-AB" * @return - MAC formatted in bytes * @throws IllegalArgumentException - if mac address is invalid diff --git a/library/src/main/java/com/stealthcopter/networktools/Ping.java b/library/src/main/java/com/stealthcopter/networktools/Ping.java index 6a43fc8..304c54e 100644 --- a/library/src/main/java/com/stealthcopter/networktools/Ping.java +++ b/library/src/main/java/com/stealthcopter/networktools/Ping.java @@ -1,5 +1,6 @@ package com.stealthcopter.networktools; +import com.stealthcopter.networktools.ping.PingOptions; import com.stealthcopter.networktools.ping.PingResult; import com.stealthcopter.networktools.ping.PingStats; import com.stealthcopter.networktools.ping.PingTools; @@ -34,7 +35,7 @@ public interface PingListener { private String addressString = null; private InetAddress address; - private int timeOutMillis = 1000; + private final PingOptions pingOptions = new PingOptions(); private int delayBetweenScansMillis = 0; private int times = 1; private boolean cancelled = false; @@ -74,7 +75,7 @@ public static Ping onAddress(InetAddress ia) { */ public Ping setTimeOutMillis(int timeOutMillis) { if (timeOutMillis < 0) throw new IllegalArgumentException("Times cannot be less than 0"); - this.timeOutMillis = timeOutMillis; + pingOptions.setTimeoutMillis(timeOutMillis); return this; } @@ -91,6 +92,18 @@ public Ping setDelayMillis(int delayBetweenScansMillis) { return this; } + /** + * Set the time to live + * + * @param timeToLive - the TTL for each ping + * @return this object to allow chaining + */ + public Ping setTimeToLive(int timeToLive) { + if (timeToLive < 1) throw new IllegalArgumentException("TTL cannot be less than 1"); + pingOptions.setTimeToLive(timeToLive); + return this; + } + /** * Set number of times to ping the address * @@ -146,7 +159,7 @@ public void cancel() { public PingResult doPing() throws UnknownHostException { cancelled = false; resolveAddressString(); - return PingTools.doPing(address, timeOutMillis); + return PingTools.doPing(address, pingOptions); } /** @@ -184,7 +197,7 @@ public void run() { // times == 0 is the case that we can continuous scanning while (noPings > 0 || times == 0) { - PingResult pingResult = PingTools.doPing(address, timeOutMillis); + PingResult pingResult = PingTools.doPing(address, pingOptions); if (pingListener != null) { pingListener.onResult(pingResult); diff --git a/library/src/main/java/com/stealthcopter/networktools/PortScan.java b/library/src/main/java/com/stealthcopter/networktools/PortScan.java index ef9f0bc..ef81675 100644 --- a/library/src/main/java/com/stealthcopter/networktools/PortScan.java +++ b/library/src/main/java/com/stealthcopter/networktools/PortScan.java @@ -288,7 +288,7 @@ public void cancel() { } /** - * Perform a synchronous port scan and return a list of open ports + * Perform a synchronous (blocking) port scan and return a list of open ports * * @return - ping result */ @@ -320,7 +320,7 @@ public ArrayList doScan() { } /** - * Perform an asynchronous port scan + * Perform an asynchronous (non-blocking) port scan * * @param portListener - the listener to fire portscan results to. * @return - this object so we can cancel the scan if needed diff --git a/library/src/main/java/com/stealthcopter/networktools/SubnetDevices.java b/library/src/main/java/com/stealthcopter/networktools/SubnetDevices.java index f42b9ee..f3de717 100644 --- a/library/src/main/java/com/stealthcopter/networktools/SubnetDevices.java +++ b/library/src/main/java/com/stealthcopter/networktools/SubnetDevices.java @@ -6,6 +6,7 @@ import java.net.InetAddress; import java.net.UnknownHostException; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -21,6 +22,8 @@ public class SubnetDevices { private ArrayList devicesFound; private OnSubnetDeviceFound listener; private int timeOutMillis = 2500; + private boolean cancelled = false; + private HashMap ipMacHashMap = null; // This class is not to be instantiated private SubnetDevices() { @@ -72,7 +75,7 @@ public static SubnetDevices fromIPAddress(final String ipAddress) { subnetDevice.addresses = new ArrayList<>(); - // Get addresses from ARP Info first as they are likely to be pingable + // Get addresses from ARP Info first as they are likely to be reachable subnetDevice.addresses.addAll(ARPInfo.getAllIPAddressesInARPCache()); // Add all missing addresses in subnet @@ -134,31 +137,68 @@ public SubnetDevices setTimeOutMillis(int timeOutMillis) throws IllegalArgumentE return this; } + /** + * Cancel a running scan + */ + public void cancel() { + this.cancelled = true; + } - public void findDevices(final OnSubnetDeviceFound listener) { + /** + * Starts the scan to find other devices on the subnet + * + * @param listener - to pass on the results + * @return this object so we can call cancel on it if needed + */ + public SubnetDevices findDevices(final OnSubnetDeviceFound listener) { this.listener = listener; + cancelled = false; devicesFound = new ArrayList<>(); - ExecutorService executor = Executors.newFixedThreadPool(this.noThreads); + new Thread(new Runnable() { + @Override + public void run() { - for (final String add : addresses) { - Runnable worker = new SubnetDeviceFinderRunnable(add); - executor.execute(worker); - } + // Load mac addresses into cache var (to avoid hammering the /proc/net/arp file when + // lots of devices are found on the network. + ipMacHashMap = ARPInfo.getAllIPAndMACAddressesInARPCache(); - // This will make the executor accept no new threads - // and finish all existing threads in the queue - executor.shutdown(); - // Wait until all threads are finish - try { - executor.awaitTermination(1, TimeUnit.HOURS); - } catch (InterruptedException e) { - e.printStackTrace(); - } + ExecutorService executor = Executors.newFixedThreadPool(noThreads); + + for (final String add : addresses) { + Runnable worker = new SubnetDeviceFinderRunnable(add); + executor.execute(worker); + } + + // This will make the executor accept no new threads + // and finish all existing threads in the queue + executor.shutdown(); + // Wait until all threads are finish + try { + executor.awaitTermination(1, TimeUnit.HOURS); + } catch (InterruptedException e) { + e.printStackTrace(); + } - this.listener.onFinished(devicesFound); + // Loop over devices found and add in the MAC addresses if missing. + // We do this after scanning for all devices as /proc/net/arp may add info + // because of the scan. + ipMacHashMap = ARPInfo.getAllIPAndMACAddressesInARPCache(); + for (Device device : devicesFound) { + if (device.mac == null && ipMacHashMap.containsKey(device.ip)) { + device.mac = ipMacHashMap.get(device.ip); + } + } + + + listener.onFinished(devicesFound); + + } + }).start(); + + return this; } private synchronized void subnetDeviceFound(Device device) { @@ -175,12 +215,20 @@ public class SubnetDeviceFinderRunnable implements Runnable { @Override public void run() { + + if (cancelled) return; + try { InetAddress ia = InetAddress.getByName(address); PingResult pingResult = Ping.onAddress(ia).setTimeOutMillis(timeOutMillis).doPing(); if (pingResult.isReachable) { Device device = new Device(ia); - device.mac = ARPInfo.getMACFromIPAddress(ia.getHostAddress()); + + // Add the device MAC address if it is in the cache + if (ipMacHashMap.containsKey(ia.getHostAddress())) { + device.mac = ipMacHashMap.get(ia.getHostAddress()); + } + device.time = pingResult.timeTaken; subnetDeviceFound(device); } diff --git a/library/src/main/java/com/stealthcopter/networktools/ping/PingNative.java b/library/src/main/java/com/stealthcopter/networktools/ping/PingNative.java index 4870a35..0b91255 100644 --- a/library/src/main/java/com/stealthcopter/networktools/ping/PingNative.java +++ b/library/src/main/java/com/stealthcopter/networktools/ping/PingNative.java @@ -16,7 +16,7 @@ public class PingNative { private PingNative() { } - public static PingResult ping(InetAddress host, int timeOutMillis) throws IOException, InterruptedException { + public static PingResult ping(InetAddress host, PingOptions pingOptions) throws IOException, InterruptedException { PingResult pingResult = new PingResult(host); if (host == null) { @@ -27,8 +27,8 @@ public static PingResult ping(InetAddress host, int timeOutMillis) throws IOExce StringBuilder echo = new StringBuilder(); Runtime runtime = Runtime.getRuntime(); - int timeoutSeconds = timeOutMillis / 1000; - if (timeoutSeconds < 0) timeoutSeconds = 1; + int timeoutSeconds = Math.max(pingOptions.getTimeoutMillis() / 1000, 1); + int ttl = Math.max(pingOptions.getTimeToLive(), 1); String address = host.getHostAddress(); String pingCommand = "ping"; @@ -46,24 +46,28 @@ public static PingResult ping(InetAddress host, int timeOutMillis) throws IOExce address = host.getHostName(); } - Process proc = runtime.exec(pingCommand + " -c 1 -w " + timeoutSeconds + " " + address); + Process proc = runtime.exec(pingCommand + " -c 1 -W " + timeoutSeconds + " -t " + ttl + " " + address); proc.waitFor(); int exit = proc.exitValue(); String pingError; - if (exit == 0) { - InputStreamReader reader = new InputStreamReader(proc.getInputStream()); - BufferedReader buffer = new BufferedReader(reader); - String line; - while ((line = buffer.readLine()) != null) { - echo.append(line).append("\n"); - } - return getPingStats(pingResult, echo.toString()); - } else if (exit == 1) { - pingError = "failed, exit = 1"; - } else { - pingError = "error, exit = 2"; + switch (exit) { + case 0: + InputStreamReader reader = new InputStreamReader(proc.getInputStream()); + BufferedReader buffer = new BufferedReader(reader); + String line; + while ((line = buffer.readLine()) != null) { + echo.append(line).append("\n"); + } + return getPingStats(pingResult, echo.toString()); + case 1: + pingError = "failed, exit = 1"; + break; + default: + pingError = "error, exit = 2"; + break; } pingResult.error = pingError; + proc.destroy(); return pingResult; } diff --git a/library/src/main/java/com/stealthcopter/networktools/ping/PingOptions.java b/library/src/main/java/com/stealthcopter/networktools/ping/PingOptions.java new file mode 100644 index 0000000..1051b40 --- /dev/null +++ b/library/src/main/java/com/stealthcopter/networktools/ping/PingOptions.java @@ -0,0 +1,27 @@ +package com.stealthcopter.networktools.ping; + +public class PingOptions { + private int timeoutMillis; + private int timeToLive; + + public PingOptions() { + timeToLive = 128; + timeoutMillis = 1000; + } + + public int getTimeoutMillis() { + return timeoutMillis; + } + + public void setTimeoutMillis(int timeoutMillis) { + this.timeoutMillis = Math.max(timeoutMillis, 1000); + } + + public int getTimeToLive() { + return timeToLive; + } + + public void setTimeToLive(int timeToLive) { + this.timeToLive = Math.max(timeToLive, 1); + } +} diff --git a/library/src/main/java/com/stealthcopter/networktools/ping/PingTools.java b/library/src/main/java/com/stealthcopter/networktools/ping/PingTools.java index b72ab8c..68d79a2 100644 --- a/library/src/main/java/com/stealthcopter/networktools/ping/PingTools.java +++ b/library/src/main/java/com/stealthcopter/networktools/ping/PingTools.java @@ -18,14 +18,14 @@ private PingTools() { * on failure. * * @param ia - address to ping - * @param timeOutMillis - timeout in millisecdonds + * @param pingOptions - ping command options * @return - the ping results */ - public static PingResult doPing(InetAddress ia, int timeOutMillis) { + public static PingResult doPing(InetAddress ia, PingOptions pingOptions) { // Try native ping first try { - return PingTools.doNativePing(ia, timeOutMillis); + return PingTools.doNativePing(ia, pingOptions); } catch (InterruptedException e) { PingResult pingResult = new PingResult(ia); pingResult.isReachable = false; @@ -35,7 +35,7 @@ public static PingResult doPing(InetAddress ia, int timeOutMillis) { } // Fallback to java based ping - return PingTools.doJavaPing(ia, timeOutMillis); + return PingTools.doJavaPing(ia, pingOptions); } @@ -43,13 +43,13 @@ public static PingResult doPing(InetAddress ia, int timeOutMillis) { * Perform a ping using the native ping binary * * @param ia - address to ping - * @param timeOutMillis - timeout in millisecdonds + * @param pingOptions - ping command options * @return - the ping results * @throws IOException - IO error running ping command - * @throws InterruptedException - thread interupt + * @throws InterruptedException - thread interrupt */ - public static PingResult doNativePing(InetAddress ia, int timeOutMillis) throws IOException, InterruptedException { - return PingNative.ping(ia, timeOutMillis); + public static PingResult doNativePing(InetAddress ia, PingOptions pingOptions) throws IOException, InterruptedException { + return PingNative.ping(ia, pingOptions); } /** @@ -58,10 +58,10 @@ public static PingResult doNativePing(InetAddress ia, int timeOutMillis) throws * on port 7 (Echo) of the remote host. * * @param ia - address to ping - * @param timeOutMillis - timeout in millisecdonds + * @param pingOptions - ping command options * @return - the ping results */ - public static PingResult doJavaPing(InetAddress ia, int timeOutMillis) { + public static PingResult doJavaPing(InetAddress ia, PingOptions pingOptions) { PingResult pingResult = new PingResult(ia); if (ia == null) { @@ -71,7 +71,7 @@ public static PingResult doJavaPing(InetAddress ia, int timeOutMillis) { try { long startTime = System.nanoTime(); - final boolean reached = ia.isReachable(timeOutMillis); + final boolean reached = ia.isReachable(null, pingOptions.getTimeToLive(), pingOptions.getTimeoutMillis()); pingResult.timeTaken = (System.nanoTime() - startTime) / 1e6f; pingResult.isReachable = reached; if (!reached) pingResult.error = "Timed Out"; diff --git a/library/src/main/java/com/stealthcopter/networktools/subnet/Device.java b/library/src/main/java/com/stealthcopter/networktools/subnet/Device.java index 5d85d52..98538db 100644 --- a/library/src/main/java/com/stealthcopter/networktools/subnet/Device.java +++ b/library/src/main/java/com/stealthcopter/networktools/subnet/Device.java @@ -3,11 +3,9 @@ import java.net.InetAddress; public class Device { - public String ip = ""; - public String hostname = ""; - public String mac = ""; - - + public String ip; + public String hostname; + public String mac; public float time = 0; public Device(InetAddress ip) { diff --git a/library/src/main/res/values/strings.xml b/library/src/main/res/values/strings.xml deleted file mode 100644 index d7df651..0000000 --- a/library/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - AndroidNetworkToolsLibary - diff --git a/library/src/test/java/com/stealthcopter/networktools/ARPInfoTest.java b/library/src/test/java/com/stealthcopter/networktools/ARPInfoTest.java index 0dcb01f..7a31128 100644 --- a/library/src/test/java/com/stealthcopter/networktools/ARPInfoTest.java +++ b/library/src/test/java/com/stealthcopter/networktools/ARPInfoTest.java @@ -10,14 +10,9 @@ public class ARPInfoTest { @Test - public void nullIPsandMacsReturnNull() throws Exception { - + public void nullIPsandMacsReturnNull() { assertNull(ARPInfo.getMACFromIPAddress(null)); assertNull(ARPInfo.getIPAddressFromMAC(null)); - -// assertEquals(arpInfo.getMACFromIPAddress("192.168.18.11"), "00:04:20:06:55:1a"); -// assertEquals(arpInfo.getIPAddressFromMAC("00:22:43:ab:2a:5b"), "192.168.18.36"); - } @Test(expected = IllegalArgumentException.class) diff --git a/readme.md b/readme.md index f799521..ea01ea5 100644 --- a/readme.md +++ b/readme.md @@ -13,6 +13,8 @@ Disappointed by the lack of good network apis in android / java I developed a co ## General info +The javadoc should provide all information needed to understand the methods, but if not feel free to add a issue in github and I'll address any questions! :) + ### Sample app The sample app is published on Google play to allow you to quickly and easier test the library. Enjoy! And please do feedback to us if your tests produce different results.