Skip to content

Instantly share code, notes, and snippets.

@wabzqem
Last active December 5, 2020 05:08
Show Gist options
  • Save wabzqem/e4673da2d9da0de95cd1924511e21811 to your computer and use it in GitHub Desktop.
Save wabzqem/e4673da2d9da0de95cd1924511e21811 to your computer and use it in GitHub Desktop.
Slack feature flags
var classname = "Slack.FeatureFlagManager";
var classmethod = "- isFeatureEnabled:";
var methodsignature = "(bool) - isFeatureEnabled:(pointer)";
try {
var hook = ObjC.classes['Slack.FeatureFlagManager']['- isFeatureEnabled:'];
//(bool) - isFeatureEnabled:(pointer)
Interceptor.attach(hook.implementation, {
onEnter: function (args) {
send("[Call_Stack]\nClass: " + classname + "\nMethod: " + methodsignature + "\n");
this.s = ""
this.s = this.s + "[Hook_Stack]\n"
this.s = this.s + "Class: " + classname + "\n"
this.s = this.s + "Method: " + methodsignature + "\n"
this.replace = false;
if (classmethod.indexOf(":") !== -1) {
var params = classmethod.split(":");
params[0] = params[0].split(" ")[1];
for (var i = 0; i < params.length - 1; i++) {
try {
this.s = this.s + "Input: " + params[i] + ": " + new ObjC.Object(args[2 + i]).toString() + "\n";
var feature = new ObjC.Object(args[2 + i]).toString();
if (feature == "story_time" || feature == "ios_voice_messages" || feature == "modern_tab_design" || feature == "ios_modern_text_input" || feature == "qr_code_invite") {
this.replace = true;
}
} catch (e) {
this.s = this.s + "Input: " + params[i] + ": " + args[2 + i].toString() + "\n";
}
}
}
},
//(bool) - isFeatureEnabled:(pointer)
onLeave: function (retval) {
this.s = this.s + "Output: " + retval.toString() + "\n";
if (this.replace) {
retval.replace(1);
}
}
});
} catch (err) {
send("[!] Exception: " + err.message);
send("Not able to hook \nClass: " + classname + "\nMethod: " + methodsignature + "\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment