Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/GH05TCREW/MetasploitMCP
/ functions
Functions
137 in github.com/GH05TCREW/MetasploitMCP
⨍
Functions
137
◇
Types & classes
25
↳
Endpoints
6
↓ 33 callers
Function
_parse_options_gracefully
Gracefully parse options from different formats. Handles: - Dict format (correct): {"key": "value", "key2": "value2"} - String f
MetasploitMCP.py:324
↓ 16 callers
Function
get_msf_client
Gets the initialized MSF client instance, raising an error if not ready.
MetasploitMCP.py:106
↓ 8 callers
Function
update_runoption
(key, value)
MetasploitMCP.py:888
↓ 7 callers
Function
_get_module_object
Gets the MSF module object, handling potential path variations.
MetasploitMCP.py:400
↓ 7 callers
Method
read
(self)
conftest.py:74
↓ 6 callers
Function
_set_module_options
Sets options on a module object, performing basic type guessing.
MetasploitMCP.py:428
↓ 5 callers
Function
_execute_module_console
Helper to execute a module synchronously via console.
MetasploitMCP.py:603
↓ 5 callers
Function
run_command_safely
Safely run a command on a Metasploit console and return the output. Relies primarily on detecting the MSF prompt for command completion.
MetasploitMCP.py:218
↓ 4 callers
Function
_execute_module_rpc
Helper to execute an exploit, auxiliary, or post module as a background job via RPC. Includes polling logic for exploit sessions.
MetasploitMCP.py:454
↓ 4 callers
Function
find_available_port
Finds an available TCP port.
MetasploitMCP.py:1700
↓ 4 callers
Function
generate_payload
Generate a Metasploit payload using the RPC API (payload.generate). Saves the generated payload to a file on the server if successful. A
MetasploitMCP.py:830
↓ 4 callers
Function
get_msf_console
Async context manager for creating and reliably destroying an MSF console.
MetasploitMCP.py:165
↓ 4 callers
Function
list_exploits
List available Metasploit exploits, optionally filtered by search term. Args: search_term: Optional term to filter exploits (case-in
MetasploitMCP.py:740
↓ 4 callers
Function
run_exploit
Run a Metasploit exploit module with specified options. Handles async (job) and sync (console) execution, and includes session polling for jo
MetasploitMCP.py:992
↓ 3 callers
Function
initialize_msf_client
Initializes the global Metasploit RPC client instance. Raises exceptions on failure.
MetasploitMCP.py:66
↓ 3 callers
Function
list_payloads
List available Metasploit payloads, optionally filtered by platform and/or architecture. Args: platform: Optional platform filter (e
MetasploitMCP.py:783
↓ 3 callers
Function
start_listener
Start a new Metasploit handler (exploit/multi/handler) as a background job. Args: payload_type: The payload to handle (e.g., 'window
MetasploitMCP.py:1473
↓ 3 callers
Method
write
(self, command)
conftest.py:77
↓ 2 callers
Method
__setitem__
(self, key, value)
tests/test_tools_integration.py:82
↓ 2 callers
Method
execute
(self, payload=None)
tests/test_tools_integration.py:85
↓ 2 callers
Function
run_command
Run a command and handle errors.
run_tests.py:13
↓ 2 callers
Function
send_session_command
Send a command to an active Metasploit session (Meterpreter or Shell) and get output. Uses session.run_with_output for Meterpreter, and a pro
MetasploitMCP.py:1235
↓ 1 callers
Function
check_dependencies
Check if test dependencies are installed.
run_tests.py:33
↓ 1 callers
Function
list_active_sessions
List active Metasploit sessions with their details.
MetasploitMCP.py:1205
↓ 1 callers
Function
main
()
run_tests.py:46
↓ 1 callers
Method
payload_generate
(self)
tests/test_tools_integration.py:92
↓ 1 callers
Function
stop_job
Stop a running Metasploit job (handler or other). Verifies disappearance.
MetasploitMCP.py:1533
↓ 1 callers
Function
terminate_session
Forcefully terminate a Metasploit session using the session.stop() method. Args: session_id: ID of the session to terminate.
MetasploitMCP.py:1589
Method
__call__
Handle Server-Sent Events connection for MCP communication.
MetasploitMCP.py:1647
Method
__call__
Handle client POST messages for MCP communication.
MetasploitMCP.py:1657
Method
__init__
(self)
conftest.py:56
Method
__init__
(self, cid='test-console')
conftest.py:71
Method
__init__
(self)
tests/test_helpers.py:28
Method
__init__
(self, cid='test-console-id')
tests/test_helpers.py:36
Method
__init__
(self, *args, **kwargs)
tests/test_tools_integration.py:25
Method
__init__
(self)
tests/test_tools_integration.py:46
Method
__init__
(self, cid='test-console-id')
tests/test_tools_integration.py:63
Method
__init__
(self, fullname)
tests/test_tools_integration.py:75
Function
_received_request
(self, *args, **kwargs)
MetasploitMCP.py:308
Function
capture_logs
Fixture to capture and provide log output.
conftest.py:122
Function
check_msf_connection
Check the current status of the Metasploit RPC connection. Returns connection status information for debugging.
MetasploitMCP.py:114
Method
decorator
(func)
tests/test_tools_integration.py:30
Function
health_check
Check connectivity to the Metasploit RPC service.
MetasploitMCP.py:1674
Function
list_listeners
List all active Metasploit jobs, categorizing exploit/multi/handler jobs.
MetasploitMCP.py:1407
Function
mock_asyncio_to_thread
Fixture to mock asyncio.to_thread for testing.
conftest.py:113
Method
mock_client
Fixture providing a mock MSF client.
tests/test_helpers.py:111
Method
mock_client
Fixture providing a mock MSF client.
tests/test_helpers.py:215
Method
mock_client
Fixture providing a mock MSF client.
tests/test_tools_integration.py:124
Method
mock_client_and_module
Fixture providing mocked client and module.
tests/test_tools_integration.py:240
Method
mock_console
Fixture providing a mock console.
tests/test_helpers.py:262
Method
mock_exploit_environment
Fixture providing mocked exploit execution environment.
tests/test_tools_integration.py:319
Method
mock_job_environment
Fixture providing mocked job management environment.
tests/test_tools_integration.py:487
Function
mock_logger
Fixture providing a mock logger.
conftest.py:98
Method
mock_module
Fixture providing a mock module object.
tests/test_helpers.py:161
Function
mock_msf_environment
Session-scoped fixture that provides a complete mock MSF environment.
conftest.py:52
Method
mock_session_environment
Fixture providing mocked session management environment.
tests/test_tools_integration.py:414
Function
mock_to_thread
(func, *args, **kwargs)
conftest.py:115
Function
pytest_addoption
Add custom command line options.
conftest.py:129
Function
pytest_collection_modifyitems
Modify test collection to add markers automatically.
conftest.py:32
Function
pytest_configure
Configure pytest with custom settings.
conftest.py:14
Function
pytest_runtest_setup
Setup hook to skip tests based on markers and options.
conftest.py:144
Method
read
(self)
tests/test_helpers.py:39
Method
read
(self)
tests/test_tools_integration.py:67
Function
reset_msf_client
Automatically reset the global MSF client between tests.
conftest.py:154
Function
run_auxiliary_module
Run a Metasploit auxiliary module. Args: module_name: Name/path of the auxiliary module (e.g., 'scanner/ssh/ssh_login'). opt
MetasploitMCP.py:1137
Function
run_post_module
Run a Metasploit post-exploitation module against a session. Args: module_name: Name/path of the post module (e.g., 'windows/gather/
MetasploitMCP.py:1083
Method
slow_exploits
()
tests/test_tools_integration.py:176
Function
temp_payload_dir
Fixture providing a temporary directory for payload saves.
conftest.py:104
Method
test_boolean_conversion
Test boolean value conversion.
tests/test_options_parsing.py:83
Method
test_complex_values
Test parsing complex values like file paths and URLs.
tests/test_options_parsing.py:121
Method
test_dict_format_passthrough
Test that dictionary format is passed through unchanged.
tests/test_options_parsing.py:32
Method
test_edge_case_empty_value
Test handling of empty values.
tests/test_options_parsing.py:178
Method
test_empty_dict_returns_empty_dict
Test that empty dictionary returns empty dictionary.
tests/test_options_parsing.py:53
Method
test_empty_string_returns_empty_dict
Test that empty string returns empty dictionary.
tests/test_options_parsing.py:45
Method
test_equals_in_value
Test parsing when value contains equals sign.
tests/test_options_parsing.py:114
Method
test_error_empty_key
Test error handling for empty key.
tests/test_options_parsing.py:147
Method
test_error_invalid_type
Test error handling for invalid input types.
tests/test_options_parsing.py:155
Method
test_error_missing_equals
Test error handling for missing equals sign.
tests/test_options_parsing.py:139
Method
test_find_available_port_all_busy
Test when all ports in range are busy.
tests/test_helpers.py:317
Method
test_find_available_port_second_attempt
Test finding port on second attempt.
tests/test_helpers.py:328
Method
test_find_available_port_success
Test finding an available port.
tests/test_helpers.py:309
Method
test_generate_payload_dict_options
Test payload generation with dictionary options.
tests/test_tools_integration.py:254
Method
test_generate_payload_empty_options
Test payload generation with empty options.
tests/test_tools_integration.py:287
Method
test_generate_payload_invalid_string_options
Test payload generation with invalid string options.
tests/test_tools_integration.py:301
Method
test_generate_payload_string_options
Test payload generation with string options.
tests/test_tools_integration.py:270
Method
test_get_module_object_full_path
Test module object retrieval with full path.
tests/test_helpers.py:129
Method
test_get_module_object_msf_error
Test module object retrieval with MSF RPC error.
tests/test_helpers.py:149
Method
test_get_module_object_not_found
Test module object retrieval when module not found.
tests/test_helpers.py:141
Method
test_get_module_object_success
Test successful module object retrieval.
tests/test_helpers.py:118
Method
test_get_msf_client_initialized
Test get_msf_client when client is initialized.
tests/test_helpers.py:99
Method
test_get_msf_client_not_initialized
Test get_msf_client when client not initialized.
tests/test_helpers.py:93
Method
test_get_msf_console_cleanup_error
Test that cleanup errors don't propagate.
tests/test_helpers.py:247
Method
test_get_msf_console_creation_error
Test console creation error handling.
tests/test_helpers.py:238
Method
test_get_msf_console_success
Test successful console creation and cleanup.
tests/test_helpers.py:222
Method
test_initialize_msf_client_invalid_port
Test MSF client initialization with invalid port.
tests/test_helpers.py:87
Method
test_initialize_msf_client_success
Test successful MSF client initialization.
tests/test_helpers.py:68
Method
test_large_number_handling
Test handling of large numbers that might not fit in int.
tests/test_options_parsing.py:223
Method
test_list_active_sessions
Test listing active sessions.
tests/test_tools_integration.py:434
Method
test_list_exploits_error
Test listing exploits with MSF error.
tests/test_tools_integration.py:161
Method
test_list_exploits_no_filter
Test listing exploits without filter.
tests/test_tools_integration.py:131
next →
1–100 of 137, ranked by callers