From 7e98bc373a8034e318a2473f50d7eb4c5c307f64 Mon Sep 17 00:00:00 2001 From: speyrefitte Date: Mon, 17 Nov 2014 18:37:48 +0100 Subject: [PATCH] =?UTF-8?q?=C2=A0license=20automata=20update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rdpy/protocol/rdp/pdu/lic.py | 5 ++-- rdpy/protocol/rdp/sec.py | 52 ++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 rdpy/protocol/rdp/sec.py diff --git a/rdpy/protocol/rdp/pdu/lic.py b/rdpy/protocol/rdp/pdu/lic.py index adf6094..24bc4c3 100644 --- a/rdpy/protocol/rdp/pdu/lic.py +++ b/rdpy/protocol/rdp/pdu/lic.py @@ -226,6 +226,7 @@ def createNewLicenseRequest(serverLicenseRequest): Create new license request in response to server license request @see: http://msdn.microsoft.com/en-us/library/cc241989.aspx @see: http://msdn.microsoft.com/en-us/library/cc241918.aspx - @todo: need RDP license server """ - return LicPacket(message = ClientNewLicenseRequest()) \ No newline at end of file + message = ClientNewLicenseRequest() + + return LicPacket(message) \ No newline at end of file diff --git a/rdpy/protocol/rdp/sec.py b/rdpy/protocol/rdp/sec.py new file mode 100644 index 0000000..60e06c2 --- /dev/null +++ b/rdpy/protocol/rdp/sec.py @@ -0,0 +1,52 @@ +# +# Copyright (c) 2014 Sylvain Peyrefitte +# +# This file is part of rdpy. +# +# rdpy is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +""" +Some use full methods for security in RDP +""" + +import sha, md5 + +def saltedHash(inputData, salt, salt1, salt2): + """ + @summary: Generate particular signature from combination of sha1 and md5 + @see: http://msdn.microsoft.com/en-us/library/cc241992.aspx + @param inputData: strange input (see doc) + @param salt: salt for context call + @param salt1: another salt (ex : client random) + @param salt2: another another salt (ex: server random) + @return : MD5(Salt + SHA1(Input + Salt + Salt1 + Salt2)) + """ + sha1Digest = sha.new() + md5Digest = md5.new() + + sha1Digest.update(inputData) + sha1Digest.update(salt[:48]) + sha1Digest.update(salt1) + sha1Digest.update(salt2) + sha1Sig = sha1Digest.digest() + + md5Digest.update(salt[:48]) + md5Digest.update(sha1Sig) + + return md5Digest.digest() + +def masterSecret(preMasterSecret, clientRandom, serverRandom): + """ + """ \ No newline at end of file