diff --git a/src/leakers/TransformiceLeaker.as b/src/leakers/TransformiceLeaker.as index baa84c8..e9c57c0 100644 --- a/src/leakers/TransformiceLeaker.as +++ b/src/leakers/TransformiceLeaker.as @@ -11,64 +11,47 @@ package leakers { super("http://www.transformice.com/Transformice.swf", true); } - private static function extends_socket(domain: ApplicationDomain, type: Class) : Boolean { - if (type == Socket) { - return true; - } - - var description: * = describeType(type); - - for each (var parent: * in description.elements("factory").elements("extendsClass")) { - var parent_type: * = domain.getDefinition(parent.attribute("type")); + private function get_socket_prop_name(description: XML, type_name: String) : void { + for each (var variable: * in description.elements("variable")) { + if (variable.attribute("type") == type_name) { + this.socket_prop_name = variable.attribute("name"); - if (extends_socket(domain, parent_type)) { - return true; + return; } } - - return false; } - private function get_socket_method_name(domain: ApplicationDomain, description: XML) : String { + private function call_socket_method(domain: ApplicationDomain, description: XML, key: int) : Socket { + var document: * = this.document(); + for each (var method: * in description.elements("method")) { if (method.elements("parameter").length() != 0) { continue; } - var return_type_name: * = method.attribute("returnType"); - if (return_type_name == "void" || return_type_name == "*") { + if (method.attribute("returnType") != "*") { continue; } - var return_type: * = domain.getDefinition(return_type_name); - if (!extends_socket(domain, return_type)) { - continue; + try { + return document[method.attribute("name")](key); + } catch (error: Error) { + /* ... */ } - - this.build_leaker_socket(domain, return_type_name); - - return method.attribute("name"); } return null; } - private function get_socket_prop_name(description: XML, type_name: String) : void { - for each (var variable: * in description.elements("variable")) { - if (variable.attribute("type") == type_name) { - this.socket_prop_name = variable.attribute("name"); - - return; - } - } - } - protected override function process_socket_info(domain: ApplicationDomain, _: XML) : void { var document: * = this.document(); var description: * = describeType(document); /* Load a socket into the dictionary. */ - var real_socket: * = document[this.get_socket_method_name(domain, description)](-1); + var real_socket: * = this.call_socket_method(domain, description, -1); + + var socket_type_name: * = getQualifiedClassName(real_socket); + this.build_leaker_socket(domain, socket_type_name); for each (var variable: * in description.elements("variable")) { if (variable.attribute("type") != "flash.utils::Dictionary") { @@ -91,7 +74,7 @@ package leakers { this.socket_dict_name = variable.attribute("name"); - this.get_socket_prop_name(describeType(maybe_socket), getQualifiedClassName(real_socket)); + this.get_socket_prop_name(describeType(maybe_socket), socket_type_name); return; }