Divide the length of the input string by 4, take the remainder. If it is 2, add two = characters at the end. If it is 3, add one = character at the end.
You now have Base64-URL with padding.
| // HTTP client for testing high connection concurrency | |
| // Authors: Richard Jones and Rasmus Andersson | |
| // Released in the public domain. No restrictions, no support. | |
| #include <sys/types.h> | |
| #include <sys/time.h> | |
| #include <sys/queue.h> | |
| #include <stdlib.h> | |
| #include <err.h> | |
| #include <event.h> | |
| #include <evhttp.h> |
| urlencode() { | |
| # urlencode <string> | |
| old_lc_collate=$LC_COLLATE | |
| LC_COLLATE=C | |
| local length="${#1}" | |
| for (( i = 0; i < length; i++ )); do | |
| local c="${1:$i:1}" | |
| case $c in |
| # the following two lines give a two-line status, with the current window highlighted | |
| hardstatus alwayslastline | |
| hardstatus string '%{= kG}[%{G}%H%? %1`%?%{g}][%= %{= kw}%-w%{+b yk} %n*%t%?(%u)%? %{-}%+w %=%{g}][%{B}%m/%d %{W}%C%A%{g}]' | |
| # huge scrollback buffer | |
| defscrollback 5000 | |
| # no welcome message | |
| startup_message off |
| #!/bin/bash | |
| set -ue | |
| bash_trace () { | |
| typeset -i i=0 | |
| for func in "${FUNCNAME[@]}" | |
| do | |
| printf '%15s() %s:%d\n' \ | |
| "$func" "${BASH_SOURCE[$i]}" "${BASH_LINENO[$i]}" |
Exporting password + one-time code data from iCloud Keychain is now officially supported in macOS Monterey and Safari 15 (for Monterey, Big Sur, and Catalina). You can access it in the Password Manager’s “gear” icon (System Preferences > Passwords on Monterey, and Safari > Passwords everywhere else), or via the File > Export > Passwords... menu item). You shouldn't need to hack up your own exporter anymore.
After my dad died, I wanted to be able to have access any of his online accounts going forward. My dad was a Safari user and used iCloud Keychain to sync his credentials across his devices. I don’t want to have to keep an OS X user account around just to access his accounts, so I wanted to export his credentials to a portable file.
| import os | |
| import sys | |
| import struct | |
| import ctypes | |
| import compress | |
| #compress.py from https://github.com/magical/nlzss/blob/master/compress.py | |
| #slightly modified padding | |
| def getWord(b, k, n=4): | |
| return sum(list(map(lambda c: b[k+c]<<(c*8),range(n)))) |
| #include <netdb.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <errno.h> | |
| #define CANARY "in_the_coal_mine" | |
| struct { | |
| char buffer[1024]; |
Successful mitmproxy-3.7 setup tested on OS X 10.13.6 and iPhone X running 12.1.4
Enable IP forwarding and disable ICMP redirects to keep the iPad sending traffic to the proxy
sudo sysctl -w net.inet.ip.forwarding=1
sudo sysctl -w net.inet.ip.redirect=0
net.inet.ip.forwarding
Enable IP forwarding between interfaces