byt3bl33d3r / CrackMapExec

A swiss army knife for pentesting networks
BSD 2-Clause "Simplified" License
8.46k stars 1.64k forks source link

Add error handling when using incorrect module options #152

Closed c0d3xpl0it closed 7 years ago

c0d3xpl0it commented 7 years ago

Steps to reproduce

Hello, We encountered below error while running Powerview sub module.

root@kali:~# cme 10.0.1.6 -u ITService -p abcd@12345 -M powerview -o Get-ComputerDetails Traceback (most recent call last): File "/usr/local/bin/cme", line 11, in load_entry_point('crackmapexec==3.1.5.dev0', 'console_scripts', 'cme')() File "/usr/local/lib/python2.7/dist-packages/crackmapexec-3.1.5.dev0-py2.7.egg/cme/crackmapexec.py", line 219, in main module, context, server = loader.init_module(modules[m]['path']) File "/usr/local/lib/python2.7/dist-packages/crackmapexec-3.1.5.dev0-py2.7.egg/cme/moduleloader.py", line 79, in init_module key, value = option.split('=', 1) ValueError: need more than 1 value to unpack

OS

Kali 2016

Target OS

Windows 2008 R2

Please guide, if I am missing on something.

byt3bl33d3r commented 7 years ago

The command should be : cme 10.0.1.6 -u ITService -p abcd@12345 -M powerview -o COMMAND=Get-ComputerDetails

You can view a modules options by running: cme -M powerview --show-options

However, this brought to light some error handling issues. Will keep this open as a reminder.

byt3bl33d3r commented 7 years ago

An error message should now appear when invalid options are specified. Thanks!