1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| $ echo -e "titi toto\ninsert into table1 ( id, nom, prenom ) values ( 1, 'toto', 'tata' );" | perl -F'\(' -ane '
if ($_ =~ /table1/) {
@b=split /\x27/ , @F[2];
$b[1]="\x27".substr((split /\$/,crypt($b[1],"\$5\$AZERTY"))[3],0,14)."\x27";
$b[3]="\x27".substr((split /\$/,crypt($b[3],"\$5\$AZERTY"))[3],0,14)."\x27";
$_=join("",$F[0]."(".$F[1]."(",@b);
}
if ($_ =~ /table2/) {
@b=split /\x27/ , @F[2];
$b[1]="\x27".substr((split /\$/,crypt($b[1],"\$5\$AZERTY"))[3],0,14)."\x27";
$b[3]="\x27".substr((split /\$/,crypt($b[3],"\$5\$AZERTY"))[3],0,14)."\x27";
$b[5]="\x27".substr((split /\$/,crypt($b[5],"\$5\$AZERTY"))[3],0,14)."\x27";
$_=join("",$F[0]."(".$F[1]."(",@b);
}
print > resultat.txt' |