diff --git a/app/src/main/java/com/emanuelef/remote_capture/CaptureHelper.java b/app/src/main/java/com/emanuelef/remote_capture/CaptureHelper.java index 513a840f..3bdaa8a9 100644 --- a/app/src/main/java/com/emanuelef/remote_capture/CaptureHelper.java +++ b/app/src/main/java/com/emanuelef/remote_capture/CaptureHelper.java @@ -43,11 +43,13 @@ public class CaptureHelper { private static final String TAG = "CaptureHelper"; private final ComponentActivity mActivity; private final ActivityResultLauncher mLauncher; + private final boolean mResolveHosts; private CaptureSettings mSettings; private CaptureStartListener mListener; - public CaptureHelper(ComponentActivity activity) { + public CaptureHelper(ComponentActivity activity, boolean resolve_hosts) { mActivity = activity; + mResolveHosts = resolve_hosts; mLauncher = activity.registerForActivityResult( new ActivityResultContracts.StartActivityForResult(), this::captureServiceResult); } @@ -97,6 +99,11 @@ public class CaptureHelper { } private void resolveHosts() { + if (!mResolveHosts) { + startCaptureOk(); + return; + } + final Handler handler = new Handler(Looper.getMainLooper()); (new Thread(() -> { diff --git a/app/src/main/java/com/emanuelef/remote_capture/activities/CaptureCtrl.java b/app/src/main/java/com/emanuelef/remote_capture/activities/CaptureCtrl.java index 6a8d636d..d8c11c12 100644 --- a/app/src/main/java/com/emanuelef/remote_capture/activities/CaptureCtrl.java +++ b/app/src/main/java/com/emanuelef/remote_capture/activities/CaptureCtrl.java @@ -98,7 +98,7 @@ public class CaptureCtrl extends AppCompatActivity { getWindow().addFlags(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); super.onCreate(savedInstanceState); - mCapHelper = new CaptureHelper(this); + mCapHelper = new CaptureHelper(this, false); mCapHelper.setListener(success -> { setResult(success ? RESULT_OK : RESULT_CANCELED, null); finish(); diff --git a/app/src/main/java/com/emanuelef/remote_capture/activities/MainActivity.java b/app/src/main/java/com/emanuelef/remote_capture/activities/MainActivity.java index cf541f63..ee8e76d4 100644 --- a/app/src/main/java/com/emanuelef/remote_capture/activities/MainActivity.java +++ b/app/src/main/java/com/emanuelef/remote_capture/activities/MainActivity.java @@ -161,7 +161,7 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig initAppState(); checkPermissions(); - mCapHelper = new CaptureHelper(this); + mCapHelper = new CaptureHelper(this, true); mCapHelper.setListener(success -> { if(!success) { Log.w(TAG, "Capture start failed"); diff --git a/docs/app_api.md b/docs/app_api.md index cb6a4503..8912f126 100644 --- a/docs/app_api.md +++ b/docs/app_api.md @@ -85,7 +85,7 @@ As shown above, the capture settings can be specified by using intent extras. Th | http_server_port | int | | | the HTTP server port in http_server mode | | pcap_uri | string | | | the URI for the PCAP dump in pcap_file mode (overrides pcap_name) | | socks5_enabled | bool | | vpn | true to redirect the TCP connections to a SOCKS5 proxy | -| socks5_proxy_ip_address | string | | vpn | the SOCKS5 proxy host | +| socks5_proxy_ip_address | string | | vpn | the SOCKS5 proxy IP address | | socks5_proxy_port | int | | vpn | the SOCKS5 proxy port | | root_capture | bool | | | true to capture packets in root mode, false to use the VPNService | | pcapdroid_trailer | bool | | | true to enable the PCAPdroid trailer |