picklock 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. picklock-0.1.0/.flake8 +12 -0
  2. picklock-0.1.0/.gitignore +91 -0
  3. picklock-0.1.0/CODE_OF_CONDUCT.md +128 -0
  4. picklock-0.1.0/CONTRIBUTING.md +210 -0
  5. picklock-0.1.0/LICENSE +21 -0
  6. picklock-0.1.0/Makefile +332 -0
  7. picklock-0.1.0/PKG-INFO +118 -0
  8. picklock-0.1.0/README.md +72 -0
  9. picklock-0.1.0/SECURITY.md +67 -0
  10. picklock-0.1.0/codecov.yml +25 -0
  11. picklock-0.1.0/picklock/__init__.py +31 -0
  12. picklock-0.1.0/picklock/__main__.py +10 -0
  13. picklock-0.1.0/picklock/addressing.py +259 -0
  14. picklock-0.1.0/picklock/cli.py +262 -0
  15. picklock-0.1.0/picklock/commands/__init__.py +601 -0
  16. picklock-0.1.0/picklock/commands/alias_commands.py +249 -0
  17. picklock-0.1.0/picklock/commands/memory_commands.py +789 -0
  18. picklock-0.1.0/picklock/commands/pointer_commands.py +582 -0
  19. picklock-0.1.0/picklock/commands/ps_commands.py +325 -0
  20. picklock-0.1.0/picklock/commands/scan_commands.py +1041 -0
  21. picklock-0.1.0/picklock/commands/session_commands.py +751 -0
  22. picklock-0.1.0/picklock/dependencies.py +67 -0
  23. picklock-0.1.0/picklock/errors.py +50 -0
  24. picklock-0.1.0/picklock/output.py +470 -0
  25. picklock-0.1.0/picklock/processes.py +107 -0
  26. picklock-0.1.0/picklock/py.typed +0 -0
  27. picklock-0.1.0/picklock/session.py +455 -0
  28. picklock-0.1.0/picklock/shell.py +417 -0
  29. picklock-0.1.0/picklock/store.py +106 -0
  30. picklock-0.1.0/picklock/valuetypes.py +303 -0
  31. picklock-0.1.0/pyproject.toml +131 -0
  32. picklock-0.1.0/tests/conftest.py +67 -0
  33. picklock-0.1.0/tests/test_addressing.py +89 -0
  34. picklock-0.1.0/tests/test_aliases.py +264 -0
  35. picklock-0.1.0/tests/test_cli.py +154 -0
  36. picklock-0.1.0/tests/test_commands.py +902 -0
  37. picklock-0.1.0/tests/test_dependencies.py +44 -0
  38. picklock-0.1.0/tests/test_end_to_end.py +661 -0
  39. picklock-0.1.0/tests/test_output.py +199 -0
  40. picklock-0.1.0/tests/test_scanning.py +169 -0
  41. picklock-0.1.0/tests/test_session.py +112 -0
  42. picklock-0.1.0/tests/test_settings_persistence.py +131 -0
  43. picklock-0.1.0/tests/test_shell.py +237 -0
  44. picklock-0.1.0/tests/test_valuetypes.py +93 -0
picklock-0.1.0/.flake8 ADDED
@@ -0,0 +1,12 @@
1
+ [flake8]
2
+
3
+ max-line-length = 130
4
+ # E203: whitespace before ':' (black-compatible — black puts spaces around the
5
+ # colon in slices like data[i : i + n], which conflicts with PEP 8).
6
+ # E701: multiple statements on one line (colon) — used pervasively as a style choice.
7
+ # W503: line break before binary operator (black-compatible).
8
+ ignore = E203, E701, W503
9
+
10
+ per-file-ignores =
11
+ # __init__.py files are allowed to have unused imports and lines-too-long.
12
+ */__init__.py:F401, E501
@@ -0,0 +1,91 @@
1
+ # Byte-compiled / cached
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # Build / packaging
7
+ build/
8
+ .build/
9
+ dist/
10
+ *.egg-info/
11
+ *.egg
12
+ .eggs/
13
+ *.whl
14
+ *.tar.gz
15
+ pip-log.txt
16
+ pip-delete-this-directory.txt
17
+ MANIFEST
18
+
19
+ # Virtual environments
20
+ venv/
21
+ .venv/
22
+ env/
23
+ ENV/
24
+
25
+ # Testing & coverage
26
+ .pytest_cache/
27
+ *.pytest_cache
28
+ .coverage
29
+ .coverage.*
30
+ htmlcov/
31
+ coverage.xml
32
+ *.cover
33
+ .tox/
34
+ .nox/
35
+ .hypothesis/
36
+
37
+ # Type checkers & linters
38
+ .mypy_cache/
39
+ .ruff_cache/
40
+ .pyre/
41
+ .pytype/
42
+
43
+ # IDEs / editors
44
+ .idea/
45
+ .vscode/
46
+ *.code-workspace
47
+ *.sublime-*
48
+ .spyderproject
49
+ .spyproject
50
+
51
+ # Editor swap / backup files
52
+ *.swp
53
+ *.swo
54
+ *~
55
+ .\#*
56
+ \#*\#
57
+
58
+ # OS-specific cruft
59
+ .DS_Store
60
+ .AppleDouble
61
+ .LSOverride
62
+ Thumbs.db
63
+ Desktop.ini
64
+ .directory
65
+
66
+ # Toolchain / version pinning state
67
+ .tool-versions
68
+ .python-version
69
+
70
+ # Local environment files (never commit secrets)
71
+ .env
72
+ .env.local
73
+ .env.*.local
74
+
75
+ # Logs / temporary
76
+ *.log
77
+ *.tmp
78
+
79
+ # Sphinx / docs build output
80
+ docs/_build/
81
+
82
+ # Generated from the command registry at build time by
83
+ # scripts/generate_command_reference.py — committing it would let a
84
+ # stale copy outlive the code it describes.
85
+ docs/reference/commands.md
86
+
87
+ # Project-local
88
+ .claude/
89
+
90
+ # A throwaway alias store, if one is pointed here
91
+ aliases.json
@@ -0,0 +1,128 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ `contact@jeanloui.dev`.
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at
119
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120
+
121
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
122
+ enforcement ladder](https://github.com/mozilla/diversity).
123
+
124
+ [homepage]: https://www.contributor-covenant.org
125
+
126
+ For answers to common questions about this code of conduct, see the FAQ at
127
+ https://www.contributor-covenant.org/faq. Translations are available at
128
+ https://www.contributor-covenant.org/translations.
@@ -0,0 +1,210 @@
1
+ # Contributing to Picklock
2
+
3
+ Thanks for your interest in contributing!
4
+
5
+ Picklock is a terminal client for [PyMemoryEditor][pyme]. If your change is
6
+ about *how memory is read, written or scanned*, it probably belongs upstream in
7
+ PyMemoryEditor; if it is about *what you type and what you see*, it belongs
8
+ here. When in doubt, open an issue and it will be routed.
9
+
10
+ ## Development setup
11
+
12
+ ```bash
13
+ python -m venv venv
14
+ source venv/bin/activate # On Windows: venv\Scripts\activate
15
+ make install-dev # pip install -e ".[dev]"
16
+ ```
17
+
18
+ The `Makefile` is the single source of truth for the dev commands below — run
19
+ `make help` to see every target. The raw command each target wraps is shown in
20
+ parentheses if you would rather run it directly.
21
+
22
+ ## Running the test suite
23
+
24
+ ```bash
25
+ make test # pytest tests -v
26
+ ```
27
+
28
+ The suite has two halves.
29
+
30
+ Most of it never touches a process: parsing, formatting, dispatch, help,
31
+ aliases, settings. Those run in about two seconds.
32
+
33
+ `tests/test_end_to_end.py` drives every command against a **real** process —
34
+ the test process itself, the same trick PyMemoryEditor's own suite uses, which
35
+ is why it needs no privileges and no second program to launch. It puts known
36
+ values in memory with `ctypes`, types the command, and asserts on the table
37
+ that comes back. What is under test is the command, not the library: a failure
38
+ there means Picklock is wrong.
39
+
40
+ The scans walk a live address space, so they add about thirty seconds.
41
+ `make test` includes them and CI runs the lot, which is the point: a command
42
+ body is not covered until it has run against a real process. The `target`
43
+ fixture skips itself if the platform refuses to open its own process, so a
44
+ hostile runner degrades to the fast half rather than failing.
45
+
46
+ ## Linting and type checking
47
+
48
+ ```bash
49
+ make lint # flake8 picklock tests
50
+ make type-check # mypy picklock
51
+ ```
52
+
53
+ ## Before you push
54
+
55
+ ```bash
56
+ make pre-commit # lint + type-check + test
57
+ ```
58
+
59
+ CI runs the same three, plus a build, on Ubuntu, Windows and macOS across
60
+ Python 3.10–3.13. The matrix matters here: the shell has to start and dispatch
61
+ identically where `readline` is missing (Windows), and `picklock -e "version"`
62
+ is smoke-tested from the installed console script on every cell.
63
+
64
+ ## Project layout
65
+
66
+ ```
67
+ picklock/
68
+ ├── __init__.py # Version and the public re-exports
69
+ ├── __main__.py # python -m picklock
70
+ ├── cli.py # argparse front end: flags, batch mode, exit statuses
71
+ ├── shell.py # The REPL: line splitting, dispatch, readline, history
72
+ ├── session.py # Everything a session remembers: target, results, settings
73
+ ├── addressing.py # The address expression language ([...], module+offset, #N)
74
+ ├── valuetypes.py # The type vocabulary and the signed/unsigned bridge
75
+ ├── output.py # Every byte Picklock prints: tables, hexdump, footers
76
+ ├── processes.py # Cross-platform process enumeration
77
+ ├── store.py # The JSON files Picklock remembers things in
78
+ ├── errors.py # CommandError and friends
79
+ └── commands/ # One module per group; each registers with @command
80
+ ```
81
+
82
+ Two rules keep the shape:
83
+
84
+ - **Commands never print directly.** They go through `session.printer`, which
85
+ is what makes output testable against a `StringIO`.
86
+ - **Anything the user got wrong raises `CommandError`.** The shell catches that
87
+ one class, prints one `ERROR:` line and returns to the prompt. An exception
88
+ that is *not* a `CommandError` is a bug in Picklock and is allowed to escape
89
+ with its traceback.
90
+
91
+ ## Adding a command
92
+
93
+ 1. Pick the module in `picklock/commands/` that matches the namespace.
94
+ 2. Register the handler. The name is a colon-separated path whose first
95
+ segment is one of the groups in `NAMESPACES`; the heading in `help` follows
96
+ from it, so there is nothing to keep in step. Do **not** give it a
97
+ plain-word alias: two groups could each want `read`, and a test enforces
98
+ that namespaced commands have none.
99
+
100
+ Note the word *namespace* is internal. To the reader there are only
101
+ commands, some of which take a subcommand — a test sweeps every help page,
102
+ topic and error to keep the word out of what they see.
103
+
104
+ A name with no colon is a **top-level** command, reserved for the shell's
105
+ own vocabulary (`help`, `set`, `exit`). Anything that touches the target
106
+ belongs in a namespace, and a test enforces that too.
107
+
108
+ ```python
109
+ def _mycommand_parser() -> CommandParser:
110
+ parser = CommandParser("memory:mycommand")
111
+ parser.add_argument("address", help="what to act on")
112
+ return parser
113
+
114
+
115
+ @command(
116
+ "memory:mycommand",
117
+ parser=_mycommand_parser,
118
+ summary="One line, sentence case, ending in a period.",
119
+ details="The long help, printed by 'help memory:mycommand'.",
120
+ examples=("memory:mycommand 0x1000",),
121
+ )
122
+ def cmd_mycommand(session: Session, args: List[str]) -> None:
123
+ options = _mycommand_parser().parse_args(args)
124
+
125
+ process = session.require_process("memory:mycommand")
126
+ address = parse_address(options.address, session)
127
+ ...
128
+ ```
129
+
130
+ There is no `usage=`: the usage line is generated from the parser, so it
131
+ always names every flag the command accepts. Give each argument a `help=`
132
+ and a readable `metavar` — those two are what the help is built from.
133
+
134
+ If the command prints a table that can be longer than a screen, page it
135
+ with the shared helpers rather than a `--limit` of your own:
136
+
137
+ ```python
138
+ def _mycommand_parser() -> CommandParser:
139
+ return add_paging_arguments(CommandParser("memory:mycommand"))
140
+
141
+
142
+ page = paginate(
143
+ session, rows, command="memory:mycommand",
144
+ limit=options.limit, page=options.page, show_all=options.all,
145
+ )
146
+ session.printer.table(headers, page.rows, total=page.total,
147
+ page=page.number, pages=page.count,
148
+ next_page=page.next_page)
149
+ ```
150
+
151
+ That gives the same three flags, the same wording, the same
152
+ `page N of M` footer and the same `Next page: ...` line as every other
153
+ listing — and a test enforces that the wording does not drift.
154
+
155
+ Names go **two levels at most** — `scan:keep`, never `scan:results:keep`.
156
+ The registry rejects a third level, and a test pins that down: a deeper name
157
+ buys tidiness at the cost of a listing that has to be walked twice to be
158
+ read once.
159
+
160
+ `<command>:help` is a dispatcher convention rather than a registered
161
+ command, so it answers for every command at every depth — `memory:help`,
162
+ `memory:read:help`, `clear:help` — without one `help` command per group
163
+ cluttering the listings it exists to print. It keeps working, but the
164
+ spelling the help *advertises* is `help <command>`: one form for everything,
165
+ and it reads as a sentence.
166
+
167
+ 3. Use `CommandParser`, not a bare `ArgumentParser`: it raises instead of
168
+ calling `sys.exit`, which would kill the shell on a typo.
169
+ 4. Take addresses through `parse_address` so your command speaks the same
170
+ `[game.exe+0x10]+0x8` and `#3` language as every other one.
171
+
172
+ Pass every argument a `help=` string. `help <command>` (and `<command> --help`)
173
+ builds its **Arguments** and **Options** sections from the parser itself, so
174
+ the documentation cannot drift from what the command accepts — there is only
175
+ one definition of either.
176
+
177
+ `help` and `picklock --help` are likewise generated from the registry, so a
178
+ command cannot be added without also being documented. `tests/test_commands.py`
179
+ enforces all of it: every command must declare a parser, every argument must
180
+ carry help text, every flag must appear in the command's help, and a usage line
181
+ may not advertise a flag the parser does not accept. A new command is covered
182
+ the moment it is registered.
183
+
184
+ ## Submitting changes
185
+
186
+ 1. Open an issue first for bug reports or substantial features.
187
+ 2. Branch from `main`. Keep commits focused.
188
+ 3. Run `make pre-commit` locally before pushing.
189
+ 4. PR titles follow [Conventional Commits][cc] (`feat:`, `fix:`, `docs:`, …) —
190
+ CI lints the title.
191
+ 5. Describe the change and how it was tested. For a command body, paste the
192
+ session.
193
+
194
+ ## Reporting bugs
195
+
196
+ Please include:
197
+
198
+ - The output of `picklock --version` — it names Picklock, PyMemoryEditor,
199
+ Python and the platform.
200
+ - The exact command you typed and the exact output you got.
201
+ - Whether you were running elevated (`sudo` / Administrator).
202
+ - For Linux: whether `/proc/sys/kernel/yama/ptrace_scope` is `0` or `1`.
203
+
204
+ ## Security
205
+
206
+ If you find a security issue, please see [`SECURITY.md`](https://github.com/JeanExtreme002/Picklock/blob/main/SECURITY.md).
207
+ **Do not** report it via GitHub issues.
208
+
209
+ [pyme]: https://github.com/JeanExtreme002/PyMemoryEditor
210
+ [cc]: https://www.conventionalcommits.org/
picklock-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jean Loui Bernard Silva de Jesus
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.