Skip to content

Incorrect binwalk module path in binw.py when launching from command line on Windows #40

@AndisGrossteins

Description

@AndisGrossteins

If HexWalk is added to PATH and executed from command line in terminal, the module search path in binw.py is interpreted as relative to CWD and also the binw.py file is created in current directory, not in the directory where HexWalk binary is installed, i.e.: %userprofile%\HexWalk\win64.

I'd suggest creating the binw.py in the directory next to hexwalk.exe and using less error-prone approach to Python modules path:

import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'binwalk', 'src'))
import binwalk

Prepending the path instead of appending avoids possible conflicts with binwalk module in user or global scope.

BTW, installing HexWalk using winget (command: ❯ winget install HexWalk) installs it in current directory because target directory is not passed to the installer executable. The installer should default to either per-user installation path in %LocalAppData%\Programs\HexWalk or global installation in %ProgramFiles%\HexWalk if installing with elevated permissions.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions