Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue with pylnk #2

Closed
GraySh3ll opened this issue Feb 9, 2021 · 2 comments
Closed

issue with pylnk #2

GraySh3ll opened this issue Feb 9, 2021 · 2 comments

Comments

@GraySh3ll
Copy link

Have installed liblnk-20200810, trying to run LNKUp on the latest version of Kali (2020.4) and encountering the following errors.
cmd: (python v3.9.1+)
python3 http://generate.py --host (myIP) --type ntlm --output out.lnk
Error:
Traceback (most recent call last):
File "/home/rory/LNKUp-master/generate.py", line 169, in
main(args=cmd_line_args)
File "/home/rory/LNKUp-master/generate.py", line 120, in main
link = for_file(r'C:\Windows\System32\cmd.exe', filepath)
File "/home/rory/LNKUp-master/generate.py", line 151, in for_file
return pylnk.from_segment_list(elements, lnk_name)
File "/usr/lib/python3/dist-packages/pylnk.py", line 1754, in from_segment_list
entries.append(DriveEntry(drive))
File "/usr/lib/python3/dist-packages/pylnk.py", line 488, in init
m = _DRIVE_PATTERN.match(drive.strip())
TypeError: cannot use a string pattern on a bytes-like object

cmd: (python v2.7.18)
python generate.py --host (myIP) --type ntlm --output out.lnk
error:
Traceback (most recent call last):
File "generate.py", line 169, in
main(args=cmd_line_args)
File "generate.py", line 120, in main
link = for_file(r'C:\Windows\System32\cmd.exe', filepath)
File "generate.py", line 140, in for_file
lnk = pylnk.create(lnk_name)
AttributeError: 'module' object has no attribute 'create'

@Plazmaz
Copy link
Owner

Plazmaz commented Feb 11, 2021

So I dug into this. The standard pylnk doesn't support python 3. Originally the warning about python bindings was because on windows it uses win32com.client. However, turns out pylnk is not the actual binding, but a native python implementation. This implementation may or may not have actually worked with my code at one point, but it's hard to tell. Pylnk is a very old, outdated dependency that will only work with python 2. So, if you want to use this script, you'll need to use it with py2 and the original pylnk. However, in the process of navigating this annoying dependency tree again, I stumbled across a fork of pylnk here: https://github.com/strayge/pylnk
that seems to have a very nice, feature-rich CLI built into it, and may be a nice alternative to LNKUp if the icon can be set using a UNC path. Hope that helps!

@Plazmaz Plazmaz pinned this issue Feb 11, 2021
@Plazmaz
Copy link
Owner

Plazmaz commented Feb 11, 2021

Going to close this issue (I think it'll stay pinned?),

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

No branches or pull requests

2 participants