Skip to content

Commit

Permalink
added todo task, fixed setup, minor message fixes, minor func fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ghost-ng committed Jan 4, 2024
1 parent 51fbc5e commit ed0b5f4
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 19 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,18 @@ pip install slinger-_._._.tar.gz
### Task Scheduler
- all in one (create, execute, delete)
- add task run modifiers (run every X min/hour)
### Registry
- uptime
- process enumeration (inspired by nmap ns script)
### Service Control
- sc modify
### Test
- test on a domain
## Contributing
### Creating Your Own Plugin for Slinger
Expand Down
5 changes: 0 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,5 @@ def parse_requirements(filename):
url="https://github.com/ghost-ng/slinger",
python_requires='>=3.10',
scripts=['src/slinger.py'],
entry_points={
'console_scripts': [
'slinger=slinger.slinger:main',
],
},
data_files=[('src/slingerpkg/plugins', ['src/slingerpkg/plugins/my_plugin.py'])],
)
18 changes: 9 additions & 9 deletions src/slinger.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ def main():
original_settings = termios.tcgetattr(0)

parser = argparse.ArgumentParser(description='impacket swiss army knife (sort of)')
parser.add_argument('--host', required=True, help='Host to connect to')
parser.add_argument('-u', '--username', required=True, help='Username for authentication')
parser.add_argument('-d', '--domain', default='', help='Domain for authentication')
parser.add_argument('-p', '--port', type=int, default=445, help='Port to connect to')
parser.add_argument('--nojoy', action='store_true', help='Turn off emojis')
parser.add_argument('-host', required=True, help='Host to connect to')
parser.add_argument('-user', '--username', required=True, help='Username for authentication')
parser.add_argument('-domain', '--domain', default='', help='Domain for authentication')
parser.add_argument('-port', type=int, default=445, help='Port to connect to')
parser.add_argument('-nojoy', action='store_true', help='Turn off emojis')
# authentication mutually exclusive group
auth_group = parser.add_mutually_exclusive_group(required=True)
auth_group.add_argument('-pass', '--password', help='Password for authentication')
auth_group.add_argument('--ntlm', help='NTLM hash for authentication')
auth_group.add_argument('--kerberos', action='store_true', help='Use Kerberos for authentication')
parser.add_argument('--debug', action='store_true', help='Turn on debug output')
auth_group.add_argument('-ntlm', help='NTLM hash for authentication')
auth_group.add_argument('-kerberos', action='store_true', help='Use Kerberos for authentication')
parser.add_argument('-debug', action='store_true', help='Turn on debug output')

if len(sys.argv) == 1:
parser.print_help()
Expand Down Expand Up @@ -142,7 +142,7 @@ def main():
continue
except Exception as e:
print_debug(str(e), sys.exc_info())
print_bad(f"Error: {e}: {sys.exc_info()}")

continue
except argparse.ArgumentError as e:
#print("Unknown command")
Expand Down
2 changes: 1 addition & 1 deletion src/slingerpkg/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = '0.2.0'
__version__ = '0.3.0'
__package__ = 'slinger'
2 changes: 1 addition & 1 deletion src/slingerpkg/lib/dcetransport.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def _checkServiceStatus(self, serviceName):
# Let's check its status
ans = scmr.hRQueryServiceStatus(self.dce, svcHandle)
if ans['lpServiceStatus']['dwCurrentState'] == scmr.SERVICE_STOPPED:
print_info('Service %s is in stopped state' % serviceName)
print_info('Service %s is in a stopped state' % serviceName)
return False
elif ans['lpServiceStatus']['dwCurrentState'] == scmr.SERVICE_RUNNING:
print_info('Service %s is already running' % serviceName)
Expand Down
1 change: 1 addition & 0 deletions src/slingerpkg/lib/schtasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def enum_task_folders_recursive(self, args):
folder (str): The folder to start the enumeration from. Defaults to "\\".
start_index (int): The starting index for the enumeration. Defaults to 0.
"""
print_info("Getting all tasks, this might take a while...")
folder="\\"
start_index=0
print_info("Enumerating Task Scheduler...")
Expand Down
37 changes: 35 additions & 2 deletions src/slingerpkg/lib/smblib.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def connect_share(self, args):
self.share = share
print_good(f"Connected to share {share}")
self.is_connected_to_share = True
self.relative_path = ""
self.update_current_path()
except Exception as e:
print_debug(str(e), sys.exc_info())
Expand Down Expand Up @@ -348,13 +349,45 @@ def dir_list(self, args=None):
if f.is_system(): attributes += 'S'
if f.is_archive(): attributes += 'A'
long_name = f.get_longname()
dirList.append([file_type, creation_time, last_access_time, last_write_time, filesize, attributes, long_name])
# attributes is file type - attributes (if not empty)
attribs = file_type if attributes == '' else file_type + "," + attributes
dirList.append([attribs, creation_time, last_access_time, last_write_time, filesize, long_name])
if path == "\\":
suffix = ""
else:
suffix = path + "\\"
print_info("Showing directory listing for: " + os.path.normpath(self.share + "\\" + suffix))
print_log(tabulate(dirList, headers=['Type', 'Created', 'Last Access', 'Last Write', 'Size', 'Attribs', 'Name'], tablefmt='psql'))

# get sort option from arg.sort
sort_option = args.sort
reverse_sort_option = args.sort_reverse
if sort_option == "name":
if reverse_sort_option:
dirList.sort(key=lambda x: x[5], reverse=True)
else:
dirList.sort(key=lambda x: x[5])
elif sort_option == "created":
if reverse_sort_option:
dirList.sort(key=lambda x: x[1], reverse=True)
else:
dirList.sort(key=lambda x: x[1])
elif sort_option == "lastaccess":
if reverse_sort_option:
dirList.sort(key=lambda x: x[2], reverse=True)
else:
dirList.sort(key=lambda x: x[2])
elif sort_option == "lastwrite":
if reverse_sort_option:
dirList.sort(key=lambda x: x[3], reverse=True)
else:
dirList.sort(key=lambda x: x[3])
elif sort_option == "size":
if reverse_sort_option:
dirList.sort(key=lambda x: x[4], reverse=True)
else:
dirList.sort(key=lambda x: x[4])

print_log(tabulate(dirList, headers=['Attribs', 'Created', 'LastAccess', 'LastWrite', 'Size', 'Name'], tablefmt='psql'))
except Exception as e:
print_debug(f"Failed to list directory {path} on share {self.share}: {e}", sys.exc_info())
print_bad(f"Failed to list directory {path} on share {self.share}: {e}")
4 changes: 3 additions & 1 deletion src/slingerpkg/utils/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ def setup_cli_parser(slingerClient):
# Subparser for 'ls' command
parser_dir = subparsers.add_parser('ls', help='List directory contents', description='List contents of a directory at a specified path', epilog='Example Usage: ls /path/to/directory')
parser_dir.add_argument('path', nargs='?', default=".", help='Path to list contents, defaults to current path')
parser_dir.add_argument('-s', '--sort', choices=['name','size','created','lastaccess','lastwrite'], default="date", help='Sort the directory contents by name, size, or date')
parser_dir.add_argument('-sr', '--sort-reverse', action='store_true', help='Reverse the sort order', default=False)
parser_dir.set_defaults(func=slingerClient.dir_list)

# Subparser for 'shares' command
Expand Down Expand Up @@ -425,7 +427,7 @@ def get_prompt(client, nojoy):
preamble = slinger_emoji + " "
emoji = preamble if not nojoy else ""

prompt = f"{emoji}{colors.OKGREEN}({client.host}):{client.current_path}>{colors.ENDC} "
prompt = f"{emoji}{colors.OKGREEN}({client.host}):\\\\{client.current_path}>{colors.ENDC} "
return prompt


Expand Down

0 comments on commit ed0b5f4

Please sign in to comment.