[17927] 2021-05-09_用Python构建PE文件

文档创建者:s7ckTeam
浏览次数:2
最后更新:2025-01-18
2021-05-09_用Python构建PE文件 P y t h o n P E   w 8 a y   H a c k i n g   2 0 2 1 - 0 5 - 0 9 P y t h o n P E P E 使 P y t h o n 3 P E 仿 c s s h e l l c o d e . m d   -     ( h a c k i n g 8 . c o m ) 1 .   p e D O S   M Z W i n d o w s   3 . 1   N E P E P E 2 .   E X E D l l 使 P E E X E D L L     P E + S h e l l C o d e P E P y t h o n P E W i n d o w s   u n s i g n e d   s h o r t   2 b y t e   u n s i g n e d   l o n g     4 b y t e   u n s i g n e d   l o n g   l o n g   8 b y t e w i n n t . h I m a g e   F o r m a t s t r u c t < H L Q
m s f s h e l l c o d e $   m s f v e n o m   - a   x 8 6   - p   w i n d o w s / e x e c   C M D = " c a l c "   - f   p y t h o n [ - ]   N o   p l a t f o r m   w a s   s e l e c t e d ,   c h o o s i n g   M s f : : M o d u l e : : P l a t f o r m : : W i n d o w s   f r o m   t h e   p a y l o a d N o   e n c o d e r   s p e c i f i e d ,   o u t p u t t i n g   r a w   p a y l o a d P a y l o a d   s i z e :   1 8 9   b y t e s F i n a l   s i z e   o f   p y t h o n   f i l e :   9 3 2   b y t e s b u f   =     b " " b u f   + =   b " x f c x e 8 x 8 2 x 0 0 x 0 0 x 0 0 x 6 0 x 8 9 x e 5 x 3 1 x c 0 x 6 4 x 8 b " b u f   + =   b " x 5 0 x 3 0 x 8 b x 5 2 x 0 c x 8 b x 5 2 x 1 4 x 8 b x 7 2 x 2 8 x 0 f x b 7 " b u f   + =   b " x 4 a x 2 6 x 3 1 x f f x a c x 3 c x 6 1 x 7 c x 0 2 x 2 c x 2 0 x c 1 x c f " b u f   + =   b " x 0 d x 0 1 x c 7 x e 2 x f 2 x 5 2 x 5 7 x 8 b x 5 2 x 1 0 x 8 b x 4 a x 3 c " b u f   + =   b " x 8 b x 4 c x 1 1 x 7 8 x e 3 x 4 8 x 0 1 x d 1 x 5 1 x 8 b x 5 9 x 2 0 x 0 1 " b u f   + =   b " x d 3 x 8 b x 4 9 x 1 8 x e 3 x 3 a x 4 9 x 8 b x 3 4 x 8 b x 0 1 x d 6 x 3 1 " b u f   + =   b " x f f x a c x c 1 x c f x 0 d x 0 1 x c 7 x 3 8 x e 0 x 7 5 x f 6 x 0 3 x 7 d " b u f   + =   b " x f 8 x 3 b x 7 d x 2 4 x 7 5 x e 4 x 5 8 x 8 b x 5 8 x 2 4 x 0 1 x d 3 x 6 6 " b u f   + =   b " x 8 b x 0 c x 4 b x 8 b x 5 8 x 1 c x 0 1 x d 3 x 8 b x 0 4 x 8 b x 0 1 x d 0 " b u f   + =   b " x 8 9 x 4 4 x 2 4 x 2 4 x 5 b x 5 b x 6 1 x 5 9 x 5 a x 5 1 x f f x e 0 x 5 f " b u f   + =   b " x 5 f x 5 a x 8 b x 1 2 x e b x 8 d x 5 d x 6 a x 0 1 x 8 d x 8 5 x b 2 x 0 0 " b u f   + =   b " x 0 0 x 0 0 x 5 0 x 6 8 x 3 1 x 8 b x 6 f x 8 7 x f f x d 5 x b b x f 0 x b 5 " b u f   + =   b " x a 2 x 5 6 x 6 8 x a 6 x 9 5 x b d x 9 d x f f x d 5 x 3 c x 0 6 x 7 c x 0 a " b u f   + =   b " x 8 0 x f b x e 0 x 7 5 x 0 5 x b b x 4 7 x 1 3 x 7 2 x 6 f x 6 a x 0 0 x 5 3 " b u f   + =   b " x f f x d 5 x 6 3 x 6 1 x 6 c x 6 3 x 0 0 " #   p e P E p y t h o n p e i m p o r t   s t r u c t i m p o r t   t i m e M Z _ M A G I C   =   0 x 5 A 4 D P E _ M A G I C   =   0 x 4 5 5 0 I M A G E _ F I L E _ M A C H I N E _ I 3 8 6   =   0 x 0 1 4 c I M A G E _ S C N _ M E M _ E X E C U T E   =   0 x 2 0 0 0 0 0 0 0     #   S e c t i o n   i s   e x e c u t a b l e . I M A G E _ S C N _ M E M _ R E A D   =   0 x 4 0 0 0 0 0 0 0     #   S e c t i o n   i s   r e a d a b l e . I M A G E _ S C N _ M E M _ W R I T E   =   0 x 8 0 0 0 0 0 0 0     #   S e c t i o n   i s   w r i t e a b l e . I M A G E _ S C N _ C N T _ C O D E   =   0 x 0 0 0 0 0 0 2 0 I M A G E _ S C N _ C N T _ I N I T I A L I Z E D _ D A T A   =   0 x 0 0 0 0 0 0 4 0 c l a s s   D O S _ H E A D E R _ 3 2 ( o b j e c t ) :         ' ' '         D O S   m a g i c     e _ l f a n e w           ' ' '         e _ m a g i c   =   M Z _ M A G I C         e _ c b l p ,   e _ c p ,   e _ c r l c ,   e _ c p a r h d r ,   e _ m i n a l l o c ,   e _ m a x a l l o c ,   e _ s s ,   e _ s p ,           e _ c s u m ,   e _ i p ,   e _ c s ,   e _ l f a r l c ,   e _ o v n o ,   e _ r e s ,   e _ o e m i d ,           e _ o e m i n f o ,   e _ r e s 2 ,   e _ l f a n e w   =   [ 0 ]   *   1 8
        d e f   _ _ i n i t _ _ ( s e l f ) :                 s e l f . f m t   =   " < 3 0 H L "                 #     3 0 H ( u n s i g n e d   s h o r t   2 b y t e )   L ( u n s i g n e d   l o n g     4 b y t e )                 s e l f . e _ r e s   =   [ 0 ,   0 ,   0 ,   0 ]                 s e l f . e _ r e s 2   =   [ 0 ,   0 ,   0 ,   0 ,   0 ,   0 ,   0 ,   0 ,   0 ,   0 ]         d e f   r a w ( s e l f ) :                 r e t u r n   s t r u c t . p a c k ( s e l f . f m t ,   s e l f . e _ m a g i c ,   s e l f . e _ c b l p ,   s e l f . e _ c p ,                                                       s e l f . e _ c r l c ,   s e l f . e _ c p a r h d r ,   s e l f . e _ m i n a l l o c ,                                                       s e l f . e _ m a x a l l o c ,   s e l f . e _ s s ,   s e l f . e _ s p ,   s e l f . e _ c s u m ,                                                       s e l f . e _ i p ,   s e l f . e _ c s ,   s e l f . e _ l f a r l c ,   s e l f . e _ o v n o ,                                                       s e l f . e _ r e s [ 0 ] ,   s e l f . e _ r e s [ 1 ] ,   s e l f . e _ r e s [ 2 ] ,   s e l f . e _ r e s [ 3 ] ,                                                       s e l f . e _ o e m i d ,   s e l f . e _ o e m i n f o ,                                                       s e l f . e _ r e s 2 [ 0 ] ,   s e l f . e _ r e s 2 [ 1 ] ,   s e l f . e _ r e s 2 [ 2 ] ,   s e l f . e _ r e s 2 [ 3 ] ,                                                       s e l f . e _ r e s 2 [ 4 ] ,   s e l f . e _ r e s 2 [ 5 ] ,   s e l f . e _ r e s 2 [ 6 ] ,   s e l f . e _ r e s 2 [ 7 ] ,                                                       s e l f . e _ r e s 2 [ 8 ] ,   s e l f . e _ r e s 2 [ 9 ] ,   s e l f . e _ l f a n e w )         #   e _ l f a n e w         d e f   g e t P E O f f s e t ( s e l f ) :                 r e t u r n   s e l f . e _ l f a n e w         d e f   g e t S i z e ( s e l f ) :                 ' ' '                 D O S , S I Z E : 3 0 * 2 + 1 * 4 = 6 4                 : r e t u r n :                 ' ' '                 r e t u r n   s t r u c t . c a l c s i z e ( s e l f . f m t ) c l a s s   I M A G E _ N T _ H E A D E R _ 3 2 ( o b j e c t ) :         d e f   _ _ i n i t _ _ ( s e l f ) :                 s e l f . S i g n a t u r e   =   P E _ M A G I C                 s e l f . f i l e _ h e a d e r   =   s e l f . I M A G E _ F I L E _ H E A D E R ( )                 s e l f . o p t i o n a l _ h e a d e r   =   s e l f . I M A G E _ O P T I O N A L _ H E A D E R 3 2 ( )         d e f   g e t S i z e ( s e l f ) :                 ' ' '                 P E , S I Z E : 4 + 2 0 + 2 2 4 = 2 4 8                 : r e t u r n :                 ' ' '                 r e t u r n   4   +   s e l f . f i l e _ h e a d e r . g e t S i z e ( )   +   s e l f . o p t i o n a l _ h e a d e r . g e t S i z e ( )         d e f   r a w ( s e l f ) :                 r e t u r n   s t r u c t . p a c k ( " < L " ,   s e l f . S i g n a t u r e )   +   s e l f . f i l e _ h e a d e r . r a w ( )   +   s e l f . o p t i o n a l _ h e a d e r . r a w ( )         c l a s s   I M A G E _ F I L E _ H E A D E R :                 M a c h i n e ,                   N u m b e r O f S e c t i o n s ,                   T i m e D a t e S t a m p ,                   P o i n t e r T o S y m b o l T a b l e ,                   N u m b e r O f S y m b o l s ,                   S i z e O f O p t i o n a l H e a d e r ,                   C h a r a c t e r i s t i c s   =   I M A G E _ F I L E _ M A C H I N E _ I 3 8 6 ,   0 ,   0 ,   0 ,   0 ,   0 ,   0                 d e f   _ _ i n i t _ _ ( s e l f ) :                         s e l f . f m t   =   " < 2 H 3 L 2 H "                 d e f   g e t S i z e ( s e l f ) :                         ' ' '                         P E , S I Z E : 2 * 2 + 3 * 4 + 2 * 2 = 2 0                         : r e t u r n :                         ' ' '                         r e t u r n   s t r u c t . c a l c s i z e ( s e l f . f m t )                 d e f   r a w ( s e l f ) :                         r e t u r n   s t r u c t . p a c k ( s e l f . f m t ,   s e l f . M a c h i n e ,                                                               s e l f . N u m b e r O f S e c t i o n s ,                                                               s e l f . T i m e D a t e S t a m p ,                                                               s e l f . P o i n t e r T o S y m b o l T a b l e ,                                                               s e l f . N u m b e r O f S y m b o l s ,                                                               s e l f . S i z e O f O p t i o n a l H e a d e r ,                                                               s e l f . C h a r a c t e r i s t i c s )         c l a s s   I M A G E _ O P T I O N A L _ H E A D E R 3 2 :
        c l a s s   I M A G E _ O P T I O N A L _ H E A D E R 3 2 :                 M a g i c   =   0 x 1 0 b     #   3 2 0 x 1 0 B 6 4 0 x 2 0 B R O M 0 x 1 0 7                 M a j o r L i n k e r V e r s i o n   =   0                 M i n o r L i n k e r V e r s i o n   =   0                 S i z e O f C o d e   =   0     #   . t e x t F i l e A l i g n m e n t                 S i z e O f I n i t i a l i z e d D a t a   =   0                 S i z e O f U n i n i t i a l i z e d D a t a   =   0                 A d d r e s s O f E n t r y P o i n t   =   0     #   , R V A                 B a s e O f C o d e   =   0     #   , , R V A                 B a s e O f D a t a   =   0     #   , , R V A                 I m a g e B a s e   =   0     #   , 线 , R V A                 S e c t i o n A l i g n m e n t   =   0                 F i l e A l i g n m e n t   =   0                 M a j o r O p e r a t i n g S y s t e m V e r s i o n   =   0                 M i n o r O p e r a t i n g S y s t e m V e r s i o n   =   0                 M a j o r I m a g e V e r s i o n   =   0                 M i n o r I m a g e V e r s i o n   =   0                 M a j o r S u b s y s t e m V e r s i o n   =   4                 M i n o r S u b s y s t e m V e r s i o n   =   0                 W i n 3 2 V e r s i o n V a l u e   =   0                 S i z e O f I m a g e   =   0     #   P E                 S i z e O f H e a d e r s   =   0     #   D O S P E P E                 C h e c k S u m   =   0     #                   S u b s y s t e m   =   2     #   , N T P E W i n 3 2 :   W i n d o w s   G U I   W i n d o w s   C U I   ( )                 D l l C h a r a c t e r i s t i c s   =   0                 S i z e O f S t a c k R e s e r v e   =   0                 S i z e O f S t a c k C o m m i t   =   0                 S i z e O f H e a p R e s e r v e   =   0                 S i z e O f H e a p C o m m i t   =   0                 L o a d e r F l a g s   =   0                 N u m b e r O f R v a A n d S i z e s   =   0 x 1 0     #   D a t a D i r e c t o r y W i n d o w s   N T 1 6 - >   0 0   0 0   0 0   1 0                 D A T A _ D I R E C T O R Y   =   [ ]                 d e f   _ _ i n i t _ _ ( s e l f ) :                         s e l f . f m t   =   " < H B B 9 L 6 H 4 L 2 H 6 L "                 d e f   g e t S i z e ( s e l f ) :                         ' ' '                         S I Z E : 1 9 * 4 + 9 * 2 + 2 * 1 + 1 6 * 8 = 2 2 4                         : r e t u r n :                         ' ' '                         s e l f s i z e   =   s t r u c t . c a l c s i z e ( s e l f . f m t )                         f o r   i m a g e _ d a t a   i n   s e l f . D A T A _ D I R E C T O R Y :                                 s e l f s i z e   + =   i m a g e _ d a t a . g e t S i z e ( )                         r e t u r n   s e l f s i z e                 d e f   r a w ( s e l f ) :                         s e l f d a t a   =   s t r u c t . p a c k ( s e l f . f m t ,   s e l f . M a g i c ,                                                                       s e l f . M a j o r L i n k e r V e r s i o n ,                                                                       s e l f . M i n o r L i n k e r V e r s i o n ,                                                                       s e l f . S i z e O f C o d e ,                                                                       s e l f . S i z e O f I n i t i a l i z e d D a t a ,                                                                       s e l f . S i z e O f U n i n i t i a l i z e d D a t a ,                                                                       s e l f . A d d r e s s O f E n t r y P o i n t ,                                                                       s e l f . B a s e O f C o d e ,                                                                       s e l f . B a s e O f D a t a ,                                                                       s e l f . I m a g e B a s e ,                                                                       s e l f . S e c t i o n A l i g n m e n t ,                                                                       s e l f . F i l e A l i g n m e n t ,                                                                       s e l f . M a j o r O p e r a t i n g S y s t e m V e r s i o n ,                                                                       s e l f . M i n o r O p e r a t i n g S y s t e m V e r s i o n ,                                                                       s e l f . M a j o r I m a g e V e r s i o n ,                                                                       s e l f . M i n o r I m a g e V e r s i o n ,                                                                       s e l f . M a j o r S u b s y s t e m V e r s i o n ,                                                                       s e l f . M i n o r S u b s y s t e m V e r s i o n ,                                                                       s e l f . W i n 3 2 V e r s i o n V a l u e ,                                                                       s e l f . S i z e O f I m a g e ,                                                                       s e l f . S i z e O f H e a d e r s ,                                                                       s e l f . C h e c k S u m ,                                                                       s e l f . S u b s y s t e m ,                                                                       s e l f . D l l C h a r a c t e r i s t i c s ,                                                                       s e l f . S i z e O f S t a c k R e s e r v e ,                                                                       s e l f . S i z e O f S t a c k C o m m i t ,                                                                       s e l f . S i z e O f H e a p R e s e r v e ,
                                                                      s e l f . S i z e O f H e a p R e s e r v e ,                                                                       s e l f . S i z e O f H e a p C o m m i t ,                                                                       s e l f . L o a d e r F l a g s ,                                                                       s e l f . N u m b e r O f R v a A n d S i z e s )                         f o r   i m a g e _ d a t a   i n   s e l f . D A T A _ D I R E C T O R Y :                                 s e l f d a t a   + =   i m a g e _ d a t a . r a w ( )                         r e t u r n   s e l f d a t a         c l a s s   I M A G E _ D A T A _ D I R E C T O R Y :                 V i r t u a l A d d r e s s   =   0                 S i z e   =   0                 d e f   _ _ i n i t _ _ ( s e l f ) :                         p a s s                 d e f   r a w ( s e l f ) :                         r e t u r n   s t r u c t . p a c k ( " < 2 L " ,   s e l f . V i r t u a l A d d r e s s ,   s e l f . S i z e )                 d e f   g e t S i z e ( s e l f ) :                         r e t u r n   0 x 4   *   2 c l a s s   S e c t i o n :         d e f   _ _ i n i t _ _ ( s e l f ) :                 s e l f . f m t   =   " < L L L L L L H H L "                 s e l f . N a m e   =   " "                 s e l f . V i r t u a l S i z e   =   s e l f . V i r t u a l A d d r e s s   =   s e l f . S i z e O f R a w D a t a   =   s e l f . P o i n t e r T o R a w D a t a   =                           s e l f . P o i n t e r T o R e l o c a t i o n s   =   s e l f . P o i n t e r T o L i n e n u m b e r s   =                           s e l f . N u m b e r O f R e l o c a t i o n s   =   s e l f . N u m b e r O f L i n e n u m b e r s   =                           s e l f . C h a r a c t e r i s t i c s   =   0                 #   V i r t u a l S i z e   使 , P h y s i c a l A d d r e s s , .                 #   V i r t u a l A d d r e s s   R A V , R V A                 #   S i z e O f R a w D a t a   , , P E                 #   P o i n t e r T o R a w D a t a   , , P E         d e f   g e t S i z e ( s e l f ) :                 r e t u r n   s t r u c t . c a l c s i z e ( s e l f . f m t )   +   8         d e f   h a s ( s e l f ,   r v a ,   i m a g e b a s e = 0 ) :                 r e t u r n   ( s e l f . V i r t u a l A d d r e s s   +   i m a g e b a s e )   < =   r v a   <   ( s e l f . V i r t u a l A d d r e s s   +   s e l f . V i r t u a l S i z e   +   i m a g e b a s e         d e f   h a s O f f s e t ( s e l f ,   o f f s e t ) :                 r e t u r n   s e l f . P o i n t e r T o R a w D a t a   < =   o f f s e t   <   ( s e l f . P o i n t e r T o R a w D a t a   +   s e l f . V i r t u a l S i z e )         d e f   r a w ( s e l f ) :                 s e l f . N a m e   =   ( s e l f . N a m e   +   " x 0 0 "   *   ( 8   -   l e n ( s e l f . N a m e ) ) ) [ : 8 ]                 r e t u r n   s e l f . N a m e . e n c o d e ( )   +   s t r u c t . p a c k ( s e l f . f m t ,   s e l f . V i r t u a l S i z e ,                                                                                                 s e l f . V i r t u a l A d d r e s s ,   s e l f . S i z e O f R a w D a t a ,   s e l f . P o i n t e r T o R a w D a t a                                                                                                 s e l f . P o i n t e r T o R e l o c a t i o n s ,   s e l f . P o i n t e r T o L i n e n u m b e r s ,                                                                                                 s e l f . N u m b e r O f R e l o c a t i o n s ,   s e l f . N u m b e r O f L i n e n u m b e r s ,                                                                                                 s e l f . C h a r a c t e r i s t i c s ) c l a s s   I m p o r t D e s c r i p t o r :         d e f   _ _ i n i t _ _ ( s e l f ) :                 s e l f . f m t   =   " < L L L L L "                 s e l f . O r i g i n a l F i r s t T h u n k   =   s e l f . T i m e D a t e S t a m p   =   s e l f . F o r w a r d e r C h a i n   =   s e l f . N a m e   =                           s e l f . F i r s t T h u n k   =   0         d e f   r a w ( s e l f ) :                 r e t u r n   s t r u c t . p a c k ( s e l f . f m t ,   s e l f . O r i g i n a l F i r s t T h u n k ,   s e l f . T i m e D a t e S t a m p ,   s e l f . F o r w a r d e r C h a i n ,   s e l f . N a m e                                                       s e l f . F i r s t T h u n k )         d e f   g e t S i z e ( s e l f ) :                 r e t u r n   s t r u c t . c a l c s i z e ( s e l f . f m t ) #   t y p e d e f   s t r u c t   _ I M A G E _ T H U N K _ D A T A 3 2   { #           u n i o n   { #                   D W O R D   F o r w a r d e r S t r i n g ;             / /   P B Y T E         F u n c t i o n   =   0         d e f   g e t S i z e ( s e l f ) :                 r e t u r n   4         d e f   r a w ( s e l f ) :                 r e t u r n   s t r u c t . p a c k ( " < L " ,   s e l f . F u n c t i o n ) c l a s s   I m a g e I m p o r t B y N a m e :         d e f   _ _ i n i t _ _ ( s e l f ) :                 s e l f . f m t   =   " < H "                 s e l f . H i n t   =   0                 s e l f . N a m e   =   " "         d e f   g e t S i z e ( s e l f ) :                 s i z e   =   l e n ( s e l f . N a m e )   +   3     #   1   f o r   0   +   2   f o r   H i n t
                s i z e   =   l e n ( s e l f . N a m e )   +   3     #   1   f o r   0   +   2   f o r   H i n t                 i f   s i z e   %   2 :                         s i z e   + =   1     #   P a d d i n g                 r e t u r n   s i z e         d e f   r a w ( s e l f ) :                 r a w   =   s t r u c t . p a c k ( s e l f . f m t ,   s e l f . H i n t )   +   s e l f . N a m e . e n c o d e ( )   +   b " x 0 0 "                 i f   l e n ( r a w )   %   2 :                         r a w   + =   " 0 "     #   p a d d i n g                 r e t u r n   r a w d e f   a l i g n ( i d x ,   a l i g m e n t ) :         r e t u r n   ( i d x   +   a l i g m e n t )   &   ~ ( a l i g m e n t   -   1 ) d e f   d w o r d ( v ) :         r e t u r n   s t r u c t . p a c k ( " < L " ,   v ) i f   _ _ n a m e _ _   = =   ' _ _ m a i n _ _ ' :         l e n g t h   =   0         m z   =   D O S _ H E A D E R _ 3 2 ( )         m z . e _ l f a n e w   =   m z . g e t S i z e ( )         l e n g t h   + =   m z . g e t S i z e ( )         #   p e         p e   =   I M A G E _ N T _ H E A D E R _ 3 2 ( )         p e . f i l e _ h e a d e r . N u m b e r O f S e c t i o n s   =   1     #   s e c t i o n         p e . f i l e _ h e a d e r . T i m e D a t e S t a m p   =   i n t ( t i m e . t i m e ( ) )         p e . f i l e _ h e a d e r . C h a r a c t e r i s t i c s   =   1   +   2   +   4   +   2 5 6         #   r e f e r   h t t p s : / / b l o g . c s d n . n e t / q i m i n g _ z h a n g / a r t i c l e / d e t a i l s / 7 3 0 9 9 0 9 # 3 . 2 . 2         p e . o p t i o n a l _ h e a d e r . A d d r e s s O f E n t r y P o i n t   =   0 x 1 0 0 0         p e . o p t i o n a l _ h e a d e r . I m a g e B a s e   =   0 x 4 0 0 0 0 0         p e . o p t i o n a l _ h e a d e r . S e c t i o n A l i g n m e n t   =   0 x 1 0 0 0         p e . o p t i o n a l _ h e a d e r . F i l e A l i g n m e n t   =   0 x 2 0 0         f o r   i   i n   r a n g e ( p e . o p t i o n a l _ h e a d e r . N u m b e r O f R v a A n d S i z e s ) :                 p e . o p t i o n a l _ h e a d e r . D A T A _ D I R E C T O R Y . a p p e n d ( p e . I M A G E _ D A T A _ D I R E C T O R Y ( ) )         p e . f i l e _ h e a d e r . S i z e O f O p t i o n a l H e a d e r   =   p e . o p t i o n a l _ h e a d e r . g e t S i z e ( )         l e n g t h   + =   p e . g e t S i z e ( )         #   . t e x t   s e c t i o n         t e x t   =   S e c t i o n ( )         t e x t . N a m e   =   " . t e x t "         t e x t . C h a r a c t e r i s t i c s   =   I M A G E _ S C N _ C N T _ C O D E   |   I M A G E _ S C N _ M E M _ R E A D   |   I M A G E _ S C N _ M E M _ E X E C U T E         t e x t . V i r t u a l A d d r e s s   =   0 x 1 0 0 0         #   . r d a t a r a c t e r i s t i c s   =   I M A G E _ S C N _ C N T _ I N I T I A L I Z E D _ D A T A   |   I M A G E _ S C N _ M E M _ R E A D         l e n g t h   + =   t e x t . g e t S i z e ( )         #   p a d i n g         p e . o p t i o n a l _ h e a d e r . S i z e O f H e a d e r s   =   a l i g n ( l e n g t h ,   p e . o p t i o n a l _ h e a d e r . F i l e A l i g n m e n t )         p a d d i n g   =   ( p e . o p t i o n a l _ h e a d e r . S i z e O f H e a d e r s   -   l e n g t h )   *   b ' x 0 0 '         l e n g t h   =   p e . o p t i o n a l _ h e a d e r . S i z e O f H e a d e r s         #   t e x t         b u f   =   b " "         b u f   + =   b " x f c x e 8 x 8 2 x 0 0 x 0 0 x 0 0 x 6 0 x 8 9 x e 5 x 3 1 x c 0 x 6 4 x 8 b "         b u f   + =   b " x 5 0 x 3 0 x 8 b x 5 2 x 0 c x 8 b x 5 2 x 1 4 x 8 b x 7 2 x 2 8 x 0 f x b 7 "         b u f   + =   b " x 4 a x 2 6 x 3 1 x f f x a c x 3 c x 6 1 x 7 c x 0 2 x 2 c x 2 0 x c 1 x c f "         b u f   + =   b " x 0 d x 0 1 x c 7 x e 2 x f 2 x 5 2 x 5 7 x 8 b x 5 2 x 1 0 x 8 b x 4 a x 3 c "         b u f   + =   b " x 8 b x 4 c x 1 1 x 7 8 x e 3 x 4 8 x 0 1 x d 1 x 5 1 x 8 b x 5 9 x 2 0 x 0 1 "         b u f   + =   b " x d 3 x 8 b x 4 9 x 1 8 x e 3 x 3 a x 4 9 x 8 b x 3 4 x 8 b x 0 1 x d 6 x 3 1 "         b u f   + =   b " x f f x a c x c 1 x c f x 0 d x 0 1 x c 7 x 3 8 x e 0 x 7 5 x f 6 x 0 3 x 7 d "         b u f   + =   b " x f 8 x 3 b x 7 d x 2 4 x 7 5 x e 4 x 5 8 x 8 b x 5 8 x 2 4 x 0 1 x d 3 x 6 6 "         b u f   + =   b " x 8 b x 0 c x 4 b x 8 b x 5 8 x 1 c x 0 1 x d 3 x 8 b x 0 4 x 8 b x 0 1 x d 0 "         b u f   + =   b " x 8 9 x 4 4 x 2 4 x 2 4 x 5 b x 5 b x 6 1 x 5 9 x 5 a x 5 1 x f f x e 0 x 5 f "         b u f   + =   b " x 5 f x 5 a x 8 b x 1 2 x e b x 8 d x 5 d x 6 a x 0 1 x 8 d x 8 5 x b 2 x 0 0 "         b u f   + =   b " x 0 0 x 0 0 x 5 0 x 6 8 x 3 1 x 8 b x 6 f x 8 7 x f f x d 5 x b b x f 0 x b 5 "         b u f   + =   b " x a 2 x 5 6 x 6 8 x a 6 x 9 5 x b d x 9 d x f f x d 5 x 3 c x 0 6 x 7 c x 0 a "         b u f   + =   b " x 8 0 x f b x e 0 x 7 5 x 0 5 x b b x 4 7 x 1 3 x 7 2 x 6 f x 6 a x 0 0 x 5 3 "         b u f   + =   b " x f f x d 5 x 6 3 x 6 1 x 6 c x 6 3 x 0 0 "         s e c t i o n _ t e x t   =   b u f         t e x t . V i r t u a l S i z e   =   l e n ( s e c t i o n _ t e x t )         t e x t . S i z e O f R a w D a t a   =   a l i g n ( t e x t . V i r t u a l S i z e ,   p e . o p t i o n a l _ h e a d e r . S e c t i o n A l i g n m e n t )         t e x t . P o i n t e r T o R a w D a t a   =   l e n g t h
        t e x t . P o i n t e r T o R a w D a t a   =   l e n g t h         s e c t i o n _ t e x t   + =   b " x 0 0 "   *   ( t e x t . S i z e O f R a w D a t a   -   l e n ( s e c t i o n _ t e x t ) )         l e n g t h   + =   l e n ( s e c t i o n _ t e x t )         #           p e . o p t i o n a l _ h e a d e r . S i z e O f I m a g e   =   a l i g n ( l e n g t h ,                                                                                       p e . o p t i o n a l _ h e a d e r . S e c t i o n A l i g n m e n t )     #   / /   I m a g e , P E S e c t i o n A l i g n m e n t         #           c o d e   =   b " "         c o d e   + =   m z . r a w ( )         c o d e   + =   p e . r a w ( )         #   s e c t i o n         c o d e   + =   t e x t . r a w ( )         c o d e   + =   p a d d i n g         #   s e c t i o n         c o d e   + =   s e c t i o n _ t e x t         p r i n t ( c o d e )         w i t h   o p e n ( " t e s t . e x e " ,   " w b " )   a s   f :                 f . w r i t e ( c o d e ) P E 0 s e c t i o n t e x t s h e l l c o d e ( 3 2 ) P E k b s e c t i o n t e x t . S i z e O f R a w D a t a   =   a l i g n ( t e x t . V i r t u a l S i z e ,   p e . o p t i o n a l _ h e a d e r . S e c t i o n A l i g n m e n t ) S i z e O f R a w D a t a   S e c t i o n A l i g n m e n t S e c t i o n A l i g n m e n t S e c t i o n A l i g n m e n t l o r d P E P E P E D O S _ H E A D E R _ 3 2 ( ) I M A G E _ N T _ H E A D E R _ 3 2 ( ) s e c t i o n t e x t . S i z e O f R a w D a t a
( s e c t i o n ) t e x t l o r d P E   ( P E ) S e c t i o n A l i g n m e n t s i z e o f i m a g e s i z e O f I m a g e p e . o p t i o n a l _ h e a d e r . S i z e O f I m a g e   =   p e . o p t i o n a l _ h e a d e r . S i z e O f H e a d e r s   +   a l i g n ( t e x t . S i z e O f R a w D a t a , p e . o p t i o n a l _ h e a d e r   x 8 6   P E   +   使 s h e l l c o d e A P I p y t h o n 3 u t f - 8   a n s i   u t f 1 6 s i z e o f i m a g e x 0 0 M e s s a g e B o x A a n s i M e s s a g e B o x W u t f - 1 6 " " . . e n c o d e ( " m b c s " ) . e n c o d e ( " U T F - 1 6 " )
x 8 6   1 k b   ( 5 1 2 ) d l l i m p o r t e r   =   {         " u s e r 3 2 . d l l " :   [ " M e s s a g e B o x A " ] ,         " k e r n e l 3 2 . d l l " :   [ " E x i t P r o c e s s " ] } C o n s t S t r i n g   =   {         " t i t l e " :   " " ,         " m s g " :   " ~ " } i m p o r t e r d l l C o n s t S t r i n g   t e x t s e c t i o n _ t e x t   =   b " " s e c t i o n _ t e x t   + =   b " x 6 a x 4 0 " s e c t i o n _ t e x t   + =   b " x 6 8 "   +   r e p l a c e T a b l e [ " t i t l e " ]     #   c c c c c c 0 1     t i t l e s e c t i o n _ t e x t   + =   b " x 6 8 "   +   r e p l a c e T a b l e [ " m s g " ]     #   c c c c c c 0 2     m s g s e c t i o n _ t e x t   + =   b " x 6 a x 0 0 " s e c t i o n _ t e x t   + =   b " x f f x 1 5 "   +   r e p l a c e T a b l e [ " M e s s a g e B o x A " ]     #   c c c c c c 0 3   m e s s a g e b o x #   p u s h   4 0           / /   s t y l e #   p u s h   t i t l e s e c t i o n _ t e x t   + =   b " x 6 a x 0 0 " s e c t i o n _ t e x t   + =   b " x f f x 1 5 "   +   r e p l a c e T a b l e [ " E x i t P r o c e s s " ]     #   c c c c c c 0 4   e x i t p r o c e s s #   p u s h   0 #   c a l l   e x i t p r o c e s s
p e p y t h o n p e   ( g i t h u b . c o m )   x 6 4   +   3 2 6 4 P E h e a d e r t y p e d e f   s t r u c t   _ I M A G E _ N T _ H E A D E R S 6 4   {         D W O R D   S i g n a t u r e ;         I M A G E _ F I L E _ H E A D E R   F i l e H e a d e r ;         I M A G E _ O P T I O N A L _ H E A D E R 6 4   O p t i o n a l H e a d e r ; }   I M A G E _ N T _ H E A D E R S 6 4 ,   * P I M A G E _ N T _ H E A D E R S 6 4 ; t y p e d e f   s t r u c t   _ I M A G E _ N T _ H E A D E R S           D W O R D   S i g n a t u r e ;         I M A G E _ F I L E _ H E A D E R   F i l e H e a d e r ;         I M A G E _ O P T I O N A L _ H E A D E R 3 2   O p t i o n a l H e a d e r ; }   I M A G E _ N T _ H E A D E R S 3 2 ,   * P I M A G E _ N T _ H E A D E R S 3 2 ; t y p e d e f   s t r u c t   _ I M A G E _ T H U N K _ D A T A 6 4   {         u n i o n   {                 U L O N G L O N G   F o r w a r d e r S t r i n g ;     / /   P B Y T E                   U L O N G L O N G   F u n c t i o n ;                   / /   P D W O R D                 U L O N G L O N G   O r d i n a l ;                 U L O N G L O N G   A d d r e s s O f D a t a ;         / /   P I M A G E _ I M P O R T _ B Y _ N A M E         }   u 1 ; }   I M A G E _ T H U N K _ D A T A 6 4 ; t y p e d e f   I M A G E _ T H U N K _ D A T A 6 4   *   P I M A G E _ T H U N K _ D A T A 6 4 ; # i n c l u d e   " p o p p a c k . h "                                                         u n i o n   {                 D W O R D   F o r w a r d e r S t r i n g ;             / /   P B Y T E                   D W O R D   F u n c t i o n ;                           / /   P D W O R D                 D W O R D   O r d i n a l ;                 D W O R D   A d d r e s s O f D a t a ;                 / /   P I M A G E _ I M P O R T _ B Y _ N A M E         }   u 1 ; }   I M A G E _ T H U N K _ D A T A 3 2 ; t y p e d e f   I M A G E _ T H U N K _ D A T A 3 2   *   P I M A G E _ T H U N K _ D A T A 3 2 ; x 6 4   c a l l x 6 4 3 2 A P I s t d c a l l A P I E S P M e s s a g e B o x a d d   e s p , 1 4 h M e s s a g e B o x x 6 4   c a l l h t t p s : / / b b s . p e d i y . c o m / t h r e a d - 4 3 9 6 7 . h t m h t t p s : / / b b s . p e d i y . c o m / t h r e a d - 2 5 4 2 6 5 . h t m ( x 6 4 )   h t t p s : / / g i s t . g i t h u b . c o m / b o y - h a c k / d b f e f 2 a 3 e f f 6 b 7 b 0 0 7 9 1 f 6 a 9 7 1 4 b 8 a e a w i n 6 4 T r u e 6 4
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则