mirror of
https://github.com/fortra/impacket.git
synced 2026-11-07 09:26:09 -10:00
Tests: Continue refactor of test cases (#1112)
Continue refactor some of our test cases structure. Main changes introduced are: * Moved testing guide as a separate file and added some of the steps to configure the test environment. * Leveraging unittest.main to catch command-line args and build the default suite. * Only running GitHub actions workflow once for our own branches/PRs. * Remote test config file can be specified via an env var now. * Moved remote test config to a template and ignored config file.
This commit is contained in:
1 parent
9170de2d3d
commit
6bb5ea427b
76 files changed
+420
-458
No files matched your search
@@ -12,6 +12,9 @@ jobs:
|
||||
lint:
|
||||
name: Check syntaxs errors and warnings
|
||||
runs-on: ubuntu-latest
|
||||
if:
|
||||
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
|
||||
github.repository
|
||||
|
||||
steps:
|
||||
- name: Checkout Impacket
|
||||
@@ -38,6 +41,10 @@ jobs:
|
||||
name: Run unit tests and build wheel
|
||||
needs: lint
|
||||
runs-on: ubuntu-latest
|
||||
if:
|
||||
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
|
||||
github.repository
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -85,6 +92,10 @@ jobs:
|
||||
name: Build docker image
|
||||
needs: lint
|
||||
runs-on: ubuntu-latest
|
||||
if:
|
||||
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
|
||||
github.repository
|
||||
|
||||
continue-on-error: true
|
||||
steps:
|
||||
- name: Checkout Impacket
|
||||
|
||||
@@ -70,3 +70,6 @@ target/
|
||||
|
||||
# PyCharm
|
||||
.idea
|
||||
|
||||
# Test cases configuration
|
||||
tests/dcetests.cfg
|
||||
@@ -3,6 +3,7 @@ include LICENSE
|
||||
include ChangeLog
|
||||
include README.md
|
||||
include SECURITY.md
|
||||
include TESTING.md
|
||||
|
||||
include requirements.txt
|
||||
|
||||
|
||||
@@ -57,69 +57,7 @@ and marking test cases, [tox](https://tox.readthedocs.io/) to automate the proce
|
||||
running them across supported Python versions, and [coverage](https://coverage.readthedocs.io/)
|
||||
to obtain coverage statistics.
|
||||
|
||||
### Test environment setup
|
||||
|
||||
Some test cases are "local", meaning that don't require a target environment and can
|
||||
be run off-line, while the bulk of the test cases are "remote" and requires some
|
||||
prior setup.
|
||||
|
||||
If you want to run the full set of library test cases, you need to prepare your
|
||||
environment by completing the following steps:
|
||||
|
||||
1. Install and configure a Windows 2012 R2 Domain Controller.
|
||||
* Be sure to enable and run the `RemoteRegistry` service. You can do so by
|
||||
running the following command from an elevated prompt:
|
||||
|
||||
sc start remoteregistry
|
||||
|
||||
2. Configure the [dcetest.cfg](tests/dcetests.cfg) file with the necessary information.
|
||||
Make sure you set a user with proper administrative privileges on the target Active
|
||||
Directory domain.
|
||||
|
||||
3. Install testing requirements. You can use the following command to do so:
|
||||
|
||||
python3 -m pip install tox -r requirements-test.txt
|
||||
|
||||
### Running tests
|
||||
|
||||
Once that's done, you would be able to run the test suite with `pytest`. For example,
|
||||
you can run all "local" test cases using the following command:
|
||||
|
||||
$ pytest -m "not remote"
|
||||
|
||||
Or run the "remote" test cases with the following command:
|
||||
|
||||
$ pytest -m "remote"
|
||||
|
||||
If all goes well, all test cases should pass.
|
||||
|
||||
### Automating runs
|
||||
|
||||
If you want to run the test cases in a new fresh environment, or run those across
|
||||
different Python versions, you can use `tox`. You can specify the group of test cases
|
||||
you want to run, which would be passed to `pytest`. As an example, the following
|
||||
command will run all "local" test cases across all the Python versions defined in
|
||||
the `tox` configuration:
|
||||
|
||||
$ tox -- -m "not remote"
|
||||
|
||||
### Coverage
|
||||
|
||||
If you want to measure coverage in your test cases run, you can use it via the
|
||||
`pytest-cov` plugin, for example by running the following command:
|
||||
|
||||
$ pytest --cov --cov-config=tox.ini
|
||||
|
||||
`tox` will collect and report coverage statistics as well, and combine it across
|
||||
different Python version environment runs. You will have a coverage HTML report
|
||||
located at the default `Coverage`'s location `htlmcov/index.html`.
|
||||
|
||||
|
||||
### Configuration
|
||||
|
||||
Configuration of all `pytest`, `coverage` and `tox` is contained in the
|
||||
[tox.ini](tox.ini) file. Refer to each tool documentation for further details
|
||||
about the different settings.
|
||||
A [comprehensive testing guide](TESTING.md) is available.
|
||||
|
||||
|
||||
Docker Support
|
||||
|
||||
+221
@@ -0,0 +1,221 @@
|
||||
Testing
|
||||
=======
|
||||
|
||||
The library leverages the [pytest](https://docs.pytest.org/) framework for organizing
|
||||
and marking test cases, [tox](https://tox.readthedocs.io/) to automate the process of
|
||||
running them across supported Python versions, and [coverage](https://coverage.readthedocs.io/)
|
||||
to obtain coverage statistics.
|
||||
|
||||
|
||||
Test environment setup
|
||||
----------------------
|
||||
|
||||
Some test cases are "local", meaning that don't require a target environment and can
|
||||
be run off-line, while the bulk of the test cases are "remote" and requires some
|
||||
prior setup.
|
||||
|
||||
If you want to run the full set of library test cases, you need to prepare your
|
||||
environment by completing the following steps:
|
||||
|
||||
1. [Install and configure a target Active Directory Domain Controller](#active-directory-setup-and-configuration).
|
||||
|
||||
1. [Configure remote test cases](#configure-remote-test-cases)
|
||||
|
||||
1. Install testing requirements. You can use the following command to do so:
|
||||
|
||||
python3 -m pip install tox -r requirements-test.txt
|
||||
|
||||
|
||||
Running tests
|
||||
-------------
|
||||
|
||||
Once that's done, you would be able to run the test suite with `pytest`. For example,
|
||||
you can run all "local" test cases using the following command:
|
||||
|
||||
$ pytest -m "not remote"
|
||||
|
||||
Or run the "remote" test cases with the following command:
|
||||
|
||||
$ pytest -m "remote"
|
||||
|
||||
If all goes well, all test cases should pass.
|
||||
|
||||
You can also leverage `pytest` [markers](https://docs.pytest.org/en/4.6.x/example/markers.html)
|
||||
or [keyword expressions](https://docs.pytest.org/en/4.6.x/usage.html#select-tests)
|
||||
to select which test case you want to run. Although we recommend using `pytest`, it's also possible to run individual test
|
||||
case modules via `unittest.main` method. For example, to only run `ldap` test cases,
|
||||
you can execute:
|
||||
|
||||
$ pytest -k "ldap"
|
||||
|
||||
|
||||
Automating runs
|
||||
---------------
|
||||
|
||||
If you want to run the test cases in a new fresh environment, or run those across
|
||||
different Python versions, you can use `tox`. You can specify the group of test cases
|
||||
you want to run, which would be passed to `pytest`. As an example, the following
|
||||
command will run all "local" test cases across all the Python versions defined in
|
||||
the `tox` configuration:
|
||||
|
||||
$ tox -- -m "not remote"
|
||||
|
||||
Coverage
|
||||
--------
|
||||
|
||||
If you want to measure coverage in your test cases run, you can use it via the
|
||||
`pytest-cov` plugin, for example by running the following command:
|
||||
|
||||
$ pytest --cov --cov-config=tox.ini
|
||||
|
||||
`tox` will collect and report coverage statistics as well, and combine it across
|
||||
different Python version environment runs. You will have a coverage HTML report
|
||||
located at the default `Coverage`'s location `htlmcov/index.html`.
|
||||
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
Configuration of all `pytest`, `coverage` and `tox` is contained in the
|
||||
[tox.ini](tox.ini) file. Refer to each tool documentation for further details
|
||||
about the different settings.
|
||||
|
||||
|
||||
Active Directory Setup and Configuration
|
||||
----------------------------------------
|
||||
|
||||
In order to run remote test cases, a target Active Directory need to be properly
|
||||
configured with the expected objects. Current remote test cases are expected to
|
||||
work against a Windows Server 2012 R2 Domain Controller. The following are the
|
||||
main steps required:
|
||||
|
||||
1. Make sure to disable the firewall on the interface you want to use for connecting
|
||||
to the Domain Controller.
|
||||
|
||||
PS > Set-NetFirewallProfile -Profile Domain, Public, Private -Enabled False
|
||||
|
||||
1. Install the Active Directory Domain Services on the target server.
|
||||
|
||||
PS > Install-WindowsFeature -name AD-Domain-Services -IncludeManagementTools
|
||||
|
||||
1. Make sure the server's Administrator user password meet the complexity policy, as it's required
|
||||
for promoting it to Domain Controller.
|
||||
|
||||
PS > $AdminPassword = "<Admin Password>"
|
||||
PS > $Admin=[adsi]("WinNT://$env:COMPUTERNAME/Administrator, user")
|
||||
PS > $Admin.psbase.invoke("setpassword", $AdminPassword)
|
||||
|
||||
1. Promote the installed Windows Server 2012 R2 to a Domain Controller, and configure
|
||||
a domain of your choice.
|
||||
|
||||
PS > $DomainName = "<Domain Name>"
|
||||
PS > $NetBIOSName = "<NetBIOS Name>"
|
||||
PS > $RecoveryPassword = "<Recovery Password>"
|
||||
PS > $SecureRecoveryPassword = ConvertTo-SecureString $RecoveryPassword -AsPlainText -Force
|
||||
PS > Install-ADDSForest -DomainName $DomainName -InstallDns -SafeModeAdministratorPassword $SecureRecoveryPassword -DomainNetbiosName $NetBIOSName -SkipPreChecks
|
||||
|
||||
1. Install DHCP services on the target Domain Controller.
|
||||
|
||||
PS > Install-WindowsFeature -name DHCP -IncludeManagementTools
|
||||
|
||||
1. Be sure to enable and run the `RemoteRegistry` service on the target Domain
|
||||
Controller.
|
||||
|
||||
PS > Start-Service RemoteRegistry
|
||||
|
||||
1. Enable AES and RC4 Kerberos encryption types for the user and Domain
|
||||
Controller machine accounts.
|
||||
|
||||
|
||||
### LDAPS (LDAP over SSL/TLS) configuration
|
||||
|
||||
For running LDAPS (LDAP over SSL/TLS) test cases, make sure you have a certificate
|
||||
installed and configured on the target Domain Controller. You can follow
|
||||
Microsoft's [guidelines to configure LDAPS](https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/enable-ldap-over-ssl-3rd-certification-authority).
|
||||
|
||||
You can use self-signed certificates by:
|
||||
|
||||
1. Create a CA private key and certificate:
|
||||
|
||||
$ openssl genrsa -aes256 -out ca_private.key 4096
|
||||
$ openssl req -new -x509 -days 3650 -key ca_private.key -out ca_public.crt
|
||||
|
||||
1. Copying and importing the CA public certificate into the Domain
|
||||
Controller server:
|
||||
|
||||
PS > XXX
|
||||
|
||||
1. Creating a certificate request for the LDAP service, by editing the following
|
||||
configuration file:
|
||||
|
||||
;----------------- request.inf -----------------
|
||||
[Version]
|
||||
Signature="$Windows NT$
|
||||
|
||||
[NewRequest]
|
||||
Subject = "CN=<DC fqdn>" ; replace with the FQDN of the DC
|
||||
KeySpec = 1
|
||||
KeyLength = 1024
|
||||
Exportable = TRUE
|
||||
MachineKeySet = TRUE
|
||||
SMIME = False
|
||||
PrivateKeyArchive = FALSE
|
||||
UserProtected = FALSE
|
||||
UseExistingKeySet = FALSE
|
||||
ProviderName = "Microsoft RSA SChannel Cryptographic Provider"
|
||||
ProviderType = 12
|
||||
RequestType = PKCS10
|
||||
KeyUsage = 0xa0
|
||||
|
||||
[EnhancedKeyUsageExtension]
|
||||
OID=1.3.6.1.5.5.7.3.1 ; this is for Server Authentication
|
||||
;-----------------------------------------------
|
||||
|
||||
And then running the following command:
|
||||
|
||||
PS > certreq -new request.inf ldapcert.csr
|
||||
|
||||
1. Signing the LDAP service certificate with the CA, by creating the
|
||||
`v3ext.txt` configuration file:
|
||||
|
||||
keyUsage=digitalSignature,keyEncipherment
|
||||
extendedKeyUsage=serverAuth
|
||||
subjectKeyIdentifier=hash
|
||||
|
||||
And running the following command:
|
||||
|
||||
$ openssl x509 -req -days 365 -in ldapcert.csr -CA ca_public.crt -CAkey ca_private.key -extfile v3ext.txt -set_serial 01 -out ldapcert.crt
|
||||
|
||||
1. Copying and installing the new signed LDAP service certificate into
|
||||
the Domain Controller server:
|
||||
|
||||
PS > certreq -accept ldapcert.crt
|
||||
|
||||
1. Finally restarting the Domain Controller.
|
||||
|
||||
|
||||
### Mimilib configuration
|
||||
|
||||
[Mimilib](https://github.com/gentilkiwi/mimikatz/tree/master/mimilib) test
|
||||
cases require the service to be installed on the target Domain Controller.
|
||||
|
||||
|
||||
Configure Remote Test Cases
|
||||
---------------------------
|
||||
|
||||
Create a copy of the [dcetest.cfg.template](tests/dcetests.cfg.template) file and
|
||||
configure it with the necessary information associated to the Active Directory you
|
||||
configured. By default, the remote test cases will look for the file in
|
||||
`test/dcetests.cg`, but you can specify another filename using the `REMOTE_CONFIG` environment
|
||||
variable.
|
||||
|
||||
For example, you can keep configuration of different environments in
|
||||
separate files, and specify which one you want the test to run against:
|
||||
|
||||
$ REMOTE_CONFIG=/test/dcetests-win2019.cfg pytest
|
||||
|
||||
Make sure you set a user with proper administrative privileges on the
|
||||
target Active Directory domain and that the user hashes and keys match with those
|
||||
in the environment. Hashes and Kerberos keys can be grabbed from the target Domain
|
||||
Controller using [secretsdump.py](examples/secretsdump.py) example
|
||||
script.
|
||||
@@ -161,5 +161,4 @@ class TestICMP6(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestICMP6)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -63,5 +63,4 @@ class TestIP6(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestIP6)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -135,5 +135,4 @@ class TestIP6_Address(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestIP6_Address)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -604,5 +604,4 @@ class TestIP6(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestIP6)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -128,5 +128,4 @@ class TestTCP(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestTCP)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -35,5 +35,4 @@ class TestTCP(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestTCP)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -103,5 +103,4 @@ class TestEthernet(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestEthernet)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -210,11 +210,4 @@ class SMBTransport64(SMBTransport):
|
||||
|
||||
# Process command-line arguments.
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
testcase = sys.argv[1]
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(globals()[testcase])
|
||||
else:
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(SMBTransport)
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(SMBTransport64))
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -317,11 +317,4 @@ class TCPTransport64(TCPTransport):
|
||||
|
||||
# Process command-line arguments.
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
testcase = sys.argv[1]
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(globals()[testcase])
|
||||
else:
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TCPTransport)
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TCPTransport64))
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -182,11 +182,4 @@ class TCPTransport64(TCPTransport):
|
||||
|
||||
# Process command-line arguments.
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
testcase = sys.argv[1]
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(globals()[testcase])
|
||||
else:
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TCPTransport)
|
||||
#suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TCPTransport64))
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -491,13 +491,4 @@ class TCPTransport64(TCPTransport):
|
||||
|
||||
# Process command-line arguments.
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
testcase = sys.argv[1]
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(globals()[testcase])
|
||||
else:
|
||||
#suite = unittest.TestLoader().loadTestsFromTestCase(SMBTransport)
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TCPTransport)
|
||||
#suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TCPTransport64))
|
||||
#suite.addTests(unittest.TestLoader().loadTestsFromTestCase(SMBTransport64))
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -148,13 +148,4 @@ class TCPTransport64(TCPTransport):
|
||||
|
||||
# Process command-line arguments.
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
testcase = sys.argv[1]
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(globals()[testcase])
|
||||
else:
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(SMBTransport)
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TCPTransport))
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(SMBTransport64))
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TCPTransport64))
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -240,11 +240,4 @@ class SMBTransport64(SMBTransport):
|
||||
|
||||
# Process command-line arguments.
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
testcase = sys.argv[1]
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(globals()[testcase])
|
||||
else:
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(SMBTransport)
|
||||
#suite.addTests(unittest.TestLoader().loadTestsFromTestCase(SMBTransport64))
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -139,11 +139,4 @@ class TCPTransport64(TCPTransport):
|
||||
|
||||
# Process command-line arguments.
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
testcase = sys.argv[1]
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(globals()[testcase])
|
||||
else:
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TCPTransport)
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TCPTransport64))
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -92,11 +92,4 @@ class TCPTransport64(TCPTransport):
|
||||
|
||||
# Process command-line arguments.
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
testcase = sys.argv[1]
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(globals()[testcase])
|
||||
else:
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TCPTransport)
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TCPTransport64))
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
+67
-49
@@ -20,14 +20,31 @@ from impacket.ldap.ldaptypes import SR_SECURITY_DESCRIPTOR
|
||||
|
||||
|
||||
class LDAPTests(RemoteTestCase):
|
||||
def connect(self, login=True):
|
||||
self.ldapConnection = ldap.LDAPConnection(self.url, self.baseDN)
|
||||
if login:
|
||||
self.ldapConnection.login(self.username, self.password)
|
||||
return self.ldapConnection
|
||||
|
||||
def tearDown(self):
|
||||
if hasattr(self, "ldapConnection") and self.ldapConnection:
|
||||
self.ldapConnection.close()
|
||||
|
||||
def dummySearch(self, ldapConnection):
|
||||
# Let's do a search just to be sure it's working
|
||||
searchFilter = '(servicePrincipalName=*)'
|
||||
searchFilter = "(servicePrincipalName=*)"
|
||||
|
||||
resp = ldapConnection.search(searchFilter=searchFilter,
|
||||
attributes=['servicePrincipalName', 'sAMAccountName', 'userPrincipalName',
|
||||
'MemberOf', 'pwdLastSet', 'whenCreated'])
|
||||
resp = ldapConnection.search(
|
||||
searchFilter=searchFilter,
|
||||
attributes=[
|
||||
"servicePrincipalName",
|
||||
"sAMAccountName",
|
||||
"userPrincipalName",
|
||||
"MemberOf",
|
||||
"pwdLastSet",
|
||||
"whenCreated",
|
||||
],
|
||||
)
|
||||
for item in resp:
|
||||
print(item.prettyPrint())
|
||||
|
||||
@@ -37,69 +54,77 @@ class LDAPTests(RemoteTestCase):
|
||||
# in tests, since sometimes Windows has redundant null bytes after an ACE.Stripping those away makes the
|
||||
# ACLs not match at a binary level.
|
||||
impacket.ldap.ldaptypes.RECALC_ACL_SIZE = False
|
||||
ldapConnection=self.connect()
|
||||
searchFilter = '(objectCategory=computer)'
|
||||
ldapConnection = self.connect()
|
||||
searchFilter = "(objectCategory=computer)"
|
||||
|
||||
resp = ldapConnection.search(searchFilter=searchFilter,
|
||||
attributes=['nTSecurityDescriptor'])
|
||||
resp = ldapConnection.search(
|
||||
searchFilter=searchFilter, attributes=["nTSecurityDescriptor"]
|
||||
)
|
||||
for item in resp:
|
||||
if isinstance(item, ldapasn1.SearchResultEntry) is not True:
|
||||
continue
|
||||
for attribute in item['attributes']:
|
||||
if attribute['type'] == 'nTSecurityDescriptor':
|
||||
secDesc = str(attribute['vals'][0])
|
||||
for attribute in item["attributes"]:
|
||||
if attribute["type"] == "nTSecurityDescriptor":
|
||||
secDesc = str(attribute["vals"][0])
|
||||
# Converting it so we can use it
|
||||
sd = SR_SECURITY_DESCRIPTOR()
|
||||
sd.fromString(secDesc)
|
||||
sd.dump()
|
||||
self.assertTrue(secDesc, sd.getData())
|
||||
|
||||
def connect(self):
|
||||
ldapConnection = ldap.LDAPConnection(self.url, self.baseDN)
|
||||
ldapConnection.login(self.username, self.password)
|
||||
return ldapConnection
|
||||
|
||||
def test_sicily(self):
|
||||
ldapConnection = ldap.LDAPConnection(self.url, self.baseDN)
|
||||
ldapConnection.login(authenticationChoice='sicilyPackageDiscovery')
|
||||
ldapConnection = self.connect(False)
|
||||
ldapConnection.login(authenticationChoice="sicilyPackageDiscovery")
|
||||
|
||||
def test_sicilyNtlm(self):
|
||||
ldapConnection = ldap.LDAPConnection(self.url, self.baseDN)
|
||||
ldapConnection.login(user=self.username, password=self.password, domain=self.domain)
|
||||
ldapConnection = self.connect(False)
|
||||
ldapConnection.login(
|
||||
user=self.username, password=self.password, domain=self.domain
|
||||
)
|
||||
|
||||
self.dummySearch(ldapConnection)
|
||||
|
||||
def test_kerberosLogin(self):
|
||||
ldapConnection = ldap.LDAPConnection(self.url, self.baseDN)
|
||||
ldapConnection = self.connect(False)
|
||||
ldapConnection.kerberosLogin(self.username, self.password, self.domain)
|
||||
|
||||
self.dummySearch(ldapConnection)
|
||||
|
||||
def test_kerberosLoginHashes(self):
|
||||
if len(self.hashes) > 0:
|
||||
lmhash, nthash = self.hashes.split(':')
|
||||
lmhash, nthash = self.hashes.split(":")
|
||||
else:
|
||||
lmhash = ''
|
||||
nthash = ''
|
||||
ldapConnection = ldap.LDAPConnection(self.url, self.baseDN)
|
||||
ldapConnection.kerberosLogin(self.username, '', self.domain, lmhash, nthash, '', None, None)
|
||||
lmhash = ""
|
||||
nthash = ""
|
||||
ldapConnection = self.connect(False)
|
||||
ldapConnection.kerberosLogin(
|
||||
self.username, "", self.domain, lmhash, nthash, "", None, None
|
||||
)
|
||||
|
||||
self.dummySearch(ldapConnection)
|
||||
|
||||
def test_kerberosLoginKeys(self):
|
||||
ldapConnection = ldap.LDAPConnection(self.url, self.baseDN)
|
||||
ldapConnection.kerberosLogin(self.username, '', self.domain, '', '', self.aesKey, None, None)
|
||||
ldapConnection = self.connect(False)
|
||||
ldapConnection.kerberosLogin(
|
||||
self.username, "", self.domain, "", "", self.aesKey, None, None
|
||||
)
|
||||
|
||||
self.dummySearch(ldapConnection)
|
||||
|
||||
def test_sicilyNtlmHashes(self):
|
||||
if len(self.hashes) > 0:
|
||||
lmhash, nthash = self.hashes.split(':')
|
||||
lmhash, nthash = self.hashes.split(":")
|
||||
else:
|
||||
lmhash = ''
|
||||
nthash = ''
|
||||
ldapConnection = ldap.LDAPConnection(self.url, self.baseDN)
|
||||
ldapConnection.login(user=self.username, password=self.password, domain=self.domain, lmhash=lmhash, nthash=nthash )
|
||||
lmhash = ""
|
||||
nthash = ""
|
||||
ldapConnection = self.connect(False)
|
||||
ldapConnection.login(
|
||||
user=self.username,
|
||||
password=self.password,
|
||||
domain=self.domain,
|
||||
lmhash=lmhash,
|
||||
nthash=nthash,
|
||||
)
|
||||
|
||||
self.dummySearch(ldapConnection)
|
||||
|
||||
@@ -111,31 +136,24 @@ class LDAPTests(RemoteTestCase):
|
||||
|
||||
@pytest.mark.remote
|
||||
class TCPTransport(LDAPTests, unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TCPTransport, self).setUp()
|
||||
self.set_tcp_transport_config()
|
||||
self.aesKey = self.config_file.get('SMBTransport', 'aesKey128')
|
||||
self.url = 'ldap://%s' % self.serverName
|
||||
self.baseDN = 'dc=%s, dc=%s' % (self.domain.split('.')[0], self.domain.split('.')[1])
|
||||
self.aesKey = self.config_file.get("SMBTransport", "aesKey128")
|
||||
self.url = "ldap://%s" % self.serverName
|
||||
self.baseDN = "dc=%s, dc=%s" % (
|
||||
self.domain.split(".")[0],
|
||||
self.domain.split(".")[1],
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.remote
|
||||
@pytest.mark.skipif(reason="LDAPS tests require configuration")
|
||||
class TCPTransportSSL(TCPTransport):
|
||||
|
||||
def setUp(self):
|
||||
super(TCPTransportSSL, self).setUp()
|
||||
self.url = 'ldaps://%s' % self.serverName
|
||||
self.url = "ldaps://%s" % self.serverName
|
||||
|
||||
|
||||
# Process command-line arguments.
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
testcase = sys.argv[1]
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(globals()[testcase])
|
||||
else:
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TCPTransport)
|
||||
#suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TCPTransportSSL))
|
||||
unittest.main(defaultTest='suite')
|
||||
if __name__ == "__main__":
|
||||
unittest.main(verbosity=1)
|
||||
@@ -1044,11 +1044,4 @@ class SMBTransport64(SMBTransport):
|
||||
|
||||
# Process command-line arguments.
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
testcase = sys.argv[1]
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(globals()[testcase])
|
||||
else:
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(SMBTransport)
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(SMBTransport64))
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -347,11 +347,4 @@ class SMBTransport64(SMBTransport):
|
||||
|
||||
# Process command-line arguments.
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
testcase = sys.argv[1]
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(globals()[testcase])
|
||||
else:
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(SMBTransport)
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(SMBTransport64))
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -153,13 +153,4 @@ class TCPTransport64(TCPTransport):
|
||||
|
||||
# Process command-line arguments.
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
testcase = sys.argv[1]
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(globals()[testcase])
|
||||
else:
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(SMBTransport)
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TCPTransport))
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(SMBTransport64))
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TCPTransport64))
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -108,10 +108,4 @@ class TCPTransport(RRPTests, unittest.TestCase):
|
||||
|
||||
# Process command-line arguments.
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
testcase = sys.argv[1]
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(globals()[testcase])
|
||||
else:
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TCPTransport)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -386,10 +386,4 @@ class NDRTests(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
testcase = sys.argv[1]
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(globals()[testcase])
|
||||
else:
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(NDRTests)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -76,5 +76,4 @@ class NMBTests(RemoteTestCase, unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(NMBTests)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -1066,12 +1066,4 @@ class SMBTransport(NRPCTests, unittest.TestCase):
|
||||
|
||||
# Process command-line arguments.
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
testcase = sys.argv[1]
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(globals()[testcase])
|
||||
else:
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(SMBTransport)
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TCPTransport))
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -333,10 +333,4 @@ class NTLMTests(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
testcase = sys.argv[1]
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(globals()[testcase])
|
||||
else:
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(NTLMTests)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -283,11 +283,4 @@ class RPCHTest(RemoteTestCase, unittest.TestCase):
|
||||
|
||||
# Process command-line arguments.
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
testcase = sys.argv[1]
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(globals()[testcase])
|
||||
else:
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(RPCHTest)
|
||||
unittest.TextTestRunner(verbosity=1).run(suite)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -423,11 +423,4 @@ class SMBTransport(DCERPCTests, unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
testcase = sys.argv[1]
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(globals()[testcase])
|
||||
else:
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TCPTransport)
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(SMBTransport))
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -221,11 +221,4 @@ class SMBTransport64(SMBTransport):
|
||||
|
||||
# Process command-line arguments.
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
testcase = sys.argv[1]
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(globals()[testcase])
|
||||
else:
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(SMBTransport)
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(SMBTransport64))
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -762,12 +762,4 @@ class TCPTransport(RRPTests, unittest.TestCase):
|
||||
|
||||
# Process command-line arguments.
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
testcase = sys.argv[1]
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(globals()[testcase])
|
||||
else:
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(SMBTransport)
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(SMBTransport64))
|
||||
#suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TCPTransport))
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -2867,13 +2867,4 @@ class TCPTransport64(TCPTransport):
|
||||
|
||||
# Process command-line arguments.
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
testcase = sys.argv[1]
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(globals()[testcase])
|
||||
else:
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(SMBTransport)
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TCPTransport))
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(SMBTransport64))
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TCPTransport64))
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -675,11 +675,4 @@ class TCPTransport(SCMRTests, unittest.TestCase):
|
||||
|
||||
# Process command-line arguments.
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
testcase = sys.argv[1]
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(globals()[testcase])
|
||||
else:
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(SMBTransport)
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TCPTransport))
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -302,5 +302,4 @@ class Tests(SecretsDumpTests, unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(Tests)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -333,10 +333,4 @@ class SMB3Tests(SMB1Tests):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(SMB1Tests)
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(SMB1TestsNetBIOS))
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(SMB1TestsUnicode))
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(SMB002Tests))
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(SMB21Tests))
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(SMB3Tests))
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -202,8 +202,4 @@ class SimpleSMBServerFuncTests(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
loader = unittest.TestLoader()
|
||||
suite = unittest.TestSuite()
|
||||
suite.addTests(loader.loadTestsFromTestCase(SMBServerUnitTests))
|
||||
suite.addTests(loader.loadTestsFromTestCase(SimpleSMBServerFuncTests))
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -50,4 +50,4 @@ class Test(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
unittest.main(verbosity=1)
|
||||
@@ -1162,11 +1162,4 @@ class SMBTransport64(SMBTransport):
|
||||
|
||||
# Process command-line arguments.
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
testcase = sys.argv[1]
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(globals()[testcase])
|
||||
else:
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(SMBTransport)
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(SMBTransport64))
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -1052,11 +1052,4 @@ class SMBTransport64(SMBTransport):
|
||||
|
||||
# Process command-line arguments.
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
testcase = sys.argv[1]
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(globals()[testcase])
|
||||
else:
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(SMBTransport)
|
||||
#suite.addTests(unittest.TestLoader().loadTestsFromTestCase(SMBTransport64))
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -602,11 +602,4 @@ class SMBTransport64(SMBTransport):
|
||||
|
||||
# Process command-line arguments.
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
testcase = sys.argv[1]
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(globals()[testcase])
|
||||
else:
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(SMBTransport)
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(SMBTransport64))
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -217,11 +217,4 @@ class TCPTransport64(TCPTransport):
|
||||
|
||||
# Process command-line arguments.
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
testcase = sys.argv[1]
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(globals()[testcase])
|
||||
else:
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TCPTransport)
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TCPTransport64))
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
+8
-8
@@ -7,24 +7,24 @@
|
||||
#
|
||||
# Base tests cases module
|
||||
#
|
||||
from os import getenv
|
||||
from os.path import join
|
||||
from six.moves.configparser import ConfigParser
|
||||
|
||||
|
||||
class RemoteTestCase(object):
|
||||
|
||||
def set_config_file(self):
|
||||
config_file_path = join("tests", "dcetests.cfg")
|
||||
config_file_path = getenv("REMOTE_CONFIG", join("tests", "dcetests.cfg"))
|
||||
self.config_file = ConfigParser()
|
||||
self.config_file.read(config_file_path)
|
||||
|
||||
def set_transport_config(self, transport):
|
||||
self.username = self.config_file.get(transport, 'username')
|
||||
self.domain = self.config_file.get(transport, 'domain')
|
||||
self.serverName = self.config_file.get(transport, 'servername')
|
||||
self.password = self.config_file.get(transport, 'password')
|
||||
self.machine = self.config_file.get(transport, 'machine')
|
||||
self.hashes = self.config_file.get(transport, 'hashes')
|
||||
self.username = self.config_file.get(transport, "username")
|
||||
self.domain = self.config_file.get(transport, "domain")
|
||||
self.serverName = self.config_file.get(transport, "servername")
|
||||
self.password = self.config_file.get(transport, "password")
|
||||
self.machine = self.config_file.get(transport, "machine")
|
||||
self.hashes = self.config_file.get(transport, "hashes")
|
||||
|
||||
def set_smb_transport_config(self):
|
||||
self.set_config_file()
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
[global]
|
||||
|
||||
[TCPTransport]
|
||||
# NetBIOS Name
|
||||
servername = WIN2k19-DC-IN
|
||||
# Targets IP
|
||||
machine = 192.168.223.50
|
||||
username = Administrator
|
||||
password = Passw0rd!123456
|
||||
# NTLM Hash, you can grab it with secretsdump
|
||||
hashes = aad3b435b51404eeaad3b435b51404ee:5530b61dbe4bc985d07cabd8dc373b92
|
||||
# Kerberos AES 256 Key, you can grab it with secretsdump
|
||||
aesKey256 = 4ee03a7024558fdc2a5ff280b11c09aa952949068557da6642183c79bfb0c1bf
|
||||
# Kerberos AES 128 Key, you can grab it with secretsdump
|
||||
aesKey128 = 03f2f34a134995ffd9a85e2df09f3ed9
|
||||
# It must be the domain FQDN
|
||||
domain = INNOVATION.ROCKS
|
||||
# This need to be a domain joined machine NetBIOS name
|
||||
machineuser = WIN10-WS-IN$
|
||||
# Domain joined machine NetBIOS name hashes (grab them with secretsdump)
|
||||
machineuserhashes = aad3b435b51404eeaad3b435b51404ee:5ac8ef2ae689db9c6f26566f8696fcb6
|
||||
|
||||
[SMBTransport]
|
||||
# NetBIOS Name
|
||||
servername = WIN2k19-DC-IN
|
||||
# Targets IP
|
||||
machine = 192.168.223.50
|
||||
username = Administrator
|
||||
password = Passw0rd!123456
|
||||
# NTLM Hash, you can grab it with secretsdump
|
||||
hashes = aad3b435b51404eeaad3b435b51404ee:5530b61dbe4bc985d07cabd8dc373b92
|
||||
# Kerberos AES 256 Key, you can grab it with secretsdump
|
||||
aesKey256 = 4ee03a7024558fdc2a5ff280b11c09aa952949068557da6642183c79bfb0c1bf
|
||||
# Kerberos AES 128 Key, you can grab it with secretsdump
|
||||
aesKey128 = 03f2f34a134995ffd9a85e2df09f3ed9
|
||||
# It must be the domain FQDN
|
||||
domain = INNOVATION.ROCKS
|
||||
# This need to be a domain joined machine NetBIOS name
|
||||
machineuser = WIN10-WS-IN$
|
||||
# Domain joined machine NetBIOS name hashes (grab them with secretsdump)
|
||||
machineuserhashes = aad3b435b51404eeaad3b435b51404ee:5ac8ef2ae689db9c6f26566f8696fcb6
|
||||
@@ -0,0 +1,41 @@
|
||||
[global]
|
||||
|
||||
[TCPTransport]
|
||||
# NetBIOS Name
|
||||
servername =
|
||||
# Targets IP
|
||||
machine =
|
||||
username =
|
||||
password =
|
||||
# NTLM Hash, you can grab it with secretsdump
|
||||
hashes =
|
||||
# Kerberos AES 256 Key, you can grab it with secretsdump
|
||||
aesKey256 =
|
||||
# Kerberos AES 128 Key, you can grab it with secretsdump
|
||||
aesKey128 =
|
||||
# It must be the domain FQDN
|
||||
domain =
|
||||
# This need to be a domain joined machine NetBIOS name
|
||||
machineuser =
|
||||
# Domain joined machine NetBIOS name hashes (grab them with secretsdump)
|
||||
machineuserhashes =
|
||||
|
||||
[SMBTransport]
|
||||
# NetBIOS Name
|
||||
servername =
|
||||
# Targets IP
|
||||
machine =
|
||||
username =
|
||||
password =
|
||||
# NTLM Hash, you can grab it with secretsdump
|
||||
hashes =
|
||||
# Kerberos AES 256 Key, you can grab it with secretsdump
|
||||
aesKey256 =
|
||||
# Kerberos AES 128 Key, you can grab it with secretsdump
|
||||
aesKey128 =
|
||||
# It must be the domain FQDN
|
||||
domain =
|
||||
# This need to be a domain joined machine NetBIOS name
|
||||
machineuser =
|
||||
# Domain joined machine NetBIOS name hashes (grab them with secretsdump)
|
||||
machineuserhashes =
|
||||
@@ -99,5 +99,4 @@ class TestDot11Common(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestDot11Common)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -68,5 +68,4 @@ class TestDot11Decoder(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestDot11Decoder)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -127,5 +127,4 @@ class TestDot11HierarchicalUpdate(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestDot11HierarchicalUpdate)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -48,5 +48,4 @@ class TestDot11FrameControlACK(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestDot11FrameControlACK)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -58,5 +58,4 @@ class TestDot11FrameControlCFEnd(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestDot11FrameControlCFEnd)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -58,5 +58,4 @@ class TestDot11FrameControlCFEndCFACK(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestDot11FrameControlCFEndCFACK)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -49,5 +49,4 @@ class TestDot11FrameControlCTS(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestDot11FrameControlCTS)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -58,5 +58,4 @@ class TestDot11FrameControlPSPoll(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestDot11FrameControlPSPoll)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -58,5 +58,4 @@ class TestDot11FrameControlRTS(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestDot11FrameControlRTS)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -96,5 +96,4 @@ class TestDot11DataFrames(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestDot11DataFrames)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -179,5 +179,4 @@ class TestDot11ManagementBeaconFrames(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestDot11ManagementBeaconFrames)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -176,5 +176,4 @@ class TestDot11ManagementAssociationRequestFrames(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestDot11ManagementAssociationRequestFrames)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -160,5 +160,4 @@ class TestDot11ManagementAssociationResponseFrames(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestDot11ManagementAssociationResponseFrames)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -148,5 +148,4 @@ class TestDot11ManagementAuthenticationFrames(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestDot11ManagementAuthenticationFrames)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -125,5 +125,4 @@ class TestDot11ManagementBeaconFrames(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestDot11ManagementBeaconFrames)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -125,5 +125,4 @@ class TestDot11ManagementDisassociationFrames(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestDot11ManagementDisassociationFrames)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -137,5 +137,4 @@ class TestDot11ManagementProbeRequestFrames(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestDot11ManagementProbeRequestFrames)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -186,5 +186,4 @@ class TestDot11ManagementProbeResponseFrames(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestDot11ManagementProbeResponseFrames)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -181,5 +181,4 @@ class TestDot11ManagementReassociationRequestFrames(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestDot11ManagementReassociationRequestFrames)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -160,5 +160,4 @@ class TestDot11ManagementReassociationResponseFrames(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestDot11ManagementReassociationResponseFrames)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -574,5 +574,4 @@ class TestRadioTap(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestRadioTap)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -105,5 +105,4 @@ class TestRadioTapDecoder(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestRadioTapDecoder)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -137,5 +137,4 @@ class TestDot11WEPData(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestDot11WEPData)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -118,5 +118,4 @@ class TestDot11WEPData(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestDot11WEPData)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -107,5 +107,4 @@ class TestDot11WPAData(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestDot11WPAData)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -93,5 +93,4 @@ class TestDot11WPA2Data(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestDot11WPA2Data)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -50,5 +50,4 @@ class TestHelpers(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestHelpers)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -47,5 +47,4 @@ class TestTLVContainer(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestTLVContainer)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
@@ -205,5 +205,4 @@ class DPAPITests(unittest.TestCase):
|
||||
|
||||
# Process command-line arguments.
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(DPAPITests)
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main(verbosity=1)
|
||||
Reference in new issue
Block a user