Add comprehensive PuTTY session import feature#6
Closed
steffen-heil-secforge wants to merge 1 commit into
Closed
Conversation
2f3bfcf to
a44d388
Compare
0482020 to
b019b01
Compare
62965ed to
538690c
Compare
b019b01 to
70837dd
Compare
955675c to
a4bdb3a
Compare
c770b30 to
5ac8c51
Compare
9b99d66 to
4611f60
Compare
8378727 to
05dfe2c
Compare
f65fcbe to
edf5718
Compare
812eaa9 to
d55f47e
Compare
edf5718 to
0188fc2
Compare
fe2267f to
55615ed
Compare
11abdeb to
265c0dd
Compare
5399731 to
c0a76ef
Compare
265c0dd to
0e42e13
Compare
Implements full import of PuTTY sessions from Windows registry export files,
including connection settings and port forwards. Users can import multiple
sessions at once through an interactive dialog with selective import and
bind address configuration.
Features:
- Parse PuTTY registry export files (.reg format) to extract session
configurations and port forwards
- Interactive import dialog with multi-select session list, showing:
- Session details (username@hostname:port)
- Existing host indicators with update vs. new host distinction
- Filtered list excludes identical sessions already in database
- Select all / deselect all buttons for bulk operations
- Sorted session list by name for easy navigation
- Bind address selection for imported port forwards:
- localhost (default, matches PuTTY semantics)
- All interfaces (0.0.0.0)
- WiFi hotspot (access_point)
- Security warnings for network-exposed options
- Background import task with progress dialog
- Result notifications showing import success/partial success/error states
- Graceful handling of fragment recreation (configuration changes) by
dismissing dialog rather than attempting to serialize non-serializable
session data
Parser capabilities:
- Extracts hostname, port, protocol (ssh/telnet/local/serial), username,
compression settings
- Parses all three port forward types: local (-L), remote (-R), dynamic
SOCKS (-D)
- Handles complex port forward syntax including IPv6 addresses, bind
addresses, and destination specifications
- Validates port numbers and bind addresses
- Converts PuTTY constants to ConnectBot database constants
- Truncates session list at 100 entries with user notification
- Collects and displays parsing warnings for malformed entries
Smart merge behavior:
- When importing session matching existing host nickname:
- Updates only PuTTY-related fields (protocol, hostname, port, username,
compression)
- Preserves all ConnectBot-specific settings (colors, key usage, font
size, stay-connected, quick-disconnect, auth agent, post-login,
session flags, encoding)
- Port forwards are fully replaced (old ones deleted, new ones imported)
to prevent duplicates on re-import
- Sessions identical to existing hosts are filtered out of import dialog
UI integration:
- "Import from PuTTY" menu action in HostListActivity
- File picker for selecting .reg files
- Automatic host list refresh after successful import
- Informative toast messages for all result states
Testing:
- Comprehensive unit tests for PuttyRegistryParser covering all port
forward types, edge cases, IPv6, malformed input, truncation behavior
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
0e42e13 to
b46ca6b
Compare
Owner
Author
|
Superseded by #9 (ported to new Kotlin/Compose/Room architecture) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements full import of PuTTY sessions from Windows registry export files, including connection settings and port forwards. Users can import multiple sessions at once through an interactive dialog with selective import and bind address configuration.
Note: This PR is based on #5 (wifi-hotspot-forwarding branch) and should be merged after that PR.
Features
PuTTY Registry Parsing
L<sourceport>=<destaddr>:<destport>R<sourceport>=<destaddr>:<destport>D<sourceport>Interactive Import Dialog
username@hostname:portSmart Merge Behavior
Background Import
Lifecycle Handling
UI Integration
.regfilesdia_putty_import.xml: Main import dialogitem_putty_session.xml: Session list itemParser Capabilities
Supported PuTTY Fields
HostName: Target hostname/IPPortNumber: SSH/telnet portProtocol: ssh, telnet, local, serialUserName: Login usernameCompression: Enable/disable compressionPortForwardingX: All port forward definitionsPort Forward Parsing
L8080=localhost:80(local forward)R2222=192.168.1.100:22(remote forward)D1080(dynamic SOCKS proxy)L6[::1]:8080=[2001:db8::1]:80(IPv6 with bind address)Testing
Comprehensive unit tests in PuttyRegistryParserTest: