Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split boofuzz/sessions.py #638

Merged
merged 6 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ venv/
ENV/
env.bak/
venv.bak/
Pipfile

# Sphinx documentation
docs/_build/
Expand Down
7 changes: 7 additions & 0 deletions boofuzz/sessions/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from .connection import Connection
from .session import Session, open_test_run
from .session_info import SessionInfo
from .target import Target
from .web_app import WebApp

__all__ = [Connection, SessionInfo, Target, Session, WebApp, open_test_run]
30 changes: 30 additions & 0 deletions boofuzz/sessions/connection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from ..pgraph import Edge


class Connection(Edge):
def __init__(self, src, dst, callback=None):
"""
Extends pgraph.edge with a callback option. This allows us to register a function to call between node
transmissions to implement functionality such as challenge response systems. The callback method must follow
this prototype::

def callback(target, fuzz_data_logger, session, node, edge, *args, **kwargs)

Where node is the node about to be sent, edge is the last edge along the current fuzz path to "node", session
is a pointer to the session instance which is useful for snagging data such as sesson.last_recv which contains
the data returned from the last socket transmission and sock is the live socket. A callback is also useful in
situations where, for example, the size of the next packet is specified in the first packet.

Args:
src (int): Edge source ID
dst (int): Edge destination ID
callback (function): Optional. Callback function to pass received data to between node xmits

.. versionchanged:: 0.5.0
This class has been moved into the sessions subpackage. The full path is now
boofuzz.sessions.connection.Connection.
"""

super(Connection, self).__init__(src, dst)

self.callback = callback
Loading