dd"@dZdZdZdZd
dZdZdZddZddZy	)chddl}t|d}|j|}|j}|SNutf-8)base64	bytearray	b64encodedecode)stringr
byte_arrayencrypted_bytesencrypted_strings     3/home/s/sultans/web/python/demo/etl/util/encrypt.pyencryptrs6 0J''
3O&--/chddl}t|d}|j|}|j}|Sr)rr	b64decoder	)r
rrrr
s     rdecryptrs5 09O&&7J '')FNrcddl}ddlm}t|d}|j	|}||}|j|j
}|SNr)Fernetr)rcryptography.fernetrbytesurlsafe_b64encoderencode)strpswdrrkeyfernet
encrypted_strs       rencrypt2r (sI*
4
 D

%
%d
+CC[FNN3::<0Mrcddl}ddlm}t|d}|j	|}||}|j|j
}|Sr)rrrrrrr	)rrrrrr
decrypted_strs       rdecrypt2r#8sJ*
4
 D

%
%d
+C
C[FNN3'..0Mrc&d}d}d}d}||z|z|z}d}|D]}	|t|	z
}|t|z}
|
dk(rd}
|jdk(r|}||
d|d|
z}n
||
d|d|
z}|}|j||}
|j	|
}|S)NABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
0123456789z~!@#$%^&*:;.',?+=/rr)ordlenlower	maketrans	translate)r
r	direction	uppercase	lowercasenumberspunctuationbaseseedcharoffsetsourcetarget
transTable	newStrings               rcryptr;Gs.I.IG&Ki''1K?DDD	
CI
F
qy&I%fggv.fggv.!!&0J!!*-Irct||dS)Nrr;r
rs  rencrypt3r?fY''rct||dS)Nrr=r>s  rdecrypt3rBor@rc|dk(rd}nd}t|d}t||}|dz|zdz}|j||j|S)Nmysql5/home/sultans/web/python/demo/etl/util/mysql_keys.txt6/home/sultans/web/python/demo/etl/util/oracle_keys.txta=
)openr?writeclose)nameconnection_stringdbfileoutputr
new_connections       radd_connection_stringrSxs]	7{FG
$s^F  148CZ"22T9N
LL 
LLNrc|dk(rd}nd}t|d}|j}|j|jd}|D],}|jdd\}}||k(st	||}	|	cSdzS)	NrDrErFrrIrHr(z
 Not found)rJreadrLsplitrB)
rMrOrPinputlinesconnection_stringsline
connectionr
rNs
          rget_connection_stringr]s	7{FGcNEJJLE	KKMT*"(,

3q(9%$!))94 @$%
#$%rN)r)rD)	rrr r#r;r?rBrSr]rr<module>r_s2 	 >((&&r