Skip to content

Instantly share code, notes, and snippets.

View NSExceptional's full-sized avatar

Tanner Bennett NSExceptional

View GitHub Profile
@saagarjha
saagarjha / MetadataExtractor.js
Created February 17, 2023 09:36
Apple's metadata extraction code for link previews in Messages, taken from macOS Ventura 13.3 Beta (22E5219e)
//
// LinkPresentation
// Copyright © 2015-2020 Apple Inc. All rights reserved.
//
// FIXME: Twitter equivalents?
(function () {
var MetadataExtractor = {
@simonbs
simonbs / AppKitTextView.swift
Created January 27, 2023 08:39
Shows how a multi-platform SwiftUI can bridge to UIKit and AppKit.
// Implementation of the view using AppKit.
#if os(macOS)
import AppKit
import SwiftUI
final class AppKitTextView: NSView {
let textView: NSTextView = {
let this = NSTextView()
this.translatesAutoresizingMaskIntoConstraints = false
return this
@fariswd
fariswd / x-tt-token.js
Created September 19, 2022 09:50
x-tt-token
const CryptoJS = require("crypto-js");
const decrypt = (input) => {
const key = CryptoJS.enc.Utf8.parse("webapp1.0+202106");
const ciphertext = CryptoJS.enc.Base64.parse(input);
const encryptedCP = CryptoJS.lib.CipherParams.create({
ciphertext: ciphertext,
});
const decryptedWA = CryptoJS.AES.decrypt(encryptedCP, key, { iv: key });
const decryptedUtf8 = decryptedWA.toString(CryptoJS.enc.Utf8);
@markmals
markmals / Combine+concurrency.swift
Last active June 24, 2021 09:05
Extensions to Apple's Combine framework to interoperate with Swift 5.5's new concurrency features
import Combine
extension Publisher {
var stream: AsyncThrowingStream<Output> {
AsyncThrowingStream(Output.self) { continuation in
let cancellable = sink { completion in
switch completion {
case .finished: continuation.finish()
case .failure(let error): continuation.finish(throwing: error)
}
@johnzaro
johnzaro / iOS14DirectMethodsGuide.txt
Last active November 26, 2023 13:15
Guide to using libundirect and finding direct methods on iOS 14
(I used hopper disassembler)
1) Open the Safari binary from iOS 13.7 [binary 1] and also open a Safari binary from iOS 14+ [binary 2] which has the selector you are interested in converted to direct method.
2) Search in the processes tab of the [binary 1] for the selector you are interested in.
3) Open it and have a look at the code inside it by using the 'pseudo-code mode'.
4) We now arrive to the 1st way to find a direct method:
@rnystrom
rnystrom / example.swift
Created January 18, 2021 00:30
Show the keyboard as a UISearchController in a modal is displayed
class ViewController: UIViewController {
@IBAction func onSearch(_ sender: Any) {
let fakeWindow = UIWindow(windowScene: view.window!.windowScene!)
let fakeTextField = UITextField()
fakeTextField.autocorrectionType = .no
fakeWindow.addSubview(fakeTextField)
fakeWindow.makeKeyAndVisible()
fakeTextField.becomeFirstResponder()
@rmcdongit
rmcdongit / macOS_SytemPrefs.md
Last active December 23, 2024 17:21
Apple System Preferences URL Schemes

macOS 10.15 System Preference Panes

Below are a list of System Preference pane URLs and paths that can be accessed with scripting to assist users with enabling macOS security settings without having to walk them through launching System Preferences, finding panes, and scrolling to settings. Not all panes have an accessible anchor and some are OS specific.

To find the Pane ID of a specific pane, open the System Preferences app and select the desired Preference Pane. With the pane selected, open the ScriptEditor.app and run the following script to copy the current Pane ID to your clipboard and display any available anchors:

tell application "System Preferences"
	set CurrentPane to the id of the current pane
	set the clipboard to CurrentPane
@teknogeek
teknogeek / universalUnpin.js
Last active December 6, 2024 14:34
Frida Universal™ SSL Unpinner
Java.perform(function() {
console.log('\n[.] Cert Pinning Bypass');
// Create a TrustManager that trusts everything
console.log('[+] Creating a TrustyTrustManager that trusts everything...');
var X509TrustManager = Java.use('javax.net.ssl.X509TrustManager');
var TrustyTrustManager = Java.registerClass({
name: 'com.example.TrustyTrustManager',
implements: [X509TrustManager],
methods: {
@alexkaessner
alexkaessner / custom-ios-simulator-statusbar.sh
Last active April 8, 2024 18:36
Customize iOS Simulator Status Bar (Xcode 11+)
$ xcrun simctl status_bar booted override --time "9:41" --batteryState charged --batteryLevel 100 --cellularMode active
@0xced
0xced / Working without a nib.md
Created March 7, 2019 19:02
Working without a nib blog posts by Jeff Johnson (@lapcatsoftware)
  • [Working without a nib, Part 1][1]
  • [Working without a nib, Part 2: Also Also Wik][2]
  • [Working without a nib, Part 5: No, 3!][3]
  • [Working without a nib, Part 4: setAppleMenu][4]
  • [Working without a nib, Part 5: Open Recent menu][5]
  • [Working without a nib, Part 6: Working without a xib][6]
  • [Working without a nib, Part 7: The empire strikes back][7]
  • [Working without a nib, Part 8: The nib awakens][8]
  • [Working without a nib, Part 9: Shipping without a nib][9]
  • [Working without a nib, Part 10: Mac Main Menu][10]