From fa25a403b9289969e79513a0dcfa97ad4c9dc2ea Mon Sep 17 00:00:00 2001 From: "emrah.ozel@icloud.com" Date: Mon, 19 Feb 2024 00:33:45 +0300 Subject: [PATCH] Added SamrUnicodeChangePasswordUser2 request and response classes for Samr --- ...SamrUnicodeChangePasswordUser2Request.java | 66 +++++++++++++++++++ ...amrUnicodeChangePasswordUser2Response.java | 16 +++++ 2 files changed, 82 insertions(+) create mode 100644 src/main/java/com/rapid7/client/dcerpc/mssamr/messages/SamrUnicodeChangePasswordUser2Request.java create mode 100644 src/main/java/com/rapid7/client/dcerpc/mssamr/messages/SamrUnicodeChangePasswordUser2Response.java diff --git a/src/main/java/com/rapid7/client/dcerpc/mssamr/messages/SamrUnicodeChangePasswordUser2Request.java b/src/main/java/com/rapid7/client/dcerpc/mssamr/messages/SamrUnicodeChangePasswordUser2Request.java new file mode 100644 index 00000000..8b76c0b4 --- /dev/null +++ b/src/main/java/com/rapid7/client/dcerpc/mssamr/messages/SamrUnicodeChangePasswordUser2Request.java @@ -0,0 +1,66 @@ +package com.rapid7.client.dcerpc.mssamr.messages; + +import com.rapid7.client.dcerpc.io.PacketOutput; +import com.rapid7.client.dcerpc.messages.RequestCall; +import com.rapid7.client.dcerpc.objects.RPCUnicodeString; + +import java.io.IOException; + +/** + * SamrUnicodeChangePasswordUser2 + *
+ * The SamrUnicodeChangePasswordUser2 method changes a user's password.
+ *
+ * long SamrUnicodeChangePasswordUser2(
+ *  [in] handle_t BindingHandle,
+ *  [in, unique] PRPC_UNICODE_STRING ServerName,
+ *  [in] PRPC_UNICODE_STRING UserName,
+ *  [in, unique] PSAMPR_ENCRYPTED_USER_PASSWORD NewPasswordEncryptedWithOldNt,
+ *  [in, unique] PENCRYPTED_NT_OWF_PASSWORD OldNtOwfPasswordEncryptedWithNewNt,
+ *  [in] unsigned char LmPresent,
+ *  [in, unique] PSAMPR_ENCRYPTED_USER_PASSWORD NewPasswordEncryptedWithOldLm,
+ *  [in, unique] PENCRYPTED_LM_OWF_PASSWORD OldLmOwfPasswordEncryptedWithNewNt
+ );
+ * 
+ */ +public class SamrUnicodeChangePasswordUser2Request extends RequestCall { + + public static final short OP_NUM = 55; + private final byte[] domainHandle; + private RPCUnicodeString.NonNullTerminated serverName; + private RPCUnicodeString.NonNullTerminated userName; + private byte[] newPasswordEncryptedWithOldNt; + private byte[] oldNtOwfPasswordEncryptedWithNewNt; + private int lmPresent; + private byte[] newPasswordEncryptedWithOldLm; + private byte[] oldLmOwfPasswordEncryptedWithNewNt; + + public SamrUnicodeChangePasswordUser2Request(byte[] domainHandle, RPCUnicodeString.NonNullTerminated serverName, RPCUnicodeString.NonNullTerminated userName, byte[] newPasswordEncryptedWithOldNt, byte[] oldNtOwfPasswordEncryptedWithNewNt, byte[] newPasswordEncryptedWithOldLm, byte[] oldLmOwfPasswordEncryptedWithNewNt) { + super(OP_NUM); + this.domainHandle = domainHandle; + this.serverName = serverName; + this.userName = userName; + this.newPasswordEncryptedWithOldNt = newPasswordEncryptedWithOldNt; + this.oldNtOwfPasswordEncryptedWithNewNt = oldNtOwfPasswordEncryptedWithNewNt; + this.newPasswordEncryptedWithOldLm = newPasswordEncryptedWithOldLm; + this.oldLmOwfPasswordEncryptedWithNewNt = oldLmOwfPasswordEncryptedWithNewNt; + } + + @Override + public void marshal(PacketOutput packetOut) throws IOException { + lmPresent = 0; + packetOut.write(this.domainHandle); + packetOut.writeMarshallable(this.serverName); + packetOut.writeMarshallable(this.userName); + packetOut.write(this.newPasswordEncryptedWithOldNt); + packetOut.write(this.oldNtOwfPasswordEncryptedWithNewNt); + packetOut.writeInt(this.lmPresent); + packetOut.write(this.newPasswordEncryptedWithOldLm); + packetOut.write(this.oldLmOwfPasswordEncryptedWithNewNt); + } + + @Override + public SamrUnicodeChangePasswordUser2Response getResponseObject() { + return new SamrUnicodeChangePasswordUser2Response(); + } +} diff --git a/src/main/java/com/rapid7/client/dcerpc/mssamr/messages/SamrUnicodeChangePasswordUser2Response.java b/src/main/java/com/rapid7/client/dcerpc/mssamr/messages/SamrUnicodeChangePasswordUser2Response.java new file mode 100644 index 00000000..1808bccb --- /dev/null +++ b/src/main/java/com/rapid7/client/dcerpc/mssamr/messages/SamrUnicodeChangePasswordUser2Response.java @@ -0,0 +1,16 @@ +package com.rapid7.client.dcerpc.mssamr.messages; + + +import com.rapid7.client.dcerpc.io.PacketInput; +import com.rapid7.client.dcerpc.messages.RequestResponse; + +import java.io.IOException; + + +public class SamrUnicodeChangePasswordUser2Response extends RequestResponse { + + @Override + public void unmarshalResponse(PacketInput packetIn) throws IOException { + + } +}