Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix SSH subcommand
  • Loading branch information
andreashappe committed Aug 29, 2023
commit 76503b583105a84d25fff3b3d8e601d05451e116
2 changes: 0 additions & 2 deletions targets/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ def connect(self):
connect_kwargs={"password": self.password},
)
self.conn=conn

def test(self):
self.conn.open()

def run(self, cmd):
Expand Down
21 changes: 16 additions & 5 deletions wintermute.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import os
import time
import paramiko

from dotenv import load_dotenv

Expand Down Expand Up @@ -75,13 +76,23 @@
user = next_cmd["username"]
password = next_cmd["password"]

# TODO: this is currently highly broken
test = SSHHostConn(ip, user, password)
print(str(test.test()))
if result == "root":
cmd_history.append(diff, "ssh", "tried ssh with username " + next_cmd["username"] + " and password " + next_cmd["password"], True, "Login was successful")
authenticated = False
try:
test.connect()
authenticated = True
except paramiko.ssh_exception.AuthenticationException:
print("seems like SSH authentication failed..")

if not authenticated:
cmd_history.append(diff, "ssh", "tried ssh with username " + next_cmd["username"] + " and password " + next_cmd["password"], "Authentication error", "False", "Login was not successful")
else:
cmd_history.append(diff, "ssh", "tried ssh with username " + next_cmd["username"] + " and password " + next_cmd["password"], False, "Login was not successful")
user = conn.run("whoami")

if user == "root":
cmd_history.append(diff, "ssh", "tried ssh with username " + next_cmd["username"] + " and password " + next_cmd["password"], "Authentication successful", "True", "Login was successful")
else:
cmd_history.append(diff, "ssh", "tried ssh with username " + next_cmd["username"] + " and password " + next_cmd["password"], "Authentication successful but not root", "False", "Login was successful but not root")

# aks chatgpt to explain what it expects about the tested
# system. Understanding this might help human learning
Expand Down