
    5i                     x    d dl Z d dlT d dlmZ d Z G d de j                  Zd Zedk    r e             dS dS )	    N)*)hexdumpc                    t          | t                    r| S t          | t                    r| d d                                         dk    rt          | dd          d          S | d d                                         dk    rt          | dd          d          S t          |           S t	          dt          |           z            )N   0x   0bzUnknown integer format! %s)
isinstanceintstrlower	Exceptiontype)xs    L/home/kali/Ninja/venv/lib/python3.11/site-packages/minidump/minidumpshell.pyargs2intr      s    q# :	
(C 	:rrU[[]]d
aeR..!u{{}}
aeQ--
a&&= 	.a8999    c                       e Zd ZdZdZdZdZdZd Zd Z	d Z
d Zd	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd ZdS )MinidumpShellzBWelcome to the minidump shell.   Type help or ? to list commands.
z[minidump] Nr   c                     t                               |          | _        | j                                                                        | _        dS )zOpens minidump fileN)MinidumpFileparsemini
get_readerget_buffered_readerreader)selffilenames     r   do_openzMinidumpShell.do_open   s<      **$)	$$&&::<<$+++r   c                 n    | j         j        (t          t          | j         j                             dS dS )z$Shows PEB information (if available)N)r   pebprintr   r   argss     r   do_pebzMinidumpShell.do_peb    s4    	Y]TY]		 r   c                 6   | j         j        &t          t          | j         j                             | j         j        &t          t          | j         j                             | j         j        (t          t          | j         j                             dS dS )z+Lists all thread information (if available)N)r   threadsr"   r   
threads_exthread_infor#   s     r   
do_threadszMinidumpShell.do_threads%   s    	Y"TY		   	Y%TY!	"	"###	Y&TY"	#	#$$$$$ '&r   c                 6   | j         j        &t          t          | j         j                             | j         j        &t          t          | j         j                             | j         j        (t          t          | j         j                             dS dS )zLists all memory segmentsN)r   memory_segmentsr"   r   memory_segments_64memory_infor#   s     r   	do_memoryzMinidumpShell.do_memory.   s    	Y*TY&	'	'(((	Y!-TY)	*	*+++	Y&TY"	#	#$$$$$ '&r   c                     | j         j        &t          t          | j         j                             | j         j        (t          t          | j         j                             dS dS )z?Lists all loaded and unloaded module information (if available)N)r   modulesr"   r   unloaded_modulesr#   s     r   
do_moduleszMinidumpShell.do_modules7   s\    	Y"TY		   	Y+TY'	(	())))) ,+r   c                 n    | j         j        (t          t          | j         j                             dS dS )zShows sysinfo (if available)N)r   sysinfor"   r   r#   s     r   
do_sysinfozMinidumpShell.do_sysinfo>   6    	Y"TY		      #"r   c                 n    | j         j        (t          t          | j         j                             dS dS )z*Shows exception information (if available)N)r   	exceptionr"   r   r#   s     r   do_exceptionzMinidumpShell.do_exceptionC   6    	Y$TY 	!	!""""" %$r   c                     | j         j        &t          t          | j         j                             | j         j        (t          t          | j         j                             dS dS )zLists all comments (if any)N)r   	comment_ar"   r   	comment_wr#   s     r   do_commentszMinidumpShell.do_commentsH   s\    	Y$TY 	!	!"""	Y$TY 	!	!""""" %$r   c                 n    | j         j        (t          t          | j         j                             dS dS )z Lists all handles (if available)N)r   handlesr"   r   r#   s     r   
do_handleszMinidumpShell.do_handlesO   r7   r   c                 n    | j         j        (t          t          | j         j                             dS dS )z+Lists all miscellaneous info (if available)N)r   	misc_infor"   r   r#   s     r   do_misczMinidumpShell.do_miscT   r;   r   c                     dS )QuitT r#   s     r   do_quitzMinidumpShell.do_quitZ   s    	r   c                 ,    |                      d          S rG   NrI   r#   s     r   do_exitzMinidumpShell.do_exit]       	d		r   c                 ,    |                      d          S rK   rL   r#   s     r   do_qzMinidumpShell.do_q`   rN   r   c                 .    t          |          | _        dS )zIChanges the hexdump print size to the given bytes/line size (default: 16)N)r   hexdump_size)r   	printsizes     r   do_printsizezMinidumpShell.do_printsizee   s    y))$r   c                     | j                                         }| j         j        j        }||z
  }dt	          |          dt	          |          dt	          |          d| _        d S )N[ +z] )r   tellcurrent_segmentstart_addresshexprompt)r   r$   poscurrent_segment_startsegment_relative_positions        r   update_promptzMinidumpShell.update_prompti   sl    #+5C!$99!$S3/D+E+E+E+EsKdGeGeGeGef$+++r   c                     | j                                         }|t          d           t          t          |                     dS )zIShows/refreshes the current position in the process' virtual memory spaceNzRReader not yet positioned! Issue a "move" command with the desired memory address!)r   rY   r"   r\   )r   r$   r   s      r   do_tellzMinidumpShell.do_tello   s>    
k!Y	]^^^A-----r   c                     t          |          }| j                            |           |                     d           dS )z>Sets the current position in the process' virtual memory spaceN)r   r   movera   )r   positionr^   s      r   do_movezMinidumpShell.do_movev   s?    #+3Tr   c                     t          |          }| j                                        }| j                            |          }t	          t          || j        d|                     |                     d           dS )zePerforms a read of 'count' bytes from the current position and updates the cursor with the bytes read.lengthsepstartN)r   r   rY   readr"   r   rR   ra   r   count
pos_beforedatas       r   do_readzMinidumpShell.do_read|   q    
5//%{!!*			%	 	 $d/S*MMMNNNTr   c                     | j                                         }t          d|z             t          dt          |          z             |                     d           dS )zReads a signed integer starting the current position and updates the cursor with the bytes read. The integer size is determined automatically by the processor architecture information from the dump fileD: %sH: %sN)r   read_intr"   r\   ra   r   r$   rr   s      r   do_readizMinidumpShell.do_readi   sZ    					$$#d))Tr   c                     | j                                         }t          d|z             t          dt          |          z             |                     d           dS )zReads an unsigned integer starting the current position and updates the cursor with the bytes read. The integer size is determined automatically by the processor architecture information from the dump filerv   rw   N)r   	read_uintr"   r\   ra   ry   s      r   	do_readuizMinidumpShell.do_readui   sZ    				 	 $$#d))Tr   c                     t          |          }| j                                        }| j                            |          }t	          t          || j        d|                     |                     d           dS )zYPerforms a read of 'count' bytes from the current position but doesn't update the cursor.ri   rj   N)r   r   rY   peekr"   r   rR   ra   ro   s       r   do_peekzMinidumpShell.do_peek   rt   r   )__name__
__module____qualname__intror]   r   r   rR   r   r%   r*   r/   r3   r6   r:   r?   rB   rE   rI   rM   rP   rT   ra   rc   rg   rs   rz   r}   r   rH   r   r   r   r      sk       
O


= = =
  
% % %% % %* * *! ! !
# # #
# # #! ! !
# # #      
* * *g g g              r   r   c                     dd l } |                     d          }|                    ddd           |                                }t	                      }|j        r|                    |j                   |                                 d S )Nr   zA parser for minidumnp files)descriptionz-fz--minidumpfilez&path to the minidump file of lsass.exe)help)argparseArgumentParseradd_argument
parse_argsr   minidumpfiler   cmdloop)r   parserr$   shells       r   mainr      s    

!
!.L
!
M
MT+2Z[[[	 #--!"""r   __main__)	cmdminidump.minidumpfileminidump.common_structsr   r   Cmdr   r   r   rH   r   r   <module>r      s    



 # # # # + + + + + +: : :D D D D DCG D D DN
 
 
 z r   