Add whois lookup button

This commit is contained in:
emanuele-f 2021-10-26 18:17:39 +02:00
parent b0698b6246
commit f1cdbebeff
6 changed files with 38 additions and 7 deletions

View File

@ -24,6 +24,7 @@ import androidx.annotation.NonNull;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
@ -97,6 +98,11 @@ public class ConnectionDetailsActivity extends BaseActivity implements Connectio
mBlacklistedIp = findViewById(R.id.blacklisted_ip);
mBlacklistedHost = findViewById(R.id.blacklisted_host);
findViewById(R.id.whois_ip).setOnClickListener(v -> {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://search.arin.net/rdap/?query=" + mConn.dst_ip));
startActivity(intent);
});
String l4proto = Utils.proto2str(mConn.ipproto);
//if(l4proto.equals("TCP"))

View File

@ -574,7 +574,8 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
int sizeIndex = cursor.getColumnIndex(OpenableColumns.SIZE);
long file_size = !cursor.isNull(sizeIndex) ? cursor.getLong(sizeIndex) : -1;
String fname = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME));
int idx = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME);
String fname = (idx >= 0) ? cursor.getString(idx) : "*unknown*";
cursor.close();
// If file is empty, delete it
@ -647,7 +648,8 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
if((cursor == null) || !cursor.moveToFirst())
return null;
String fname = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME));
int idx = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME);
String fname = (idx >= 0) ? cursor.getString(idx) : "*unknown*";
cursor.close();
mPcapFname = fname;

View File

@ -63,7 +63,7 @@ public class FilterDescriptor implements Serializable {
if(!showMasked)
addChip(inflater, group, R.id.not_hidden, ctx.getString(R.string.not_hidden_filter));
if(onlyBlacklisted)
addChip(inflater, group, R.id.blacklisted, ctx.getString(R.string.malicious_filter));
addChip(inflater, group, R.id.blacklisted, ctx.getString(R.string.malicious));
if(onlyPlaintext)
addChip(inflater, group, R.id.only_plaintext, ctx.getString(R.string.plaintext));
if(status != Status.STATUS_INVALID) {

View File

@ -0,0 +1,5 @@
<vector android:autoMirrored="true" android:height="16dp"
android:tint="?attr/colorControlNormal" android:viewportHeight="24"
android:viewportWidth="24" android:width="16dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M19,19H5V5h7V3H5c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2v-7h-2v7zM14,3v2h3.59l-9.83,9.83 1.41,1.41L19,6.41V10h2V3h-7z"/>
</vector>

View File

@ -82,9 +82,8 @@
app:tint="@color/colorTabText"/>
<TextView
android:id="@+id/detail_info"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.75"
android:textIsSelectable="true"
tools:text="ssl.example.com" />
</LinearLayout>
@ -131,13 +130,30 @@
android:layout_height="match_parent"
android:paddingVertical="3sp"
android:src="@drawable/ic_skull"
app:tint="@color/colorTabText"/>
app:tint="@color/colorTabText"
android:contentDescription="@string/malicious" />
<TextView
android:id="@+id/detail_destination"
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textIsSelectable="true"
tools:text="5.6.7.8:443" />
<com.google.android.material.button.MaterialButton
android:id="@+id/whois_ip"
android:insetTop="0dp"
android:insetBottom="0dp"
android:minWidth="0dp"
android:layout_marginStart="10dp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingVertical="0dp"
android:paddingHorizontal="5dp"
android:drawableEnd="@drawable/ic_external"
app:drawableTint="@color/colorPrimary"
style="@style/Widget.MaterialComponents.Button.TextButton"
android:textSize="12sp"
android:text="@string/whois_lookup"/>
</LinearLayout>
</TableRow>

View File

@ -6,6 +6,8 @@
<string name="app_and_proto" translatable="false">%1$s (%2$s)</string>
<string name="sni" translatable="false">SNI</string>
<string name="url" translatable="false">URL</string>
<string name="whois_lookup" translatable="false">WHOIS</string>
<string name="virustotal" translatable="false">VIRUSTOTAL</string>
<!-- Localized -->
<string name="start_button">Start</string>
@ -200,7 +202,7 @@
<string name="show_help">Show help</string>
<string name="malware_whitelist_help">This user-defined whitelist is used to inhibit malware detection. Connections matching any of these rules will not be marked as malware. You can create rules by long pressing a malicious connection.</string>
<string name="hidden_connections_help">This list contains rules to hide connections from the connections list. Hiding connections allows you to focus on the relevant ones.</string>
<string name="malicious_filter">Malicious</string>
<string name="malicious">Malicious</string>
<string name="status_filter">Status: %1$s</string>
<string name="not_hidden_filter">Not hidden</string>
<string name="copy_action">Copy…</string>