Commit d013b42a by Peter Wu

Ignore dotfiles only while discovering magic files

Some programs (which?) might create temporary files like `~name` or
`_name`, but maybe there are people who actually rely on names like
`_name`. Let's restrict the filter to just dotfiles for now.
parent af32a01e
......@@ -66,8 +66,8 @@ class Settings:
system_binarch = self._system_path(self.BINWALK_MAGIC_DIR, self.BINARCH_MAGIC_FILE)
def list_files(dir_path):
# Restrict files list to names starting with an alphanumeric
return [os.path.join(dir_path, x) for x in os.listdir(dir_path) if x[0].isalnum()]
# Ignore hidden dotfiles.
return [os.path.join(dir_path, x) for x in os.listdir(dir_path) if not x.startswith('.')]
if not system_only:
user_dir = os.path.join(self.user_dir, self.BINWALK_USER_DIR, self.BINWALK_MAGIC_DIR)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment