arz_api.bypass_antibot.script

  1import re
  2import dukpy
  3import requests
  4import aiohttp
  5from aiohttp_socks import ProxyConnector
  6
  7
  8text = """
  9/*
 10 * aes.js: implements AES - Advanced Encryption Standard
 11 * from the SlowAES project, http://code.google.com/p/slowaes/
 12 *
 13 * Copyright (c) 2008 	Josh Davis ( http://www.josh-davis.org ),
 14 *						Mark Percival ( http://mpercival.com ),
 15 *
 16 * Ported from C code written by Laurent Haan ( http://www.progressive-coding.com )
 17 *
 18 * Licensed under the Apache License, Version 2.0
 19 * http://www.apache.org/licenses/
 20 */
 21
 22var slowAES = {
 23	/*
 24	 * START AES SECTION
 25	 */
 26	aes:{
 27		// structure of valid key sizes
 28		keySize:{
 29			SIZE_128:16,
 30			SIZE_192:24,
 31			SIZE_256:32
 32		},
 33
 34		// Rijndael S-box
 35		sbox:[
 36		0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
 37		0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
 38		0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
 39		0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,
 40		0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84,
 41		0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf,
 42		0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8,
 43		0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2,
 44		0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73,
 45		0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb,
 46		0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79,
 47		0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,
 48		0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a,
 49		0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e,
 50		0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
 51		0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 ],
 52
 53		// Rijndael Inverted S-box
 54		rsbox:
 55		[ 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb
 56		, 0x7c, 0xe3, 0x39, 0x82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 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f
 68		, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef
 69		, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61
 70		, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d ],
 71
 72		/* rotate the word eight bits to the left */
 73		rotate:function(word)
 74		{
 75			var c = word[0];
 76			for (var i = 0; i < 3; i++)
 77				word[i] = word[i+1];
 78			word[3] = c;
 79
 80			return word;
 81		},
 82
 83		// Rijndael Rcon
 84		Rcon:[
 85		0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8,
 86		0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3,
 87		0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f,
 88		0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d,
 89		0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab,
 90		0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d,
 91		0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25,
 92		0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01,
 93		0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d,
 94		0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa,
 95		0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a,
 96		0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02,
 97		0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a,
 98		0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef,
 99		0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94,
100		0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04,
101		0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f,
102		0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5,
103		0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33,
104		0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb ],
105
106		G2X: [
107		0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x10, 0x12, 0x14, 0x16,
108		0x18, 0x1a, 0x1c, 0x1e, 0x20, 0x22, 0x24, 0x26, 0x28, 0x2a, 0x2c, 0x2e,
109		0x30, 0x32, 0x34, 0x36, 0x38, 0x3a, 0x3c, 0x3e, 0x40, 0x42, 0x44, 0x46,
110		0x48, 0x4a, 0x4c, 0x4e, 0x50, 0x52, 0x54, 0x56, 0x58, 0x5a, 0x5c, 0x5e,
111		0x60, 0x62, 0x64, 0x66, 0x68, 0x6a, 0x6c, 0x6e, 0x70, 0x72, 0x74, 0x76,
112		0x78, 0x7a, 0x7c, 0x7e, 0x80, 0x82, 0x84, 0x86, 0x88, 0x8a, 0x8c, 0x8e,
113		0x90, 0x92, 0x94, 0x96, 0x98, 0x9a, 0x9c, 0x9e, 0xa0, 0xa2, 0xa4, 0xa6,
114		0xa8, 0xaa, 0xac, 0xae, 0xb0, 0xb2, 0xb4, 0xb6, 0xb8, 0xba, 0xbc, 0xbe,
115		0xc0, 0xc2, 0xc4, 0xc6, 0xc8, 0xca, 0xcc, 0xce, 0xd0, 0xd2, 0xd4, 0xd6,
116		0xd8, 0xda, 0xdc, 0xde, 0xe0, 0xe2, 0xe4, 0xe6, 0xe8, 0xea, 0xec, 0xee,
117		0xf0, 0xf2, 0xf4, 0xf6, 0xf8, 0xfa, 0xfc, 0xfe, 0x1b, 0x19, 0x1f, 0x1d,
118		0x13, 0x11, 0x17, 0x15, 0x0b, 0x09, 0x0f, 0x0d, 0x03, 0x01, 0x07, 0x05,
119		0x3b, 0x39, 0x3f, 0x3d, 0x33, 0x31, 0x37, 0x35, 0x2b, 0x29, 0x2f, 0x2d,
120		0x23, 0x21, 0x27, 0x25, 0x5b, 0x59, 0x5f, 0x5d, 0x53, 0x51, 0x57, 0x55,
121		0x4b, 0x49, 0x4f, 0x4d, 0x43, 0x41, 0x47, 0x45, 0x7b, 0x79, 0x7f, 0x7d,
122		0x73, 0x71, 0x77, 0x75, 0x6b, 0x69, 0x6f, 0x6d, 0x63, 0x61, 0x67, 0x65,
123		0x9b, 0x99, 0x9f, 0x9d, 0x93, 0x91, 0x97, 0x95, 0x8b, 0x89, 0x8f, 0x8d,
124		0x83, 0x81, 0x87, 0x85, 0xbb, 0xb9, 0xbf, 0xbd, 0xb3, 0xb1, 0xb7, 0xb5,
125		0xab, 0xa9, 0xaf, 0xad, 0xa3, 0xa1, 0xa7, 0xa5, 0xdb, 0xd9, 0xdf, 0xdd,
126		0xd3, 0xd1, 0xd7, 0xd5, 0xcb, 0xc9, 0xcf, 0xcd, 0xc3, 0xc1, 0xc7, 0xc5,
127		0xfb, 0xf9, 0xff, 0xfd, 0xf3, 0xf1, 0xf7, 0xf5, 0xeb, 0xe9, 0xef, 0xed,
128		0xe3, 0xe1, 0xe7, 0xe5
129		],
130
131		G3X: [
132		0x00, 0x03, 0x06, 0x05, 0x0c, 0x0f, 0x0a, 0x09, 0x18, 0x1b, 0x1e, 0x1d,
133		0x14, 0x17, 0x12, 0x11, 0x30, 0x33, 0x36, 0x35, 0x3c, 0x3f, 0x3a, 0x39,
134		0x28, 0x2b, 0x2e, 0x2d, 0x24, 0x27, 0x22, 0x21, 0x60, 0x63, 0x66, 0x65,
135		0x6c, 0x6f, 0x6a, 0x69, 0x78, 0x7b, 0x7e, 0x7d, 0x74, 0x77, 0x72, 0x71,
136		0x50, 0x53, 0x56, 0x55, 0x5c, 0x5f, 0x5a, 0x59, 0x48, 0x4b, 0x4e, 0x4d,
137		0x44, 0x47, 0x42, 0x41, 0xc0, 0xc3, 0xc6, 0xc5, 0xcc, 0xcf, 0xca, 0xc9,
138		0xd8, 0xdb, 0xde, 0xdd, 0xd4, 0xd7, 0xd2, 0xd1, 0xf0, 0xf3, 0xf6, 0xf5,
139		0xfc, 0xff, 0xfa, 0xf9, 0xe8, 0xeb, 0xee, 0xed, 0xe4, 0xe7, 0xe2, 0xe1,
140		0xa0, 0xa3, 0xa6, 0xa5, 0xac, 0xaf, 0xaa, 0xa9, 0xb8, 0xbb, 0xbe, 0xbd,
141		0xb4, 0xb7, 0xb2, 0xb1, 0x90, 0x93, 0x96, 0x95, 0x9c, 0x9f, 0x9a, 0x99,
142		0x88, 0x8b, 0x8e, 0x8d, 0x84, 0x87, 0x82, 0x81, 0x9b, 0x98, 0x9d, 0x9e,
143		0x97, 0x94, 0x91, 0x92, 0x83, 0x80, 0x85, 0x86, 0x8f, 0x8c, 0x89, 0x8a,
144		0xab, 0xa8, 0xad, 0xae, 0xa7, 0xa4, 0xa1, 0xa2, 0xb3, 0xb0, 0xb5, 0xb6,
145		0xbf, 0xbc, 0xb9, 0xba, 0xfb, 0xf8, 0xfd, 0xfe, 0xf7, 0xf4, 0xf1, 0xf2,
146		0xe3, 0xe0, 0xe5, 0xe6, 0xef, 0xec, 0xe9, 0xea, 0xcb, 0xc8, 0xcd, 0xce,
147		0xc7, 0xc4, 0xc1, 0xc2, 0xd3, 0xd0, 0xd5, 0xd6, 0xdf, 0xdc, 0xd9, 0xda,
148		0x5b, 0x58, 0x5d, 0x5e, 0x57, 0x54, 0x51, 0x52, 0x43, 0x40, 0x45, 0x46,
149		0x4f, 0x4c, 0x49, 0x4a, 0x6b, 0x68, 0x6d, 0x6e, 0x67, 0x64, 0x61, 0x62,
150		0x73, 0x70, 0x75, 0x76, 0x7f, 0x7c, 0x79, 0x7a, 0x3b, 0x38, 0x3d, 0x3e,
151		0x37, 0x34, 0x31, 0x32, 0x23, 0x20, 0x25, 0x26, 0x2f, 0x2c, 0x29, 0x2a,
152		0x0b, 0x08, 0x0d, 0x0e, 0x07, 0x04, 0x01, 0x02, 0x13, 0x10, 0x15, 0x16,
153		0x1f, 0x1c, 0x19, 0x1a
154		],
155
156		G9X: [
157		0x00, 0x09, 0x12, 0x1b, 0x24, 0x2d, 0x36, 0x3f, 0x48, 0x41, 0x5a, 0x53,
158		0x6c, 0x65, 0x7e, 0x77, 0x90, 0x99, 0x82, 0x8b, 0xb4, 0xbd, 0xa6, 0xaf,
159		0xd8, 0xd1, 0xca, 0xc3, 0xfc, 0xf5, 0xee, 0xe7, 0x3b, 0x32, 0x29, 0x20,
160		0x1f, 0x16, 0x0d, 0x04, 0x73, 0x7a, 0x61, 0x68, 0x57, 0x5e, 0x45, 0x4c,
161		0xab, 0xa2, 0xb9, 0xb0, 0x8f, 0x86, 0x9d, 0x94, 0xe3, 0xea, 0xf1, 0xf8,
162		0xc7, 0xce, 0xd5, 0xdc, 0x76, 0x7f, 0x64, 0x6d, 0x52, 0x5b, 0x40, 0x49,
163		0x3e, 0x37, 0x2c, 0x25, 0x1a, 0x13, 0x08, 0x01, 0xe6, 0xef, 0xf4, 0xfd,
164		0xc2, 0xcb, 0xd0, 0xd9, 0xae, 0xa7, 0xbc, 0xb5, 0x8a, 0x83, 0x98, 0x91,
165		0x4d, 0x44, 0x5f, 0x56, 0x69, 0x60, 0x7b, 0x72, 0x05, 0x0c, 0x17, 0x1e,
166		0x21, 0x28, 0x33, 0x3a, 0xdd, 0xd4, 0xcf, 0xc6, 0xf9, 0xf0, 0xeb, 0xe2,
167		0x95, 0x9c, 0x87, 0x8e, 0xb1, 0xb8, 0xa3, 0xaa, 0xec, 0xe5, 0xfe, 0xf7,
168		0xc8, 0xc1, 0xda, 0xd3, 0xa4, 0xad, 0xb6, 0xbf, 0x80, 0x89, 0x92, 0x9b,
169		0x7c, 0x75, 0x6e, 0x67, 0x58, 0x51, 0x4a, 0x43, 0x34, 0x3d, 0x26, 0x2f,
170		0x10, 0x19, 0x02, 0x0b, 0xd7, 0xde, 0xc5, 0xcc, 0xf3, 0xfa, 0xe1, 0xe8,
171		0x9f, 0x96, 0x8d, 0x84, 0xbb, 0xb2, 0xa9, 0xa0, 0x47, 0x4e, 0x55, 0x5c,
172		0x63, 0x6a, 0x71, 0x78, 0x0f, 0x06, 0x1d, 0x14, 0x2b, 0x22, 0x39, 0x30,
173		0x9a, 0x93, 0x88, 0x81, 0xbe, 0xb7, 0xac, 0xa5, 0xd2, 0xdb, 0xc0, 0xc9,
174		0xf6, 0xff, 0xe4, 0xed, 0x0a, 0x03, 0x18, 0x11, 0x2e, 0x27, 0x3c, 0x35,
175		0x42, 0x4b, 0x50, 0x59, 0x66, 0x6f, 0x74, 0x7d, 0xa1, 0xa8, 0xb3, 0xba,
176		0x85, 0x8c, 0x97, 0x9e, 0xe9, 0xe0, 0xfb, 0xf2, 0xcd, 0xc4, 0xdf, 0xd6,
177		0x31, 0x38, 0x23, 0x2a, 0x15, 0x1c, 0x07, 0x0e, 0x79, 0x70, 0x6b, 0x62,
178		0x5d, 0x54, 0x4f, 0x46
179		],
180
181		GBX: [
182		0x00, 0x0b, 0x16, 0x1d, 0x2c, 0x27, 0x3a, 0x31, 0x58, 0x53, 0x4e, 0x45,
183		0x74, 0x7f, 0x62, 0x69, 0xb0, 0xbb, 0xa6, 0xad, 0x9c, 0x97, 0x8a, 0x81,
184		0xe8, 0xe3, 0xfe, 0xf5, 0xc4, 0xcf, 0xd2, 0xd9, 0x7b, 0x70, 0x6d, 0x66,
185		0x57, 0x5c, 0x41, 0x4a, 0x23, 0x28, 0x35, 0x3e, 0x0f, 0x04, 0x19, 0x12,
186		0xcb, 0xc0, 0xdd, 0xd6, 0xe7, 0xec, 0xf1, 0xfa, 0x93, 0x98, 0x85, 0x8e,
187		0xbf, 0xb4, 0xa9, 0xa2, 0xf6, 0xfd, 0xe0, 0xeb, 0xda, 0xd1, 0xcc, 0xc7,
188		0xae, 0xa5, 0xb8, 0xb3, 0x82, 0x89, 0x94, 0x9f, 0x46, 0x4d, 0x50, 0x5b,
189		0x6a, 0x61, 0x7c, 0x77, 0x1e, 0x15, 0x08, 0x03, 0x32, 0x39, 0x24, 0x2f,
190		0x8d, 0x86, 0x9b, 0x90, 0xa1, 0xaa, 0xb7, 0xbc, 0xd5, 0xde, 0xc3, 0xc8,
191		0xf9, 0xf2, 0xef, 0xe4, 0x3d, 0x36, 0x2b, 0x20, 0x11, 0x1a, 0x07, 0x0c,
192		0x65, 0x6e, 0x73, 0x78, 0x49, 0x42, 0x5f, 0x54, 0xf7, 0xfc, 0xe1, 0xea,
193		0xdb, 0xd0, 0xcd, 0xc6, 0xaf, 0xa4, 0xb9, 0xb2, 0x83, 0x88, 0x95, 0x9e,
194		0x47, 0x4c, 0x51, 0x5a, 0x6b, 0x60, 0x7d, 0x76, 0x1f, 0x14, 0x09, 0x02,
195		0x33, 0x38, 0x25, 0x2e, 0x8c, 0x87, 0x9a, 0x91, 0xa0, 0xab, 0xb6, 0xbd,
196		0xd4, 0xdf, 0xc2, 0xc9, 0xf8, 0xf3, 0xee, 0xe5, 0x3c, 0x37, 0x2a, 0x21,
197		0x10, 0x1b, 0x06, 0x0d, 0x64, 0x6f, 0x72, 0x79, 0x48, 0x43, 0x5e, 0x55,
198		0x01, 0x0a, 0x17, 0x1c, 0x2d, 0x26, 0x3b, 0x30, 0x59, 0x52, 0x4f, 0x44,
199		0x75, 0x7e, 0x63, 0x68, 0xb1, 0xba, 0xa7, 0xac, 0x9d, 0x96, 0x8b, 0x80,
200		0xe9, 0xe2, 0xff, 0xf4, 0xc5, 0xce, 0xd3, 0xd8, 0x7a, 0x71, 0x6c, 0x67,
201		0x56, 0x5d, 0x40, 0x4b, 0x22, 0x29, 0x34, 0x3f, 0x0e, 0x05, 0x18, 0x13,
202		0xca, 0xc1, 0xdc, 0xd7, 0xe6, 0xed, 0xf0, 0xfb, 0x92, 0x99, 0x84, 0x8f,
203		0xbe, 0xb5, 0xa8, 0xa3
204		],
205
206		GDX: [
207		0x00, 0x0d, 0x1a, 0x17, 0x34, 0x39, 0x2e, 0x23, 0x68, 0x65, 0x72, 0x7f,
208		0x5c, 0x51, 0x46, 0x4b, 0xd0, 0xdd, 0xca, 0xc7, 0xe4, 0xe9, 0xfe, 0xf3,
209		0xb8, 0xb5, 0xa2, 0xaf, 0x8c, 0x81, 0x96, 0x9b, 0xbb, 0xb6, 0xa1, 0xac,
210		0x8f, 0x82, 0x95, 0x98, 0xd3, 0xde, 0xc9, 0xc4, 0xe7, 0xea, 0xfd, 0xf0,
211		0x6b, 0x66, 0x71, 0x7c, 0x5f, 0x52, 0x45, 0x48, 0x03, 0x0e, 0x19, 0x14,
212		0x37, 0x3a, 0x2d, 0x20, 0x6d, 0x60, 0x77, 0x7a, 0x59, 0x54, 0x43, 0x4e,
213		0x05, 0x08, 0x1f, 0x12, 0x31, 0x3c, 0x2b, 0x26, 0xbd, 0xb0, 0xa7, 0xaa,
214		0x89, 0x84, 0x93, 0x9e, 0xd5, 0xd8, 0xcf, 0xc2, 0xe1, 0xec, 0xfb, 0xf6,
215		0xd6, 0xdb, 0xcc, 0xc1, 0xe2, 0xef, 0xf8, 0xf5, 0xbe, 0xb3, 0xa4, 0xa9,
216		0x8a, 0x87, 0x90, 0x9d, 0x06, 0x0b, 0x1c, 0x11, 0x32, 0x3f, 0x28, 0x25,
217		0x6e, 0x63, 0x74, 0x79, 0x5a, 0x57, 0x40, 0x4d, 0xda, 0xd7, 0xc0, 0xcd,
218		0xee, 0xe3, 0xf4, 0xf9, 0xb2, 0xbf, 0xa8, 0xa5, 0x86, 0x8b, 0x9c, 0x91,
219		0x0a, 0x07, 0x10, 0x1d, 0x3e, 0x33, 0x24, 0x29, 0x62, 0x6f, 0x78, 0x75,
220		0x56, 0x5b, 0x4c, 0x41, 0x61, 0x6c, 0x7b, 0x76, 0x55, 0x58, 0x4f, 0x42,
221		0x09, 0x04, 0x13, 0x1e, 0x3d, 0x30, 0x27, 0x2a, 0xb1, 0xbc, 0xab, 0xa6,
222		0x85, 0x88, 0x9f, 0x92, 0xd9, 0xd4, 0xc3, 0xce, 0xed, 0xe0, 0xf7, 0xfa,
223		0xb7, 0xba, 0xad, 0xa0, 0x83, 0x8e, 0x99, 0x94, 0xdf, 0xd2, 0xc5, 0xc8,
224		0xeb, 0xe6, 0xf1, 0xfc, 0x67, 0x6a, 0x7d, 0x70, 0x53, 0x5e, 0x49, 0x44,
225		0x0f, 0x02, 0x15, 0x18, 0x3b, 0x36, 0x21, 0x2c, 0x0c, 0x01, 0x16, 0x1b,
226		0x38, 0x35, 0x22, 0x2f, 0x64, 0x69, 0x7e, 0x73, 0x50, 0x5d, 0x4a, 0x47,
227		0xdc, 0xd1, 0xc6, 0xcb, 0xe8, 0xe5, 0xf2, 0xff, 0xb4, 0xb9, 0xae, 0xa3,
228		0x80, 0x8d, 0x9a, 0x97
229		],
230
231		GEX: [
232		0x00, 0x0e, 0x1c, 0x12, 0x38, 0x36, 0x24, 0x2a, 0x70, 0x7e, 0x6c, 0x62,
233		0x48, 0x46, 0x54, 0x5a, 0xe0, 0xee, 0xfc, 0xf2, 0xd8, 0xd6, 0xc4, 0xca,
234		0x90, 0x9e, 0x8c, 0x82, 0xa8, 0xa6, 0xb4, 0xba, 0xdb, 0xd5, 0xc7, 0xc9,
235		0xe3, 0xed, 0xff, 0xf1, 0xab, 0xa5, 0xb7, 0xb9, 0x93, 0x9d, 0x8f, 0x81,
236		0x3b, 0x35, 0x27, 0x29, 0x03, 0x0d, 0x1f, 0x11, 0x4b, 0x45, 0x57, 0x59,
237		0x73, 0x7d, 0x6f, 0x61, 0xad, 0xa3, 0xb1, 0xbf, 0x95, 0x9b, 0x89, 0x87,
238		0xdd, 0xd3, 0xc1, 0xcf, 0xe5, 0xeb, 0xf9, 0xf7, 0x4d, 0x43, 0x51, 0x5f,
239		0x75, 0x7b, 0x69, 0x67, 0x3d, 0x33, 0x21, 0x2f, 0x05, 0x0b, 0x19, 0x17,
240		0x76, 0x78, 0x6a, 0x64, 0x4e, 0x40, 0x52, 0x5c, 0x06, 0x08, 0x1a, 0x14,
241		0x3e, 0x30, 0x22, 0x2c, 0x96, 0x98, 0x8a, 0x84, 0xae, 0xa0, 0xb2, 0xbc,
242		0xe6, 0xe8, 0xfa, 0xf4, 0xde, 0xd0, 0xc2, 0xcc, 0x41, 0x4f, 0x5d, 0x53,
243		0x79, 0x77, 0x65, 0x6b, 0x31, 0x3f, 0x2d, 0x23, 0x09, 0x07, 0x15, 0x1b,
244		0xa1, 0xaf, 0xbd, 0xb3, 0x99, 0x97, 0x85, 0x8b, 0xd1, 0xdf, 0xcd, 0xc3,
245		0xe9, 0xe7, 0xf5, 0xfb, 0x9a, 0x94, 0x86, 0x88, 0xa2, 0xac, 0xbe, 0xb0,
246		0xea, 0xe4, 0xf6, 0xf8, 0xd2, 0xdc, 0xce, 0xc0, 0x7a, 0x74, 0x66, 0x68,
247		0x42, 0x4c, 0x5e, 0x50, 0x0a, 0x04, 0x16, 0x18, 0x32, 0x3c, 0x2e, 0x20,
248		0xec, 0xe2, 0xf0, 0xfe, 0xd4, 0xda, 0xc8, 0xc6, 0x9c, 0x92, 0x80, 0x8e,
249		0xa4, 0xaa, 0xb8, 0xb6, 0x0c, 0x02, 0x10, 0x1e, 0x34, 0x3a, 0x28, 0x26,
250		0x7c, 0x72, 0x60, 0x6e, 0x44, 0x4a, 0x58, 0x56, 0x37, 0x39, 0x2b, 0x25,
251		0x0f, 0x01, 0x13, 0x1d, 0x47, 0x49, 0x5b, 0x55, 0x7f, 0x71, 0x63, 0x6d,
252		0xd7, 0xd9, 0xcb, 0xc5, 0xef, 0xe1, 0xf3, 0xfd, 0xa7, 0xa9, 0xbb, 0xb5,
253		0x9f, 0x91, 0x83, 0x8d
254		],
255
256		// Key Schedule Core
257		core:function(word,iteration)
258		{
259			/* rotate the 32-bit word 8 bits to the left */
260			word = this.rotate(word);
261			/* apply S-Box substitution on all 4 parts of the 32-bit word */
262			for (var i = 0; i < 4; ++i)
263				word[i] = this.sbox[word[i]];
264			/* XOR the output of the rcon operation with i to the first part (leftmost) only */
265			word[0] = word[0]^this.Rcon[iteration];
266			return word;
267		},
268
269		/* Rijndael's key expansion
270		 * expands an 128,192,256 key into an 176,208,240 bytes key
271		 *
272		 * expandedKey is a pointer to an char array of large enough size
273		 * key is a pointer to a non-expanded key
274		 */
275		expandKey:function(key,size)
276		{
277			var expandedKeySize = (16*(this.numberOfRounds(size)+1));
278
279			/* current expanded keySize, in bytes */
280			var currentSize = 0;
281			var rconIteration = 1;
282			var t = [];   // temporary 4-byte variable
283
284			var expandedKey = [];
285			for(var i = 0;i < expandedKeySize;i++)
286				expandedKey[i] = 0;
287
288			/* set the 16,24,32 bytes of the expanded key to the input key */
289			for (var j = 0; j < size; j++)
290				expandedKey[j] = key[j];
291			currentSize += size;
292
293			while (currentSize < expandedKeySize)
294			{
295				/* assign the previous 4 bytes to the temporary value t */
296				for (var k = 0; k < 4; k++)
297					t[k] = expandedKey[(currentSize - 4) + k];
298
299				/* every 16,24,32 bytes we apply the core schedule to t
300				 * and increment rconIteration afterwards
301				 */
302				if(currentSize % size == 0)
303					t = this.core(t, rconIteration++);
304
305				/* For 256-bit keys, we add an extra sbox to the calculation */
306				if(size == this.keySize.SIZE_256 && ((currentSize % size) == 16))
307					for(var l = 0; l < 4; l++)
308						t[l] = this.sbox[t[l]];
309
310				/* We XOR t with the four-byte block 16,24,32 bytes before the new expanded key.
311				 * This becomes the next four bytes in the expanded key.
312				 */
313				for(var m = 0; m < 4; m++) {
314					expandedKey[currentSize] = expandedKey[currentSize - size] ^ t[m];
315					currentSize++;
316				}
317			}
318			return expandedKey;
319		},
320
321		// Adds (XORs) the round key to the state
322		addRoundKey:function(state,roundKey)
323		{
324			for (var i = 0; i < 16; i++)
325				state[i] ^= roundKey[i];
326			return state;
327		},
328
329		// Creates a round key from the given expanded key and the
330		// position within the expanded key.
331		createRoundKey:function(expandedKey,roundKeyPointer)
332		{
333			var roundKey = [];
334			for (var i = 0; i < 4; i++)
335				for (var j = 0; j < 4; j++)
336					roundKey[j*4+i] = expandedKey[roundKeyPointer + i*4 + j];
337			return roundKey;
338		},
339
340		/* substitute all the values from the state with the value in the SBox
341		 * using the state value as index for the SBox
342		 */
343		subBytes:function(state,isInv)
344		{
345			for (var i = 0; i < 16; i++)
346				state[i] = isInv?this.rsbox[state[i]]:this.sbox[state[i]];
347			return state;
348		},
349
350		/* iterate over the 4 rows and call shiftRow() with that row */
351		shiftRows:function(state,isInv)
352		{
353			for (var i = 0; i < 4; i++)
354				state = this.shiftRow(state,i*4, i,isInv);
355			return state;
356		},
357
358		/* each iteration shifts the row to the left by 1 */
359		shiftRow:function(state,statePointer,nbr,isInv)
360		{
361			for (var i = 0; i < nbr; i++)
362			{
363				if(isInv)
364				{
365					var tmp = state[statePointer + 3];
366					for (var j = 3; j > 0; j--)
367						state[statePointer + j] = state[statePointer + j-1];
368					state[statePointer] = tmp;
369				}
370				else
371				{
372					var tmp = state[statePointer];
373					for (var j = 0; j < 3; j++)
374						state[statePointer + j] = state[statePointer + j+1];
375					state[statePointer + 3] = tmp;
376				}
377			}
378			return state;
379		},
380
381		// galois multiplication of 8 bit characters a and b
382		galois_multiplication:function(a,b)
383		{
384			var p = 0;
385			for(var counter = 0; counter < 8; counter++)
386			{
387				if((b & 1) == 1)
388					p ^= a;
389				if(p > 0x100) p ^= 0x100;
390				var hi_bit_set = (a & 0x80); //keep p 8 bit
391				a <<= 1;
392				if(a > 0x100) a ^= 0x100; //keep a 8 bit
393				if(hi_bit_set == 0x80)
394					a ^= 0x1b;
395				if(a > 0x100) a ^= 0x100; //keep a 8 bit
396				b >>= 1;
397				if(b > 0x100) b ^= 0x100; //keep b 8 bit
398			}
399			return p;
400		},
401
402		// galois multipication of the 4x4 matrix
403		mixColumns:function(state,isInv)
404		{
405			var column = [];
406			/* iterate over the 4 columns */
407			for (var i = 0; i < 4; i++)
408			{
409				/* construct one column by iterating over the 4 rows */
410				for (var j = 0; j < 4; j++)
411					column[j] = state[(j*4)+i];
412				/* apply the mixColumn on one column */
413				column = this.mixColumn(column,isInv);
414				/* put the values back into the state */
415				for (var k = 0; k < 4; k++)
416					state[(k*4)+i] = column[k];
417			}
418			return state;
419		},
420
421		// galois multipication of 1 column of the 4x4 matrix
422		mixColumn:function(column,isInv)
423		{
424			var mult = [];
425			if(isInv)
426				mult = [14,9,13,11];
427			else
428				mult = [2,1,1,3];
429			var cpy = [];
430			for(var i = 0; i < 4; i++)
431				cpy[i] = column[i];
432
433			column[0] = 	this.galois_multiplication(cpy[0],mult[0]) ^
434					this.galois_multiplication(cpy[3],mult[1]) ^
435					this.galois_multiplication(cpy[2],mult[2]) ^
436					this.galois_multiplication(cpy[1],mult[3]);
437			column[1] = 	this.galois_multiplication(cpy[1],mult[0]) ^
438					this.galois_multiplication(cpy[0],mult[1]) ^
439					this.galois_multiplication(cpy[3],mult[2]) ^
440					this.galois_multiplication(cpy[2],mult[3]);
441			column[2] = 	this.galois_multiplication(cpy[2],mult[0]) ^
442					this.galois_multiplication(cpy[1],mult[1]) ^
443					this.galois_multiplication(cpy[0],mult[2]) ^
444					this.galois_multiplication(cpy[3],mult[3]);
445			column[3] = 	this.galois_multiplication(cpy[3],mult[0]) ^
446					this.galois_multiplication(cpy[2],mult[1]) ^
447					this.galois_multiplication(cpy[1],mult[2]) ^
448					this.galois_multiplication(cpy[0],mult[3]);
449			return column;
450		},
451
452		// applies the 4 operations of the forward round in sequence
453		round:function(state, roundKey)
454		{
455			state = this.subBytes(state,false);
456			state = this.shiftRows(state,false);
457			state = this.mixColumns(state,false);
458			state = this.addRoundKey(state, roundKey);
459			return state;
460		},
461
462		// applies the 4 operations of the inverse round in sequence
463		invRound:function(state,roundKey)
464		{
465			state = this.shiftRows(state,true);
466			state = this.subBytes(state,true);
467			state = this.addRoundKey(state, roundKey);
468			state = this.mixColumns(state,true);
469			return state;
470		},
471
472		/*
473		 * Perform the initial operations, the standard round, and the final operations
474		 * of the forward aes, creating a round key for each round
475		 */
476		main:function(state,expandedKey,nbrRounds)
477		{
478			state = this.addRoundKey(state, this.createRoundKey(expandedKey,0));
479			for (var i = 1; i < nbrRounds; i++)
480				state = this.round(state, this.createRoundKey(expandedKey,16*i));
481			state = this.subBytes(state,false);
482			state = this.shiftRows(state,false);
483			state = this.addRoundKey(state, this.createRoundKey(expandedKey,16*nbrRounds));
484			return state;
485		},
486
487		/*
488		 * Perform the initial operations, the standard round, and the final operations
489		 * of the inverse aes, creating a round key for each round
490		 */
491		invMain:function(state, expandedKey, nbrRounds)
492		{
493			state = this.addRoundKey(state, this.createRoundKey(expandedKey,16*nbrRounds));
494			for (var i = nbrRounds-1; i > 0; i--)
495				state = this.invRound(state, this.createRoundKey(expandedKey,16*i));
496			state = this.shiftRows(state,true);
497			state = this.subBytes(state,true);
498			state = this.addRoundKey(state, this.createRoundKey(expandedKey,0));
499			return state;
500		},
501
502		numberOfRounds:function(size)
503		{
504			var nbrRounds;
505			switch (size) /* set the number of rounds */
506			{
507				case this.keySize.SIZE_128:
508					nbrRounds = 10;
509					break;
510				case this.keySize.SIZE_192:
511					nbrRounds = 12;
512					break;
513				case this.keySize.SIZE_256:
514					nbrRounds = 14;
515					break;
516				default:
517					return null;
518					break;
519			}
520			return nbrRounds;
521		},
522
523		// encrypts a 128 bit input block against the given key of size specified
524		encrypt:function(input,key,size)
525		{
526			var output = [];
527			var block = []; /* the 128 bit block to encode */
528			var nbrRounds = this.numberOfRounds(size);
529			/* Set the block values, for the block:
530			 * a0,0 a0,1 a0,2 a0,3
531			 * a1,0 a1,1 a1,2 a1,3
532			 * a2,0 a2,1 a2,2 a2,3
533			 * a3,0 a3,1 a3,2 a3,3
534			 * the mapping order is a0,0 a1,0 a2,0 a3,0 a0,1 a1,1 ... a2,3 a3,3
535			 */
536			for (var i = 0; i < 4; i++) /* iterate over the columns */
537				for (var j = 0; j < 4; j++) /* iterate over the rows */
538					block[(i+(j*4))] = input[(i*4)+j];
539
540			/* expand the key into an 176, 208, 240 bytes key */
541			var expandedKey = this.expandKey(key, size); /* the expanded key */
542			/* encrypt the block using the expandedKey */
543			block = this.main(block, expandedKey, nbrRounds);
544			for (var k = 0; k < 4; k++) /* unmap the block again into the output */
545				for (var l = 0; l < 4; l++) /* iterate over the rows */
546					output[(k*4)+l] = block[(k+(l*4))];
547			return output;
548		},
549
550		// decrypts a 128 bit input block against the given key of size specified
551		decrypt:function(input, key, size)
552		{
553			var output = [];
554			var block = []; /* the 128 bit block to decode */
555			var nbrRounds = this.numberOfRounds(size);
556			/* Set the block values, for the block:
557			 * a0,0 a0,1 a0,2 a0,3
558			 * a1,0 a1,1 a1,2 a1,3
559			 * a2,0 a2,1 a2,2 a2,3
560			 * a3,0 a3,1 a3,2 a3,3
561			 * the mapping order is a0,0 a1,0 a2,0 a3,0 a0,1 a1,1 ... a2,3 a3,3
562			 */
563			for (var i = 0; i < 4; i++) /* iterate over the columns */
564				for (var j = 0; j < 4; j++) /* iterate over the rows */
565					block[(i+(j*4))] = input[(i*4)+j];
566			/* expand the key into an 176, 208, 240 bytes key */
567			var expandedKey = this.expandKey(key, size);
568			/* decrypt the block using the expandedKey */
569			block = this.invMain(block, expandedKey, nbrRounds);
570			for (var k = 0; k < 4; k++)/* unmap the block again into the output */
571				for (var l = 0; l < 4; l++)/* iterate over the rows */
572					output[(k*4)+l] = block[(k+(l*4))];
573			return output;
574		}
575	},
576	/*
577	 * END AES SECTION
578	 */
579
580	/*
581	 * START MODE OF OPERATION SECTION
582	 */
583	//structure of supported modes of operation
584	modeOfOperation:{
585		OFB:0,
586		CFB:1,
587		CBC:2
588	},
589
590	// get a 16 byte block (aes operates on 128bits)
591	getBlock: function(bytesIn,start,end,mode)
592	{
593		if(end - start > 16)
594			end = start + 16;
595
596		return bytesIn.slice(start, end);
597	},
598
599	/*
600	 * Mode of Operation Encryption
601	 * bytesIn - Input String as array of bytes
602	 * mode - mode of type modeOfOperation
603	 * key - a number array of length 'size'
604	 * size - the bit length of the key
605	 * iv - the 128 bit number array Initialization Vector
606	 */
607	encrypt: function (bytesIn, mode, key, iv)
608	{
609		var size = key.length;
610		if(iv.length%16)
611		{
612			throw 'iv length must be 128 bits.';
613		}
614		// the AES input/output
615		var byteArray = [];
616		var input = [];
617		var output = [];
618		var ciphertext = [];
619		var cipherOut = [];
620		// char firstRound
621		var firstRound = true;
622		if (mode == this.modeOfOperation.CBC)
623			this.padBytesIn(bytesIn);
624		if (bytesIn !== null)
625		{
626			for (var j = 0;j < Math.ceil(bytesIn.length/16); j++)
627			{
628				var start = j*16;
629				var end = j*16+16;
630				if(j*16+16 > bytesIn.length)
631					end = bytesIn.length;
632				byteArray = this.getBlock(bytesIn,start,end,mode);
633				if (mode == this.modeOfOperation.CFB)
634				{
635					if (firstRound)
636					{
637						output = this.aes.encrypt(iv, key, size);
638						firstRound = false;
639					}
640					else
641						output = this.aes.encrypt(input, key, size);
642					for (var i = 0; i < 16; i++)
643						ciphertext[i] = byteArray[i] ^ output[i];
644					for(var k = 0;k < end-start;k++)
645						cipherOut.push(ciphertext[k]);
646					input = ciphertext;
647				}
648				else if (mode == this.modeOfOperation.OFB)
649				{
650					if (firstRound)
651					{
652						output = this.aes.encrypt(iv, key, size);
653						firstRound = false;
654					}
655					else
656						output = this.aes.encrypt(input, key, size);
657					for (var i = 0; i < 16; i++)
658						ciphertext[i] = byteArray[i] ^ output[i];
659					for(var k = 0;k < end-start;k++)
660						cipherOut.push(ciphertext[k]);
661					input = output;
662				}
663				else if (mode == this.modeOfOperation.CBC)
664				{
665					for (var i = 0; i < 16; i++)
666						input[i] = byteArray[i] ^ ((firstRound) ? iv[i] : ciphertext[i]);
667					firstRound = false;
668					ciphertext = this.aes.encrypt(input, key, size);
669					// always 16 bytes because of the padding for CBC
670					for(var k = 0;k < 16;k++)
671						cipherOut.push(ciphertext[k]);
672				}
673			}
674		}
675		return cipherOut;
676	},
677
678	/*
679	 * Mode of Operation Decryption
680	 * cipherIn - Encrypted String as array of bytes
681	 * originalsize - The unencrypted string length - required for CBC
682	 * mode - mode of type modeOfOperation
683	 * key - a number array of length 'size'
684	 * size - the bit length of the key
685	 * iv - the 128 bit number array Initialization Vector
686	 */
687	decrypt:function(cipherIn,mode,key,iv)
688	{
689		var size = key.length;
690		if(iv.length%16)
691		{
692			throw 'iv length must be 128 bits.';
693		}
694		// the AES input/output
695		var ciphertext = [];
696		var input = [];
697		var output = [];
698		var byteArray = [];
699		var bytesOut = [];
700		// char firstRound
701		var firstRound = true;
702		if (cipherIn !== null)
703		{
704			for (var j = 0;j < Math.ceil(cipherIn.length/16); j++)
705			{
706				var start = j*16;
707				var end = j*16+16;
708				if(j*16+16 > cipherIn.length)
709					end = cipherIn.length;
710				ciphertext = this.getBlock(cipherIn,start,end,mode);
711				if (mode == this.modeOfOperation.CFB)
712				{
713					if (firstRound)
714					{
715						output = this.aes.encrypt(iv, key, size);
716						firstRound = false;
717					}
718					else
719						output = this.aes.encrypt(input, key, size);
720					for (i = 0; i < 16; i++)
721						byteArray[i] = output[i] ^ ciphertext[i];
722					for(var k = 0;k < end-start;k++)
723						bytesOut.push(byteArray[k]);
724					input = ciphertext;
725				}
726				else if (mode == this.modeOfOperation.OFB)
727				{
728					if (firstRound)
729					{
730						output = this.aes.encrypt(iv, key, size);
731						firstRound = false;
732					}
733					else
734						output = this.aes.encrypt(input, key, size);
735					for (i = 0; i < 16; i++)
736						byteArray[i] = output[i] ^ ciphertext[i];
737					for(var k = 0;k < end-start;k++)
738						bytesOut.push(byteArray[k]);
739					input = output;
740				}
741				else if(mode == this.modeOfOperation.CBC)
742				{
743					output = this.aes.decrypt(ciphertext, key, size);
744					for (i = 0; i < 16; i++)
745						byteArray[i] = ((firstRound) ? iv[i] : input[i]) ^ output[i];
746					firstRound = false;
747					for(var k = 0;k < end-start;k++)
748						bytesOut.push(byteArray[k]);
749					input = ciphertext;
750				}
751			}
752			if(mode == this.modeOfOperation.CBC)
753			    this.unpadBytesOut(bytesOut);
754		}
755		return bytesOut;
756	},
757	padBytesIn: function(data) {
758		var len = data.length;
759		var padByte = 16 - (len % 16);
760		for (var i = 0; i < padByte; i++) {
761			data.push(padByte);
762		}
763	},
764	unpadBytesOut: function(data) {
765		var padCount = 0;
766		var padByte = -1;
767		var blockSize = 16;
768		if (data.length > 16) {
769		for (var i = data.length - 1; i >= data.length-1 - blockSize; i--) {
770			if (data[i] <= blockSize) {
771				if (padByte == -1)
772					padByte = data[i];
773				if (data[i] != padByte) {
774					padCount = 0;
775					break;
776				}
777				padCount++;
778			} else
779				break;
780			if (padCount == padByte)
781				break;
782		}
783		if (padCount > 0)
784			data.splice(data.length - padCount, padCount);
785		}
786	}
787	/*
788	 * END MODE OF OPERATION SECTION
789	 */
790};
791"""
792
793
794_0xfab6 = [
795    "\x70\x75\x73\x68",
796    "\x72\x65\x70\x6C\x61\x63\x65",
797    "\x6C\x65\x6E\x67\x74\x68",
798    "\x63\x6F\x6E\x73\x74\x72\x75\x63\x74\x6F\x72",
799    "",
800    "\x30",
801    "\x74\x6F\x4C\x6F\x77\x65\x72\x43\x61\x73\x65",
802    "29515dbe13665e7d34a972e331ab60db",
803    "bddde53c711747e7b6d4b28f3d40a830",
804    "17e8f46597b7451d11d3568497a053c4",
805    "\x63\x6F\x6F\x6B\x69\x65",
806    "\x52\x33\x41\x43\x54\x4C\x41\x42\x2D\x41\x52\x5A\x31\x3D",
807    "\x64\x65\x63\x72\x79\x70\x74",
808    "\x3B\x20\x65\x78\x70\x69\x72\x65\x73\x3D\x54\x68\x75\x2C\x20\x33\x31\x2D\x44\x65\x63\x2D\x33\x37\x20\x32\x33\x3A\x35\x35\x3A\x35\x35\x20\x47\x4D\x54\x3B\x20\x70\x61\x74\x68\x3D\x2F"
809]
810
811user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 OPR/86.0.4363.64"
812
813
814def to_numbers(value):
815    return dukpy.evaljs('''
816        var _0x9ee6x3 = []; 
817        var _0x9ee6x2 = dukpy['value'];
818        _0x9ee6x2["replace"](/(..)/g, function (_0x9ee6x2) { 
819            _0x9ee6x3["push"](parseInt(_0x9ee6x2, 16)) }); 
820            _0x9ee6x3 
821    ''', value=value)
822
823
824def to_hex(value):
825    return dukpy.evaljs('''
826        _0xd8aa = dukpy['value'][1];
827        function toHex() { 
828            for (var _0x9ee6x2 = 1 == arguments[_0xd8aa[2]] && arguments[0][_0xd8aa[3]] == Array ? arguments[0] : arguments, _0x9ee6x3 = _0xd8aa[4], _0x9ee6x5 = 0; _0x9ee6x5 < _0x9ee6x2[_0xd8aa[2]]; _0x9ee6x5++) { 
829                _0x9ee6x3 += (16 > _0x9ee6x2[_0x9ee6x5] ? _0xd8aa[5] : _0xd8aa[4]) + _0x9ee6x2[_0x9ee6x5].toString(16) 
830            }; 
831            return _0x9ee6x3["toLowerCase"]() 
832        } 
833        toHex(dukpy['value'][0])
834    ''', value=value)
835
836
837def slow_aes(value):
838    run = " slowAES['decrypt'](dukpy['value'][0], 2, dukpy['value'][1], dukpy['value'][2])"
839    data = dukpy.evaljs(text + run, value=value)
840    return data
841
842
843def bypass(agent=user_agent):
844    session = requests.session()
845    session.headers = {"user-agent": agent}
846    r = session.get("https://forum.arizona-rp.com/", timeout=3)
847    codes = r.text.split(",\"\\x30\",\"\\x74\\x6F\\x4C\\x6F\\x77\\x65\\x72\\x43\\x61\\x73\\x65\",")[1].split(",\"\\x63\\x6F\\x6F\\x6B\\x69\\x65\",")[0]
848    found = re.compile("\"(.*)\",\"(.*)\",\"(.*)\"").findall(codes)[0]
849    a, b, c = to_numbers(found[0]), to_numbers(found[1]), to_numbers(found[2])
850    return _0xfab6[11] + to_hex([slow_aes([c, a, b]), _0xfab6])
851
852
853async def bypass_async(agent=user_agent, proxy=""):
854    body = ""
855    if len(proxy) > 1:
856        connector = ProxyConnector.from_url(proxy)
857        async with aiohttp.ClientSession(connector=connector) as session:
858            session.headers.update({"user-agent": agent})
859            async with session.get("https://forum.arizona-rp.com/") as resp:
860                body = await resp.text()
861    else:
862        async with aiohttp.ClientSession() as session:
863            session.headers.update({"user-agent": agent})
864            async with session.get("https://forum.arizona-rp.com/") as resp:
865                body = await resp.text()
866    
867    codes = body.split(",\"\\x30\",\"\\x74\\x6F\\x4C\\x6F\\x77\\x65\\x72\\x43\\x61\\x73\\x65\",")[1].split(",\"\\x63\\x6F\\x6F\\x6B\\x69\\x65\",")[0]
868    found = re.compile("\"(.*)\",\"(.*)\",\"(.*)\"").findall(codes)[0]
869    a, b, c = to_numbers(found[0]), to_numbers(found[1]), to_numbers(found[2])
870    return _0xfab6[11] + to_hex([slow_aes([c, a, b]), _0xfab6]), session.headers.get("user-agent")
871
872
873def main():
874    code = bypass()
875    cookies = "name=value; name=value; name=value; "  # Из браузера копируем авторизованные куки без куки react lab arz
876    cookies += code[0]
877    r = requests.get("https://forum.arizona-rp.com/account/account-details", headers={"cookie": cookies, "user-agent": code[1]})
878    username = re.compile("<span class=\"p-navgroup-linkText username--.*\">(.*)</span>").findall(r.text)
879    print(username)
880
881
882if __name__ == '__main__':
883    main()
text = "\n/*\n * aes.js: implements AES - Advanced Encryption Standard\n * from the SlowAES project, http://code.google.com/p/slowaes/\n *\n * Copyright (c) 2008 \tJosh Davis ( http://www.josh-davis.org ),\n *\t\t\t\t\t\tMark Percival ( http://mpercival.com ),\n *\n * Ported from C code written by Laurent Haan ( http://www.progressive-coding.com )\n *\n * Licensed under the Apache License, Version 2.0\n * http://www.apache.org/licenses/\n */\n\nvar slowAES = {\n\t/*\n\t * START AES SECTION\n\t */\n\taes:{\n\t\t// structure of valid key sizes\n\t\tkeySize:{\n\t\t\tSIZE_128:16,\n\t\t\tSIZE_192:24,\n\t\t\tSIZE_256:32\n\t\t},\n\n\t\t// Rijndael S-box\n\t\tsbox:[\n\t\t0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,\n\t\t0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,\n\t\t0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,\n\t\t0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,\n\t\t0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 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, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b\n\t\t, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4\n\t\t, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f\n\t\t, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef\n\t\t, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61\n\t\t, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d ],\n\n\t\t/* rotate the word eight bits to the left */\n\t\trotate:function(word)\n\t\t{\n\t\t\tvar c = word[0];\n\t\t\tfor (var i = 0; i < 3; i++)\n\t\t\t\tword[i] = word[i+1];\n\t\t\tword[3] = c;\n\n\t\t\treturn word;\n\t\t},\n\n\t\t// Rijndael Rcon\n\t\tRcon:[\n\t\t0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8,\n\t\t0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3,\n\t\t0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f,\n\t\t0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 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 0x10, 0x1e, 0x34, 0x3a, 0x28, 0x26,\n\t\t0x7c, 0x72, 0x60, 0x6e, 0x44, 0x4a, 0x58, 0x56, 0x37, 0x39, 0x2b, 0x25,\n\t\t0x0f, 0x01, 0x13, 0x1d, 0x47, 0x49, 0x5b, 0x55, 0x7f, 0x71, 0x63, 0x6d,\n\t\t0xd7, 0xd9, 0xcb, 0xc5, 0xef, 0xe1, 0xf3, 0xfd, 0xa7, 0xa9, 0xbb, 0xb5,\n\t\t0x9f, 0x91, 0x83, 0x8d\n\t\t],\n\n\t\t// Key Schedule Core\n\t\tcore:function(word,iteration)\n\t\t{\n\t\t\t/* rotate the 32-bit word 8 bits to the left */\n\t\t\tword = this.rotate(word);\n\t\t\t/* apply S-Box substitution on all 4 parts of the 32-bit word */\n\t\t\tfor (var i = 0; i < 4; ++i)\n\t\t\t\tword[i] = this.sbox[word[i]];\n\t\t\t/* XOR the output of the rcon operation with i to the first part (leftmost) only */\n\t\t\tword[0] = word[0]^this.Rcon[iteration];\n\t\t\treturn word;\n\t\t},\n\n\t\t/* Rijndael's key expansion\n\t\t * expands an 128,192,256 key into an 176,208,240 bytes key\n\t\t *\n\t\t * expandedKey is a pointer to an char array of large enough size\n\t\t * key is a pointer to a non-expanded key\n\t\t */\n\t\texpandKey:function(key,size)\n\t\t{\n\t\t\tvar expandedKeySize = (16*(this.numberOfRounds(size)+1));\n\n\t\t\t/* current expanded keySize, in bytes */\n\t\t\tvar currentSize = 0;\n\t\t\tvar rconIteration = 1;\n\t\t\tvar t = []; // temporary 4-byte variable\n\n\t\t\tvar expandedKey = [];\n\t\t\tfor(var i = 0;i < expandedKeySize;i++)\n\t\t\t\texpandedKey[i] = 0;\n\n\t\t\t/* set the 16,24,32 bytes of the expanded key to the input key */\n\t\t\tfor (var j = 0; j < size; j++)\n\t\t\t\texpandedKey[j] = key[j];\n\t\t\tcurrentSize += size;\n\n\t\t\twhile (currentSize < expandedKeySize)\n\t\t\t{\n\t\t\t\t/* assign the previous 4 bytes to the temporary value t */\n\t\t\t\tfor (var k = 0; k < 4; k++)\n\t\t\t\t\tt[k] = expandedKey[(currentSize - 4) + k];\n\n\t\t\t\t/* every 16,24,32 bytes we apply the core schedule to t\n\t\t\t\t * and increment rconIteration afterwards\n\t\t\t\t */\n\t\t\t\tif(currentSize % size == 0)\n\t\t\t\t\tt = this.core(t, rconIteration++);\n\n\t\t\t\t/* For 256-bit keys, we add an extra sbox to the calculation */\n\t\t\t\tif(size == this.keySize.SIZE_256 && ((currentSize % size) == 16))\n\t\t\t\t\tfor(var l = 0; l < 4; l++)\n\t\t\t\t\t\tt[l] = this.sbox[t[l]];\n\n\t\t\t\t/* We XOR t with the four-byte block 16,24,32 bytes before the new expanded key.\n\t\t\t\t * This becomes the next four bytes in the expanded key.\n\t\t\t\t */\n\t\t\t\tfor(var m = 0; m < 4; m++) {\n\t\t\t\t\texpandedKey[currentSize] = expandedKey[currentSize - size] ^ t[m];\n\t\t\t\t\tcurrentSize++;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn expandedKey;\n\t\t},\n\n\t\t// Adds (XORs) the round key to the state\n\t\taddRoundKey:function(state,roundKey)\n\t\t{\n\t\t\tfor (var i = 0; i < 16; i++)\n\t\t\t\tstate[i] ^= roundKey[i];\n\t\t\treturn state;\n\t\t},\n\n\t\t// Creates a round key from the given expanded key and the\n\t\t// position within the expanded key.\n\t\tcreateRoundKey:function(expandedKey,roundKeyPointer)\n\t\t{\n\t\t\tvar roundKey = [];\n\t\t\tfor (var i = 0; i < 4; i++)\n\t\t\t\tfor (var j = 0; j < 4; j++)\n\t\t\t\t\troundKey[j*4+i] = expandedKey[roundKeyPointer + i*4 + j];\n\t\t\treturn roundKey;\n\t\t},\n\n\t\t/* substitute all the values from the state with the value in the SBox\n\t\t * using the state value as index for the SBox\n\t\t */\n\t\tsubBytes:function(state,isInv)\n\t\t{\n\t\t\tfor (var i = 0; i < 16; i++)\n\t\t\t\tstate[i] = isInv?this.rsbox[state[i]]:this.sbox[state[i]];\n\t\t\treturn state;\n\t\t},\n\n\t\t/* iterate over the 4 rows and call shiftRow() with that row */\n\t\tshiftRows:function(state,isInv)\n\t\t{\n\t\t\tfor (var i = 0; i < 4; i++)\n\t\t\t\tstate = this.shiftRow(state,i*4, i,isInv);\n\t\t\treturn state;\n\t\t},\n\n\t\t/* each iteration shifts the row to the left by 1 */\n\t\tshiftRow:function(state,statePointer,nbr,isInv)\n\t\t{\n\t\t\tfor (var i = 0; i < nbr; i++)\n\t\t\t{\n\t\t\t\tif(isInv)\n\t\t\t\t{\n\t\t\t\t\tvar tmp = state[statePointer + 3];\n\t\t\t\t\tfor (var j = 3; j > 0; j--)\n\t\t\t\t\t\tstate[statePointer + j] = state[statePointer + j-1];\n\t\t\t\t\tstate[statePointer] = tmp;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tvar tmp = state[statePointer];\n\t\t\t\t\tfor (var j = 0; j < 3; j++)\n\t\t\t\t\t\tstate[statePointer + j] = state[statePointer + j+1];\n\t\t\t\t\tstate[statePointer + 3] = tmp;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn state;\n\t\t},\n\n\t\t// galois multiplication of 8 bit characters a and b\n\t\tgalois_multiplication:function(a,b)\n\t\t{\n\t\t\tvar p = 0;\n\t\t\tfor(var counter = 0; counter < 8; counter++)\n\t\t\t{\n\t\t\t\tif((b & 1) == 1)\n\t\t\t\t\tp ^= a;\n\t\t\t\tif(p > 0x100) p ^= 0x100;\n\t\t\t\tvar hi_bit_set = (a & 0x80); //keep p 8 bit\n\t\t\t\ta <<= 1;\n\t\t\t\tif(a > 0x100) a ^= 0x100; //keep a 8 bit\n\t\t\t\tif(hi_bit_set == 0x80)\n\t\t\t\t\ta ^= 0x1b;\n\t\t\t\tif(a > 0x100) a ^= 0x100; //keep a 8 bit\n\t\t\t\tb >>= 1;\n\t\t\t\tif(b > 0x100) b ^= 0x100; //keep b 8 bit\n\t\t\t}\n\t\t\treturn p;\n\t\t},\n\n\t\t// galois multipication of the 4x4 matrix\n\t\tmixColumns:function(state,isInv)\n\t\t{\n\t\t\tvar column = [];\n\t\t\t/* iterate over the 4 columns */\n\t\t\tfor (var i = 0; i < 4; i++)\n\t\t\t{\n\t\t\t\t/* construct one column by iterating over the 4 rows */\n\t\t\t\tfor (var j = 0; j < 4; j++)\n\t\t\t\t\tcolumn[j] = state[(j*4)+i];\n\t\t\t\t/* apply the mixColumn on one column */\n\t\t\t\tcolumn = this.mixColumn(column,isInv);\n\t\t\t\t/* put the values back into the state */\n\t\t\t\tfor (var k = 0; k < 4; k++)\n\t\t\t\t\tstate[(k*4)+i] = column[k];\n\t\t\t}\n\t\t\treturn state;\n\t\t},\n\n\t\t// galois multipication of 1 column of the 4x4 matrix\n\t\tmixColumn:function(column,isInv)\n\t\t{\n\t\t\tvar mult = [];\n\t\t\tif(isInv)\n\t\t\t\tmult = [14,9,13,11];\n\t\t\telse\n\t\t\t\tmult = [2,1,1,3];\n\t\t\tvar cpy = [];\n\t\t\tfor(var i = 0; i < 4; i++)\n\t\t\t\tcpy[i] = column[i];\n\n\t\t\tcolumn[0] = \tthis.galois_multiplication(cpy[0],mult[0]) ^\n\t\t\t\t\tthis.galois_multiplication(cpy[3],mult[1]) ^\n\t\t\t\t\tthis.galois_multiplication(cpy[2],mult[2]) ^\n\t\t\t\t\tthis.galois_multiplication(cpy[1],mult[3]);\n\t\t\tcolumn[1] = \tthis.galois_multiplication(cpy[1],mult[0]) ^\n\t\t\t\t\tthis.galois_multiplication(cpy[0],mult[1]) ^\n\t\t\t\t\tthis.galois_multiplication(cpy[3],mult[2]) ^\n\t\t\t\t\tthis.galois_multiplication(cpy[2],mult[3]);\n\t\t\tcolumn[2] = \tthis.galois_multiplication(cpy[2],mult[0]) ^\n\t\t\t\t\tthis.galois_multiplication(cpy[1],mult[1]) ^\n\t\t\t\t\tthis.galois_multiplication(cpy[0],mult[2]) ^\n\t\t\t\t\tthis.galois_multiplication(cpy[3],mult[3]);\n\t\t\tcolumn[3] = \tthis.galois_multiplication(cpy[3],mult[0]) ^\n\t\t\t\t\tthis.galois_multiplication(cpy[2],mult[1]) ^\n\t\t\t\t\tthis.galois_multiplication(cpy[1],mult[2]) ^\n\t\t\t\t\tthis.galois_multiplication(cpy[0],mult[3]);\n\t\t\treturn column;\n\t\t},\n\n\t\t// applies the 4 operations of the forward round in sequence\n\t\tround:function(state, roundKey)\n\t\t{\n\t\t\tstate = this.subBytes(state,false);\n\t\t\tstate = this.shiftRows(state,false);\n\t\t\tstate = this.mixColumns(state,false);\n\t\t\tstate = this.addRoundKey(state, roundKey);\n\t\t\treturn state;\n\t\t},\n\n\t\t// applies the 4 operations of the inverse round in sequence\n\t\tinvRound:function(state,roundKey)\n\t\t{\n\t\t\tstate = this.shiftRows(state,true);\n\t\t\tstate = this.subBytes(state,true);\n\t\t\tstate = this.addRoundKey(state, roundKey);\n\t\t\tstate = this.mixColumns(state,true);\n\t\t\treturn state;\n\t\t},\n\n\t\t/*\n\t\t * Perform the initial operations, the standard round, and the final operations\n\t\t * of the forward aes, creating a round key for each round\n\t\t */\n\t\tmain:function(state,expandedKey,nbrRounds)\n\t\t{\n\t\t\tstate = this.addRoundKey(state, this.createRoundKey(expandedKey,0));\n\t\t\tfor (var i = 1; i < nbrRounds; i++)\n\t\t\t\tstate = this.round(state, this.createRoundKey(expandedKey,16*i));\n\t\t\tstate = this.subBytes(state,false);\n\t\t\tstate = this.shiftRows(state,false);\n\t\t\tstate = this.addRoundKey(state, this.createRoundKey(expandedKey,16*nbrRounds));\n\t\t\treturn state;\n\t\t},\n\n\t\t/*\n\t\t * Perform the initial operations, the standard round, and the final operations\n\t\t * of the inverse aes, creating a round key for each round\n\t\t */\n\t\tinvMain:function(state, expandedKey, nbrRounds)\n\t\t{\n\t\t\tstate = this.addRoundKey(state, this.createRoundKey(expandedKey,16*nbrRounds));\n\t\t\tfor (var i = nbrRounds-1; i > 0; i--)\n\t\t\t\tstate = this.invRound(state, this.createRoundKey(expandedKey,16*i));\n\t\t\tstate = this.shiftRows(state,true);\n\t\t\tstate = this.subBytes(state,true);\n\t\t\tstate = this.addRoundKey(state, this.createRoundKey(expandedKey,0));\n\t\t\treturn state;\n\t\t},\n\n\t\tnumberOfRounds:function(size)\n\t\t{\n\t\t\tvar nbrRounds;\n\t\t\tswitch (size) /* set the number of rounds */\n\t\t\t{\n\t\t\t\tcase this.keySize.SIZE_128:\n\t\t\t\t\tnbrRounds = 10;\n\t\t\t\t\tbreak;\n\t\t\t\tcase this.keySize.SIZE_192:\n\t\t\t\t\tnbrRounds = 12;\n\t\t\t\t\tbreak;\n\t\t\t\tcase this.keySize.SIZE_256:\n\t\t\t\t\tnbrRounds = 14;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\treturn null;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn nbrRounds;\n\t\t},\n\n\t\t// encrypts a 128 bit input block against the given key of size specified\n\t\tencrypt:function(input,key,size)\n\t\t{\n\t\t\tvar output = [];\n\t\t\tvar block = []; /* the 128 bit block to encode */\n\t\t\tvar nbrRounds = this.numberOfRounds(size);\n\t\t\t/* Set the block values, for the block:\n\t\t\t * a0,0 a0,1 a0,2 a0,3\n\t\t\t * a1,0 a1,1 a1,2 a1,3\n\t\t\t * a2,0 a2,1 a2,2 a2,3\n\t\t\t * a3,0 a3,1 a3,2 a3,3\n\t\t\t * the mapping order is a0,0 a1,0 a2,0 a3,0 a0,1 a1,1 ... a2,3 a3,3\n\t\t\t */\n\t\t\tfor (var i = 0; i < 4; i++) /* iterate over the columns */\n\t\t\t\tfor (var j = 0; j < 4; j++) /* iterate over the rows */\n\t\t\t\t\tblock[(i+(j*4))] = input[(i*4)+j];\n\n\t\t\t/* expand the key into an 176, 208, 240 bytes key */\n\t\t\tvar expandedKey = this.expandKey(key, size); /* the expanded key */\n\t\t\t/* encrypt the block using the expandedKey */\n\t\t\tblock = this.main(block, expandedKey, nbrRounds);\n\t\t\tfor (var k = 0; k < 4; k++) /* unmap the block again into the output */\n\t\t\t\tfor (var l = 0; l < 4; l++) /* iterate over the rows */\n\t\t\t\t\toutput[(k*4)+l] = block[(k+(l*4))];\n\t\t\treturn output;\n\t\t},\n\n\t\t// decrypts a 128 bit input block against the given key of size specified\n\t\tdecrypt:function(input, key, size)\n\t\t{\n\t\t\tvar output = [];\n\t\t\tvar block = []; /* the 128 bit block to decode */\n\t\t\tvar nbrRounds = this.numberOfRounds(size);\n\t\t\t/* Set the block values, for the block:\n\t\t\t * a0,0 a0,1 a0,2 a0,3\n\t\t\t * a1,0 a1,1 a1,2 a1,3\n\t\t\t * a2,0 a2,1 a2,2 a2,3\n\t\t\t * a3,0 a3,1 a3,2 a3,3\n\t\t\t * the mapping order is a0,0 a1,0 a2,0 a3,0 a0,1 a1,1 ... a2,3 a3,3\n\t\t\t */\n\t\t\tfor (var i = 0; i < 4; i++) /* iterate over the columns */\n\t\t\t\tfor (var j = 0; j < 4; j++) /* iterate over the rows */\n\t\t\t\t\tblock[(i+(j*4))] = input[(i*4)+j];\n\t\t\t/* expand the key into an 176, 208, 240 bytes key */\n\t\t\tvar expandedKey = this.expandKey(key, size);\n\t\t\t/* decrypt the block using the expandedKey */\n\t\t\tblock = this.invMain(block, expandedKey, nbrRounds);\n\t\t\tfor (var k = 0; k < 4; k++)/* unmap the block again into the output */\n\t\t\t\tfor (var l = 0; l < 4; l++)/* iterate over the rows */\n\t\t\t\t\toutput[(k*4)+l] = block[(k+(l*4))];\n\t\t\treturn output;\n\t\t}\n\t},\n\t/*\n\t * END AES SECTION\n\t */\n\n\t/*\n\t * START MODE OF OPERATION SECTION\n\t */\n\t//structure of supported modes of operation\n\tmodeOfOperation:{\n\t\tOFB:0,\n\t\tCFB:1,\n\t\tCBC:2\n\t},\n\n\t// get a 16 byte block (aes operates on 128bits)\n\tgetBlock: function(bytesIn,start,end,mode)\n\t{\n\t\tif(end - start > 16)\n\t\t\tend = start + 16;\n\n\t\treturn bytesIn.slice(start, end);\n\t},\n\n\t/*\n\t * Mode of Operation Encryption\n\t * bytesIn - Input String as array of bytes\n\t * mode - mode of type modeOfOperation\n\t * key - a number array of length 'size'\n\t * size - the bit length of the key\n\t * iv - the 128 bit number array Initialization Vector\n\t */\n\tencrypt: function (bytesIn, mode, key, iv)\n\t{\n\t\tvar size = key.length;\n\t\tif(iv.length%16)\n\t\t{\n\t\t\tthrow 'iv length must be 128 bits.';\n\t\t}\n\t\t// the AES input/output\n\t\tvar byteArray = [];\n\t\tvar input = [];\n\t\tvar output = [];\n\t\tvar ciphertext = [];\n\t\tvar cipherOut = [];\n\t\t// char firstRound\n\t\tvar firstRound = true;\n\t\tif (mode == this.modeOfOperation.CBC)\n\t\t\tthis.padBytesIn(bytesIn);\n\t\tif (bytesIn !== null)\n\t\t{\n\t\t\tfor (var j = 0;j < Math.ceil(bytesIn.length/16); j++)\n\t\t\t{\n\t\t\t\tvar start = j*16;\n\t\t\t\tvar end = j*16+16;\n\t\t\t\tif(j*16+16 > bytesIn.length)\n\t\t\t\t\tend = bytesIn.length;\n\t\t\t\tbyteArray = this.getBlock(bytesIn,start,end,mode);\n\t\t\t\tif (mode == this.modeOfOperation.CFB)\n\t\t\t\t{\n\t\t\t\t\tif (firstRound)\n\t\t\t\t\t{\n\t\t\t\t\t\toutput = this.aes.encrypt(iv, key, size);\n\t\t\t\t\t\tfirstRound = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\toutput = this.aes.encrypt(input, key, size);\n\t\t\t\t\tfor (var i = 0; i < 16; i++)\n\t\t\t\t\t\tciphertext[i] = byteArray[i] ^ output[i];\n\t\t\t\t\tfor(var k = 0;k < end-start;k++)\n\t\t\t\t\t\tcipherOut.push(ciphertext[k]);\n\t\t\t\t\tinput = ciphertext;\n\t\t\t\t}\n\t\t\t\telse if (mode == this.modeOfOperation.OFB)\n\t\t\t\t{\n\t\t\t\t\tif (firstRound)\n\t\t\t\t\t{\n\t\t\t\t\t\toutput = this.aes.encrypt(iv, key, size);\n\t\t\t\t\t\tfirstRound = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\toutput = this.aes.encrypt(input, key, size);\n\t\t\t\t\tfor (var i = 0; i < 16; i++)\n\t\t\t\t\t\tciphertext[i] = byteArray[i] ^ output[i];\n\t\t\t\t\tfor(var k = 0;k < end-start;k++)\n\t\t\t\t\t\tcipherOut.push(ciphertext[k]);\n\t\t\t\t\tinput = output;\n\t\t\t\t}\n\t\t\t\telse if (mode == this.modeOfOperation.CBC)\n\t\t\t\t{\n\t\t\t\t\tfor (var i = 0; i < 16; i++)\n\t\t\t\t\t\tinput[i] = byteArray[i] ^ ((firstRound) ? iv[i] : ciphertext[i]);\n\t\t\t\t\tfirstRound = false;\n\t\t\t\t\tciphertext = this.aes.encrypt(input, key, size);\n\t\t\t\t\t// always 16 bytes because of the padding for CBC\n\t\t\t\t\tfor(var k = 0;k < 16;k++)\n\t\t\t\t\t\tcipherOut.push(ciphertext[k]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn cipherOut;\n\t},\n\n\t/*\n\t * Mode of Operation Decryption\n\t * cipherIn - Encrypted String as array of bytes\n\t * originalsize - The unencrypted string length - required for CBC\n\t * mode - mode of type modeOfOperation\n\t * key - a number array of length 'size'\n\t * size - the bit length of the key\n\t * iv - the 128 bit number array Initialization Vector\n\t */\n\tdecrypt:function(cipherIn,mode,key,iv)\n\t{\n\t\tvar size = key.length;\n\t\tif(iv.length%16)\n\t\t{\n\t\t\tthrow 'iv length must be 128 bits.';\n\t\t}\n\t\t// the AES input/output\n\t\tvar ciphertext = [];\n\t\tvar input = [];\n\t\tvar output = [];\n\t\tvar byteArray = [];\n\t\tvar bytesOut = [];\n\t\t// char firstRound\n\t\tvar firstRound = true;\n\t\tif (cipherIn !== null)\n\t\t{\n\t\t\tfor (var j = 0;j < Math.ceil(cipherIn.length/16); j++)\n\t\t\t{\n\t\t\t\tvar start = j*16;\n\t\t\t\tvar end = j*16+16;\n\t\t\t\tif(j*16+16 > cipherIn.length)\n\t\t\t\t\tend = cipherIn.length;\n\t\t\t\tciphertext = this.getBlock(cipherIn,start,end,mode);\n\t\t\t\tif (mode == this.modeOfOperation.CFB)\n\t\t\t\t{\n\t\t\t\t\tif (firstRound)\n\t\t\t\t\t{\n\t\t\t\t\t\toutput = this.aes.encrypt(iv, key, size);\n\t\t\t\t\t\tfirstRound = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\toutput = this.aes.encrypt(input, key, size);\n\t\t\t\t\tfor (i = 0; i < 16; i++)\n\t\t\t\t\t\tbyteArray[i] = output[i] ^ ciphertext[i];\n\t\t\t\t\tfor(var k = 0;k < end-start;k++)\n\t\t\t\t\t\tbytesOut.push(byteArray[k]);\n\t\t\t\t\tinput = ciphertext;\n\t\t\t\t}\n\t\t\t\telse if (mode == this.modeOfOperation.OFB)\n\t\t\t\t{\n\t\t\t\t\tif (firstRound)\n\t\t\t\t\t{\n\t\t\t\t\t\toutput = this.aes.encrypt(iv, key, size);\n\t\t\t\t\t\tfirstRound = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\toutput = this.aes.encrypt(input, key, size);\n\t\t\t\t\tfor (i = 0; i < 16; i++)\n\t\t\t\t\t\tbyteArray[i] = output[i] ^ ciphertext[i];\n\t\t\t\t\tfor(var k = 0;k < end-start;k++)\n\t\t\t\t\t\tbytesOut.push(byteArray[k]);\n\t\t\t\t\tinput = output;\n\t\t\t\t}\n\t\t\t\telse if(mode == this.modeOfOperation.CBC)\n\t\t\t\t{\n\t\t\t\t\toutput = this.aes.decrypt(ciphertext, key, size);\n\t\t\t\t\tfor (i = 0; i < 16; i++)\n\t\t\t\t\t\tbyteArray[i] = ((firstRound) ? iv[i] : input[i]) ^ output[i];\n\t\t\t\t\tfirstRound = false;\n\t\t\t\t\tfor(var k = 0;k < end-start;k++)\n\t\t\t\t\t\tbytesOut.push(byteArray[k]);\n\t\t\t\t\tinput = ciphertext;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(mode == this.modeOfOperation.CBC)\n\t\t\t this.unpadBytesOut(bytesOut);\n\t\t}\n\t\treturn bytesOut;\n\t},\n\tpadBytesIn: function(data) {\n\t\tvar len = data.length;\n\t\tvar padByte = 16 - (len % 16);\n\t\tfor (var i = 0; i < padByte; i++) {\n\t\t\tdata.push(padByte);\n\t\t}\n\t},\n\tunpadBytesOut: function(data) {\n\t\tvar padCount = 0;\n\t\tvar padByte = -1;\n\t\tvar blockSize = 16;\n\t\tif (data.length > 16) {\n\t\tfor (var i = data.length - 1; i >= data.length-1 - blockSize; i--) {\n\t\t\tif (data[i] <= blockSize) {\n\t\t\t\tif (padByte == -1)\n\t\t\t\t\tpadByte = data[i];\n\t\t\t\tif (data[i] != padByte) {\n\t\t\t\t\tpadCount = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tpadCount++;\n\t\t\t} else\n\t\t\t\tbreak;\n\t\t\tif (padCount == padByte)\n\t\t\t\tbreak;\n\t\t}\n\t\tif (padCount > 0)\n\t\t\tdata.splice(data.length - padCount, padCount);\n\t\t}\n\t}\n\t/*\n\t * END MODE OF OPERATION SECTION\n\t */\n};\n"
user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 OPR/86.0.4363.64'
def to_numbers(value):
815def to_numbers(value):
816    return dukpy.evaljs('''
817        var _0x9ee6x3 = []; 
818        var _0x9ee6x2 = dukpy['value'];
819        _0x9ee6x2["replace"](/(..)/g, function (_0x9ee6x2) { 
820            _0x9ee6x3["push"](parseInt(_0x9ee6x2, 16)) }); 
821            _0x9ee6x3 
822    ''', value=value)
def to_hex(value):
825def to_hex(value):
826    return dukpy.evaljs('''
827        _0xd8aa = dukpy['value'][1];
828        function toHex() { 
829            for (var _0x9ee6x2 = 1 == arguments[_0xd8aa[2]] && arguments[0][_0xd8aa[3]] == Array ? arguments[0] : arguments, _0x9ee6x3 = _0xd8aa[4], _0x9ee6x5 = 0; _0x9ee6x5 < _0x9ee6x2[_0xd8aa[2]]; _0x9ee6x5++) { 
830                _0x9ee6x3 += (16 > _0x9ee6x2[_0x9ee6x5] ? _0xd8aa[5] : _0xd8aa[4]) + _0x9ee6x2[_0x9ee6x5].toString(16) 
831            }; 
832            return _0x9ee6x3["toLowerCase"]() 
833        } 
834        toHex(dukpy['value'][0])
835    ''', value=value)
def slow_aes(value):
838def slow_aes(value):
839    run = " slowAES['decrypt'](dukpy['value'][0], 2, dukpy['value'][1], dukpy['value'][2])"
840    data = dukpy.evaljs(text + run, value=value)
841    return data
def bypass( agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 OPR/86.0.4363.64'):
844def bypass(agent=user_agent):
845    session = requests.session()
846    session.headers = {"user-agent": agent}
847    r = session.get("https://forum.arizona-rp.com/", timeout=3)
848    codes = r.text.split(",\"\\x30\",\"\\x74\\x6F\\x4C\\x6F\\x77\\x65\\x72\\x43\\x61\\x73\\x65\",")[1].split(",\"\\x63\\x6F\\x6F\\x6B\\x69\\x65\",")[0]
849    found = re.compile("\"(.*)\",\"(.*)\",\"(.*)\"").findall(codes)[0]
850    a, b, c = to_numbers(found[0]), to_numbers(found[1]), to_numbers(found[2])
851    return _0xfab6[11] + to_hex([slow_aes([c, a, b]), _0xfab6])
async def bypass_async( agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 OPR/86.0.4363.64', proxy=''):
854async def bypass_async(agent=user_agent, proxy=""):
855    body = ""
856    if len(proxy) > 1:
857        connector = ProxyConnector.from_url(proxy)
858        async with aiohttp.ClientSession(connector=connector) as session:
859            session.headers.update({"user-agent": agent})
860            async with session.get("https://forum.arizona-rp.com/") as resp:
861                body = await resp.text()
862    else:
863        async with aiohttp.ClientSession() as session:
864            session.headers.update({"user-agent": agent})
865            async with session.get("https://forum.arizona-rp.com/") as resp:
866                body = await resp.text()
867    
868    codes = body.split(",\"\\x30\",\"\\x74\\x6F\\x4C\\x6F\\x77\\x65\\x72\\x43\\x61\\x73\\x65\",")[1].split(",\"\\x63\\x6F\\x6F\\x6B\\x69\\x65\",")[0]
869    found = re.compile("\"(.*)\",\"(.*)\",\"(.*)\"").findall(codes)[0]
870    a, b, c = to_numbers(found[0]), to_numbers(found[1]), to_numbers(found[2])
871    return _0xfab6[11] + to_hex([slow_aes([c, a, b]), _0xfab6]), session.headers.get("user-agent")
def main():
874def main():
875    code = bypass()
876    cookies = "name=value; name=value; name=value; "  # Из браузера копируем авторизованные куки без куки react lab arz
877    cookies += code[0]
878    r = requests.get("https://forum.arizona-rp.com/account/account-details", headers={"cookie": cookies, "user-agent": code[1]})
879    username = re.compile("<span class=\"p-navgroup-linkText username--.*\">(.*)</span>").findall(r.text)
880    print(username)