mirror of
https://github.com/rapid7/metasploit-payloads
synced 2025-03-24 18:16:24 +01:00
pedantic fixes
This commit is contained in:
parent
92e4be2ded
commit
86c02d4b28
java/meterpreter/meterpreter/src/main/java/com/metasploit/meterpreter
@ -162,7 +162,7 @@ public abstract class Transport {
|
||||
if (this.aesKey != null) {
|
||||
try
|
||||
{
|
||||
if (this.aesEnabled && this.aesKey != null) {
|
||||
if (this.aesEnabled) {
|
||||
encType = (this.aesKey.length == 32 ? ENC_AES256 : ENC_AES128);
|
||||
data = aesEncrypt(data);
|
||||
}
|
||||
|
@ -1,18 +1,15 @@
|
||||
package com.metasploit.meterpreter.core;
|
||||
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
import java.security.KeyFactory;
|
||||
import java.security.PublicKey;
|
||||
import java.security.SecureRandom;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
import java.lang.String;
|
||||
import javax.crypto.Cipher;
|
||||
|
||||
import com.metasploit.meterpreter.Transport;
|
||||
import com.metasploit.meterpreter.Meterpreter;
|
||||
import com.metasploit.meterpreter.TLVPacket;
|
||||
import com.metasploit.meterpreter.TLVType;
|
||||
import com.metasploit.meterpreter.Utils;
|
||||
import com.metasploit.meterpreter.command.Command;
|
||||
|
||||
public class core_negotiate_tlv_encryption implements Command {
|
||||
@ -21,10 +18,16 @@ public class core_negotiate_tlv_encryption implements Command {
|
||||
|
||||
public int execute(Meterpreter meterpreter, TLVPacket request, TLVPacket response) throws Exception {
|
||||
byte[] der = request.getRawValue(TLVType.TLV_TYPE_RSA_PUB_KEY);
|
||||
int encType = (Cipher.getMaxAllowedKeyLength("AES") >= 256 ? Transport.ENC_AES256 : Transport.ENC_AES128);
|
||||
byte[] aesKey = new byte[encType == Transport.ENC_AES256 ? 32 : 16];
|
||||
int encType;
|
||||
byte[] aesKey;
|
||||
if (Cipher.getMaxAllowedKeyLength("AES") < 256) {
|
||||
encType = Transport.ENC_AES128;
|
||||
aesKey = new byte[16];
|
||||
} else {
|
||||
encType = Transport.ENC_AES256;
|
||||
aesKey = new byte[32];
|
||||
}
|
||||
sr.nextBytes(aesKey);
|
||||
|
||||
try
|
||||
{
|
||||
PublicKey pubKey = getPublicKey(der);
|
||||
|
Loading…
x
Reference in New Issue
Block a user