File tree Expand file tree Collapse file tree
cSploit/src/main/java/org/csploit/android/net Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919package org .csploit .android .net ;
2020
2121import android .support .annotation .NonNull ;
22+ import android .support .annotation .Nullable ;
23+ import org .csploit .android .core .System ;
24+ import org .csploit .android .helpers .NetworkHelper ;
2225
2326import java .io .BufferedReader ;
2427import java .math .BigInteger ;
2528import java .net .InetAddress ;
2629import java .net .UnknownHostException ;
2730import java .util .Arrays ;
2831
29- import org .csploit .android .core .System ;
30- import org .csploit .android .helpers .NetworkHelper ;
31-
3232public class Endpoint implements Comparable <Endpoint >
3333{
3434 private InetAddress mAddress = null ;
@@ -57,15 +57,9 @@ public Endpoint(String address){
5757 this (address , null );
5858 }
5959
60- public Endpoint (InetAddress address , byte [] hardware ){
61- try {
60+ public Endpoint (InetAddress address , @ Nullable byte [] hardware ){
6261 mAddress = address ;
63- mHardware = Arrays .copyOf (hardware , hardware .length );
64- }
65- catch (Exception e ){
66- System .errorLogging (e );
67- mAddress = null ;
68- }
62+ mHardware = hardware != null ? Arrays .copyOf (hardware , hardware .length ) : null ;
6963 }
7064
7165 public Endpoint (String address , String hardware ){
Original file line number Diff line number Diff line change 2525import android .net .wifi .WifiInfo ;
2626import android .net .wifi .WifiManager ;
2727import android .support .annotation .NonNull ;
28+ import android .support .annotation .Nullable ;
2829import android .util .Patterns ;
29-
3030import org .apache .commons .net .util .SubnetUtils ;
3131import org .csploit .android .core .Logger ;
3232import org .csploit .android .core .System ;
3333import org .csploit .android .helpers .NetworkHelper ;
3434
3535import java .lang .reflect .Method ;
36- import java .net .InetAddress ;
37- import java .net .InterfaceAddress ;
38- import java .net .NetworkInterface ;
39- import java .net .NoRouteToHostException ;
40- import java .net .SocketException ;
41- import java .net .UnknownHostException ;
36+ import java .net .*;
4237import java .util .ArrayList ;
4338import java .util .Collections ;
4439import java .util .Enumeration ;
@@ -339,9 +334,10 @@ public byte[] getGatewayHardware() {
339334 return Endpoint .parseMacAddress (mWifiInfo .getBSSID ());
340335 }
341336
337+ @ Nullable
342338 public byte [] getLocalHardware () {
343339 try {
344- return mInterface .getHardwareAddress ();
340+ return mInterface .getHardwareAddress (); //FIXME: #831
345341 } catch (SocketException e ) {
346342 System .errorLogging (e );
347343 }
You can’t perform that action at this time.
0 commit comments