Skip to content

Instantly share code, notes, and snippets.

@xorrior
Last active November 14, 2021 05:25
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xorrior/86948fb6782efe87f26a704e81dbf0fc to your computer and use it in GitHub Desktop.
Save xorrior/86948fb6782efe87f26a704e81dbf0fc to your computer and use it in GitHub Desktop.
Installer Plugin that pops a message box to the user
//
// MyInstallerPane.m
// messagebox
//
// Created by Chris Ross on 1/23/18.
// Copyright © 2018 testplugin. All rights reserved.
//
/*
This should be in MyInstallerPane.h
#import <InstallerPlugins/InstallerPlugins.h>
@interface MyInstallerPane : InstallerPane
@end
*/
#import "MyInstallerPane.h"
#import <Foundation/Foundation.h>
@implementation MyInstallerPane
- (NSString *)title
{
return [[NSBundle bundleForClass:[self class]] localizedStringForKey:@"PaneTitle" value:nil table:nil];
}
- (void)didEnterPane:(InstallerSectionDirection)dir
{
//Malicious logic when entering pane
NSAlert *alert = [[NSAlert alloc] init];
[alert setMessageText:@"Are you sure you want to install my malware?"];
[alert setInformativeText:@"Remember, you WANTED this...."];
[alert addButtonWithTitle:@"OK"];
[alert addButtonWithTitle:@"Cancel"];
[alert setAlertStyle:NSInformationalAlertStyle];
NSInteger result = [alert runModal];
if (result == NSAlertFirstButtonReturn) {
NSLog(@"first button clicked");
} else if (result == NSAlertSecondButtonReturn) {
NSLog(@"Second button clicked");
}
}
- (void) willEnterPane:(InstallerSectionDirection)dir {
//Malicious logic when ????
}
- (BOOL)shouldExitPane:(InstallerSectionDirection)dir
{
return YES;
}
@end
@JodhwaniMadhur
Copy link

Hello @xorrior , I am working on an Installer Plugin that opens the browser with a pre specified URL, I am unable to get help on this since I am new to macOS and Installer Plugins, can you help me with it, the problem I am dealing with is that I have the functions in C++/ObjC but I am unable to call them, Please help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment