-
Notifications
You must be signed in to change notification settings - Fork 13.8k
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
Update msfvenom format CLI parameter to be case insensitive #10802
Update msfvenom format CLI parameter to be case insensitive #10802
Conversation
Just to be pedantic - this seems like a slippery slope and counter to the spirit of unix being case sensitive. |
I can understand your point, though I disagree in this case. Many options that msfvenom and msfconsole provide should be case sensitive, though in this case I don't see the rational for it. Unlike parameter names which benefit from, as using -C and -c can be valuable, parameters such as -o which are going to decide output filenames, and should match the OS's decisions, is there an example where the case of the format string, used internal to the tool for deciding output structure, matters? |
I guess it's also a question of uniformity. If |
From my perspective it comes down to tool intelligence. Tools should have intelligent understanding of their options and adjust user input accordingly either automatically via forced downcasing or via suggestions, "did you mean c"? It's frustrating that the tool can't make basic adjustments to user arguments that, in all ways except case, match a known option. Honestly, I think all options should have this intelligence if it's applicable to the type of values the option takes. With that said, this is the one that most commonly bites me and that I see bite other people, as MSF doesn't follow the naming conventions of the language naming styles (which commonly leverage case). For this reason, I often see developers using "proper" naming (C, Python, etc.) instead of the lowercase naming used within the tool. |
I like this as a user-interface thing, but scattering all these |
Sorry for the delay in getting back on this. OSCE exam prep and exam took over my time. I don't mind making that change (to use the single f.downcase) if that's the preferred path. Is that the only change that should be made? |
No worries @kkirsche, life gets busy! I think that's only change needed to get the PR merged, if we decide we want to make this a deeper property of the code we can always propagate it down. A related change you could add to this PR or do separately if you wanted would be to print the formats when an invalid one has been chosen. You could do this by changing the exception raised in https://github.com/rapid7/metasploit-framework/blob/master/lib/msf/base/simple/buffer.rb (lines 61 and 91 at time of writing) from |
Pushed that update with the dump_formats change and the change to where format downcasing occurs |
Following up on this, is there any additional information that you need from me to be able to review and process this? |
Sorry for the delay @kkirsche looks good! |
Release NotesThe format |
No worries, life happens, especially around the holidays. Thanks for the review and feedback — always happy to contribute |
Taking after:
https://github.com/rapid7/metasploit-framework/blob/master/lib/msf/core/payload_generator.rb#L296
This pull request makes minor adjustments to conditional statements related to the format parameter allowing the condition to act in a case insensitive manner rather than requiring lowercase options.
Verification
With the changes installed, use the following command:
Before the change:
After the change: