From 05693709d5e46f4b9abe3ab8bf547aa418ce6bca Mon Sep 17 00:00:00 2001 From: htran Date: Fri, 4 Oct 2024 20:30:33 -0700 Subject: [PATCH] fix(doxless): typecheck, use os.walk for cross-platform --- README.md | 22 ++++++++++++++++++++++ scripts/doxless.py | 7 ++++--- 2 files changed, 26 insertions(+), 3 deletions(-) mode change 100644 => 100755 scripts/doxless.py diff --git a/README.md b/README.md index cf121dc..058fe24 100644 --- a/README.md +++ b/README.md @@ -32,3 +32,25 @@ profile sharing process. - [r2modman](https://github.com/ebkr/r2modmanPlus/tags) is in `%AppData%/r2modmanPlus-local/RiskOfRain2/profiles` - [thunderstore (WARNING: DOWNLOAD ON CLICK)](https://www.overwolf.com/app/Thunderstore-Thunderstore_Mod_Manager) is in `%AppData%/Thunderstore\ Mod\ Manager/DataFolder/RiskOfRain2/profiles` +**Doxxing yourself** + +I've provided [script to check for dox](./scripts/doxless.py), turns out +r2modman: +- Uses abspath, of Windows machines, on `%AppData%` (default: `SysDrive:/User//AppData/Roaming`) +for icon paths +- Does not erase this information + +This is one way to leak information. I did not remove it in the current sync. +The r2modman's importer can just check for validity and go grab a different path. + +Note that you'll probably will have a much better performance via `rg $USER`, +this script currently doesn't offer much. + +```sh +python3 scripts/doxless.py +""" +*.mods.yml +""" +``` + + diff --git a/scripts/doxless.py b/scripts/doxless.py old mode 100644 new mode 100755 index 5c3a23f..ce65675 --- a/scripts/doxless.py +++ b/scripts/doxless.py @@ -5,7 +5,7 @@ import os import time import sys -def in_content(needle: str, pathlike: str): +def in_content(needle: str, pathlike: str | pathlib.Path): content = "" try: # NB: latin-1 since we actually do have some language translation files @@ -16,7 +16,7 @@ def in_content(needle: str, pathlike: str): return needle in content -def gitignore_patterns(gitignore_f: str | None = None): +def gitignore_patterns(gitignore_f: str): with open(gitignore_f, 'r') as f: return {line for line in (line.strip() for line in f) if not line.startswith('#') and line} @@ -33,7 +33,8 @@ def main(): username_in_content = [] user_lower = username.lower() - for root, dirs, filenames in pathlib.Path("./").walk(): + for _root, dirs, filenames in os.walk(pathlib.Path("./")): + root = pathlib.Path(_root) absdirs = [ e for e in ((root.joinpath(d), d) for d in dirs)