Guest User

Untitled

a guest
Aug 9th, 2011
839
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. //----------------------------------------------------------------------
  3. //Symbol 3 MovieClip [__Packages.com.ns.utils.GUID] Frame 0
  4. //----------------------------------------------------------------------
  5. class com.ns.utils.GUID
  6. {
  7. static var _guidInstance;
  8. function GUID () {
  9. }
  10. static function create() {
  11. if (_guidInstance == undefined) {
  12. var _local1 = new Date();
  13. var _local4 = _local1.getTime();
  14. var _local3 = Math.random() * Number.MAX_VALUE;
  15. var _local2 = System.capabilities.serverString;
  16. _guidInstance = hex_md5(((_local4 + _local2) + _local3) + (counter++)).toUpperCase();
  17. }
  18. return(_guidInstance);
  19. }
  20. static function getNewGUID() {
  21. var _local1 = new Date();
  22. var _local4 = _local1.getTime();
  23. var _local3 = Math.random() * Number.MAX_VALUE;
  24. var _local2 = System.capabilities.serverString;
  25. return(hex_md5(((_local4 + _local2) + _local3) + (counter++)).toUpperCase());
  26. }
  27. static function hex_md5(s) {
  28. return(binl2hex(core_md5(str2binl(s), s.length * chrsz)));
  29. }
  30. static function b64_md5(s) {
  31. return(binl2b64(core_md5(str2binl(s), s.length * chrsz)));
  32. }
  33. static function str_md5(s) {
  34. return(binl2str(core_md5(str2binl(s), s.length * chrsz)));
  35. }
  36. static function hex_hmac_md5(key, data) {
  37. return(binl2hex(core_hmac_md5(key, data)));
  38. }
  39. static function b64_hmac_md5(key, data) {
  40. return(binl2b64(core_hmac_md5(key, data)));
  41. }
  42. static function str_hmac_md5(key, data) {
  43. return(binl2str(core_hmac_md5(key, data)));
  44. }
  45. static function md5_vm_test() {
  46. return(hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72");
  47. }
  48. static function core_md5(x, len) {
  49. x[len >> 5] = x[len >> 5] | (128 << (len % 32));
  50. x[(((len + 64) >>> 9) << 4) + 14] = len;
  51. var _local4 = 1732584193 /* 0x67452301 */;
  52. var _local3 = -271733879;
  53. var _local2 = -1732584194;
  54. var _local1 = 271733878 /* 0x10325476 */;
  55. var _local5 = 0;
  56. while (_local5 < x.length) {
  57. var _local10 = _local4;
  58. var _local9 = _local3;
  59. var _local8 = _local2;
  60. var _local7 = _local1;
  61. _local4 = md5_ff(_local4, _local3, _local2, _local1, x[_local5 + 0], 7, -680876936);
  62. _local1 = md5_ff(_local1, _local4, _local3, _local2, x[_local5 + 1], 12, -389564586);
  63. _local2 = md5_ff(_local2, _local1, _local4, _local3, x[_local5 + 2], 17, 606105819);
  64. _local3 = md5_ff(_local3, _local2, _local1, _local4, x[_local5 + 3], 22, -1044525330);
  65. _local4 = md5_ff(_local4, _local3, _local2, _local1, x[_local5 + 4], 7, -176418897);
  66. _local1 = md5_ff(_local1, _local4, _local3, _local2, x[_local5 + 5], 12, 1200080426);
  67. _local2 = md5_ff(_local2, _local1, _local4, _local3, x[_local5 + 6], 17, -1473231341);
  68. _local3 = md5_ff(_local3, _local2, _local1, _local4, x[_local5 + 7], 22, -45705983);
  69. _local4 = md5_ff(_local4, _local3, _local2, _local1, x[_local5 + 8], 7, 1770035416);
  70. _local1 = md5_ff(_local1, _local4, _local3, _local2, x[_local5 + 9], 12, -1958414417);
  71. _local2 = md5_ff(_local2, _local1, _local4, _local3, x[_local5 + 10], 17, -42063);
  72. _local3 = md5_ff(_local3, _local2, _local1, _local4, x[_local5 + 11], 22, -1990404162);
  73. _local4 = md5_ff(_local4, _local3, _local2, _local1, x[_local5 + 12], 7, 1804603682);
  74. _local1 = md5_ff(_local1, _local4, _local3, _local2, x[_local5 + 13], 12, -40341101);
  75. _local2 = md5_ff(_local2, _local1, _local4, _local3, x[_local5 + 14], 17, -1502002290);
  76. _local3 = md5_ff(_local3, _local2, _local1, _local4, x[_local5 + 15], 22, 1236535329);
  77. _local4 = md5_gg(_local4, _local3, _local2, _local1, x[_local5 + 1], 5, -165796510);
  78. _local1 = md5_gg(_local1, _local4, _local3, _local2, x[_local5 + 6], 9, -1069501632);
  79. _local2 = md5_gg(_local2, _local1, _local4, _local3, x[_local5 + 11], 14, 643717713);
  80. _local3 = md5_gg(_local3, _local2, _local1, _local4, x[_local5 + 0], 20, -373897302);
  81. _local4 = md5_gg(_local4, _local3, _local2, _local1, x[_local5 + 5], 5, -701558691);
  82. _local1 = md5_gg(_local1, _local4, _local3, _local2, x[_local5 + 10], 9, 38016083);
  83. _local2 = md5_gg(_local2, _local1, _local4, _local3, x[_local5 + 15], 14, -660478335);
  84. _local3 = md5_gg(_local3, _local2, _local1, _local4, x[_local5 + 4], 20, -405537848);
  85. _local4 = md5_gg(_local4, _local3, _local2, _local1, x[_local5 + 9], 5, 568446438);
  86. _local1 = md5_gg(_local1, _local4, _local3, _local2, x[_local5 + 14], 9, -1019803690);
  87. _local2 = md5_gg(_local2, _local1, _local4, _local3, x[_local5 + 3], 14, -187363961);
  88. _local3 = md5_gg(_local3, _local2, _local1, _local4, x[_local5 + 8], 20, 1163531501);
  89. _local4 = md5_gg(_local4, _local3, _local2, _local1, x[_local5 + 13], 5, -1444681467);
  90. _local1 = md5_gg(_local1, _local4, _local3, _local2, x[_local5 + 2], 9, -51403784);
  91. _local2 = md5_gg(_local2, _local1, _local4, _local3, x[_local5 + 7], 14, 1735328473);
  92. _local3 = md5_gg(_local3, _local2, _local1, _local4, x[_local5 + 12], 20, -1926607734);
  93. _local4 = md5_hh(_local4, _local3, _local2, _local1, x[_local5 + 5], 4, -378558);
  94. _local1 = md5_hh(_local1, _local4, _local3, _local2, x[_local5 + 8], 11, -2022574463);
  95. _local2 = md5_hh(_local2, _local1, _local4, _local3, x[_local5 + 11], 16, 1839030562);
  96. _local3 = md5_hh(_local3, _local2, _local1, _local4, x[_local5 + 14], 23, -35309556);
  97. _local4 = md5_hh(_local4, _local3, _local2, _local1, x[_local5 + 1], 4, -1530992060);
  98. _local1 = md5_hh(_local1, _local4, _local3, _local2, x[_local5 + 4], 11, 1272893353);
  99. _local2 = md5_hh(_local2, _local1, _local4, _local3, x[_local5 + 7], 16, -155497632);
  100. _local3 = md5_hh(_local3, _local2, _local1, _local4, x[_local5 + 10], 23, -1094730640);
  101. _local4 = md5_hh(_local4, _local3, _local2, _local1, x[_local5 + 13], 4, 681279174);
  102. _local1 = md5_hh(_local1, _local4, _local3, _local2, x[_local5 + 0], 11, -358537222);
  103. _local2 = md5_hh(_local2, _local1, _local4, _local3, x[_local5 + 3], 16, -722521979);
  104. _local3 = md5_hh(_local3, _local2, _local1, _local4, x[_local5 + 6], 23, 76029189);
  105. _local4 = md5_hh(_local4, _local3, _local2, _local1, x[_local5 + 9], 4, -640364487);
  106. _local1 = md5_hh(_local1, _local4, _local3, _local2, x[_local5 + 12], 11, -421815835);
  107. _local2 = md5_hh(_local2, _local1, _local4, _local3, x[_local5 + 15], 16, 530742520);
  108. _local3 = md5_hh(_local3, _local2, _local1, _local4, x[_local5 + 2], 23, -995338651);
  109. _local4 = md5_ii(_local4, _local3, _local2, _local1, x[_local5 + 0], 6, -198630844);
  110. _local1 = md5_ii(_local1, _local4, _local3, _local2, x[_local5 + 7], 10, 1126891415);
  111. _local2 = md5_ii(_local2, _local1, _local4, _local3, x[_local5 + 14], 15, -1416354905);
  112. _local3 = md5_ii(_local3, _local2, _local1, _local4, x[_local5 + 5], 21, -57434055);
  113. _local4 = md5_ii(_local4, _local3, _local2, _local1, x[_local5 + 12], 6, 1700485571);
  114. _local1 = md5_ii(_local1, _local4, _local3, _local2, x[_local5 + 3], 10, -1894986606);
  115. _local2 = md5_ii(_local2, _local1, _local4, _local3, x[_local5 + 10], 15, -1051523);
  116. _local3 = md5_ii(_local3, _local2, _local1, _local4, x[_local5 + 1], 21, -2054922799);
  117. _local4 = md5_ii(_local4, _local3, _local2, _local1, x[_local5 + 8], 6, 1873313359);
  118. _local1 = md5_ii(_local1, _local4, _local3, _local2, x[_local5 + 15], 10, -30611744);
  119. _local2 = md5_ii(_local2, _local1, _local4, _local3, x[_local5 + 6], 15, -1560198380);
  120. _local3 = md5_ii(_local3, _local2, _local1, _local4, x[_local5 + 13], 21, 1309151649);
  121. _local4 = md5_ii(_local4, _local3, _local2, _local1, x[_local5 + 4], 6, -145523070);
  122. _local1 = md5_ii(_local1, _local4, _local3, _local2, x[_local5 + 11], 10, -1120210379);
  123. _local2 = md5_ii(_local2, _local1, _local4, _local3, x[_local5 + 2], 15, 718787259);
  124. _local3 = md5_ii(_local3, _local2, _local1, _local4, x[_local5 + 9], 21, -343485551);
  125. _local4 = safe_add(_local4, _local10);
  126. _local3 = safe_add(_local3, _local9);
  127. _local2 = safe_add(_local2, _local8);
  128. _local1 = safe_add(_local1, _local7);
  129. _local5 = _local5 + 16;
  130. }
  131. return(Array(_local4, _local3, _local2, _local1));
  132. }
  133. static function md5_cmn(q, a, b, x, s, t) {
  134. return(safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b));
  135. }
  136. static function md5_ff(a, b, c, d, x, s, t) {
  137. return(md5_cmn((b & c) | ((~b) & d), a, b, x, s, t));
  138. }
  139. static function md5_gg(a, b, c, d, x, s, t) {
  140. return(md5_cmn((b & d) | (c & (~d)), a, b, x, s, t));
  141. }
  142. static function md5_hh(a, b, c, d, x, s, t) {
  143. return(md5_cmn((b ^ c) ^ d, a, b, x, s, t));
  144. }
  145. static function md5_ii(a, b, c, d, x, s, t) {
  146. return(md5_cmn(c ^ (b | (~d)), a, b, x, s, t));
  147. }
  148. static function core_hmac_md5(key, data) {
  149. var _local2 = str2binl(key);
  150. if (_local2.length > 16) {
  151. _local2 = core_md5(_local2, key.length * chrsz);
  152. }
  153. var _local3 = Array(16);
  154. var _local4 = Array(16);
  155. var _local1 = 0;
  156. while (_local1 < 16) {
  157. _local3[_local1] = _local2[_local1] ^ 909522486;
  158. _local4[_local1] = _local2[_local1] ^ 1549556828;
  159. _local1++;
  160. }
  161. var _local5 = core_md5(_local3.concat(str2binl(data)), 512 + (data.length * chrsz));
  162. return(core_md5(_local4.concat(_local5), 640));
  163. }
  164. static function safe_add(x, y) {
  165. var _local1 = (x & 65535) + (y & 65535);
  166. var _local2 = ((x >> 16) + (y >> 16)) + (_local1 >> 16);
  167. return((_local2 << 16) | (_local1 & 65535));
  168. }
  169. static function bit_rol(num, cnt) {
  170. return((num << cnt) | (num >>> (32 - cnt)));
  171. }
  172. static function str2binl(str) {
  173. var _local3 = Array();
  174. var _local4 = (1 << chrsz) - 1;
  175. var _local1 = 0;
  176. while (_local1 < (str.length * chrsz)) {
  177. _local3[_local1 >> 5] = _local3[_local1 >> 5] | ((str.charCodeAt(_local1 / chrsz) & _local4) << (_local1 % 32));
  178. _local1 = _local1 + chrsz;
  179. }
  180. return(_local3);
  181. }
  182. static function binl2str(bin) {
  183. var _local3 = "";
  184. var _local4 = (1 << chrsz) - 1;
  185. var _local1 = 0;
  186. while (_local1 < (bin.length * 32)) {
  187. _local3 = _local3 + String.fromCharCode((bin[_local1 >> 5] >>> (_local1 % 32)) & _local4);
  188. _local1 = _local1 + chrsz;
  189. }
  190. return(_local3);
  191. }
  192. static function binl2hex(binarray) {
  193. var _local3 = (hexcase ? "0123456789ABCDEF" : "0123456789abcdef");
  194. var _local4 = "";
  195. var _local1 = 0;
  196. while (_local1 < (binarray.length * 4)) {
  197. _local4 = _local4 + (_local3.charAt((binarray[_local1 >> 2] >> (((_local1 % 4) * 8) + 4)) & 15) + _local3.charAt((binarray[_local1 >> 2] >> ((_local1 % 4) * 8)) & 15));
  198. _local1++;
  199. }
  200. return(_local4);
  201. }
  202. static function binl2b64(binarray) {
  203. var _local6 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
  204. var _local4 = "";
  205. var _local2 = 0;
  206. while (_local2 < (binarray.length * 4)) {
  207. var _local5 = ((((binarray[_local2 >> 2] >> (8 * (_local2 % 4))) & 255) << 16) | (((binarray[(_local2 + 1) >> 2] >> (8 * ((_local2 + 1) % 4))) & 255) << 8)) | ((binarray[(_local2 + 2) >> 2] >> (8 * ((_local2 + 2) % 4))) & 255);
  208. var _local1 = 0;
  209. while (_local1 < 4) {
  210. if (((_local2 * 8) + (_local1 * 6)) > (binarray.length * 32)) {
  211. _local4 = _local4 + b64pad;
  212. } else {
  213. _local4 = _local4 + _local6.charAt((_local5 >> (6 * (3 - _local1))) & 63);
  214. }
  215. _local1++;
  216. }
  217. _local2 = _local2 + 3;
  218. }
  219. return(_local4);
  220. }
  221. static var counter = 0;
  222. static var hexcase = 0;
  223. static var b64pad = "";
  224. static var chrsz = 8;
  225. }
  226. 
  227. //----------------------------------------------------------------------
  228. //Frame 1
  229. //----------------------------------------------------------------------
  230. com.ns.utils.ConsoleLogger.getInstance().setEnabled(_root.logging == "true");
  231. var controller = (new com.ns.controller.Controller());
  232. var debug = function (str) {
  233. com.ns.utils.ConsoleLogger.getInstance().debug(str);
  234. };
  235. var getGUID = function () {
  236. return(controller.getGUID());
  237. };
  238. var methodName = "getGUID";
  239. var instance = null;
  240. var method = getGUID;
  241. var wasSuccessful = flash.external.ExternalInterface.addCallback(methodName, instance, method);
  242. if (wasSuccessful) {
  243. debug("add callback getGUID suceed!");
  244. } else {
  245. debug("add callback getGUID failed!");
  246. }
  247. var hasGUID = function () {
  248. return(controller.hasGUID());
  249. };
  250. methodName = "hasGUID";
  251. instance = null;
  252. method = hasGUID;
  253. wasSuccessful = flash.external.ExternalInterface.addCallback(methodName, instance, method);
  254. if (wasSuccessful) {
  255. debug("add callback hasGUID suceed!");
  256. } else {
  257. debug("add callback hasGUID failed!");
  258. }
  259. var clearGUID = function () {
  260. controller.clearGUID();
  261. };
  262. methodName = "clearGUID";
  263. instance = null;
  264. method = clearGUID;
  265. wasSuccessful = flash.external.ExternalInterface.addCallback(methodName, instance, method);
  266. if (wasSuccessful) {
  267. debug("add callback clearGUID suceed!");
  268. } else {
  269. debug("add callback clearGUID failed!");
  270. }
  271. var getVisit = function () {
  272. return(controller.getVisit());
  273. };
  274. methodName = "getVisit";
  275. instance = null;
  276. method = getVisit;
  277. wasSuccessful = flash.external.ExternalInterface.addCallback(methodName, instance, method);
  278. if (wasSuccessful) {
  279. debug("add callback getVisit suceed!");
  280. } else {
  281. debug("add callback getVisit failed!");
  282. }
  283. flash.external.ExternalInterface.call("guidLoaded");
  284. 
  285. //----------------------------------------------------------------------
  286. //Symbol 1 MovieClip [__Packages.com.ns.utils.ConsoleLogger] Frame 0
  287. //----------------------------------------------------------------------
  288. class com.ns.utils.ConsoleLogger
  289. {
  290. static var _instance;
  291. var consoleExists;
  292. function ConsoleLogger () {
  293. }
  294. static function getInstance() {
  295. if (!_instance) {
  296. _instance = new com.ns.utils.ConsoleLogger();
  297. }
  298. return(_instance);
  299. }
  300. function setEnabled(value) {
  301. _enabled = value;
  302. }
  303. function sendMsg(msg, level) {
  304. if (level == undefined) {
  305. level = "info";
  306. }
  307. if (_enabled && (flash.external.ExternalInterface.available)) {
  308. var _local2 = (getTimeString() + " >> ") + msg;
  309. if (consoleExists == null) {
  310. consoleExists = flash.external.ExternalInterface.call("function() { return (typeof(window.console) != 'undefined'); }");
  311. }
  312. if (consoleExists) {
  313. flash.external.ExternalInterface.call("console." + level, _local2);
  314. }
  315. trace(_local2);
  316. }
  317. }
  318. function getTimeString() {
  319. var _local3 = getTimer();
  320. var _local2 = Math.floor(_local3 / 3600000);
  321. var _local4 = Math.floor((_local3 - (((_local2 * 1000) * 60) * 60)) / 60000);
  322. var _local5 = Math.floor(((_local3 - (((_local2 * 1000) * 60) * 60)) - ((_local4 * 1000) * 60)) / 1000);
  323. var _local6 = ((_local3 - (((_local2 * 1000) * 60) * 60)) - ((_local4 * 1000) * 60)) - (_local5 * 1000);
  324. var _local1 = "";
  325. if (_local2 < 10) {
  326. _local1 = _local1 + "0";
  327. }
  328. _local1 = _local1 + (_local2 + ":");
  329. if (_local4 < 10) {
  330. _local1 = _local1 + "0";
  331. }
  332. _local1 = _local1 + (_local4 + ":");
  333. if (_local5 < 10) {
  334. _local1 = _local1 + "0";
  335. }
  336. _local1 = _local1 + (_local5 + ".");
  337. if (_local6 < 100) {
  338. _local1 = _local1 + "0";
  339. }
  340. if (_local6 < 10) {
  341. _local1 = _local1 + "0";
  342. }
  343. _local1 = _local1 + _local6.toString();
  344. return(_local1);
  345. }
  346. function info(msg) {
  347. sendMsg(msg, "info");
  348. }
  349. function debug(msg) {
  350. sendMsg(msg, "debug");
  351. }
  352. function warn(msg) {
  353. sendMsg(msg, "warn");
  354. }
  355. function error(msg) {
  356. sendMsg(msg, "error");
  357. }
  358. var _enabled = true;
  359. }
  360. 
  361. //----------------------------------------------------------------------
  362. //Symbol 2 MovieClip [__Packages.com.ns.controller.Controller] Frame 0
  363. //----------------------------------------------------------------------
  364. class com.ns.controller.Controller
  365. {
  366. var _globalFSO;
  367. function Controller () {
  368. }
  369. function hasGUID() {
  370. com.ns.utils.ConsoleLogger.getInstance().debug("hasGUID: Start");
  371. if (getComputerguid() == undefined) {
  372. com.ns.utils.ConsoleLogger.getInstance().debug("hasGUID: Client does not have GUID");
  373. return(false);
  374. }
  375. com.ns.utils.ConsoleLogger.getInstance().debug("hasGUID: Client has GUID");
  376. com.ns.utils.ConsoleLogger.getInstance().debug("hasGUID: Done");
  377. return(true);
  378. }
  379. function getGUID() {
  380. com.ns.utils.ConsoleLogger.getInstance().debug("getGUID: Start");
  381. if (getComputerguid() == undefined) {
  382. setComputerguid(com.ns.utils.GUID.getNewGUID());
  383. }
  384. var _local2 = getComputerguid();
  385. com.ns.utils.ConsoleLogger.getInstance().debug("getGUID: Done");
  386. return(_local2);
  387. }
  388. function clearGUID() {
  389. com.ns.utils.ConsoleLogger.getInstance().debug("clearGUID: Start");
  390. var _local2 = flash.external.ExternalInterface.call("Behaviors.eraseCookie", "guid");
  391. _globalFSO = SharedObject.getLocal("BeaconService", "/");
  392. delete _globalFSO.data.computerguid;
  393. _globalFSO.flush();
  394. com.ns.utils.ConsoleLogger.getInstance().debug("clearGUID: Done");
  395. }
  396. function setComputerguidInFSO(value) {
  397. com.ns.utils.ConsoleLogger.getInstance().debug("setComputerguidInFSO: Start");
  398. _globalFSO = SharedObject.getLocal("BeaconService", "/");
  399. _globalFSO.data.computerguid = value;
  400. _globalFSO.flush();
  401. com.ns.utils.ConsoleLogger.getInstance().debug("setComputerguidInFSO: Done");
  402. }
  403. function setComputerguid(value) {
  404. com.ns.utils.ConsoleLogger.getInstance().debug("setComputerguid: Start");
  405. flash.external.ExternalInterface.call("Behaviors.setCookie", "guid", value);
  406. setComputerguidInFSO(value);
  407. com.ns.utils.ConsoleLogger.getInstance().debug("setComputerguid: Done");
  408. }
  409. function getComputerguid() {
  410. com.ns.utils.ConsoleLogger.getInstance().debug("getComputerguid: Start");
  411. var _local2 = flash.external.ExternalInterface.call("Behaviors.getCookie", "guid");
  412. if (_local2 == undefined) {
  413. _local2 = getComputerguidFromFSO();
  414. if (_local2 != undefined) {
  415. flash.external.ExternalInterface.call("Behaviors.setCookie", "guid", _local2);
  416. }
  417. } else {
  418. setComputerguidInFSO(_local2);
  419. }
  420. com.ns.utils.ConsoleLogger.getInstance().debug("getComputerguid: Done");
  421. return(_local2);
  422. }
  423. function getComputerguidFromFSO() {
  424. com.ns.utils.ConsoleLogger.getInstance().debug("getComputerguidFromFSO: Start");
  425. _globalFSO = SharedObject.getLocal("BeaconService", "/");
  426. com.ns.utils.ConsoleLogger.getInstance().debug("getComputerguidFromFSO: Done");
  427. return(_globalFSO.data.computerguid);
  428. }
  429. function getVisit() {
  430. com.ns.utils.ConsoleLogger.getInstance().debug("getVisit: Start");
  431. _globalFSO = SharedObject.getLocal("BeaconService", "/");
  432. com.ns.utils.ConsoleLogger.getInstance().debug("getVisit: Done");
  433. return(_globalFSO.data.visitNumber.visit || 0);
  434. }
  435. }
RAW Paste Data