Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

Commit

Permalink
Merge pull request #395 from byt3bl33d3r/v5-dev
Browse files Browse the repository at this point in the history
CrackMapExec v5.1.0dev - 3TH@n
  • Loading branch information
mpgn committed Jun 25, 2020
2 parents 0a49f75 + 7323502 commit 895f16c
Show file tree
Hide file tree
Showing 20 changed files with 1,037 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/crackmapexec.yml
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: CrackMapExec tests on ${{ matrix.os }}
uses: actions/setup-python@v1
with:
python-version: 3.8
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -6,6 +6,7 @@ data/cme.db
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
bin/

# C extensions
*.so
Expand Down Expand Up @@ -33,6 +34,7 @@ var/
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
!crackmapexec.spec

# Installer logs
pip-log.txt
Expand Down
2 changes: 1 addition & 1 deletion README.md
@@ -1,4 +1,4 @@
![Supported Python versions](https://img.shields.io/badge/python-3.8+-blue.svg)
![Supported Python versions](https://img.shields.io/badge/python-3.7+-blue.svg)

# CrackMapExec

Expand Down
8 changes: 4 additions & 4 deletions cme/cli.py
Expand Up @@ -6,8 +6,8 @@

def gen_cli_args():

VERSION = '5.0.2dev'
CODENAME = 'P3l1as'
VERSION = '5.1.0dev'
CODENAME = '3TH@n'

p_loader = protocol_loader()
protocols = p_loader.get_protocols()
Expand Down Expand Up @@ -48,8 +48,8 @@ def gen_cli_args():
std_parser.add_argument("-u", metavar="USERNAME", dest='username', nargs='+', default=[], help="username(s) or file(s) containing usernames")
std_parser.add_argument("-p", metavar="PASSWORD", dest='password', nargs='+', default=[], help="password(s) or file(s) containing passwords")
std_parser.add_argument("-k", "--kerberos", action='store_true', help="Use Kerberos authentication from ccache file (KRB5CCNAME)")
std_parser.add_argument("--aesKey", action='store_true', help="AES key to use for Kerberos Authentication (128 or 256 bits)")
std_parser.add_argument("--kdcHost", action='store_true', help="IP Address of the domain controller. If omitted it will use the domain part (FQDN) specified in the target parameter")
std_parser.add_argument("--aesKey", metavar="AESKEY", nargs='+', help="AES key to use for Kerberos Authentication (128 or 256 bits)")
std_parser.add_argument("--kdcHost", metavar="KDCHOST", help="IP Address of the domain controller. If omitted it will use the domain part (FQDN) specified in the target parameter")

fail_group = std_parser.add_mutually_exclusive_group()
fail_group.add_argument("--gfail-limit", metavar='LIMIT', type=int, help='max number of global failed login attempts')
Expand Down
12 changes: 6 additions & 6 deletions cme/connection.py
Expand Up @@ -79,11 +79,11 @@ def proto_flow(self):
self.enum_host_info()
self.proto_logger()
self.print_host_info()
self.login()
if hasattr(self.args, 'module') and self.args.module:
self.call_modules()
else:
self.call_cmd_args()
if self.login():
if hasattr(self.args, 'module') and self.args.module:
self.call_modules()
else:
self.call_cmd_args()

def call_cmd_args(self):
for k, v in vars(self.args).items():
Expand Down Expand Up @@ -227,7 +227,7 @@ def login(self):
if self.plaintext_login(self.domain, usr.strip(), f_pass.strip()): return True
else:
if self.plaintext_login(usr.strip(), f_pass.strip()): return True

user.seek(0) # added june 2020, may break everything but solve this issue cme smb file -u file -p file
elif isinstance(user, str):
if hasattr(self.args, 'hash') and self.args.hash:
with sem:
Expand Down
3 changes: 3 additions & 0 deletions cme/crackmapexec.py
Expand Up @@ -212,3 +212,6 @@ def main():

if module_server:
module_server.shutdown()

if __name__ == '__main__':
main()
2 changes: 2 additions & 0 deletions cme/first_run.py
Expand Up @@ -10,6 +10,8 @@

CME_PATH = os.path.expanduser('~/.cme')
TMP_PATH = os.path.join('/tmp', 'cme_hosted')
if os.name == 'nt':
TMP_PATH = os.getenv('LOCALAPPDATA') + '\\Temp\\cme_hosted'
WS_PATH = os.path.join(CME_PATH, 'workspaces')
CERT_PATH = os.path.join(CME_PATH, 'cme.pem')
CONFIG_PATH = os.path.join(CME_PATH, 'cme.conf')
Expand Down
4 changes: 2 additions & 2 deletions cme/logger.py
Expand Up @@ -69,8 +69,8 @@ def info(self, msg, *args, **kwargs):
msg, kwargs = self.process(u'{} {}'.format(colored("[*]", 'blue', attrs=['bold']), msg), kwargs)
self.logger.info(msg, *args, **kwargs)

def error(self, msg, *args, **kwargs):
msg, kwargs = self.process(u'{} {}'.format(colored("[-]", 'red', attrs=['bold']), msg), kwargs)
def error(self, msg, color='red', *args, **kwargs):
msg, kwargs = self.process(u'{} {}'.format(colored("[-]", color, attrs=['bold']), msg), kwargs)
self.logger.error(msg, *args, **kwargs)

def debug(self, msg, *args, **kwargs):
Expand Down

0 comments on commit 895f16c

Please sign in to comment.