Skip to content

Commit

Permalink
Cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
friedkeenan committed Jun 24, 2024
1 parent de0a1b1 commit 53c7aa1
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/leakers/DeadMazeLeaker.as
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ package leakers {
}
}

protected override function process_socket_info(domain: ApplicationDomain, _: XML) : void {
protected override function process_connection_info(domain: ApplicationDomain, _: XML) : void {
var document: * = this.document();
var description: * = describeType(document);

Expand Down
39 changes: 20 additions & 19 deletions src/leakers/Leaker.as
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ package leakers {
this.leaker_socket_class = this.game_domain().getDefinition("ServerboundLeakerSocket") as Class;
}

protected function process_socket_info(domain: ApplicationDomain, description: XML) : void {
protected function process_connection_info(domain: ApplicationDomain, description: XML) : void {
for each (var variable: * in description.elements("factory").elements("variable")) {
if (variable.attribute("type") == "flash.net::Socket") {
this.socket_prop_name = variable.attribute("name");
Expand Down Expand Up @@ -373,20 +373,6 @@ package leakers {
return null;
}

private static function get_address_prop_name(description: XML) : String {
for each (var variable: * in description.elements("factory").elements("variable")) {
/*
NOTE: There are two non-static properties which
are strings, but they both hold the same value.
*/
if (variable.attribute("type") == "String") {
return variable.attribute("name");
}
}

return null;
}

private static function get_possible_ports_properties(description: XML) : Array {
var possible_names: * = new Array();

Expand Down Expand Up @@ -440,15 +426,13 @@ package leakers {
continue;
}

this.process_socket_info(domain, description);
this.process_connection_info(domain, description);

var address_prop_name: * = get_address_prop_name(description);
var possible_ports_prop_names: * = get_possible_ports_properties(description);
var instance_name: * = get_connection_instance_name(description);

this.connection_class_info = {
klass: klass,
address_prop_name: address_prop_name,
possible_ports_prop_names: possible_ports_prop_names,
instance_name: instance_name
};
Expand All @@ -467,6 +451,23 @@ package leakers {
instance[this.socket_prop_name] = socket;
}

protected function get_connected_address(instance: *) : String {
var description: * = describeType(instance);

for each (var variable: * in description.elements("variable")) {
/*
NOTE: There are multiple non-static String
properties, but they hold the same value.
*/

if (variable.attribute("type") == "String") {
return instance[variable.attribute("name")];
}
}

return null;
}

private function try_replace_socket(event: Event) : void {
if (this.leaker_socket_class == null) {
return;
Expand All @@ -486,7 +487,7 @@ package leakers {

this.removeEventListener(Event.ENTER_FRAME, this.try_replace_socket);

this.server_address = instance[this.connection_class_info.address_prop_name];
this.server_address = this.get_connected_address(instance);

for each (var ports_name: * in this.connection_class_info.possible_ports_prop_names) {
var possible_ports: * = instance[ports_name];
Expand Down
20 changes: 19 additions & 1 deletion src/leakers/TransformiceLeaker.as
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ package leakers {
return null;
}

protected override function process_socket_info(domain: ApplicationDomain, _: XML) : void {
protected override function process_connection_info(domain: ApplicationDomain, _: XML) : void {
var document: * = this.document();
var description: * = describeType(document);

Expand Down Expand Up @@ -81,6 +81,24 @@ package leakers {
}
}

protected override function get_connected_address(instance: *) : String {
var description: * = describeType(instance);

for each (var variable: * in description.elements("variable")) {
if (variable.attribute("type") != "String") {
continue;
}

var value: * = instance[variable.attribute("name")];

if (value != "_nfs_801") {
return value;
}
}

return null;
}

protected override function get_connection_socket(instance: *) : Socket {
for each (var socket: * in this.document()[this.socket_dict_name]) {
return socket[this.socket_prop_name];
Expand Down

0 comments on commit 53c7aa1

Please sign in to comment.