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

Add support for ipconfig in php meterpreter #720

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jvoisin
Copy link
Contributor

@jvoisin jvoisin commented Oct 10, 2024

No description provided.

Copy link
Contributor

@smcintyre-r7 smcintyre-r7 left a comment

Choose a reason for hiding this comment

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

This isn't working for me. It seems to be complaining about net_get_interfaces.

Evaling stdapi
PHP Fatal error:  Uncaught Error: Undefined constant "net_get_interfaces" in /tmp/meterpreter.php(1) : eval()'d code(530) : eval()'d code:1272
Stack trace:
#0 /tmp/meterpreter.php(1) : eval()'d code(530): eval()
#1 /tmp/meterpreter.php(1) : eval()'d code(945): core_loadlib()
#2 /tmp/meterpreter.php(1) : eval()'d code(1525): create_response()
#3 /tmp/meterpreter.php(1): eval()
#4 {main}
  thrown in /tmp/meterpreter.php(1) : eval()'d code(530) : eval()'d code on line 1272

@jvoisin
Copy link
Contributor Author

jvoisin commented Oct 28, 2024

Oops, fixed in a7a10d6

Copy link
Contributor

@smcintyre-r7 smcintyre-r7 left a comment

Choose a reason for hiding this comment

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

This still isn't working for me. Can you please test it and post the output of a successful run? Even after making the change I suggested to rename the function, I'm getting a stack trace on the Metasploit side.

meterpreter > ipconfig
[-] Error while running command ipconfig: undefined method `each_byte' for nil:NilClass

Call stack:
/home/smcintyre/Repositories/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/net/interface.rb:46:in `pretty'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb:231:in `block in cmd_ipconfig'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb:230:in `each'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb:230:in `cmd_ipconfig'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:582:in `run_command'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/post/meterpreter/ui/console.rb:102:in `run_command'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:531:in `block in run_single'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:525:in `each'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:525:in `run_single'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/post/meterpreter/ui/console.rb:64:in `block in interact'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/ui/text/shell.rb:160:in `block in run'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/ui/text/shell.rb:309:in `block in with_history_manager_context'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/ui/text/shell/history_manager.rb:35:in `with_context'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/ui/text/shell.rb:306:in `with_history_manager_context'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/ui/text/shell.rb:133:in `run'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/post/meterpreter/ui/console.rb:62:in `interact'
/home/smcintyre/Repositories/metasploit-framework/lib/msf/base/sessions/meterpreter.rb:582:in `_interact'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/ui/interactive.rb:53:in `interact'
/home/smcintyre/Repositories/metasploit-framework/lib/msf/ui/console/command_dispatcher/core.rb:1749:in `cmd_sessions'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:582:in `run_command'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:531:in `block in run_single'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:525:in `each'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:525:in `run_single'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/ui/text/shell.rb:165:in `block in run'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/ui/text/shell.rb:309:in `block in with_history_manager_context'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/ui/text/shell/history_manager.rb:35:in `with_context'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/ui/text/shell.rb:306:in `with_history_manager_context'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/ui/text/shell.rb:133:in `run'
/home/smcintyre/Repositories/metasploit-framework/lib/metasploit/framework/command/console.rb:54:in `start'
/home/smcintyre/Repositories/metasploit-framework/lib/metasploit/framework/command/base.rb:82:in `start'
./msfconsole:23:in `<main>'
meterpreter > 

if (is_callable('net_get_interfaces')) {
register_command('stdapi_net_config_get_interfaces', COMMAND_ID_STDAPI_NET_CONFIG_GET_INTERFACES);
}
function stdapi_net_config_get_arp_interfaces($req, &$pkt) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this needs to be: stdapi_net_config_get_interfaces

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants