krzychu12350 / phpmetasploit
This plugin allows to interact with Metasploit framework either through msfrpcd deamon or the msgrpc plugin running in msfconsole.
Installs: 129
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:composer-plugin
Requires
- php: >=8.1.2
- composer-plugin-api: ^2.3
- ext-curl: *
- lib-curl-zlib: ^1.2
- curl/curl: ^2.3
- fabpot/goutte: v4.0.2
- nette/php-generator: ^4.0
- rybakit/msgpack: ^0.9.1
Requires (Dev)
- composer/composer: ^2.0
- phpunit/phpunit: ^10.0.16
This package is auto-updated.
Last update: 2025-03-08 04:10:46 UTC
README
The PHP library whose code is automatically generated based on the Metasploit framework documentation.
Table of Contents
- Documentation of standard methods
- Class diagram
- Prerequisites
- Installing and running the library
- Run unit tests
- License
Documentation of standard methods
Class diagram
Library class structure
Prerequisites
- PHP 8.1.2 minimum
- Composer 2.5.5 minimum
Installing and running the library
1. Metasploit RPC server initialization
- via msgrpc plugin
To start the server through the msgrpc plugin, execute the following command in the Metasploit framework default console:
load msgrpc
The command has the following parameters:
- ServerHost - hostname on which the server is listening,
- ServerPort - port number on which the server is listening,
- User - user name that allows access to the server,
- Pass – server access password. It is required that the password is enclosed in quotation marks,
- SSL – enable or place SSL on the RPC socket. Select true enable SSL and false disable SSL.
An example command might be as follows:
load msgrpc ServerHost=192.168.1.0 ServerPort=55553 User=user Pass='pass123'
- via msfrpcd demon
To start the RPC server through the msfrpcd daemon, launch the system terminal and then execute the following command:
msfrpcd -P <password>
where is the defined password for access to the server, this parameter is required
The above command has the following parameters:
- -a – name of the host on which the server is listening,
- -p – port number on which the server is listening,
- -U – username that allows access to the server,
- -P – access password to the server. The password must be enclosed in single quotes,
- -S – enable or disable SSL on the RPC socket. True enables SSL and false disables SSL,
- -f – adding this parameter starts the msfrpcd daemon in the background.
In each of the parameters, means that the value of the parameter must be provided.
An example command might be as follows:
./msfrpcd -U user -P pass123 -a 127.0.0.1 -u /api/1.0 -p 55553 -f
2. Library installation
Before installation, make sure that the Composer package manager is installed in the operating system.
Then run the following command to install the library:
composer require krzychu12350/phpmetasploit
During the library installation process, allow the library to dynamically generate the code by pressing the y key and then the key confirming the selection of this option.
3. Launching the library
To start using the library, initialize the MsfRpcClient class object, and then call the msfAuth method to obtain the authentication token. As a result, you get a token that allow you to execute all functions available in the library.
Run unit tests
To run unit tests launch the system terminal and go to root directory of the library and type in following command:
composer tests
License
All Rights Reserved
Copyright (c) 2022 Krzysztof Karaś
Created by Krzysztof Karaś