Skip to content

Commit

Permalink
Update for the most recent Transformice 1.811
Browse files Browse the repository at this point in the history
  • Loading branch information
friedkeenan committed Apr 19, 2024
1 parent bb6d60c commit 4a851d6
Showing 1 changed file with 18 additions and 35 deletions.
53 changes: 18 additions & 35 deletions src/leakers/TransformiceLeaker.as
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand All @@ -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;
}
Expand Down

0 comments on commit 4a851d6

Please sign in to comment.