Skip to content

feat: import hosts from PuTTY .reg files#9

Open
steffen-heil-secforge wants to merge 7 commits into
feat/wifi-hotspot-forwardingfrom
feat/putty-import
Open

feat: import hosts from PuTTY .reg files#9
steffen-heil-secforge wants to merge 7 commits into
feat/wifi-hotspot-forwardingfrom
feat/putty-import

Conversation

@steffen-heil-secforge

Copy link
Copy Markdown
Owner

Summary

  • Parses Windows Registry .reg files exported from PuTTY (UTF-8, UTF-16 LE/BE BOM detection)
  • Imports SSH sessions as Host entries; URL-decodes session names, NFC-deduplicates, caps at 100 sessions
  • Parses PuTTY port forward format ([46]?[LRD]<port>[=host:port], comma-separated) into PortForward entities
  • New PuttyImportScreen: file picker → session checklist with select/deselect all, bind address picker (reusing hotspot bind address constants), security warning, import button
  • Updates existing hosts (hostname/port/username/compression) rather than duplicating on re-import
  • "Import PuTTY hosts" menu item added to the HostList overflow menu

Depends on: #8 (WiFi hotspot port forwarding) — stack this PR on top

Test plan

  • ./gradlew testOssDebugUnitTest — 18 PuttyRegistryParserTest cases cover basic parse, URL-decode, BOM variants, port forwards (L/R/D), 100-session cap, NFC dedup, invalid ports
  • Export a session from PuTTY as .reg, copy to device, import via menu → host appears in list with correct details
  • Re-import same file → existing host updated, not duplicated
  • File with >100 sessions → truncation warning shown

🤖 Generated with Claude Code

steffen-heil-secforge and others added 7 commits June 16, 2026 16:07
Parses Windows Registry Editor files exported by PuTTY, extracting SSH
sessions as Host + PortForward objects with BOM detection, URL-decoding
of session names, NFC deduplication, a 100-session cap, and full support
for local, remote, and dynamic (SOCKS5) port-forward entries.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add 1..65535 range checks for srcPort and destPort in parseSinglePortForward
- Replace deprecated URLDecoder.decode(String, String) with Charset overload
- Add tests for out-of-range source and destination port rejection

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements PuttyImportViewModel for the PuTTY .reg import feature with
loadFile(), toggleSession(), selectAll(), setBindAddress(), and
importSelected() logic backed by HostRepository and PuttyRegistryParser.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements the PuTTY import screen with file picker (State 1) and
session list + bind address selector + import button (State 2).
Adds all putty_import_* and list_menu_import_putty string resources.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- importSelected() now sets isLoading=true at start and false on success/failure
- importResult changed from String? to Boolean (removes hardcoded English strings)
- LaunchedEffect checks importResult as Boolean instead of null check
- anySelected wrapped with remember(uiState.sessions)
- bindOptions extracted outside LazyColumn item and wrapped with remember
- ArrowBack icon contentDescription set to R.string.button_navigate_up

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add PUTTY_IMPORT route to NavDestinations, register PuttyImportScreen
as a composable in NavGraph, and expose an onImportFromPuTTY callback
in HostListScreen that is wired to a new "Import PuTTY hosts" overflow
menu item.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant