byt3bl33d3r / CrackMapExec

A swiss army knife for pentesting networks
BSD 2-Clause "Simplified" License
8.38k stars 1.64k forks source link

Multiple actions asked, global fail at first fail #49

Closed maaaaz closed 8 years ago

maaaaz commented 8 years ago

Hello @byt3bl33d3r,

I'm reporting a bug related to multiple actions execution. Indeed if you specify multiple actions comprising at least one not authorized, the whole execution will fail and you won't even see the authorized one.

In this example the user :

(venvcrackmapexec)root@kali:~/Partage/CrackMapExec_fork# python crackmapexec.py 192.168.11.136 -u user1 -p yoloswag1! --shares 
11-29-2015 14:15:41 [*] 192.168.11.136:445 is running Windows 6.3 Build 9600 (name:DC01) (domain:ADYOLO)
11-29-2015 14:15:41 [+] 192.168.11.136:445 Login successful ADYOLO\user1:yoloswag1!
11-29-2015 14:15:41 [+] 192.168.11.136:445 Available shares:
11-29-2015 14:15:41           SHARE     Permissions
11-29-2015 14:15:41           -----     -----------
11-29-2015 14:15:41          ADMIN$       NO ACCESS
11-29-2015 14:15:41            IPC$            READ
11-29-2015 14:15:41           share     READ, WRITE
11-29-2015 14:15:41          SYSVOL            READ
11-29-2015 14:15:41              C$       NO ACCESS
11-29-2015 14:15:41        NETLOGON            READ
(venvcrackmapexec)root@kali:~/Partage/CrackMapExec_fork# python crackmapexec.py 192.168.11.136 -u user1 -p yoloswag1! --list share
11-29-2015 14:20:26 [*] 192.168.11.136:445 is running Windows 6.3 Build 9600 (name:DC01) (domain:ADYOLO)
11-29-2015 14:20:26 [+] 192.168.11.136:445 Login successful ADYOLO\user1:yoloswag1!
11-29-2015 14:20:26 [-] 192.168.11.136:445 SMB SessionError: STATUS_ACCESS_DENIED({Access Denied} A process has requested access to an object but has not been granted those access rights.)

Now, if I ask for both actions in the same command line, both will fail as I won't see the authorized one:

(venvcrackmapexec)root@kali:~/Partage/CrackMapExec_fork# python crackmapexec.py 192.168.11.136 -u user1 -p yoloswag1! --shares --list share
11-29-2015 14:21:54 [*] 192.168.11.136:445 is running Windows 6.3 Build 9600 (name:DC01) (domain:ADYOLO)
11-29-2015 14:21:54 [+] 192.168.11.136:445 Login successful ADYOLO\user1:yoloswag1!
11-29-2015 14:21:54 [-] 192.168.11.136:445 SMB SessionError: STATUS_ACCESS_DENIED({Access Denied} A process has requested access to an object but has not been granted those access rights.)

Cheers

byt3bl33d3r commented 8 years ago

@maaaaz unfortunately this isn't exactly a quick fix, would have to completely re-factor the scripts exception handling. I didn't think about this particular situation while doing the first re-write (which is kinda stupid of me).

I'm putting this on the backburner for now. Will happily except pull requests though \o/

byt3bl33d3r commented 8 years ago

@maaaaz also fixed in v3.0. Thanks!