Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronjwood committed Mar 28, 2018
2 parents 337ef63 + e4e28a8 commit 8ff1cef
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 27
versionCode 54
versionName "2.2.6"
versionCode 55
versionName "2.2.8"
applicationId "com.aaronjwood.portauthority"
setProperty("archivesBaseName", "PortAuthority-$versionName")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public final class MainActivity extends AppCompatActivity implements MainAsyncRe
private ListView hostList;
private TextView internalIp;
private TextView externalIp;
private String cachedWanIp;
private TextView signalStrength;
private TextView ssid;
private TextView bssid;
Expand Down Expand Up @@ -213,6 +214,8 @@ public void setupMac() {
macVendor.setText(R.string.noWifiConnection);
} catch (IOException | SQLiteException | UnsupportedOperationException e) {
macVendor.setText(R.string.getMacVendorFailed);
} catch (Wireless.NoWifiInterface e) {
macAddress.setText(R.string.noWifiInterface);
}
}

Expand Down Expand Up @@ -452,7 +455,7 @@ public void run() {
Errors.showError(context, resources.getString(R.string.failedSignal));
return;
}

signalStrength.setText(String.format(resources.getString(R.string.signalLink), signal, speed));
signalHandler.postDelayed(this, TIMER_INTERVAL);
}
Expand Down Expand Up @@ -581,7 +584,10 @@ private void getExternalIp() {
if (UserPreference.getFetchExternalIp(this)) {
label.setVisibility(View.VISIBLE);
ip.setVisibility(View.VISIBLE);
wifi.getExternalIpAddress(this);

if (cachedWanIp == null) {
wifi.getExternalIpAddress(this);
}
} else {
label.setVisibility(View.GONE);
ip.setVisibility(View.GONE);
Expand Down Expand Up @@ -642,6 +648,7 @@ public void onSaveInstanceState(Bundle savedState) {
adapterData.add(item);
}
savedState.putSerializable("hosts", adapterData);
savedState.putString("wanIp", cachedWanIp);
}
}

Expand All @@ -655,6 +662,8 @@ public void onSaveInstanceState(Bundle savedState) {
public void onRestoreInstanceState(Bundle savedState) {
super.onRestoreInstanceState(savedState);

cachedWanIp = savedState.getString("wanIp");
externalIp.setText(cachedWanIp);
hosts = (ArrayList<Host>) savedState.getSerializable("hosts");
if (hosts != null) {
setupHostsAdapter();
Expand Down Expand Up @@ -718,6 +727,7 @@ public void processFinish(int output) {
*/
@Override
public void processFinish(String output) {
cachedWanIp = output;
externalIp.setText(output);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ public static class NoWifiManagerException extends Exception {
public static class NoConnectivityManagerException extends Exception {
}

public static class NoWifiInterface extends Exception {

}

/**
* Constructor to set the activity for context
*
Expand All @@ -44,14 +48,17 @@ public Wireless(Context context) {
*
* @return MAC address
*/
public String getMacAddress() throws UnknownHostException, SocketException, NoWifiManagerException {
public String getMacAddress() throws UnknownHostException, SocketException, NoWifiManagerException, NoWifiInterface {
String address = getWifiInfo().getMacAddress(); //Won't work on Android 6+ https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-hardware-id
if (!"02:00:00:00:00:00".equals(address)) {
return address;
}

//This should get us the device's MAC address on Android 6+
NetworkInterface iface = NetworkInterface.getByInetAddress(getWifiInetAddress());
if (iface == null) {
throw new NoWifiInterface();
}

byte[] mac = iface.getHardwareAddress();

Expand Down
61 changes: 61 additions & 0 deletions app/src/main/res/values-fr/array.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="threads">
<item>500</item>
<item>450</item>
<item>400</item>
<item>350</item>
<item>300</item>
<item>250</item>
<item>200</item>
<item>150</item>
<item>100</item>
<item>50</item>
<item>25</item>
<item>10</item>
</string-array>
<string-array name="upperDrawer">
<item>\u2601 Scanner l\'hôte WAN</item>
<item>\u2194 Recherche DNS</item>
</string-array>
<string-array name="lowerDrawer">
<item>\u2195 MAJ Base de données OUI</item>
<item>\u2195 MAJ Liste Ports</item>
<item>\u2699 Paramètres</item>
</string-array>
<string-array name="records">
<item>Type d\'Enregistrement</item>
<item>A</item>
<item>A6</item>
<item>AAAA</item>
<item>AFSDB</item>
<item>APL</item>
<item>CERT</item>
<item>CNAME</item>
<item>DHCID</item>
<item>DLV</item>
<item>DNAME</item>
<item>DNSKEY</item>
<item>DS</item>
<item>IPSECKEY</item>
<item>KEY</item>
<item>KX</item>
<item>LOC</item>
<item>MX</item>
<item>NAPTR</item>
<item>NS</item>
<item>NSEC</item>
<item>NSEC3</item>
<item>NSEC3PARAM</item>
<item>PTR</item>
<item>RP</item>
<item>RRSIG</item>
<item>SIG</item>
<item>SOA</item>
<item>SRV</item>
<item>SSHFP</item>
<item>TLSA</item>
<item>TXT</item>
<item>URI</item>
</string-array>
</resources>
53 changes: 53 additions & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Gestion des Ports</string>
<string name="action_settings">Paramètres</string>
<string name="macAddress">MAC</string>
<string name="macVendor">Fournisseur</string>
<string name="internalIpLabel">LAN IP</string>
<string name="externalIpLabel">WAN IP</string>
<string name="fetching">Récupération…</string>
<string name="signalLabel">Signal/Vitesse</string>
<string name="hostDiscovery">Trouver les Hôtes</string>
<string name="ssid">SSID</string>
<string name="bssid">BSSID</string>
<string name="scanWellKnownPorts">Scanner les Ports Connus</string>
<string name="scanPortRange">Scanner l\'intervalle de ports</string>
<string name="resetPortRange">Réinitialiser l\'intervalle de ports</string>
<string name="openPorts">Ports Ouverts</string>
<string name="portRangeStart">Port de Départ</string>
<string name="portRangeStop">Port de Fin</string>
<string name="wifiDisabled">Wi-Fi désactivé</string>
<string name="noWifiConnection">Pas de connexion Wi-Fi</string>
<string name="wanHostHint">URL/IP</string>
<string name="scanningWarning">ATTENTION</string>
<string name="domainName">Nom Domaine</string>
<string name="dnsLookup">Recherche DNS</string>
<string name="wakeOnLan">Wake Up</string>
<string name="waking">Réveil de %1$s…</string>
<string name="ipAddress">Adresse IP</string>
<string name="startingDnsLookup">Récupération des enregistrements DNS...</string>
<string name="dnsInputError">Entrez un domaine et sélectionnez un type d\'enregistrement</string>
<string name="notConnectedLan">Vous n\'êtes pas connecté au réseau local</string>
<string name="notConnectedWifi">Vous n\'êtes connecté à aucun réseau Wi-Fi!</string>
<string name="signalLink">%1$ddBm/%2$dMbps</string>
<string name="hostScan">Recherche d\'Hôtes</string>
<string name="subnetHosts">%1$d hôtes dans votre sous-réseau</string>
<string name="sort">Trier</string>
<string name="sortHostname">Par nom d\'hôte</string>
<string name="sortVendor">Par fournisseur</string>
<string name="copyHostname">Copier le nom d\'hôte</string>
<string name="copyIp">Copier l\'IP</string>
<string name="copyMac">Copier le MAC</string>
<string name="getMacVendorFailed">Fournisseur MAC indisponible</string>
<string name="failedOpenDb">Échec de l\'ouverture de la base de données</string>
<string name="downloadingData">Téléchargement des données</string>
<string name="failedSubnetHosts">Échec de l\'obtention du nombre d\'hôtes dans le sous-réseau</string>
<string name="failedSignal">Échec de l\'obtention de la force du signal</string>
<string name="failedLinkSpeed">Impossible d\'obtenir la vitesse de liaison</string>
<string name="failedSsid">Échec de l\'obtention du SSID</string>
<string name="failedBssid">Échec de l\'obtention du BSSID</string>
<string name="failedWifiManager">Échec de l\'obtention du WifiManager pour cet appareil</string>
<string name="scanningDisclaimer">Sachez que scanner des ports sur des serveurs publics est généralement considéré comme malveillant. En outre, l\'exécution de ce type d\'analyse sur le réseau de votre opérateur plutôt que sur votre propre connexion Wi-Fi sera plus lent et produira parfois des résultats inexacts en raison de la mise en forme du trafic. Votre opérateur peut également considérer que le trafic généré par cette analyse est malveillant.</string>

</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<string name="failedSsid">Failed to get SSID</string>
<string name="failedBssid">Failed to get BSSID</string>
<string name="failedWifiManager">Failed to get WifiManager for this device</string>
<string name="noWifiInterface">No WiFi interface found</string>
<string name="scanningDisclaimer">
Please be aware that running port scans against public servers is normally considered malicious.
Additionally, running these kinds of scans over your carrier\'s network instead of your own WiFi connection will be slower and will sometimes produce inaccurate results due to traffic shaping.
Expand Down

0 comments on commit 8ff1cef

Please sign in to comment.