FYI: Importing wifi credentials via MrC Converter Suite [Solved]

SKSSF
SKSSF
Community Member
edited October 2024 in Windows

Please note that the readme.html file that comes with MrC Converter Suite has a minor typo--it states that CSV header row should be as follows for importing wifi credentials:

Title, Base Station Name, Base Station Password, Server / IP Address, AirPort ID, Network Name, Wireless Security, Wireless Network Password, Attached Storage Password, Notes

Instead, the header row should be (case changes):
Title,Base Station Name,base station password,server / IP address,AirPort ID,network name,wireless security,wireless network password,attached storage password,Notes

Without the proper case (at least for the "wireless network password" field), the corresponding field will be imported as an "original field" and thereby 1P will not generate the QR code.

Otherwise, MrC's Converter Suite worked great--thank you @MrC!


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Browser: Not Provided

Comments

  • MrC
    MrC
    Volunteer Moderator
    edited October 2024

    Hi @SKSSF

    Thank you very much for your kind words and reporting your findings.

    I'm not seeing an issue, however, so I'm puzzled as to why you see one. Labels for the csv converter are case insensitive, so you should be getting matches regardless of case. Example data:

    and a conversion where the debug lines show the key mappings:

    And the definitions for the labels are all using case-insensitive regular expression patterns (note the "i" flag at the end of the RE):

    Can you detect anything else? Perhaps be sure to properly double-quote any label value that contains whitespace (not my example data), but I'm not sure that should matter.

  • SKSSF
    SKSSF
    Community Member

    Hmm..I'm not a Regex expert, so all i can report is what results I got. Here are screenshots of the 8 csv files (in chronological order as I attempted this) I tried using the converter with. My earliest attempts didn't work because I didn't have the "--imptypes wireless" parameter, and later attempts didn't work because the wireless network password field got imported as "original field". The last screenshot is the one that worked in the end.

    First attempt (I think this imported as a note):

    Thought I needed to add a category column (I think this imported as a note):

    Different case for the security (I think this imported as a note):

    Reverted case back to original, but used the --imptypes parameter, I think this imported as a wifi credential:

    Changed the security to one of the options:

    Tried a different security option:

    Just provided the title and wifi password (per the 1P help for wifi QR codes)

    Changed the case on the header row per your post here--AND IT WORKED!:

    A few other notes:

    • I'm using converter version 2024-08-29-1342
    • My CSV files (as exported from Excel) did not have any quotes--just commas (here's a screenshot of the final CSV file--the one that worked):

    I hope that helps with troubleshooting...or maybe better yet, I think it would be helpful to add a sample csv file snippet to the readme--it was your comment here that lead me to getting this to work properly.

    While we're chatting, can I suggest a feature--the ability to convert the output from
    netsh wlan export profile key=clear folder=c:\path
    directly into a 1pux file...or converter for the output from this PowerShell script?

    Again--thank you again for providing this utility--1P should be compensating you for developing this utility that enables greater 1P usability.

  • MrC
    MrC
    Volunteer Moderator

    @SKSSF

    Thanks for the details. This is all leading me to believe there is something wrong with your CSV file, because too many things are not working. I'll enumerate:

    1. You don't need "--imptypes wireless". The csv converter automatically detects the type based on the column labels.
    2. The values in the non-labels rows cannot affect the type of record detected. Only the labels matter for this converter.
    3. Given that your first test above failed, I'm certain this is an issue with the CSV export. Any of the labels besides Title and Notes would have caused detection as type = 'wireless' .
    4. The labels really are case-insensitive.
    5. You mentioned "wifi credential" above. The csv converter has no such category, so it must have been something else.
    6. You will only get columns placed in an Original Fields section when a label doesn't match a known label. While your labels look correct in the screenshots above, only the CSV data itself can verify this.

    The image below shows a dump of a simple 3 column CSV file, and debug output running the converter against it. The data is detected as 'wireless'. It has only one column other than Title or Notes, and that label is case-varying.

    I don't have Excel installed in my VM's, nor am I up to date on all of the CSV export options it provides. It is important that the CSV is UTF-8 encoded, and follows correct CSV rules. There's some leniency with quoting. My guess is that the file encoding is incorrect, or the labels are not string matching the required labels names (case ingnored).

    If you could create for me a non-working CSV file with one label row, and one dummy data row, I can diagnose the issue and we can resolve this. I'll need the raw file, not copy/pasted text. You could email it to me - my email is at the top of all the script files.

    While we're chatting, can I suggest a feature--the ability to convert the output from
    netsh wlan export profile key=clear folder=c:\path
    directly into a 1pux file...or converter for the output from this PowerShell script?

    This wouldn't be something I could do, or would want to maintain. All my Windows work is done in VMs, and there's no WiFi there (the network comes from the host, either shared or bridged). So no wlansvc running, hence netsh wlan will fail. I wouldn't begin to know the output variations in that plain text dump, and lacking the ability to generate actual test data, it would be endless guess work. Some enterprising person might adapt that PowerShell script to produce the appropriate CSV file for the csv converter's consumption.

  • SKSSF
    SKSSF
    Community Member

    @MrC --argh, I found the issue--I copied the header row from the Column Labels table in the readme file. That list includes a trailing space after each comma, so each header row field (except for the first, Title) had a space prepended. When I edited the header row per the 1Password help post re: QR codes for wifi, I removed the leading space, and your converter handled the rest properly.

    So...my bad...and sorry for your trouble. But I do think that a sample CSV code snippet for each category might help users to format their CSV files properly.

    Thanks again!

  • MrC
    MrC
    Volunteer Moderator

    @SKSSF

    LOL! That's a good one. Whitespace... it's just so darned invisible!

    This is a case where the lack of proper double-quoting of a CSV cell, when it contains whitespace, bites back hard.

    I'm not keen on adding even more content to the already bloated csv section in the README. The same type of copy/paste errors will occur (e.g. "smart" typographic double-quote replacements). Instead, perhaps I can include sample CSV files in the suite's package, and refer users to the folder.

    Also, I'll add more debugging output to show the column labels (quoted!), as detected by the CSV processor. This would have revealed the issue, if you happened to enable debug output.

    Finally, I'll see if I can munge the labels of trailing whitespace. I can think of no reason why anyone would want such a gremlin.

  • SKSSF
    SKSSF
    Community Member

    Instead, perhaps I can include sample CSV files in the suite's package, and refer users to the folder.

    That sounds great--thanks again!!

  • MrC
    MrC
    Volunteer Moderator

    @SKSSF

    Just to close on this, I've posted a new release, that includes the following changes:

    2024-10-18 -----------------------------------------------------------------------------------------

    • Internal [suite]
      Updated local version of the Text::CSV_PP module to the latest from upstream.

    • Internal [suite]
      Add fixes to the local version of the Text::CSV_PP module to resolve an issue I discovered and
      reported for the upstream module Text::CSV_XS. Commits:

      https://github.com/Tux/Text-CSV_XS/commit/d5f6bea60b9878f07c9bc1bcbc81895d6913897e
      https://github.com/Tux/Text-CSV_XS/commit/b73c2ea50daedbc63959bc434545bd4429a98f3b

    • Fix [suite]
      When debugging is enabled, print file info for all files provided on the command line.

    • Fix [suite]
      Updated the README with a few clarifications and typo corrections.

    • New [csv]
      Example CSV files for each of the supported import categories are available in the testfiles/csv
      folder.

    • New [csv]
      Multiple CSV files can now be provided on the command line for converting into a single 1PUX (or
      1PIF).

    • New [csv]
      Added debug message to show final column labels after leading/trailing whitespace removal and
      case-lowering.

    Thanks for your valuable input. You inspired me to implement several of the improvements above, and that then lead to my discovery of an issue in the CSV module used by the converter (the author provided a fix very quickly).

    Enjoy 1Password!

  • SKSSF
    SKSSF
    Community Member

    Excellent! Got a tip jar?

  • MrC
    MrC
    Volunteer Moderator

    Only a virtual one. I just heard the clinking coins hit the jar.

  • SKSSF
    SKSSF
    Community Member

    🪙🪙🪙🪙🪙