From d2cce891d7d648220f25688c8fd8995d2e417b32 Mon Sep 17 00:00:00 2001 From: Matthew Rollings Date: Sun, 17 Jun 2018 17:39:59 +0100 Subject: [PATCH 1/7] Updated CI scripts --- app/build.gradle | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 4adf6ba..05c5390 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -18,7 +18,9 @@ apply plugin: 'com.github.triplet.play' play { track = 'beta' - serviceAccountEmail ANDROID_NETWORK_TOOLS_SERVICE_ACCOUNT + if (project.hasProperty("ANDROID_NETWORK_TOOLS_SERVICE_ACCOUNT")) { + serviceAccountEmail ANDROID_NETWORK_TOOLS_SERVICE_ACCOUNT + } pk12File = file('../key.p12') } From 751447535d704afe23defb1f95186bf25d5d14a0 Mon Sep 17 00:00:00 2001 From: Matthew Rollings Date: Mon, 18 Jun 2018 09:23:38 +0100 Subject: [PATCH 2/7] Added javadoc --- library/build.gradle | 9 +++++++++ .../stealthcopter/networktools/ARPInfo.java | 4 ++-- .../com/stealthcopter/networktools/Ping.java | 1 + .../stealthcopter/networktools/PortScan.java | 2 +- .../networktools/SubnetDevices.java | 20 ++++++++++++++++--- .../stealthcopter/networktools/WakeOnLan.java | 11 ++++++++++ .../networktools/ping/PingNative.java | 12 ++++++----- .../networktools/ping/PingTools.java | 4 ++-- .../portscanning/PortScanTCP.java | 8 ++++++++ .../portscanning/PortScanUDP.java | 9 +++++++++ scripts/github-release.sh | 6 +++--- 11 files changed, 70 insertions(+), 16 deletions(-) diff --git a/library/build.gradle b/library/build.gradle index 6715221..a884fc6 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -8,5 +8,14 @@ dependencies { testImplementation 'org.mockito:mockito-core:2.10.0' } +task javadocJar(type: Jar) { + classifier = 'javadoc' + from javadoc +} + +artifacts { + archives javadocJar +} + sourceCompatibility = "1.7" targetCompatibility = "1.7" \ No newline at end of file diff --git a/library/src/main/java/com/stealthcopter/networktools/ARPInfo.java b/library/src/main/java/com/stealthcopter/networktools/ARPInfo.java index 46d4878..2c07a99 100644 --- a/library/src/main/java/com/stealthcopter/networktools/ARPInfo.java +++ b/library/src/main/java/com/stealthcopter/networktools/ARPInfo.java @@ -8,10 +8,10 @@ /** * Created by mat on 09/12/15. - *

+ * * Looks at the file at /proc/net/arp to fromIPAddress ip/mac addresses from the cache * We assume that the file has this structure: - *

+ * * IP address HW type Flags HW address Mask Device * 192.168.18.11 0x1 0x2 00:04:20:06:55:1a * eth0 * 192.168.18.36 0x1 0x2 00:22:43:ab:2a:5b * eth0 diff --git a/library/src/main/java/com/stealthcopter/networktools/Ping.java b/library/src/main/java/com/stealthcopter/networktools/Ping.java index 89ff301..6a43fc8 100644 --- a/library/src/main/java/com/stealthcopter/networktools/Ping.java +++ b/library/src/main/java/com/stealthcopter/networktools/Ping.java @@ -141,6 +141,7 @@ public void cancel() { * request * * @return - ping result + * @throws UnknownHostException - if the host cannot be resolved */ public PingResult doPing() throws UnknownHostException { cancelled = false; diff --git a/library/src/main/java/com/stealthcopter/networktools/PortScan.java b/library/src/main/java/com/stealthcopter/networktools/PortScan.java index e47de2e..ef9f0bc 100644 --- a/library/src/main/java/com/stealthcopter/networktools/PortScan.java +++ b/library/src/main/java/com/stealthcopter/networktools/PortScan.java @@ -54,7 +54,7 @@ public interface PortListener { * @param address - Address to be pinged * @return this object to allow chaining * @throws UnknownHostException - if no IP address for the - * host could be found, or if a scope_id was specified + * {@code host} could be found, or if a scope_id was specified * for a global IPv6 address. */ public static PortScan onAddress(String address) throws UnknownHostException { diff --git a/library/src/main/java/com/stealthcopter/networktools/SubnetDevices.java b/library/src/main/java/com/stealthcopter/networktools/SubnetDevices.java index 65dc7d3..f42b9ee 100644 --- a/library/src/main/java/com/stealthcopter/networktools/SubnetDevices.java +++ b/library/src/main/java/com/stealthcopter/networktools/SubnetDevices.java @@ -34,6 +34,8 @@ public interface OnSubnetDeviceFound { /** * Find devices on the subnet working from the local device ip address + * + * @return - this for chaining */ public static SubnetDevices fromLocalAddress() { InetAddress ipv4 = IPTools.getLocalIPv4Address(); @@ -47,6 +49,8 @@ public static SubnetDevices fromLocalAddress() { /** * @param inetAddress - an ip address in the subnet + * + * @return - this for chaining */ public static SubnetDevices fromIPAddress(InetAddress inetAddress) { return fromIPAddress(inetAddress.getHostAddress()); @@ -55,6 +59,8 @@ public static SubnetDevices fromIPAddress(InetAddress inetAddress) { /** * @param ipAddress - the ipAddress string of any device in the subnet i.e. "192.168.0.1" * the final part will be ignored + * + * @return - this for chaining */ public static SubnetDevices fromIPAddress(final String ipAddress) { @@ -84,6 +90,8 @@ public static SubnetDevices fromIPAddress(final String ipAddress) { /** * @param ipAddresses - the ipAddresses of devices to be checked + * + * @return - this for chaining */ public static SubnetDevices fromIPList(final List ipAddresses) { @@ -100,8 +108,10 @@ public static SubnetDevices fromIPList(final List ipAddresses) { /** * @param noThreads set the number of threads to work with, note we default to a large number * as these requests are network heavy not cpu heavy. - * @return self - * @throws IllegalAccessException + * + * @throws IllegalArgumentException - if invalid number of threads requested + * + * @return - this for chaining */ public SubnetDevices setNoThreads(int noThreads) throws IllegalArgumentException { if (noThreads < 1) throw new IllegalArgumentException("Cannot have less than 1 thread"); @@ -112,9 +122,13 @@ public SubnetDevices setNoThreads(int noThreads) throws IllegalArgumentException /** * Sets the timeout for each address we try to ping * + * @param timeOutMillis - timeout in milliseconds for each ping + * * @return this object to allow chaining + * + * @throws IllegalArgumentException - if timeout is less than zero */ - public SubnetDevices setTimeOutMillis(int timeOutMillis) { + public SubnetDevices setTimeOutMillis(int timeOutMillis) throws IllegalArgumentException { if (timeOutMillis < 0) throw new IllegalArgumentException("Timeout cannot be less than 0"); this.timeOutMillis = timeOutMillis; return this; diff --git a/library/src/main/java/com/stealthcopter/networktools/WakeOnLan.java b/library/src/main/java/com/stealthcopter/networktools/WakeOnLan.java index d7ad69f..53adb5f 100644 --- a/library/src/main/java/com/stealthcopter/networktools/WakeOnLan.java +++ b/library/src/main/java/com/stealthcopter/networktools/WakeOnLan.java @@ -141,6 +141,8 @@ public void wake() throws IOException { /** * Asynchronous call of the wake method. This will be performed on the background thread * and optionally fire a listener when complete, or when an error occurs + * + * @param wakeOnLanListener - listener to call on result */ public void wake(final WakeOnLanListener wakeOnLanListener) { @@ -165,6 +167,9 @@ public void run() { * * @param ipStr - IP String to send to * @param macStr - MAC address to wake up + * + * @throws IllegalArgumentException - invalid ip or mac + * @throws IOException - error sending packet */ public static void sendWakeOnLan(String ipStr, String macStr) throws IllegalArgumentException, IOException { sendWakeOnLan(ipStr, macStr, DEFAULT_PORT, DEFAULT_TIMEOUT_MILLIS, DEFAULT_NO_PACKETS); @@ -178,6 +183,9 @@ public static void sendWakeOnLan(String ipStr, String macStr) throws IllegalArgu * @param port - port to send packet to * @param timeoutMillis - timeout (millis) * @param packets - number of packets to send + * + * @throws IllegalArgumentException - invalid ip or mac + * @throws IOException - error sending packet */ public static void sendWakeOnLan(final String ipStr, final String macStr, final int port, final int timeoutMillis, final int packets) throws IllegalArgumentException, IOException { if (ipStr == null) throw new IllegalArgumentException("Address cannot be null"); @@ -193,6 +201,9 @@ public static void sendWakeOnLan(final String ipStr, final String macStr, final * @param port - port to send packet to * @param timeoutMillis - timeout (millis) * @param packets - number of packets to send + * + * @throws IllegalArgumentException - invalid ip or mac + * @throws IOException - error sending packet */ public static void sendWakeOnLan(final InetAddress address, final String macStr, final int port, final int timeoutMillis, final int packets) throws IllegalArgumentException, IOException { if (address == null) throw new IllegalArgumentException("Address cannot be null"); 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 7ed1430..cc6bfbd 100644 --- a/library/src/main/java/com/stealthcopter/networktools/ping/PingNative.java +++ b/library/src/main/java/com/stealthcopter/networktools/ping/PingNative.java @@ -86,13 +86,15 @@ public static PingResult ping(InetAddress host, int timeOutMillis) throws IOExce * # activity_ping 321321. * activity_ping: unknown host 321321. * - * 1. Check if output contains 0% packet loss : Branch to success -> Get stats - * 2. Check if output contains 100% packet loss : Branch to fail -> No stats - * 3. Check if output contains 25% packet loss : Branch to partial success -> Get stats + * 1. Check if output contains 0% packet loss : Branch to success - Get stats + * 2. Check if output contains 100% packet loss : Branch to fail - No stats + * 3. Check if output contains 25% packet loss : Branch to partial success - Get stats * 4. Check if output contains "unknown host" * - * @param pingResult - * @param s + * @param pingResult - the current ping result + * @param s - result from ping command + * + * @return The ping result */ public static PingResult getPingStats(PingResult pingResult, String s) { String pingError; 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 b327289..bf5f937 100644 --- a/library/src/main/java/com/stealthcopter/networktools/ping/PingTools.java +++ b/library/src/main/java/com/stealthcopter/networktools/ping/PingTools.java @@ -45,8 +45,8 @@ public static PingResult doPing(InetAddress ia, int timeOutMillis) { * @param ia - address to ping * @param timeOutMillis - timeout in millisecdonds * @return - the ping results - * @throws IOException - * @throws InterruptedException + * @throws IOException - IO error running ping command + * @throws InterruptedException - thread interupt */ public static PingResult doNativePing(InetAddress ia, int timeOutMillis) throws IOException, InterruptedException { return PingNative.ping(ia, timeOutMillis); diff --git a/library/src/main/java/com/stealthcopter/networktools/portscanning/PortScanTCP.java b/library/src/main/java/com/stealthcopter/networktools/portscanning/PortScanTCP.java index c2537d5..34050b8 100644 --- a/library/src/main/java/com/stealthcopter/networktools/portscanning/PortScanTCP.java +++ b/library/src/main/java/com/stealthcopter/networktools/portscanning/PortScanTCP.java @@ -14,6 +14,14 @@ public class PortScanTCP { private PortScanTCP() { } + /** + * Check if a port is open with TCP + * + * @param ia - address to scan + * @param portNo - port to scan + * @param timeoutMillis - timeout + * @return - true if port is open, false if not or unknown + */ public static boolean scanAddress(InetAddress ia, int portNo, int timeoutMillis) { Socket s = null; diff --git a/library/src/main/java/com/stealthcopter/networktools/portscanning/PortScanUDP.java b/library/src/main/java/com/stealthcopter/networktools/portscanning/PortScanUDP.java index efd1939..fd58e56 100644 --- a/library/src/main/java/com/stealthcopter/networktools/portscanning/PortScanUDP.java +++ b/library/src/main/java/com/stealthcopter/networktools/portscanning/PortScanUDP.java @@ -14,6 +14,15 @@ public class PortScanUDP { private PortScanUDP() { } + /** + * Check if a port is open with UDP, note that this isn't reliable + * as UDP will does not send ACKs + * + * @param ia - address to scan + * @param portNo - port to scan + * @param timeoutMillis - timeout + * @return - true if port is open, false if not or unknown + */ public static boolean scanAddress(InetAddress ia, int portNo, int timeoutMillis) { try { diff --git a/scripts/github-release.sh b/scripts/github-release.sh index 90ddc51..e1ec1f5 100755 --- a/scripts/github-release.sh +++ b/scripts/github-release.sh @@ -16,7 +16,7 @@ GITHUB_UPLOAD_URL="https://uploads.github.com/repos/stealthcopter/AndroidNetwork function create_github_release { - version=`cat $1/build.gradle | grep -m 1 versionName | cut -d'"' -f 2` + version=$2 echo "Uploading release" @@ -33,7 +33,7 @@ function create_github_release { echo "Found id $id" # Upload apk file - GITHUB_RELEASE_FILE_PATH="app/build/outputs/apk/release/AndroidNetworkTools.apk" + GITHUB_RELEASE_FILE_PATH="app/build/outputs/apk/release/AndroidNetworkTools-release.apk" GITHUB_RELASE_FILENAME="AndroidNetworkTools.apk" curl -H "Content-Type:application/zip" -H "Authorization: token $GITHUB_RELEASE_TOKEN" --data-binary @"$GITHUB_RELEASE_FILE_PATH" $GITHUB_UPLOAD_URL$id/assets?name=$GITHUB_RELASE_FILENAME @@ -57,7 +57,7 @@ function create_github_release { if [[ $GIT_TAG != *"undefined"* ]]; then echo "Creating github release for tag $GIT_TAG" - if create_github_release $GITHUB_RELEASE_MODULE; then + if create_github_release $GITHUB_RELEASE_MODULE $GIT_TAG; then webhook $GITHUB_RELEASE_MODULE "$GITHUB_RELEASE_NAME" "Created github release for tag $TAG" else webhook $GITHUB_RELEASE_MODULE "$GITHUB_RELEASE_NAME" "Failed to create github release for tag $TAG :(" From 0ad0eb449d97286741b609b9839cd541a88b472d Mon Sep 17 00:00:00 2001 From: Matthew Rollings Date: Mon, 18 Jun 2018 09:26:00 +0100 Subject: [PATCH 3/7] Added sources --- library/build.gradle | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/library/build.gradle b/library/build.gradle index a884fc6..e3cfdfd 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -8,12 +8,18 @@ dependencies { testImplementation 'org.mockito:mockito-core:2.10.0' } +task sourcesJar(type: Jar, dependsOn: classes) { + classifier = 'sources' + from sourceSets.main.allSource +} + task javadocJar(type: Jar) { classifier = 'javadoc' from javadoc } artifacts { + archives sourcesJar archives javadocJar } From c3b3a196037f2e4de478b8d51e11ee7d5d8cdbba Mon Sep 17 00:00:00 2001 From: Matthew Rollings Date: Wed, 20 Jun 2018 09:56:44 +0100 Subject: [PATCH 4/7] Updated CI scripts #PLAY_BETA --- .circleci/key.p12.enc | Bin 2496 -> 2496 bytes .gitignore | 1 + scripts/upload-apks.sh | 4 ++-- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.circleci/key.p12.enc b/.circleci/key.p12.enc index be3d8cf1641028b746665d6bd066cb3c6d055824..ed07f353d5cfa8ce429404f7bd776548894313e4 100644 GIT binary patch literal 2496 zcmV;x2|xBzVQh3|WM5wpn}=j~sa~tEtLJF^oG~T>&q~^Qm1F7)Fy^|VlNlk!d=7b` z*M4G$+*dO%nlF7FgY=Yq+P(NxY8@_qqbudm^gi8k_x(0YER)4(BzWGA^russf83Fj zT(+!bZtszROjVcKIT(m>tymtPZpgrz_TcXdZEv*OGCE$_#J>(y02Y0P8^lb%J-X&4 zl4C5mo;-|4o${>V+&-PrU~j$5*n$|BJB|RZnM=WBrZ1yrKaYda!J~MGSmfl>?C=y}kA)I@UMo?&*TCZg@&LzF_ zLu-DNcjPB55uwtT{XJKTwP)vM@of*>(wB6hD1q>DG09fyhyuZ0!SCd+oJ#zZqD3jX0GDF$zuZGeY~nM^km-;L!eXbW*s zxFiCC&4i3G!${SvCMDy4=*mHx82r^jA!3D)rpS*%ZfHHR&4w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n=c66*JX-%^IW7Dz(57D*L%%ZpX z)PeNf)N`3wE4)OV=o0?P%--DWuCdX%l#XF}bvWz+K_p3KZT+CK*5X=lEmy+RnA@5+ zIaeFC=4X>{tt-gaR22B!RstNM!R0C-*3!1tn^8|Dy{~2xwT*BpSgn zF$Wet9IaLmihjAcz({x^VqmGvtTPk}O?TQtWw4uW*z8)o>7h%|VC9#myVJe78#kyu zmdLDVtp%6HNTGoH!lwhm1C6j~KK6j2q}jw3(MtW&S5DHvnL|)WKW3xEiG0$>7V7C~ zc;dq+-6FHz*Qd#SYa4ZRGWZ75up5tWP#G?Zgs6(x9H@QgiNdrQf1$UTEqCDxm} zg-sYF#BgIq2%*Dl<6+zq1!jYtQo%g6HHbXG&B^jtb2l%*{$F^VSjk-tT(iStU;?&U z-!u{|;bRn8P6ZoO`PQkY0@BE1l^b%M4Czh?#P_IhGvF%@L_(EC#a{Vl6?`AqDM@CT z`ZfOrp?@Bj&(P-Ck;LO`L%fkYLNA%TrNK}M{b1RqkH z@z_j3tC8veH}P5r{M6>xsX_NUHUtyNFk|5y&S@!Ty;=1H?n-uLwE~a&*HA05Ae6;m z6)HfRyGicIOrdx-I2_pOeNHb5D*R0_%tkFzn#4qfk)8{{zkHbrq$Pqj13K!qnqcwq zs$8?sQgQ2Xz2bw1G_CmJo3sk=I!uC)Qw<)bw)gJ+2VkKXiOc#>$`e8R@BWEJ+?(D{zynWG@X1#q&jLOJmVtn3;5`n}%s#7ij?*f#u3? KM3Z1FcehMmz1@HS diff --git a/.gitignore b/.gitignore index f88df09..255e0fb 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ /captures TODO key.p12 +/keystore diff --git a/scripts/upload-apks.sh b/scripts/upload-apks.sh index 085e4d6..8a6ebb6 100755 --- a/scripts/upload-apks.sh +++ b/scripts/upload-apks.sh @@ -22,7 +22,7 @@ function upload_to_beta { function upload_to_google_play { echo "Uploading $1 to Google Play" - if ./gradlew :$1:publishApkRegularRelease ; then + if ./gradlew :$1:publishApkRelease ; then webhook $1 "$APP_RELEASE_NAME" "Uploading to Google Play Succeeded" else webhook $1 "$APP_RELEASE_NAME" "Uploading to Google Play FAILED :(" @@ -39,7 +39,7 @@ function upload_to_google_play { # Print the git commit message echo "Git commit message: ${GIT_COMMIT_DESC}" -if [[ $GIT_COMMIT_DESC == *"#DEPLOY"* ]]; then +if [[ $GIT_COMMIT_DESC == *"#PLAY_BETA"* ]]; then upload_to_google_play "app" else echo "Not publishing to Google Play as deploy not found in commit message" From bbb18e17510da1130df9bbeeef8ed062b22e5d9d Mon Sep 17 00:00:00 2001 From: Matthew Rollings Date: Wed, 20 Jun 2018 10:00:27 +0100 Subject: [PATCH 5/7] Fixed version numbers #PLAY_BETA --- app/build.gradle | 4 ++-- build.gradle | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 05c5390..0da3309 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -32,8 +32,8 @@ android { applicationId "com.stealthcotper.networktools" minSdkVersion minSdkVer targetSdkVersion targetSdkVer - versionCode versionName - versionName versionCode + versionCode appVersionName + versionName appVersionCode archivesBaseName = "AndroidNetworkTools" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } diff --git a/build.gradle b/build.gradle index 92d1190..90c9eb9 100644 --- a/build.gradle +++ b/build.gradle @@ -30,6 +30,6 @@ subprojects { ext.targetSdkVer = 27 ext.supportLibVer = "27.1.1" - ext.versionName = "0.4.0" - ext.versionCode = 14 + ext.appVersionName = "0.4.0" + ext.appVersionCode = 14 } From 4ab200349fd5222881dd5f65e6b172d7fbd829e8 Mon Sep 17 00:00:00 2001 From: Matthew Rollings Date: Wed, 20 Jun 2018 10:05:15 +0100 Subject: [PATCH 6/7] Fixed code/name switch #PLAY_BETA --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 0da3309..11a38af 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -32,8 +32,8 @@ android { applicationId "com.stealthcotper.networktools" minSdkVersion minSdkVer targetSdkVersion targetSdkVer - versionCode appVersionName - versionName appVersionCode + versionName appVersionName + versionCode appVersionCode archivesBaseName = "AndroidNetworkTools" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } From 90d766b1382aefede7d05c5580807ef0cddcb0e9 Mon Sep 17 00:00:00 2001 From: Matthew Rollings Date: Thu, 21 Jun 2018 16:21:15 +0100 Subject: [PATCH 7/7] Added null check --- .../com/stealthcopter/networktools/ping/PingNative.java | 6 ++++++ .../java/com/stealthcopter/networktools/ping/PingTools.java | 6 ++++++ 2 files changed, 12 insertions(+) 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 cc6bfbd..4870a35 100644 --- a/library/src/main/java/com/stealthcopter/networktools/ping/PingNative.java +++ b/library/src/main/java/com/stealthcopter/networktools/ping/PingNative.java @@ -18,6 +18,12 @@ private PingNative() { public static PingResult ping(InetAddress host, int timeOutMillis) throws IOException, InterruptedException { PingResult pingResult = new PingResult(host); + + if (host == null) { + pingResult.isReachable = false; + return pingResult; + } + StringBuilder echo = new StringBuilder(); Runtime runtime = Runtime.getRuntime(); 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 bf5f937..b72ab8c 100644 --- a/library/src/main/java/com/stealthcopter/networktools/ping/PingTools.java +++ b/library/src/main/java/com/stealthcopter/networktools/ping/PingTools.java @@ -63,6 +63,12 @@ public static PingResult doNativePing(InetAddress ia, int timeOutMillis) throws */ public static PingResult doJavaPing(InetAddress ia, int timeOutMillis) { PingResult pingResult = new PingResult(ia); + + if (ia == null) { + pingResult.isReachable = false; + return pingResult; + } + try { long startTime = System.nanoTime(); final boolean reached = ia.isReachable(timeOutMillis);