ericzimmerman / lecmd Goto Github PK
View Code? Open in Web Editor NEWLnk Explorer Command line edition!!
License: MIT License
Lnk Explorer Command line edition!!
License: MIT License
In your README.md as well as the help text, the second example is LECmd.exe -f "C:\Temp\somelink.lnk" --json "D:\jsonOutput" --jsonpretty
, but --jsonpretty isnt a valid argument. The correct argument should just be --pretty
Here are some exceptions that I'm receiving when parsing files. There seems to be mainly two:
This is occurring it both the lecmd and nuget package that was created. The hashes are the files that are causing the exception. eg 0614ed9d8815219f4db92f425062f969b8ea654cf0b2fd08ee5070617bccd430
ERROR: 0614ed9d8815219f4db92f425062f969b8ea654cf0b2fd08ee5070617bccd430,EXCEPTION,"Unhandled exception. System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'startIndex') at System.BitConverter.ToInt32(Byte[] value, Int32 startIndex) at Lnk.ShellItems.ShellBag0X1F..ctor(Byte[] rawBytes) at Lnk.LnkFile..ctor(Byte[] rawBytes, String sourceFile)
ERROR: 0819d57ea1b8cf3e902965f13c72f093c6a7904d4cb029ed8173561d5e7a94ba,EXCEPTION,"Unhandled exception. System.OverflowException: Arithmetic operation resulted in an overflow. at Lnk.LnkFile..ctor(Byte[] rawBytes, String sourceFile) at Lnk.Lnk.LoadFile(String lnkFile)
ERROR: 09f85c2901084a4426a4d85f806ae3dbc4034af7a610fece59cff86a6335b4b6,EXCEPTION,"Unhandled exception. System.OverflowException: Arithmetic operation resulted in an overflow. at Lnk.LnkFile..ctor(Byte[] rawBytes, String sourceFile) at Lnk.Lnk.LoadFile(String lnkFile)
ERROR: 0f94fac61003fdd323a5f3e6433624f95c292bbd96ccde5d6cebe52dfa7e7468,EXCEPTION,"Unhandled exception. System.OverflowException: Arithmetic operation resulted in an overflow. at Lnk.ShellItems.ShellBag0X2E.ProcessPropertyViewDefault(Byte[] rawBytes) at Lnk.ShellItems.ShellBag0X2E..ctor(Byte[] rawBytes) at Lnk.LnkFile..ctor(Byte[] rawBytes, String sourceFile) at Lnk.Lnk.LoadFile(String lnkFile)
ERROR: 12e2298e797fbf2f627a208953e7bffa300e695af32038526691c0749c97f1e9,EXCEPTION,"Unhandled exception. System.OverflowException: Arithmetic operation resulted in an overflow. at Lnk.ShellItems.ShellBag0X2E.ProcessPropertyViewDefault(Byte[] rawBytes) at Lnk.ShellItems.ShellBag0X2E..ctor(Byte[] rawBytes) at Lnk.LnkFile..ctor(Byte[] rawBytes, String sourceFile) at Lnk.Lnk.LoadFile(String lnkFile)
ERROR: 16abcdcf3568a4d33b65bf3ac069b2a95d36aed213aefc1473e3f4cab4911e97,EXCEPTION,"Unhandled exception. System.Exception: unknown off3bitmask: 0x20 at Lnk.ShellItems.ShellBag0X1F..ctor(Byte[] rawBytes) at Lnk.LnkFile..ctor(Byte[] rawBytes, String sourceFile) at Lnk.Lnk.LoadFile(String lnkFile)
ERROR: 1f45bc918e4b2bced0d32a1208e2c52777f6c78bc7687d82fc42fdb84a454b6c,EXCEPTION,"Unhandled exception. System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'startIndex') at System.BitConverter.ToInt32(Byte[] value, Int32 startIndex) at Lnk.ShellItems.ShellBag0X1F..ctor(Byte[] rawBytes) at Lnk.LnkFile..ctor(Byte[] rawBytes, String sourceFile)
ERROR: 21cf0676c098efa8d8eff77c21df1edda3fe2bd3746c49973bc865469e13fb31,EXCEPTION,"Unhandled exception. System.Exception: unknown off3bitmask: 0x10 at Lnk.ShellItems.ShellBag0X1F..ctor(Byte[] rawBytes) at Lnk.LnkFile..ctor(Byte[] rawBytes, String sourceFile) at Lnk.Lnk.LoadFile(String lnkFile)
ERROR: 2671a1b7926c3047067f23487d121379fc581d70a4730f62da9e3d9cb9a5dca4,EXCEPTION,"Unhandled exception. System.Exception: unknown off3bitmask: 0x10 at Lnk.ShellItems.ShellBag0X1F..ctor(Byte[] rawBytes) at Lnk.LnkFile..ctor(Byte[] rawBytes, String sourceFile)
ERROR: 28987f44e46e02c88391e531a9cda3665c30ff717663fe70508944efd6ff96ad,EXCEPTION,"Unhandled exception. System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'startIndex') at System.BitConverter.ToInt32(Byte[] value, Int32 startIndex) at Lnk.ShellItems.ShellBag0X1F..ctor(Byte[] rawBytes) at Lnk.LnkFile..ctor(Byte[] rawBytes, String sourceFile)
ERROR: 2a96bc1b12d789eb3beb1c2677c2b0f345c8bc2ac9e426c3698c4ab002e3f6dd,EXCEPTION,"Unhandled exception. System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'startIndex') at System.BitConverter.ToInt16(Byte[] value, Int32 startIndex) at Lnk.ShellItems.ShellBag0X1F..ctor(Byte[] rawBytes) at Lnk.LnkFile..ctor(Byte[] rawBytes, String sourceFile)
ERROR: 2c6725c16971ddfde5b7ace55559ebebe71c339080eec1948b384f9b2876e3f1,EXCEPTION,"Unhandled exception. System.OverflowException: Arithmetic operation resulted in an overflow. at Lnk.LnkFile..ctor(Byte[] rawBytes, String sourceFile) at Lnk.Lnk.LoadFile(String lnkFile)
ERROR: 2d8d7243706e1dccb3864ae8ed151303a6505e404c57b0928577e66d44fb6c3d,EXCEPTION,"Unhandled exception. System.OverflowException: Arithmetic operation resulted in an overflow. at Lnk.ShellItems.ShellBag0X2E.ProcessPropertyViewDefault(Byte[] rawBytes) at Lnk.ShellItems.ShellBag0X2E..ctor(Byte[] rawBytes) at Lnk.LnkFile..ctor(Byte[] rawBytes, String sourceFile)
ERROR: 2eda822d669c33d9e7f24e65a55741b6afde5fbd1f1723b991055732d7dc4077,EXCEPTION,"Unhandled exception. System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'startIndex')
LECmd and the lnk library do not support multibyte characters in some fields such as such as CommonPath and LocalPath.
Therefore, those fields will be garbled.
I attached a LNK file that can reproduce the problem.
test_lnk.zip
If you use the original version of LECmd, the Local path filed is garbled. You can confirm it like the figure below.
So I PRed #10 to solve this. If you use the improved LECmd with --cp 932 option, you will find the string in the Local path is correctly displayed, although you might not be able to understand what the string is. Trust me ;-)
The target file name I used is "テスト.txt" means "test.txt" in Japanese. I hope you can distinguish the results above.
Note that before using it, execute "chcp 932" on the command prompt to change the code page into Japanese to display strings correctly.
Although I know you and English speakers do not need this option, it is useful for people who do not speak English.
I hope you take the PR #10 for the people.
If you have any questions, please let me know.
I would love to use your tool to find malicious .LNK files, but on some endpoints there are 2k files to go through. If there was an option to filter by HeaderFlags, for example by which one "HasArguments", it could speed up which files to investigate.
I often get 2 errors:
Is there a way to fix these (without renaming/moving the files)?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.