[14812] 2019-11-13_记一次编写域账号弱口令审计工具

文档创建者:s7ckTeam
浏览次数:5
最后更新:2025-01-18
2019-11-13_记一次编写域账号弱口令审计工具 j e r r y b i r d   F r e e B u f   2 0 1 9 - 1 1 - 1 3 0 x 0 0   使 使 0 x 0 1   0 x 0 1 0 1   L D A P 使 P o w e r s h e l l L D A P 5 3 0 m i n 5 0 x 0 1 0 2   K e r b e r o s 1 .   使 K e r b e r o s A S C l i e n t T G T K D C K R B T G T   *   m i m i k a t z T G S C l i e n t S T S e r v i c e   S e r v e r 访 S e r v i c e   S e r v e r 2 .   S e r v i c e   S e r v e r 使 n e t   g r o u p   d o m a i n   c o m p u t e r s   / d o m a i n : 1 2 8
使 n e t   g r o u p   d o m a i n   u s e r s   / d o m a i n : 3 .   K e r b e r o s T G S C l i e n t S e r v i c e   S e r v e r N T   H a s h S T S T S e r v i c e   S e r v e r S e r v i c e   S e r v e r S e r v i c e   S e r v e r   S e r v i c e   S e r v e r S P N S e r v i c e   S h y s i c a l N a m e , , s e t s p n   - T - q   / S P N 4 .   S P N 便 S P N s e t s p n   - A   S e r v i c e C l a s s / S P N 5 .   便 K e r b e r o s S T , I n v o k e - K e r b e r o a s t . p s 1 h a s h c a t S T 6 .   h a s h c a t 0 x 0 2   *       使 * * * * S P N         *       ! [ 1 5 7 3 4 5 0 0 7 0 _ 5 d c 8 f 1 5 6 5 7 9 5 1 . p n g ! s m a l l ] ( h t t p s : / / i m a g e . 3 0 0 1 . n e t / i m a g e s / 2 0 1 9 1 1 1 1 / 1 5 7 3 4 5 0 0 7 0 _ 5 d c 8 f 1 5 6 5 7 9 5 1 . p n g ! s m a l l ) *       * * * * S P N         *       ! [ 1 5 7 3 4 5 0 0 8 3 _ 5 d c 8 f 1 6 3 4 1 3 b 3 . p n g ! s m a l l ] ( h t t p s : / / i m a g e . 3 0 0 1 . n e t / i m a g e s / 2 0 1 9 1 1 1 1 / 1 5 7 3 4 5 0 0 8 3 _ 5 d c 8 f 1 6 3 4 1 3 b 3 . p n g ! s m a l l )
S P N S P N 访 S P N 使 m i m i k a t z S P N 使 I n v o k e - K e r b e r o a s t H a s h c a t S P N S T H a s h t g s r e p c r a c k . p y h a s h c a t H a s h 0 x 0 3   < # d o m a i n A c c o u n t C h e c k . p s 1 A u t h o r :   J C   ( @ c h r o b l e r t ) # > #   f u n c t i o n   G e t - U s e r L i s t {         #   $ r e s u l t L i s t         $ r e s u l t L i s t   =   n e t   g r o u p   " d o m a i n   u s e r s "   / d o m a i n   | % {   $ _   - s p l i t   "   " } | % {   i f   ( $ _   - n e   " " ) { $ _ . t r i m ( ) } }         #           f o r e a c h   ( $ l i n e   i n   $ r e s u l t L i s t ) {                 i f ( $ l i n e . c o n t a i n s ( " - - - " ) ) {                         $ s t a r t   =   $ r e s u l t L i s t . i n d e x o f ( $ l i n e )   +   1                         #   2 1                         $ e n d   =   $ r e s u l t L i s t . c o u n t   -   2                   }         }         $ u s e r L i s t A   =   $ r e s u l t L i s t [ $ s t a r t . . $ e n d ]         $ u s e r L i s t   =   N e w - O b j e c t   S y s t e m . C o l l e c t i o n s . A r r a y L i s t         f o r e a c h   ( $ u s e r   i n   $ u s e r L i s t A ) {                 i f (   - N o t   $ u s e r . c o n t a i n s ( " $ " ) ) {                         $ u s e r L i s t . a d d ( $ u s e r ) | O u t - N u l l                 }         }         W r i t e - H o s t   " . r e s u l t a l l U s e r L i s t . t x t "         $ u s e r L i s t   |   O u t - F i l e   " . r e s u l t a l l U s e r L i s t . t x t "         r e t u r n   $ u s e r L i s t . c l o n e ( ) } #   S P N f u n c t i o n   S e t - S P N {         P a r a m (                 [ S y s t e m . C o l l e c t i o n s . A r r a y L i s t ]   $ a l l U s e r L i s t         )         i f ( $ a l l U s e r L i s t   - e q   $ n u l l ) {                 i f ( T e s t - P a t h   " . r e s u l t a l l U s e r L i s t . t x t " ) {                         W r i t e - H o s t   " 使 r e s u l t a l l U s e r L i s t . t x t "                         $ a l l U s e r L i s t   =   G e t - C o n t e n t   . r e s u l t a l l U s e r L i s t . t x t                   } e l s e {                         W r i t e - H o s t   " a l l U s e r L i s t . t x t , E X I T "                         r e t u r n   $ f a l s e                 }         }         $ s u c U s e r L i s t   =   N e w - O b j e c t   S y s t e m . C o l l e c t i o n s . A r r a y L i s t         $ f a i U s e r L i s t   =   N e w - O b j e c t   S y s t e m . C o l l e c t i o n s . A r r a y L i s t
        $ s u c S P N L i s t   =   N e w - O b j e c t   S y s t e m . C o l l e c t i o n s . A r r a y L i s t         $ f a i S P N L i s t   =   N e w - O b j e c t   S y s t e m . C o l l e c t i o n s . A r r a y L i s t         $ a l l U s e r A n d S P N L i s t   =   N e w - O b j e c t   S y s t e m . C o l l e c t i o n s . A r r a y L i s t         f o r e a c h   ( $ n u m   i n   1 . . $ a l l U s e r L i s t . c o u n t ) {                 #                   $ S P N S t r   =   " w e a k P a s s w o r d T e s t / J C - I S D e v i l "   +   $ n u m                 $ u s e r S t r   =   $ a l l U s e r L i s t [ $ n u m - 1 ]                 $ a l l U s e r A n d S P N L i s t . a d d ( $ u s e r S t r   +   " | # | "   +   $ S P N S t r )   |   O u t - N u l l                 #                   #   使 I n v o k e - E x p r e s s i o n                 # I n v o k e - E x p r e s s i o n   $ s e t S t r                 #   r e d i r e c t   e r r o r   s t r e a m ( 2 )   t o   s u c c e s s   s t r e a m ( 1 )                 s e t s p n   - S   $ S P N S t r   - U   $ u s e r S t r   2 > & 1   |   O u t - N u l l                 i f   ( $ ?   - c o n t a i n s   " T r u e " ) {                         W r i t e - H o s t   - F o r e g r o u n d C o l o r   G r e e n   " + "   $ u s e r S t r   " "                         $ s u c U s e r L i s t . a d d ( $ u s e r S t r )   |   O u t - N u l l                         $ s u c S P N L i s t . a d d ( $ S P N S t r )   |   O u t - N u l l                 } e l s e {                         W r i t e - H o s t   - F o r e g r o u n d C o l o r   R e d   " - "   $ u s e r S t r   " "                         $ f a i U s e r L i s t . a d d ( $ u s e r S t r ) | O u t - N u l l                 }                 #                     #   R e a d - H o s t         }         W r i t e - H o s t   " u s e r S P N . r e s u l t a l l U s e r A n d S P N L i s t . t x t "         $ a l l U s e r A n d S P N L i s t   |   O u t - F i l e   " . r e s u l t a l l U s e r A n d S P N L i s t . t x t "         W r i t e - H o s t   " S P N . r e s u l t s u c U s e r L i s t . t x t "         $ s u c U s e r L i s t   |   O u t - F i l e   " . r e s u l t s u c U s e r L i s t . t x t "         W r i t e - H o s t   " S P N S P N . r e s u l t s u c S P N L i s t . t x t "         $ s u c S P N L i s t   |   O u t - F i l e   " . r e s u l t s u c S P N L i s t . t x t "         W r i t e - H o s t   " S P N . r e s u l t f a i U s e r L i s t . t x t "         $ f a i U s e r L i s t   |   O u t - F i l e   " . r e s u l t f a i U s e r L i s t . t x t "         r e t u r n   $ s u c U s e r L i s t , $ s u c S P N L i s t , $ f a i U s e r L i s t } f u n c t i o n   D e l - S P N {         P a r a m (                 [ S y s t e m . C o l l e c t i o n s . A r r a y L i s t ]   $ s u c S P N L i s t A ,                 [ S y s t e m . C o l l e c t i o n s . A r r a y L i s t ]   $ s u c U s e r L i s t A         )         i f   ( $ s u c S P N L i s t A   - e q   $ n u l l   - o r   $ s u c U s e r L i s t A   - e q   $ n u l l ) {                 i f ( T e s t - P a t h   ' . r e s u l t s u c S P N L i s t . t x t '   - a n d   T e s t - P a t h   " . r e s u l t s u c U s e r L i s t . t x t " ) {                         W r i t e - H o s t   " s u c S P N L i s t . t x t s u c U s e r L i s t . t x t "                         $ s u c S P N L i s t A   =   G e t - C o n t e n t   . r e s u l t s u c S P N L i s t . t x t                             $ s u c U s e r L i s t A   =   G e t - C o n t e n t   . r e s u l t s u c U s e r L i s t . t x t                   } e l s e {                         W r i t e - H o s t   " E X I T "                         r e t u r n   $ f a l s e                 }         }         i f   ( $ s u c S P N L i s t A . c o u n t   - n e   $ s u c U s e r L i s t A . c o u n t ) {                 W r i t e - H o s t   " S P N E X I T "                 r e t u r n   $ f a l s e         }         i f   ( $ s u c S P N L i s t A . c o u n t   - e q   0   - O R   $ s u c U s e r L i s t A . c o u n t   - e q   0 ) {                 W r i t e - H o s t   " E X I T "                 r e t u r n   $ f a l s e         }
        }         f o r e a c h   ( $ s p n S t r   i n   $ s u c S P N L i s t A ) {                 s e t s p n   - D   $ s p n S t r   $ s u c U s e r L i s t A [ $ s u c S P N L i s t A . i n d e x o f ( $ s p n S t r ) ]   2 > & 1   | O u t - N u l l                 i f ( $ ?   - c o n t a i n s   " T r u e " )   {                         W r i t e - H o s t   " "                 } e l s e {                         W r i t e - H o s t   " "                 }         }         W r i t e - H o s t   " " } #   访 S P N T G S S T , H a s h k r b s t H a s h . t x t f u n c t i o n   G e t - S e r v i c e T i c k e t {         P a r a m (                 [ S t r i n g ]   $ k r b s t H a s h F i l e N a m e         )         I m p o r t - M o d u l e   . / k e r b e r o a s t / I n v o k e - K e r b e r o a s t . p s 1         #   S e t - C o n t e n t   A N S I O u t - F i l e   U n i c o d e         I n v o k e - K e r b e r o a s t   - O u t p u t F o r m a t   H a s h c a t | s e l e c t   h a s h | % { $ _ . H a s h } | O u t - F i l e   $ k r b s t H a s h F i l e N a m e   - E n c o d i n g   a s c i i } #   t g s c r a c k f u n c t i o n   C r a c k - S e r v i c e T i c k e t {         P a r a m (                 [ S t r i n g ]   $ k r b s t H a s h F i l e N a m e ,                 [ S t r i n g ]   $ p a s s w d D i c t F i l e N a m e         )         W r i t e - H o s t   " i n g . . . . . . . "         i f ( ( T e s t - P a t h   $ k r b s t H a s h F i l e N a m e )   - a n d   ( T e s t - P a t h   $ p a s s w d D i c t F i l e N a m e ) ) {                 . h a s h c a t h a s h c a t 6 4 . e x e   - m   1 3 1 0 0   - a   0   $ k r b s t H a s h F i l e N a m e   $ p a s s w d D i c t F i l e N a m e   - o   " . s u c c e e d . t x t "   - - f o r c e                 i f ( T e s t - P a t h   " . r e s u l t s u c c e e d . t x t " ) {                         $ h a s h A n d P a s s w d L i s t   =   G e t - C o n t e n t   " . r e s u l t s u c c e e d . t x t "                         $ u s e r A n d P a s s w d L i s t   =   N e w - O b j e c t   S y s t e m . C o l l e c t i o n s . A r r a y L i s t                         f o r e a c h ( $ i t e m   i n   $ h a s h A n d P a s s w d L i s t ) {                                 $ u s e r S t r   =   ( $ i t e m . s p l i t ( " $ " ) [ 3 ] ) . s p l i t ( " * " ) [ 1 ]                                 $ p a s s w d S t r   =   $ i t e m . s p l i t ( " : " ) [ 1 ]                                 $ u s e r A n d P a s s w d   =   $ u s e r S t r   +   " | # | "   +   $ p a s s w d S t r                                 W r i t e - H o s t   - F o r e g r o u n d C o l o r   G r e e n   " + "   $ u s e r A n d P a s s w d                                 $ u s e r A n d P a s s w d L i s t . a d d ( $ u s e r A n d P a s s w d )   |   O u t - N u l l                         }                 } e l s e {                         W r i t e - H o s t   " "                         r e t u r n   $ f a l s e                 }         } e l s e {                 W r i t e - H o s t   " E X I T "                 r e t u r n   $ f a l s e         }         W r i t e - H o s t   " . r e s u l t u s e r A n d P a s s w d L i s t . t x t "         $ u s e r A n d P a s s w d L i s t   |   O u t - F i l e   " . r e s u l t u s e r A n d P a s s w d L i s t . t x t " } f u n c t i o n   L D A P C h e c k {         W r i t e - H o s t   - F o r e g r o u n d C o l o r   Y e l l o w   " 使 "         $ t m p F i l e   =   " . / r e s u l t / t m p P a s s w d . t x t "         i f ( T e s t - P a t h   " . / r e s u l t / u s e r A n d P a s s w d L i s t . t x t " ) {                 G e t - C o n t e n t   . r e s u l t u s e r A n d P a s s w d L i s t . t x t | % { $ _ . s p l i t ( ' | # | ' ) [ 3 ] } | s o r t   - U n i q u e   |   O u t - F i l e   - E n c o d i n g   a s c i i   $ t m p F i l e         } e l s e {                 W r i t e - H o s t   - F o r e g r o u n d C o l o r   Y e l l o w   " r e s u l t t m p P a s s w d . t x t "
                W r i t e - H o s t   - F o r e g r o u n d C o l o r   Y e l l o w   " r e s u l t t m p P a s s w d . t x t "                 b r e a k         }         i f ( T e s t - P a t h   $ t m p F i l e ) {                 I m p o r t - M o d u l e   . / k e r b e r o a s t / D o m a i n P a s s w o r d S p r a y . p s 1                 I n v o k e - D o m a i n P a s s w o r d S p r a y   - P a s s w o r d L i s t   $ t m p F i l e   - O   " L D A P C h e c k R e s u l t . t x t "         } } #   i f ( - N o t   ( T e s t - P a t h   " . r e s u l t " ) ) {         N e w - I t e m   - I t e m T y p e   D i r e c t o r y   " r e s u l t " } #   m e n u $ k r b s t H a s h F i l e   =   " . k r b s t H a s h . t x t " $ p a s s w d D i c t F i l e   =   " . D i c t s J C P a s s w d . t x t " D o   {         W r i t e - H o s t   " = = = = = = d o m a i n A c o u n t C h e c k = = = = = = "         W r i t e - H o s t   " | |             A u t h o r : J C                     | | "         W r i t e - H o s t   " | |             V e r s i o n : 2 . 0 . 1             | | "         W r i t e - H o s t   " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = "         W r i t e - H o s t   " = = =                                       = = = "         W r i t e - H o s t   " |   1   "         W r i t e - H o s t   " |   2   S P N "         W r i t e - H o s t   " |   3   S P N H a s h "         W r i t e - H o s t   " |   4   H a s h "         W r i t e - H o s t   " |   5   S P N "         W r i t e - H o s t   " |   6   使 S P N L D A P "         W r i t e - H o s t   " |   7   "         W r i t e - H o s t   " |   0   E X I T "         $ c h o i c e   =   R e a d - H o s t   " ` n > > "         s w i t c h ( $ c h o i c e ) {                 1   {                         W r i t e - H o s t   " "                         $ a l l U s e r L i s t   =   G e t - U s e r L i s t                         b r e a k                 }                 2   {                         R e a d - H o s t   " S P N "                         $ s u c U s e r L i s t , $ s u c S P N L i s t , $ f a i U s e r L i s t   =   S e t - S P N   $ a l l U s e r L i s t                         b r e a k                 }                 3   {                         G e t - S e r v i c e T i c k e t   $ k r b s t H a s h F i l e                         b r e a k                         }                 4   {                         C r a c k - S e r v i c e T i c k e t   $ k r b s t H a s h F i l e   $ p a s s w d D i c t F i l e                         b r e a k                 }                 5   {                         R e a d - H o s t   " S P N S P N "                         D e l - S P N   $ s u c S P N L i s t   $ s u c U s e r L i s t                         b r e a k                 }                 6   {                         L D A P C h e c k                         b r e a k                 }
G i t H u b : h t t p s : / / g i t h u b . c o m / c h r o b l e r t / d o m a i n W e a k P a s s w d C h e c k 0 x 0 4   使 使 d i c t s / J C P a s s w d . t x t p o w e r s h e l l                 7   {                         #   1 .                           W r i t e - H o s t   " "                         $ a l l U s e r L i s t   =   G e t - U s e r L i s t                         #   2 .   S P N                         R e a d - H o s t   " S P N "                         $ s u c U s e r L i s t , $ s u c S P N L i s t , $ f a i U s e r L i s t   =   S e t - S P N   $ a l l U s e r L i s t                         #   3 .   访 S P N S T , h a s h c a t k r b s t H a s h . t x t                         G e t - S e r v i c e T i c k e t   $ k r b s t H a s h F i l e                         #   4 .   使 h a s h c a t S T h a s h                         C r a c k - S e r v i c e T i c k e t   $ k r b s t H a s h F i l e   $ p a s s w d D i c t F i l e                         #   5 .   S P N                         R e a d - H o s t   " S P N S P N "                         D e l - S P N   $ s u c S P N L i s t   $ s u c U s e r L i s t                         b r e a k                 }                 0   {                                 W r i t e - H o s t   " r e s u l t "                         r e t u r n   $ f a l s e                         b r e a k                 }                 d e f a u l t   { " ` n " }         } } W h i l e ( $ t r u e )
* j e r r y b i r d F r e e B u f . C O M

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则