im cipher code
Post on 30-Dec-2015
23 Views
Preview:
DESCRIPTION
TRANSCRIPT
IM cipher code
Cipher model
• Substitution cipher– For cleartext character, substitute character in
encipher table– For ciphertext character, substitute character in
decipher table
ASCII Table (first half)
Format of encryption table
ASCII Text encrypt
97 a D98 b ]99 c V100 d ?101 e *102 f G103 g 6104 h w105 i @
ASCII Text Decrypt
68 D a
69 E '7',
70 F ']',
71 G 'f',
72 H ',',
73 I 'E',
74 J 'F',
75 K 'p',
76 L 'Y',
Encipher Table
char encr[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 'b', '.', 0, 'c', '[', 0, 0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
'R', 'u', ',', 'q', '\t', 'Y', '\n', '\'', 'n', 's', 'v', 'e', 'H', 'o', 'N', 'M', 'r', '=', '0', ';', 'z', '/', '`', 'E', '\"', 'k', '&', '5', '>', 'i', 'p', ')', '$', '!', '2', 'O', '(', 'I', 'J', '%', 'Z', 'g', '\\', '{', 'h', '7', 'S', 'P', 'a', ' ', 'W', 'x', 'y', 'T', '+', '8', '-', 'L', '9', 'f', '#', 'F', '\r', 'B', '3', 'D', ']', 'V', '?', '*', 'G', '6', 'w', '@', '}', '|', 'C', 'l', '_', 'j', 'K', '^', '1', 't', 'Q', '<', 'U', 'd', 'm', ':', 'A', 'X', '\f', '4', '~', 0, 0, 0};
Decipher Table
char decr[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, '$', '&', 0, '|', '^', 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Q', 'A', '8', '\\', '@', 'G', ':', '\'', 'D', '?', 'e', 'V', '\"', 'X', '\n', '5', '2', 'r', 'B', '`', '}', ';', 'g', 'M', 'W', 'Z', 'y', '3', 'u', '1', '<', 'd', 'i', 'z', '_', 'l', 'a', '7', ']', 'f', ',', 'E', 'F', 'p', 'Y', '/', '.', 'C', 'O', 't', ' ', 'N', 'U', 'v', 'c', 'R', '{', '%', 'H', '\r', 'J', 'b', 'q', 'n', '6', 'P', '\t', '\f', 'w', '+', '[', 'I', 'L', '=', 'o', '9', 'm', 'x', '(', '-', '>', '#', '0', ')', 's', '!', '*', 'h', 'S', 'T', '4', 'K', 'k', 'j', '~', 0, 0, 0};
Basic code snippetwhile (fin.get(inchar)){
if (((int) inchar) < 32) //for debugging cout << "Read (" << (int)inchar << ") ";
if (task == 'e') // we are encoding{
outchar = encr[(int)inchar];}else{
outchar = decr[(int)inchar];}fout << outchar;if (((int) inchar) < 32) //for debugging
cout << ": Wrote " << outchar << endl;
}
example[root@bridge ~]# psad -m /var/log/messages.1 --gnuplot --CSV-fields "dst:not192.168.10.0/24 dp:countuniq" --gnuplot-graph points --gnuplot-xrange 0:10000 --gnuplot-file-prefix test1[+] Entering Gnuplot mode...[+] Parsing iptables log messages from file: /var/log/messages.1[+] Parsed 71992 iptables log messages.[+] Writing parsed iptables data to: test1.dat[+] Writing gnuplot directive file: test1.gnu
[root@bridge ~]# gnuplot test1.gnu
f1jjQ$]1@?6*R~FqRKtD?RolRMUD1MCj6Ml*ttD6*tN=Roo6_<KCjQRooOx+oG@*C?tR,?tQ&_jQ=k0N=`"N=rNrM0zR?K&Vj<_Q<_@^,Roo6_<KCjQo61DKwRKj@_QtRoo6_<KCjQom1D_6*Rr&=rrrrRoo6_<KCjQoG@C*oK1*G@mRQ*tQ=.feFRI_Q*1@_6R%_<KCjQRlj?*NNN.feFRaD1t@_6R@KQD]C*tRCj6Rl*ttD6*tRG1jlRG@C*&RMUD1MCj6Ml*ttD6*tN=.feFRaD1t*?RE=kk0R@KQD]C*tRCj6Rl*ttD6*tN.feFR81@Q@_6RKD1t*?R@KQD]C*tR?DQDRQj&RQ*tQ=N?DQ.feFR81@Q@_6R6_<KCjQR?@1*VQ@U*RG@C*&RQ*tQ=N6_<..f1jjQ$]1@?6*R~FqR6_<KCjQRQ*tQ=N6_<.
top related