Skip to content

Instantly share code, notes, and snippets.

View kaloprominat's full-sized avatar

Pavel Kondratev kaloprominat

View GitHub Profile
@startergo
startergo / extract-firmware.md
Last active October 18, 2024 05:49
Extract Firmware from OS X installer
  • Download the full installer:
softwareupdate --list-full-installers
Finding available software
Software Update found the following full installers:
* Title: macOS Ventura, Version: 13.1, Size: 11931164KiB, Build: 22C65
* Title: macOS Ventura, Version: 13.0.1, Size: 11866460KiB, Build: 22A400
* Title: macOS Ventura, Version: 13.0, Size: 11866804KiB, Build: 22A380
* Title: macOS Monterey, Version: 12.6.2, Size: 12104568KiB, Build: 21G320
* Title: macOS Monterey, Version: 12.6.1, Size: 12108491KiB, Build: 21G217
@gowhari
gowhari / vigenere-cipher.py
Created May 23, 2018 10:24
vigenere cipher
# encoding: utf8
# vigenere cipher
# https://stackoverflow.com/a/2490718/1675586
def encode(key, string):
encoded_chars = []
for i in range(len(string)):
key_c = key[i % len(key)]
encoded_c = chr(ord(string[i]) + ord(key_c) % 256)
encoded_chars.append(encoded_c)
### Updated to reflect changes introduced with 10.13.4. Update to 10.13.4 if needed before attempting to make
SecureToken-related changes. ###
sysadminctl is a tool Apple introduced in 10.10 for working with system user accounts. In 10.13, sysadminctl is Apple's
recommended tool for working with user accounts in the CLI, replacing functionality that has long been provided by dscl
and adds new features available only in 10.13. sysadminctl can be used to change user passwords, create new users or
check the status of a new-to-10.13 security feature named SecureToken.
SecureToken is a non-visible APFS file system attribute, unlike the SIP protected flag or file creation date, that triggers
the creation of a new AuthenticationAuthority entry in a user's local account record
@Piker-Alpha
Piker-Alpha / enrollInSeedProgram.py
Created October 18, 2017 17:19
Python implementation of: seedutil enroll <program>
#!/usr/bin/python
''' Python implementation of "seedutil enroll <program>" '''
import os
import objc
from Foundation import NSBundle, NSClassFromString
SeedingBundle = NSBundle.bundleWithPath_('/System/Library/PrivateFrameworks/Seeding.framework')
@Piker-Alpha
Piker-Alpha / catalogUtilities.py
Created October 17, 2017 14:14
Show and set the CatalogURL on macOS 10.10 and greater
#!/usr/bin/python
import objc
from Foundation import NSBundle, NSClassFromString
SeedingBundle = NSBundle.bundleWithPath_('/System/Library/PrivateFrameworks/Seeding.framework')
functions = [
('currentCatalog', '@'),
@Piker-Alpha
Piker-Alpha / currentBuildIsSeed.py
Created October 17, 2017 13:51
Check for Beta build on macOS 10.10 and greater
#!/usr/bin/python
import objc
from Foundation import NSBundle, NSClassFromString
SeedingBundle = NSBundle.bundleWithPath_('/System/Library/PrivateFrameworks/Seeding.framework')
objc.loadBundleFunctions(SeedingBundle, globals(), [("currentBuildIsSeed", '@')])
buildInfo = NSClassFromString('SDBuildInfo')
h = logging.handlers.SysLogHandler(address='/var/run/syslog', facility=syslog.LOG_LOCAL1)
h = logging.handlers.SysLogHandler(address='/var/run/syslog', facility='local1')
@Alex-Just
Alex-Just / simple_encrypt_decrypt.py
Last active June 8, 2022 14:57
Simple encrypt/decrypt algorithm (Vigenere cipher)
#!/usr/bin/env python3
import base64
"""
Simple obfuscation that will obscure things from the very casual observer.
It is one of the strongest of the simple ancient ciphers.
https://en.wikipedia.org/wiki/Vigenère_cipher
"""
@fm-jason
fm-jason / _readme.md
Last active August 2, 2020 19:12
Salt SSL Certificate Deployment

Overview

This gist provides a quick overview of deploying SSL certificates to servers using Salt. I use a wildcard certificate for our domain, which makes management easier.

Quick Start

  1. Start with pillar_ssl-certificate.sls, which should be populated with your certificates and placed in Salt's pillar_roots directory (typically /srv/pillar).
  2. Place state_ssl-certificate.sls in Salt's file_roots directory (typically /srv/salt).
  3. Include the contents of top.sls in both the pillar and state top.sls file. (Modify for your minion IDs of course.)

Details

Use pillars to distribute sensitive data, such as SSL certificates. Accoring to the [Salt Pillar Walkthrough][2]:

Information transferred via pillar is guaranteed to only be presented to the minions that are targeted, making Pillar suitable for managing security information, such as cryptographic keys and passwords.

@jessepeterson
jessepeterson / crl2pkcs7.py
Created February 23, 2016 22:08
Python PKCS#7 degenerate certificates (like `openssl crl2pkcs7`) using ctypes
#!/usr/bin/python
from M2Crypto import X509, BIO, m2
import os
from ctypes import CDLL
from ctypes import *
from ctypes.util import find_library
class PKCS7_SIGNED(Structure):