Skip to content

Commit 8db769e

Browse files
committed
Fix tests and remove unnecessary abspath
1 parent 9d70105 commit 8db769e

3 files changed

Lines changed: 10 additions & 11 deletions

File tree

nxc/protocols/smb.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import ntpath
22
import binascii
33
import os
4-
from os.path import abspath
54
import re
65
from io import StringIO
76
from Cryptodome.Hash import MD4
@@ -1281,7 +1280,7 @@ def put_file_single(self, src, dst):
12811280

12821281
def put_file(self):
12831282
for src, dest in self.args.put_file:
1284-
self.put_file_single(abspath(src), dest)
1283+
self.put_file_single(src, dest)
12851284

12861285
def get_file_single(self, remote_path, download_path):
12871286
share_name = self.args.share
@@ -1299,7 +1298,7 @@ def get_file_single(self, remote_path, download_path):
12991298

13001299
def get_file(self):
13011300
for src, dest in self.args.get_file:
1302-
self.get_file_single(src, abspath(dest))
1301+
self.get_file_single(src, dest)
13031302

13041303

13051304
def enable_remoteops(self):

tests/e2e_commands.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ netexec smb TARGET_HOST -u LOGIN_USERNAME -p LOGIN_PASSWORD KERBEROS -x ipconfig
2828
netexec smb TARGET_HOST -u LOGIN_USERNAME -p LOGIN_PASSWORD KERBEROS -x ipconfig --exec-method atexec
2929
netexec smb TARGET_HOST -u LOGIN_USERNAME -p LOGIN_PASSWORD KERBEROS -x ipconfig --exec-method smbexec
3030
netexec smb TARGET_HOST -u LOGIN_USERNAME -p LOGIN_PASSWORD KERBEROS -x ipconfig --exec-method mmcexec
31-
netexec smb TARGET_HOST -u LOGIN_USERNAME -p LOGIN_PASSWORD KERBEROS --put-file TEST_NORMAL_FILE C:\Windows\Temp\test_file.txt
32-
netexec smb TARGET_HOST -u LOGIN_USERNAME -p LOGIN_PASSWORD KERBEROS --put-file TEST_NORMAL_FILE C:\Windows\Temp\test_file.txt --put-file TEST_NORMAL_FILE C:\Windows\Temp\test_file2.txt
33-
netexec smb TARGET_HOST -u LOGIN_USERNAME -p LOGIN_PASSWORD KERBEROS --get-file C:\Windows\Temp\test_file.txt /tmp/test_file.txt
31+
netexec smb TARGET_HOST -u LOGIN_USERNAME -p LOGIN_PASSWORD KERBEROS --put-file TEST_NORMAL_FILE \\Windows\\Temp\\test_file.txt
32+
netexec smb TARGET_HOST -u LOGIN_USERNAME -p LOGIN_PASSWORD KERBEROS --put-file TEST_NORMAL_FILE \\Windows\\Temp\\test_file.txt --put-file TEST_NORMAL_FILE \\Windows\\Temp\\test_file2.txt
33+
netexec smb TARGET_HOST -u LOGIN_USERNAME -p LOGIN_PASSWORD KERBEROS --get-file \\Windows\\Temp\\test_file.txt /tmp/test_file.txt
3434
##### SMB PowerShell
3535
netexec smb TARGET_HOST -u LOGIN_USERNAME -p LOGIN_PASSWORD KERBEROS -X ipconfig
3636
netexec smb TARGET_HOST -u LOGIN_USERNAME -p LOGIN_PASSWORD KERBEROS -X ipconfig --exec-method atexec

tests/e2e_tests.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import argparse
22
from os import getcwd
3-
from os.path import dirname, abspath, join, realpath, isfile
3+
from os.path import dirname, abspath, join, realpath, isfile, normpath
44
import subprocess
55
from time import time
66
from rich.console import Console
@@ -84,25 +84,25 @@ def get_cli_args():
8484
parser.add_argument(
8585
"--test-user-file",
8686
required=False,
87-
default=abspath(join(script_dir, "data", "test_users.txt")),
87+
default=normpath(join(script_dir, "data", "test_users.txt")),
8888
help="Path to the file containing test usernames",
8989
)
9090
parser.add_argument(
9191
"--test-password-file",
9292
required=False,
93-
default=abspath(join(script_dir, "data", "test_passwords.txt")),
93+
default=normpath(join(script_dir, "data", "test_passwords.txt")),
9494
help="Path to the file containing test passwords",
9595
)
9696
parser.add_argument(
9797
"--amsi-bypass-file",
9898
required=False,
99-
default=abspath(join(script_dir, "data", "test_amsi_bypass.txt")),
99+
default=normpath(join(script_dir, "data", "test_amsi_bypass.txt")),
100100
help="Path to the file containing AMSI bypasses",
101101
)
102102
parser.add_argument(
103103
"--test-normal-file",
104104
required=False,
105-
default=abspath(join(script_dir, "data", "test_file.txt")),
105+
default=normpath(join(script_dir, "data", "test_file.txt")),
106106
help="Path to file to upload/download"
107107
)
108108
parser.add_argument(

0 commit comments

Comments
 (0)