webtools-cli 1.2.9__tar.gz → 1.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: webtools-cli
3
- Version: 1.2.9
3
+ Version: 1.3.0
4
4
  Summary: Advanced Web Intelligence & Scraping Toolkit with CLI and Web UI
5
5
  Author: Abhinav Adarsh
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "webtools-cli"
7
- version = "1.2.9"
7
+ version = "1.3.0"
8
8
  description = "Advanced Web Intelligence & Scraping Toolkit with CLI and Web UI"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -1054,6 +1054,7 @@ def cloud_download(filepath):
1054
1054
 
1055
1055
  @app.route('/api/adb/status', methods=['GET'])
1056
1056
  def adb_status():
1057
+ global _active_device
1057
1058
  ok, devices_out = _adb_run([ADB_CMD, 'devices'])
1058
1059
  connected, offline = [], []
1059
1060
  if ok:
@@ -1066,10 +1067,11 @@ def adb_status():
1066
1067
  offline.append({'id': parts[0], 'status': parts[1]})
1067
1068
 
1068
1069
  if connected:
1070
+ _active_device = connected[0]
1069
1071
  return jsonify({
1070
1072
  'status': 'connected',
1071
1073
  'device_id': connected[0],
1072
- 'device_model': _adb_get_device_info(),
1074
+ 'device_model': _adb_get_device_info(connected[0]),
1073
1075
  'other_devices': len(connected) - 1
1074
1076
  })
1075
1077
  elif offline:
@@ -3675,6 +3677,7 @@ def _get_adb_cmd():
3675
3677
  return 'adb'
3676
3678
 
3677
3679
  ADB_CMD = _get_adb_cmd()
3680
+ _active_device = None # Track the active device ID for multi-device support
3678
3681
 
3679
3682
  KNOWN_BLOATWARE = {
3680
3683
  # Facebook
@@ -3753,8 +3756,13 @@ CRITICAL_PACKAGES = {
3753
3756
  'com.android.vending', 'com.android.providers.settings',
3754
3757
  }
3755
3758
 
3756
- def _adb_run(cmd, timeout=15):
3757
- """Run an adb command and return (success, stdout)"""
3759
+ def _adb_run(cmd, timeout=15, device=None):
3760
+ """Run an adb command and return (success, stdout). If device is specified, adds -s <device> flag."""
3761
+ # Auto-inject -s <device_id> for device-specific commands
3762
+ if device and len(cmd) > 1 and cmd[0] == ADB_CMD and cmd[1] != 'devices':
3763
+ cmd = [cmd[0], '-s', device] + cmd[1:]
3764
+ elif _active_device and len(cmd) > 1 and cmd[0] == ADB_CMD and cmd[1] not in ('devices', 'version', 'pair', 'connect'):
3765
+ cmd = [cmd[0], '-s', _active_device] + cmd[1:]
3758
3766
  try:
3759
3767
  result = subprocess.run(
3760
3768
  cmd, capture_output=True, text=True, timeout=timeout
@@ -3770,9 +3778,9 @@ def _adb_run(cmd, timeout=15):
3770
3778
  except Exception as e:
3771
3779
  return False, str(e)
3772
3780
 
3773
- def _adb_get_device_info():
3781
+ def _adb_get_device_info(device=None):
3774
3782
  """Get connected device model name"""
3775
- ok, out = _adb_run([ADB_CMD, 'shell', 'getprop', 'ro.product.model'])
3783
+ ok, out = _adb_run([ADB_CMD, 'shell', 'getprop', 'ro.product.model'], device=device)
3776
3784
  if ok and out:
3777
3785
  return out
3778
3786
  return "Unknown Device"
@@ -3862,6 +3870,7 @@ def _adb_display_packages(packages, search_filter=None):
3862
3870
 
3863
3871
  def run_adb_mode():
3864
3872
  """ADB Bloatware Remover - Interactive Mode"""
3873
+ global _active_device
3865
3874
  # Step 1: Check if ADB is available
3866
3875
  ok, version_out = _adb_run([ADB_CMD, 'version'])
3867
3876
  if not ok:
@@ -3902,7 +3911,8 @@ def run_adb_mode():
3902
3911
  offline_devices.append((parts[0], parts[1]))
3903
3912
 
3904
3913
  if connected_devices:
3905
- device_name = _adb_get_device_info()
3914
+ _active_device = connected_devices[0]
3915
+ device_name = _adb_get_device_info(connected_devices[0])
3906
3916
  print(f"\n {Fore.GREEN}✅ Connected: {device_name} ({connected_devices[0]}){Style.RESET_ALL}")
3907
3917
  if len(connected_devices) > 1:
3908
3918
  print(f" {Fore.YELLOW} + {len(connected_devices)-1} more device(s){Style.RESET_ALL}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: webtools-cli
3
- Version: 1.2.9
3
+ Version: 1.3.0
4
4
  Summary: Advanced Web Intelligence & Scraping Toolkit with CLI and Web UI
5
5
  Author: Abhinav Adarsh
6
6
  License-Expression: MIT
File without changes
File without changes
File without changes