Skip to content

Instantly share code, notes, and snippets.

View T1T4N's full-sized avatar
👽

Robert Armenski T1T4N

👽
View GitHub Profile
Preview on macOS 10.14.6 Mojave can remove PDF owner password
@T1T4N
T1T4N / safari_inject.m
Created January 28, 2022 20:49
Restore old tab bar in Safari 15.0 (16612.1.29.41.4, 16612)
// Restores old tab bar in Safari 15.0 (16612.1.29.41.4, 16612)
// clang -fmodules -shared -Wall -Os -o libsafariinject.dylib safariinject.m
//
// If SIP off:
// DYLD_INSERT_LIBRARIES=$PWD/libsafariinject.dylib /Applications/Safari.app/Contents/MacOS/Safari
//
// If SIP on, you can demo this by manually removing Safari's code signing signature, but many
// features (eg saved logins) won't be readable by the resigned app:
// cp -a /Applications/Safari.app ./
// codesign --remove Safari.app/Contents/MacOS/Safari
@T1T4N
T1T4N / poc-jailbreak.c
Created January 28, 2022 20:20
macOS 11.5.2-iOS 14.7.1 Kernel Race Condition POC Jailbreak
/*
Written By Pan ZhenPeng(@peterpan980927) of Alibaba Security Pandora Lab
use it on macOS: cc poc.c -o poc while True; do ./poc ; done
*/
#include <errno.h>
#include <signal.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
@T1T4N
T1T4N / sandbox_exec.sh
Created January 27, 2022 09:02
sandbox-exec usage example
/usr/bin/sandbox-exec
-p
'(version 1) (allow default) (deny network-outbound (remote ip)) (allow network-outbound (remote ip "localhost:*"))'
/Library/Developer/XcodeServer/CurrentXcodeSymlink/Contents/Developer/usr/share/xcs/Node/bin/node
/Library/Developer/XcodeServer/CurrentXcodeSymlink/Contents/Developer/usr/share/xcs/xcsd/worker.js
@T1T4N
T1T4N / swift-build-disable-sandbox.sh
Created January 26, 2022 15:19
Build a Swift binary without sandbox
swift build --configuration release --disable-sandbox
@T1T4N
T1T4N / gist:fabc7511cf17597eea0c6283a5632250
Created January 13, 2022 15:12
SSH Local Port forwarding
Client -> Server
C: ssh -L 10666:localhost:10667 user@hostname
S: nc -l 10667
C: echo 1 | netcat localhost 10666
@T1T4N
T1T4N / remove-retweets.js
Last active April 4, 2022 17:16
A script to automate removal of own Twitter retweets
// Navigate to: https://twitter.com/{username}/with_replies
// In the developer console, paste the following code
// Repeat a few times as some tweets might be missed
const sleep = ms => new Promise(res => setTimeout(res, ms));
const performWhileScrolling = async (asyncFn) => {
let oldOffset = window.pageYOffset;
let newOffset = oldOffset;
@T1T4N
T1T4N / remove-twitter-likes.js
Created January 1, 2022 15:13
A script to automate removal of own Twitter likes
// Navigate to: https://twitter.com/{username}/likes
// In the developer console, paste the following code
// Repeat a few times as some tweets might be missed
const sleep = (milliseconds) => {
return new Promise(resolve => setTimeout(resolve, milliseconds))
}
const performWhileScrolling = async (asyncFn) => {
let oldOffset = window.pageYOffset;
@T1T4N
T1T4N / nsenum_deprecate.m
Created November 23, 2021 11:51
Deprecate a NS_ENUM
typedef NS_ENUM(NSUInteger, ExampleMouseActionCode) {
ExampleMouseActionCodeLeftClick = 0,
ExampleMouseActionCodeMove = 1,
};
typedef NS_ENUM(NSUInteger, ExampleMouseActionEnum) {
ExampleMAE_LMBClick = ExampleMouseActionCodeLeftClick,
ExampleMAE_Move = ExampleMouseActionCodeMove,
} DEPRECATED_MSG_ATTRIBUTE("Use ExampleMouseActionCode instead.");
@T1T4N
T1T4N / Collection+SafeSubscript.swift
Created November 23, 2021 09:16
Add a safe subscript operator to (mutable) collections
extension Collection {
/// Returns the element at the specified index if it is within bounds, otherwise nil.
subscript(safe index: Index) -> Element? {
return indices.contains(index) ? self[index] : nil
}
subscript(safe index: Index, default defaultValue: @autoclosure () -> Element) -> Element {
return self[safe: index] ?? defaultValue()
}
}