ida-hcli 0.8.3.dev2__tar.gz → 0.8.3.dev3__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.
Files changed (77) hide show
  1. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/PKG-INFO +1 -1
  2. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/pyproject.toml +1 -1
  3. ida_hcli-0.8.3.dev3/src/hcli/__init__.py +1 -0
  4. ida_hcli-0.8.3.dev3/src/hcli/commands/setup.py +221 -0
  5. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/ida_hcli.egg-info/PKG-INFO +1 -1
  6. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/ida_hcli.egg-info/SOURCES.txt +1 -0
  7. ida_hcli-0.8.3.dev2/src/hcli/__init__.py +0 -1
  8. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/LICENSE +0 -0
  9. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/README.md +0 -0
  10. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/setup.cfg +0 -0
  11. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/__init__.py +0 -0
  12. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/auth/__init__.py +0 -0
  13. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/auth/default.py +0 -0
  14. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/auth/key/__init__.py +0 -0
  15. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/auth/key/create.py +0 -0
  16. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/auth/key/install.py +0 -0
  17. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/auth/key/list.py +0 -0
  18. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/auth/key/revoke.py +0 -0
  19. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/auth/list.py +0 -0
  20. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/auth/switch.py +0 -0
  21. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/commands.py +0 -0
  22. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/common.py +0 -0
  23. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/download.py +0 -0
  24. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/extension/__init__.py +0 -0
  25. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/extension/create.py +0 -0
  26. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/extension/list.py +0 -0
  27. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/ida/__init__.py +0 -0
  28. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/ida/install.py +0 -0
  29. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/license/__init__.py +0 -0
  30. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/license/common.py +0 -0
  31. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/license/get.py +0 -0
  32. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/license/install.py +0 -0
  33. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/license/list.py +0 -0
  34. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/login.py +0 -0
  35. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/logout.py +0 -0
  36. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/open.py +0 -0
  37. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/share/__init__.py +0 -0
  38. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/share/delete.py +0 -0
  39. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/share/get.py +0 -0
  40. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/share/list.py +0 -0
  41. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/share/put.py +0 -0
  42. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/update.py +0 -0
  43. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/commands/whoami.py +0 -0
  44. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/env.py +0 -0
  45. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/lib/__init__.py +0 -0
  46. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/lib/api/__init__.py +0 -0
  47. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/lib/api/asset.py +0 -0
  48. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/lib/api/auth.py +0 -0
  49. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/lib/api/common.py +0 -0
  50. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/lib/api/customer.py +0 -0
  51. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/lib/api/index.py +0 -0
  52. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/lib/api/keys.py +0 -0
  53. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/lib/api/license.py +0 -0
  54. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/lib/auth/__init__.py +0 -0
  55. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/lib/commands/__init__.py +0 -0
  56. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/lib/config/__init__.py +0 -0
  57. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/lib/console.py +0 -0
  58. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/lib/constants/__init__.py +0 -0
  59. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/lib/constants/auth.py +0 -0
  60. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/lib/constants/cli.py +0 -0
  61. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/lib/extensions/__init__.py +0 -0
  62. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/lib/ida/__init__.py +0 -0
  63. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/lib/ida/python.py +0 -0
  64. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/lib/update/__init__.py +0 -0
  65. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/lib/update/release.py +0 -0
  66. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/lib/update/version.py +0 -0
  67. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/lib/util/__init__.py +0 -0
  68. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/lib/util/crc32.py +0 -0
  69. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/lib/util/io.py +0 -0
  70. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/lib/util/output.py +0 -0
  71. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/lib/util/python.py +0 -0
  72. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/lib/util/string.py +0 -0
  73. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/hcli/main.py +0 -0
  74. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/ida_hcli.egg-info/dependency_links.txt +0 -0
  75. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/ida_hcli.egg-info/entry_points.txt +0 -0
  76. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/ida_hcli.egg-info/requires.txt +0 -0
  77. {ida_hcli-0.8.3.dev2 → ida_hcli-0.8.3.dev3}/src/ida_hcli.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ida-hcli
3
- Version: 0.8.3.dev2
3
+ Version: 0.8.3.dev3
4
4
  Summary: HCLI - Hex-Rays CLI Utility
5
5
  Author-email: Hex-Rays SA <support@hex-rays.com>
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ida-hcli"
3
- version = "0.8.3-dev.2"
3
+ version = "0.8.3-dev.3"
4
4
  description = "HCLI - Hex-Rays CLI Utility"
5
5
  requires-python = ">=3.10"
6
6
  license = "MIT"
@@ -0,0 +1 @@
1
+ __version__ = "0.8.3-dev.3"
@@ -0,0 +1,221 @@
1
+ from __future__ import annotations
2
+
3
+ import os
4
+ import platform
5
+ import shutil
6
+ import subprocess
7
+ import tempfile
8
+ from pathlib import Path
9
+
10
+ import rich_click as click
11
+
12
+ from hcli.lib.commands import async_command
13
+ from hcli.lib.console import console
14
+ from hcli.lib.util.io import get_hcli_executable_path
15
+
16
+
17
+ def setup_macos_protocol_handler() -> None:
18
+ """Set up protocol handler for macOS using AppleScript and plist modification."""
19
+ try:
20
+ hcli_path = get_hcli_executable_path()
21
+
22
+ print(hcli_path)
23
+
24
+ # Create AppleScript application
25
+ applescript_content = f'''
26
+ on open location this_URL
27
+ do shell script "{hcli_path} open " & quoted form of this_URL
28
+ end open location
29
+
30
+ on run
31
+ -- This handler is called when the app is launched directly
32
+ end run
33
+ '''
34
+
35
+ # Create temporary directory for the AppleScript
36
+ with tempfile.TemporaryDirectory() as temp_dir:
37
+ script_path = Path(temp_dir) / "HCLIHandler.applescript"
38
+ app_path = Path.home() / "Applications" / "HCLIHandler.app"
39
+
40
+ # Write AppleScript
41
+ script_path.write_text(applescript_content)
42
+
43
+ # Compile AppleScript to application
44
+ subprocess.run(["osacompile", "-o", str(app_path), str(script_path)], check=True)
45
+
46
+ # Create Info.plist for the app to register URL scheme
47
+ info_plist_path = app_path / "Contents" / "Info.plist"
48
+
49
+ # Read existing plist
50
+ result = subprocess.run(
51
+ ["plutil", "-convert", "xml1", "-o", "-", str(info_plist_path)],
52
+ capture_output=True,
53
+ text=True,
54
+ check=True,
55
+ )
56
+
57
+ plist_content = result.stdout
58
+
59
+ # Add URL scheme handler to plist
60
+ url_scheme_xml = """
61
+ <key>CFBundleURLTypes</key>
62
+ <array>
63
+ <dict>
64
+ <key>CFBundleURLName</key>
65
+ <string>IDA URL Handler</string>
66
+ <key>CFBundleURLSchemes</key>
67
+ <array>
68
+ <string>ida</string>
69
+ </array>
70
+ </dict>
71
+ </array>"""
72
+
73
+ # Insert before closing </dict></plist>
74
+ if "<key>CFBundleURLTypes</key>" not in plist_content:
75
+ plist_content = plist_content.replace("</dict>\n</plist>", f"{url_scheme_xml}\n</dict>\n</plist>")
76
+
77
+ # Write back the modified plist
78
+ with tempfile.NamedTemporaryFile(mode="w", suffix=".plist", delete=False) as temp_plist:
79
+ temp_plist.write(plist_content)
80
+ temp_plist_path = temp_plist.name
81
+
82
+ # Convert back to binary and replace original
83
+ subprocess.run(["plutil", "-convert", "binary1", temp_plist_path], check=True)
84
+
85
+ shutil.copy2(temp_plist_path, info_plist_path)
86
+ os.unlink(temp_plist_path)
87
+
88
+ # Register the app with Launch Services
89
+ subprocess.run(
90
+ [
91
+ "/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister",
92
+ "-f",
93
+ str(app_path),
94
+ ],
95
+ check=True,
96
+ )
97
+
98
+ console.print(f"[green]✓[/green] macOS protocol handler installed at {app_path}")
99
+
100
+ except subprocess.CalledProcessError as e:
101
+ console.print(f"[red]Failed to set up macOS protocol handler: {e}[/red]")
102
+ raise
103
+ except Exception as e:
104
+ console.print(f"[red]Error setting up macOS protocol handler: {e}[/red]")
105
+ raise
106
+
107
+
108
+ def setup_windows_protocol_handler() -> None:
109
+ """Set up protocol handler for Windows using registry entries."""
110
+ try:
111
+ import winreg # type: ignore[import-untyped]
112
+ from winreg import HKEY_CURRENT_USER, REG_SZ # type: ignore[import-untyped,attr-defined]
113
+
114
+ hcli_path = get_hcli_executable_path()
115
+ command = f'"{hcli_path}" open "%1"'
116
+
117
+ # Create registry entries for ida:// protocol
118
+ with winreg.CreateKey(HKEY_CURRENT_USER, r"SOFTWARE\Classes\ida") as key: # type: ignore[attr-defined]
119
+ winreg.SetValueEx(key, "", 0, REG_SZ, "URL:IDA Protocol") # type: ignore[attr-defined]
120
+ winreg.SetValueEx(key, "URL Protocol", 0, REG_SZ, "") # type: ignore[attr-defined]
121
+
122
+ with winreg.CreateKey(HKEY_CURRENT_USER, r"SOFTWARE\Classes\ida\DefaultIcon") as key: # type: ignore[attr-defined]
123
+ winreg.SetValueEx(key, "", 0, REG_SZ, f"{hcli_path},1") # type: ignore[attr-defined]
124
+
125
+ with winreg.CreateKey(HKEY_CURRENT_USER, r"SOFTWARE\Classes\ida\shell") as key: # type: ignore[attr-defined]
126
+ pass
127
+
128
+ with winreg.CreateKey(HKEY_CURRENT_USER, r"SOFTWARE\Classes\ida\shell\open") as key: # type: ignore[attr-defined]
129
+ pass
130
+
131
+ with winreg.CreateKey(HKEY_CURRENT_USER, r"SOFTWARE\Classes\ida\shell\open\command") as key: # type: ignore[attr-defined]
132
+ winreg.SetValueEx(key, "", 0, REG_SZ, command) # type: ignore[attr-defined]
133
+
134
+ console.print("[green]✓[/green] Windows protocol handler registered in registry")
135
+
136
+ except ImportError:
137
+ console.print("[red]winreg module not available (not on Windows?)[/red]")
138
+ raise
139
+ except Exception as e:
140
+ console.print(f"[red]Error setting up Windows protocol handler: {e}[/red]")
141
+ raise
142
+
143
+
144
+ def setup_linux_protocol_handler() -> None:
145
+ """Set up protocol handler for Linux using desktop entry and xdg-mime."""
146
+ try:
147
+ hcli_path = get_hcli_executable_path()
148
+
149
+ # Create desktop entry
150
+ desktop_entry_content = f"""[Desktop Entry]
151
+ Name=HCLI URL Handler
152
+ Exec={hcli_path} open %u
153
+ Type=Application
154
+ NoDisplay=true
155
+ MimeType=x-scheme-handler/ida;
156
+ """
157
+
158
+ # Write to applications directory
159
+ applications_dir = Path.home() / ".local" / "share" / "applications"
160
+ applications_dir.mkdir(parents=True, exist_ok=True)
161
+
162
+ desktop_file_path = applications_dir / "hcli-url-handler.desktop"
163
+ desktop_file_path.write_text(desktop_entry_content)
164
+
165
+ # Make executable
166
+ desktop_file_path.chmod(0o755)
167
+
168
+ # Register with xdg-mime
169
+ subprocess.run(["xdg-mime", "default", "hcli-url-handler.desktop", "x-scheme-handler/ida"], check=True)
170
+
171
+ # Update desktop database
172
+ subprocess.run(
173
+ ["update-desktop-database", str(applications_dir)], check=False
174
+ ) # May fail on some systems but not critical
175
+
176
+ console.print(f"[green]✓[/green] Linux protocol handler installed at {desktop_file_path}")
177
+
178
+ except subprocess.CalledProcessError as e:
179
+ console.print(f"[red]Failed to set up Linux protocol handler: {e}[/red]")
180
+ raise
181
+ except Exception as e:
182
+ console.print(f"[red]Error setting up Linux protocol handler: {e}[/red]")
183
+ raise
184
+
185
+
186
+ @click.command(name="setup")
187
+ @click.option("--force", is_flag=True, help="Force reinstall even if already configured")
188
+ @async_command
189
+ async def setup(force: bool = False) -> None:
190
+ """Set up hcli protocol handlers for ida:// URLs.
191
+
192
+ This command registers hcli as the handler for ida:// URLs on your system,
193
+ allowing web browsers and other applications to automatically open IDA-related
194
+ URLs with hcli.
195
+
196
+ The setup process varies by platform:
197
+ - macOS: Creates an AppleScript application and registers it with Launch Services
198
+ - Windows: Adds registry entries for the ida:// protocol
199
+ - Linux: Creates a desktop entry and registers with xdg-mime
200
+ """
201
+ current_platform = platform.system().lower()
202
+
203
+ console.print(f"[blue]Setting up hcli protocol handlers for {current_platform}...[/blue]")
204
+
205
+ try:
206
+ if current_platform == "darwin":
207
+ setup_macos_protocol_handler()
208
+ elif current_platform == "windows":
209
+ setup_windows_protocol_handler()
210
+ elif current_platform == "linux":
211
+ setup_linux_protocol_handler()
212
+ else:
213
+ console.print(f"[red]Unsupported platform: {current_platform}[/red]")
214
+ raise RuntimeError(f"Platform {current_platform} is not supported")
215
+
216
+ console.print("[green]✓ Protocol handler setup complete![/green]")
217
+ console.print("[yellow]You can now click ida:// links and they will open with hcli.[/yellow]")
218
+
219
+ except Exception as e:
220
+ console.print(f"[red]Setup failed: {e}[/red]")
221
+ raise
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ida-hcli
3
- Version: 0.8.3.dev2
3
+ Version: 0.8.3.dev3
4
4
  Summary: HCLI - Hex-Rays CLI Utility
5
5
  Author-email: Hex-Rays SA <support@hex-rays.com>
6
6
  License-Expression: MIT
@@ -11,6 +11,7 @@ src/hcli/commands/download.py
11
11
  src/hcli/commands/login.py
12
12
  src/hcli/commands/logout.py
13
13
  src/hcli/commands/open.py
14
+ src/hcli/commands/setup.py
14
15
  src/hcli/commands/update.py
15
16
  src/hcli/commands/whoami.py
16
17
  src/hcli/commands/auth/__init__.py
@@ -1 +0,0 @@
1
- __version__ = "0.8.3-dev.2"
File without changes
File without changes
File without changes