Skip to content

feat: add MySQL/MariaDB protocol class#62

Open
jgallagheriii wants to merge 1 commit into
sandialabs:mainfrom
jgallagheriii:feat/mysql-protocol
Open

feat: add MySQL/MariaDB protocol class#62
jgallagheriii wants to merge 1 commit into
sandialabs:mainfrom
jgallagheriii:feat/mysql-protocol

Conversation

@jgallagheriii

Copy link
Copy Markdown
Contributor

Add MySQL/MariaDB protocol class

Description

  • Add MySQL/MariaDB protocol class (peat/protocols/mysql.py) with unauthenticated server fingerprinting via TCP greeting packet, PyMySQL-backed query helpers, and on_connected/enumerate subclass hooks
  • Add PyMySQL >=1.1.0 as a project dependency
  • Add unit tests for MySQL protocol class
  • Update docs with MySQL protocol and PyMySQL dependency
    Please include a summary of the changes made.

Related Issue

Closes #59

Checklist

Please check the following items as they're completed.
Completion of all checklist items signals to maintainers that a PR is fully ready for review.

  • This PR conforms to the process detailed in the Contributing Guide
  • I have included no proprietary/sensitive information in my code
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have tested my code
  • I have added a description of my changes to the changelog in CHANGELOG.rst
  • Apply appropriate Tags to this PR, if any (e.g. bugfix, enhancement(feature), documentation, etc.)
  • Removing "Draft" status from the PR (if applicable).

@jgallagheriii jgallagheriii force-pushed the feat/mysql-protocol branch 2 times, most recently from 0307579 to 9be85dc Compare May 8, 2026 16:29

@GhostofGoes GhostofGoes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some other requests:

  • Has this been tested extensively against a OT device/system running MySQL? What SQL server instances has it been tested against (if you can share in open-source)
  • Add references to new class to developer API documentation
  • Add a documentation page dedicated to MySQL

Comment thread peat/protocols/mysql.py Outdated
Comment thread peat/protocols/mysql.py
Comment thread peat/protocols/mysql.py Outdated
Comment thread peat/protocols/mysql.py
Comment thread peat/protocols/mysql.py Outdated
Comment thread peat/protocols/mysql.py Outdated
Comment thread tests/protocols/test_mysql.py Outdated
Comment thread tests/protocols/test_mysql.py Outdated
Comment thread tests/protocols/test_mysql.py Outdated
Comment thread tests/protocols/test_mysql.py Outdated
- MySQL wrapper around PyMySQL with lazy connection via conn property
- Bound logger, __enter__/__exit__ context manager support
- on_connected and enumerate hooks for subclass customization
- Helper methods: get_databases, get_tables, get_table_row_count,
  get_users, get_grants, get_global_variables, get_process_list
- read_greeting staticmethod for unauthenticated banner fingerprinting
- Plain-function pytest suite covering all public methods and hooks

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jgallagheriii

Copy link
Copy Markdown
Contributor Author

Some other requests:

  • Has this been tested extensively against a OT device/system running MySQL? What SQL server instances has it been tested against (if you can share in open-source)
  • Add references to new class to developer API documentation
  • Add a documentation page dedicated to MySQL

This has not been tested against an OT device running MySQL. The implementation was validated against a standard MySQL instance running in Docker. The class is designed as a base class — device-specific subclasses are expected to override on_connected() and enumerate() to query proprietary tables relevant to a particular device. Testing against specific OT targets is left to those subclasses.

@GhostofGoes

Copy link
Copy Markdown
Contributor

Add a GitHub Actions workflow that spawns a MySQL container and executes tests against it

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

Successfully merging this pull request may close these issues.

[Feature] Add MySQL protocol module

2 participants