Skip to content

Instantly share code, notes, and snippets.

View kim4apple's full-sized avatar

kim4apple kim4apple

  • Shenzhen, China
View GitHub Profile
@kim4apple
kim4apple / amfid_patch.py
Created May 5, 2023 18:05 — forked from pvieito/amfid_patch.py
This script can patch macOS 10.12.2 amfid daemon on memory to allow arbitrary entitlements in Developer ID signed binaries.
#!/usr/bin/env python3
'''amfid_patch.py - Pedro José Pereira Vieito © 2016
This script can patch macOS 10.12.2 amfid daemon on memory
to allow arbitrary entitlements in Developer ID signed binaries.
Killing amfid will make the patch disapear:
$ sudo kill -9 `pgrep amfid`
You must run the script as a root (sudo) and with SIP disabled.
Title : Revisiting Mac OS X Kernel Rootkits
Author : fG!
Date : April 18, 2014
|=----------------------------------------------------------------------------=|
|=----------------=[ Revisiting Mac OS X Kernel Rootkits ]=-------------------=|
|=----------------------------------------------------------------------------=|
|=------------------------=[ fG! <[email protected]> ]=---------------------------=|
|=----------------------------------------------------------------------------=|
@kim4apple
kim4apple / EndpointSecurityDemo.m
Created July 9, 2020 03:09 — forked from Omar-Ikram/EndpointSecurityDemo.m
A demo of using Apple's new EndpointSecurity framework - tested on macOS Catalina 10.15 (19A583)
//
// main.m
// EndpointSecurityDemo
//
// Created by Omar Ikram on 17/06/2019 - Catalina 10.15 Beta 1 (19A471t)
// Updated by Omar Ikram on 15/08/2019 - Catalina 10.15 Beta 5 (19A526h)
// Updated by Omar Ikram on 01/12/2019 - Catalina 10.15 (19A583)
//
#import <Foundation/Foundation.h>
@kim4apple
kim4apple / SystemIdleTime.m
Created March 25, 2020 14:36 — forked from darrarski/SystemIdleTime.m
Get Mac OS X system idle time in Swift or Objective-C
//
// Created by Dariusz Rybicki on 17/04/16.
// Copyright © 2016 Darrarski. All rights reserved.
//
#import <Foundation/Foundation.h>
/**
Returns number of seconds since system became idle
# basic pfctl control
# ==
# Related: http://www.OpenBSD.org
# Last update: Tue Dec 28, 2004
# ==
# Note:
# this document is only provided as a basic overview
# for some common pfctl commands and is by no means
# a replacement for the pfctl and pf manual pages.
# Even though device management is disabled in Server.app,
# the processes still run. Which the only issue with this is
# it causes extremely slow shutdown times. So here we disable this shit
sudo launchctl stop com.apple.DeviceManagement.postgres;
sudo launchctl remove com.apple.DeviceManagement.postgres;
sudo launchctl unload -w /Applications/Server.app/Contents/ServerRoot/System/Library/LaunchDaemons/com.apple.DeviceManagement.postgres.plist
# Same goes for calendar server
sudo launchctl stop org.calendarserver.agent;
@kim4apple
kim4apple / gist:99ddb8d5cdba1716bd1909a7afd277fe
Created April 21, 2019 10:06 — forked from rtrouton/gist:4ff699b3f7660ae06a13
Software Update keys in Yosemite's /Library/Preferences/com.apple.SoftwareUpdate.plist
Automatically check for updates:
Enable: sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate AutomaticCheckEnabled -bool TRUE
Disable: sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate AutomaticCheckEnabled -bool FALSE
Download newly available updates in the background:
Enable: sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate AutomaticDownload -bool TRUE
Disable: sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate AutomaticDownload -bool FALSE
@kim4apple
kim4apple / ProcessUtil.m
Created February 19, 2019 02:07
Get process path with pid using libproc.
#import <libproc.h>
#import <sys/proc_info.h>
@interface ProcessUtil : NSObject
+ (NSArray <NSNumber *> *)loadProcessIds;
+ (NSString *)pathWithPid:(int)pid;
@end
@kim4apple
kim4apple / CommandUtil.m
Created February 19, 2019 01:58
Get command with pid, modify from ps.
- (NSString *)_commandFromPid:(int)pid {
int mib[3], argmax, nargs, c = 0;
size_t size;
char *procargs, *sp, *np, *cp;
mib[0] = CTL_KERN;
mib[1] = KERN_ARGMAX;
size = sizeof(argmax);
@kim4apple
kim4apple / CommandUtil.m
Created February 19, 2019 01:58
Get command with pid
- (NSString *)_commandFromPid:(int)pid {
int mib[3], argmax, nargs, c = 0;
size_t size;
char *procargs, *sp, *np, *cp;
mib[0] = CTL_KERN;
mib[1] = KERN_ARGMAX;
size = sizeof(argmax);