
    ,j                     N    d dl Z d dlZd dlmZ d dlmZ d dlmZ  G d de      Zy)    N)General)run)Loggerc                   N     e Zd ZdZdZddeddf fdZd Zd Zd	 Z	 fd
Z
 xZS )MitmmitmsystemNca_cert_filereturnc                 0    t         |           || _        y N)super__init__r
   )selfr
   	__class__s     */home/ubuntu/waydroid_script/stuff/mitm.pyr   zMitm.__init__   s    (    c                      y r    r   s    r   downloadzMitm.download   s    r   c                      y)NTr   r   s    r   skip_extractzMitm.skip_extract   s    r   c                 |   t        ddddd| j                  g      j                  j                  d      j	                         }t
        j                  j                  | j                  | j                  ddd	      }t        j                  d
|        t        j                  |d       t
        j                  j                  || d      }t        j                  d| j                   d       t        j                  d|        t        j                  | j                  |       t        j                  |d       y )Nopensslx509z-nooutz-subject_hash_oldz-inasciietcsecuritycacertszCreating directory: T)exist_okz.0zCopying z to system trust storezTarget file: i  )r   r
   stdoutdecodestripospathjoincopy_dir	partitionr   infomakedirsshutilcopyfilechmod)r   	file_hash
target_dirtarget_paths       r   copyz	Mitm.copy   s    vx)<e
  6&&/%%' 	 WW\\MM4>>5*iI
*:,78
J.ggll:)B/?@ht0011GHImK=12));7
e$r   c                 P    | j                   st        d      t        |           y )Nz;This command requires the --ca-cert switch and a *.pem file)r
   
ValueErrorr   install)r   r   s    r   r5   zMitm.install$   s(      MO Or   r   )__name__
__module____qualname__idr)   strr   r   r   r2   r5   __classcell__)r   s   @r   r   r      s9    	BI)S )$ )% r   r   )	r%   r,   stuff.generalr   tools.helperr   tools.loggerr   r   r   r   r   <module>r?      s     	  !  !7 !r   