[winrm] ruff

Signed-off-by: XiaoliChan <2209553467@qq.com>
main
XiaoliChan 2023-10-31 16:25:21 +08:00
parent 9c5f7d6488
commit 9fbe8d5bec
2 changed files with 9 additions and 7 deletions

View File

@ -23,7 +23,7 @@ jobs:
cache-dependency-path: poetry.lock cache-dependency-path: poetry.lock
- name: Install dependencies with dev group - name: Install dependencies with dev group
run: | run: |
sudo apt-get install gcc python3-dev libkrb5-dev gss-ntlmssp sudo apt-get install gcc python3-dev libkrb5-dev gss-ntlmssp -y
poetry install --with dev poetry install --with dev
- name: Run ruff - name: Run ruff
run: | run: |

View File

@ -259,12 +259,14 @@ class winrm(connection):
# So, we can get a TGT when doing nthash with kerberos auth # So, we can get a TGT when doing nthash with kerberos auth
def getTGT(self): def getTGT(self):
userName = Principal(self.username, type=constants.PrincipalNameType.NT_PRINCIPAL.value) userName = Principal(self.username, type=constants.PrincipalNameType.NT_PRINCIPAL.value)
tgt, cipher, oldSessionKey, sessionKey = getKerberosTGT(clientName = userName, tgt, cipher, oldSessionKey, sessionKey = getKerberosTGT(
password = self.password, clientName=userName,
domain = self.domain, password=self.password,
lmhash = unhexlify(self.lmhash), domain=self.domain,
nthash = unhexlify(self.nthash), lmhash=unhexlify(self.lmhash),
kdcHost = self.kdcHost) nthash=unhexlify(self.nthash),
kdcHost=self.kdcHost
)
ccache = CCache() ccache = CCache()
ccache.fromTGT(tgt, oldSessionKey, sessionKey) ccache.fromTGT(tgt, oldSessionKey, sessionKey)
tgt_file = os.path.join(tempfile.gettempdir(), f"{self.username}@{self.domain}.ccache") tgt_file = os.path.join(tempfile.gettempdir(), f"{self.username}@{self.domain}.ccache")