Skip to content

Instantly share code, notes, and snippets.

View t0rr3sp3dr0's full-sized avatar

Pedro Tôrres t0rr3sp3dr0

View GitHub Profile
#include <dlfcn.h>
//#include <mach-o/dyld.h>
//#include <mach-o/getsect.h>
//#include <mach-o/ldsyms.h>
#include <stdio.h>
#include <string.h>
#include <sys/clonefile.h>
#include <sys/errno.h>
#include <sys/syslimits.h>
@t0rr3sp3dr0
t0rr3sp3dr0 / Untitled.app:Contents:Info.plist
Last active February 20, 2024 02:41
Automator Application Stub
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>Automator Application Stub</string>
<key>CFBundleIconFile</key>
<string>ApplicationStub</string>
<key>LSUIElement</key>
<true/>
@t0rr3sp3dr0
t0rr3sp3dr0 / quarantine-exec.c
Last active February 20, 2024 01:24
exec process within a macOS download quarantine context
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
enum qtn_flags {
QTN_FLAG_DOWNLOAD = 0x0001,
};
typedef struct _qtn_proc *qtn_proc_t;
@t0rr3sp3dr0
t0rr3sp3dr0 / makepath.go
Created February 18, 2024 02:56
macOS POSIX File Path from Device Number and Inode Number
package main
// #cgo LDFLAGS: -framework Carbon
// #include <Carbon/Carbon.h>
import "C"
import (
"fmt"
"unsafe"
)
@t0rr3sp3dr0
t0rr3sp3dr0 / Defaults.strings
Created April 7, 2023 11:16
/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app/Contents/MacOS/Microsoft Update Assistant.app/Contents/Resources/Defaults.strings
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ManifestServer.Beta</key>
<string>https://officecdnmac.microsoft.com/pr/4B2D7701-0A4F-49C8-B4CB-0C2D4043F51F/MacAutoupdate/</string>
<key>ManifestServer.Current</key>
<string>https://officecdnmac.microsoft.com/pr/C1297A47-86C4-4C1F-97FA-950631F94777/MacAutoupdate/</string>
<key>ManifestServer.CurrentThrottle</key>
<string>https://officecdnmac.microsoft.com/pr/A1E15C18-4D18-40B0-8577-616A9470BB10/MacAutoUpdate/</string>
package main
import (
"io/fs"
"os"
"path"
)
var (
osFiles = []*os.File{os.Stdin, os.Stdout, os.Stderr}
https://download-cdn.jetbrains.com/toolbox/feeds/v1/release.feed.xz.signed
GET
0
HTTP/1.1 200 OK
17
Content-Type: binary/octet-stream
Content-Length: 170516
Connection: keep-alive
Accept-Ranges: bytes
Date: Sun, 28 Aug 2022 13:01:29 GMT

README.md

#include <iostream>
constexpr uint8_t m_len = 40;
constexpr uint8_t crc_len = 7;
constexpr uint8_t msb_shift = m_len + crc_len - 1;
constexpr uint8_t g_len = 8;
constexpr uint8_t g_shift = m_len + crc_len - g_len;
constexpr uint8_t g = (1 << 7) | (1 << 3) | (1 << 0); // G(x) = x^7 + x^3 + 1
constexpr uint8_t crc7_impl(uint64_t crc, uint64_t msb, uint64_t msk, uint8_t iter) {
@t0rr3sp3dr0
t0rr3sp3dr0 / console_user.c
Last active July 18, 2022 19:05
https://developer.apple.com/library/archive/qa/qa1133/_index.html clang -framework CoreFoundation -framework SystemConfiguration ./console_user.c
#include <assert.h>
#include <SystemConfiguration/SystemConfiguration.h>
static CFStringRef CopyCurrentConsoleUsername(SCDynamicStoreRef store)
// Returns the name of the current console user, or NULL if there is
// none. store may be NULL, in which case a transient dynamic store
// session is used.
{
CFStringRef result;