Skip to content

Instantly share code, notes, and snippets.

global screenWidth
global screenHeight
tell (do shell script "/usr/sbin/system_profiler SPDisplaysDataType | grep Resolution | tail -n 1") to set {screenWidth, screenHeight} to {word 2 as number, word 4 as number}
-- display dialog "screen: " & screenWidth & "x" & screenHeight
if screenWidth = 1200 then
-- display dialog "monitor U2410"
tell application "System Events"
@azu
azu / git-2.26.1-README.md
Last active January 22, 2022 21:54
Gitの認証情報を奪い取れるGit 2.26.0以下にある脆弱性について

Git 2.26.0以下にある脆弱性

Git 2.26.0以下*1には、細工したリポジトリをgit cloneしたときに、 そのユーザーのCredential(たとえばGitHub.comをcloneするときに使う認証情報)を奪い取れる脆弱性があります。

📝 取得できる認証情報は credential.helper の設定に依存する

既にPoC(検証するためのコード)もあり、結構簡単なので是非Gitを2.26.1以上にアップデートしましょう。 git submoduleを使うと見た目ではわかりにくい攻撃もできるので、「気をつける」では回避は難しいです。

function formatN (n) {
const unitList = ['y', 'z', 'a', 'f', 'p', 'n', 'u', 'm', '', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'];
const zeroIndex = 8;
const nn = n.toExponential(2).split(/e/);
let u = Math.floor(+nn[1] / 3) + zeroIndex;
if (u > unitList.length - 1) {
u = unitList.length - 1;
} else
if (u < 0) {
u = 0;
@fumiyas
fumiyas / openssh-build-static.sh
Created October 4, 2017 09:20
Build OpenSSH with static linked zlib and OpenSSL libraries
#!/bin/sh
set -u
set -e
umask 0077
prefix="/opt/openssh"
top="$(pwd)"
root="$top/root"
build="$top/build"