Skip to content

Instantly share code, notes, and snippets.

View fjh658's full-sized avatar

John Feng fjh658

View GitHub Profile
@Kyle-Ye
Kyle-Ye / XcodeLLM.md
Last active January 3, 2025 12:10
Enable XcodeLLM for ChinaSKU Mac on macOS 15 Beta 1

Warning

The following guide need to disable SIP to work.

Please confirm the risk of disabling the SIP by yourself.

Another solution which does not require disabling SIP is currently under investigation.

Step 0

Reboot into Recovery OS + Disable SIP

@fjh658
fjh658 / inject.c
Created April 16, 2022 12:46 — forked from theevilbit/inject.c
DYLD_INSERT_LIBRARIES DYLIB injection in macOS / OSX deep dive
#include <stdio.h>
#include <syslog.h>
#include <stdlib.h>
__attribute__((constructor))
static void customConstructor(int argc, const char **argv)
{
setuid(0);
system("id");
printf("Hello from dylib!\n");
@hecht1962
hecht1962 / ipstocrash.pl
Last active January 4, 2025 15:23
Convert an IPS crash report (.ips) to the legacy crash report format (.crash)
#!/usr/bin/perl
##
## This script converts an IPS crash report (.ips) to the legacy crash report format.
##
## The .ips file (JSON) is read from STDIN and the legacy crash report is written to
## STDOUT.
##
use strict;
@dceddia
dceddia / symbolicate.rb
Created June 26, 2021 18:58
Symbolicate a macOS crash report from Sentry
#!/usr/bin/env ruby
# colorization without needing a gem
class String
def colorize(color_code)
"\e[#{color_code}m#{self}\e[0m"
end
def red
colorize(31)
@juliyvchirkov
juliyvchirkov / macos-sudo-nopasswd.sh
Last active December 17, 2024 09:05
bash: sudo without a password on macOS
#!/bin/bash
#
# Enable nopasswd mode for sudo on macOS from the userspace in fast and totally non-interactive way
#
# Type the password last time to apply the new mode and forget it for any console task for ages
# Use the rollback to restore password protection
#
# Developed and tested by https://juliyvchirkov.github.io/ under the MIT license on macOS Big Sur 11.2.0
#
# Get latest version at https://gist.github.com/juliyvchirkov/3ca76582ed6b6a8366c9e7d60644960d
@linusg
linusg / generate_macos_model_identifiers_dict.py
Last active March 21, 2025 16:20
Generate macOS model identifier / device name mapping from Apple support pages
import json
import re
import requests
DEVICE_NAME_MODEL_IDENTIFIER_REGEX = r"<strong>(.*)\s*(?:<br>\s*</strong>|</strong>\s*<br>)\s*.*\s*Model (?:Label|Identifier):\s*(.*)\s*<br>"
SUPPORT_URLS = [
# iMac
"https://support.apple.com/en-gb/HT201634",
@talaviram
talaviram / add_debug_entitlement.sh
Last active April 10, 2025 03:20
Simple Utility Script for allowing debug of hardened macOS apps.
#! /bin/bash
# Simple Utility Script for allowing debug of hardened macOS apps.
# This is useful mostly for plug-in developer that would like keep developing without turning SIP off.
# Credit for idea goes to (McMartin): https://forum.juce.com/t/apple-gatekeeper-notarised-distributables/29952/57?u=ttg
# Update 2022-03-10: Based on Fabian's feedback, add capability to inject DYLD for sanitizers.
#
# Please note:
# - Modern Logic (on M1s) uses `AUHostingService` which resides within the system thus not patchable and REQUIRES to turn-off SIP.
# - Some hosts uses separate plug-in scanning or sandboxing.
# if that's the case, it's required to patch those (if needed) and attach debugger to them instead.
@Omar-Ikram
Omar-Ikram / EndpointSecurityDemo.m
Last active April 4, 2025 15:29
A demo of using Apple's EndpointSecurity framework - tested on macOS Monterey 12.2.1 (21D62)
//
// main.m
// EndpointSecurityDemo
//
// Created by Omar Ikram on 17/06/2019 - macOS Catalina 10.15 Beta 1 (19A471t)
// Updated by Omar Ikram on 15/08/2019 - macOS Catalina 10.15 Beta 5 (19A526h)
// Updated by Omar Ikram on 01/12/2019 - macOS Catalina 10.15 (19A583)
// Updated by Omar Ikram on 31/01/2021 - macOS Big Sur 11.1 (20C69)
// Updated by Omar Ikram on 07/05/2021 - macOS Big Sur 11.3.1 (20E241)
// Updated by Omar Ikram on 04/07/2021 - macOS Monterey 12 Beta 2 (21A5268h)
@mklement0
mklement0 / Enter-AdminPSSession.ps1
Last active March 20, 2025 12:50
Universal PowerShell script (PSv3+) that enters an admin (elevated) session on the local computer and optionally executes commands unattended
<#
Prerequisites: PowerShell v3+
License: MIT
Author: Michael Klement <[email protected]>
DOWNLOAD and DEFINITION OF THE FUNCTION:
irm https://gist.github.com/mklement0/f726dee9f0d3d444bf58cb81fda57884/raw/Enter-AdminPSSession.ps1 | iex
@mirkow
mirkow / FindOpenMP.cmake
Created March 19, 2017 14:28
Modified FindOpenMP to work with Clang 3.8 under Ubuntu 14.04
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#.rst:
# FindOpenMP
# ----------
#
# Finds OpenMP support
#
# This module can be used to detect OpenMP support in a compiler. If