Closed gdesmar closed 2 months ago
It does look more complex :D but I like it. Actually, I am even thinking about extending your idea and completely moving to YAML. It would really simplify the code. Here is a draft.
Here is output of lnkparse tests/samples/unknown_block --all
:
Data:
Command line arguments: /c ren cfsdaacdfawd\*.vbss *.vbs &start \cfsdaacdfawd\aiasfacoiaksf.vbs&start
explorer .android_secure&exit
Icon location: '%SystemRoot%\System32\shell32.dll'
Extra:
Special folder location block:
Offset: 213
Size: 16
Special foldeid: 37
Unknown block:
- Extra data sha256: 4f022b4bc7668d870e158010c9877224df1b9b07bd24ef32b731963232b15eb2
Size: 28
- Extra data sha256: 40ebe6ee6ad3303ae2db241742e857aee523b21553a51e2f6c2a2461f1010879
Size: 153
Header:
Accessed time: null
Creation time: null
File flags: []
File size: 0
Guid: 00021401-0000-0000-C000-000000000046
Headesize: 76
Hotkey: 0
Icon index: 3
Link flags:
- HasTargetIDList
- HasArguments
- HasIconLocation
- IsUnicode
Modified time: null
Reserved0: 0
Reserved1: 0
Reserved2: 0
Windowstyle: SW_SHOWMINNOACTIVE
Link info: {}
Target:
Index: 78
Items:
- Class: Root Folder
Guid: 20D04FE0-3AEA-1069-A2D8-08002B30309D
Sort index: My Computer
- Class: Volume Item
Data: null
Flags: '0xf'
- Class: File entry
File attribute flags: 16
File size: 0
Flags: Is directory
Modification time: null
Primary name: Windows
- Class: File entry
File attribute flags: 16
File size: 0
Flags: Is directory
Modification time: null
Primary name: system32
- Class: File entry
File attribute flags: 0
File size: 0
Flags: Is file
Modification time: null
Primary name: cmd.exe
Size: 297
Absolutely! That should simplify it greatly. I did try to use pure yaml, but I was seeing a few things that you may not like as much:
make_keys_nice
to something like format_lnk_json
and add removing those unwanted onesWhen I tried to use only yaml, I couldn't find an easy way to override key formatting (all-uppercase or not, with or without colon) and have item skipping (UNWANTED_TRAITS). With a first step of format_lnk_json
, I think you can make the second bullet point work in your draft, and the third isn't that important (and you may even be able to do it if you absolutely want it), but the first would be where I would hesitate. As a user on the commandline, it was probably nice to have it in that specific order. In the end, I'm not really using lnkparse on the commandline (more as a library and using get_json(get_all=True)
), so don't let me influence you too much! 😁
P.S. Did you mean to have Unknown (undefined) block
as italic in the README? If not, you're missing another set of *
.
Thanks for the idea. I have created a different PR https://github.com/Matmaus/LnkParse3/pull/32 where I changed priting to a modified YAML. As this PR is no more relevant I am closing it.
As we discussed, that would be the modification to make the print more list agnostic and more yaml-like for Extra blocks. I would totally understand if you consider it to be too convoluted and creating too much complexity for the benefit. I think that by making this PR, even if you chose not to take it in and I delete my repo, it'll stay for future references? Maybe it will be revisited if LnkParse3's Extra Block management keep growing into handling more odd undocumented edge cases. 🙂