Movatterモバイル変換


[0]ホーム

URL:


Skip to content
Search Gists
Sign in Sign up

Instantly share code, notes, and snippets.

@upsuper
Last activeSeptember 28, 2019 08:11
    • Star(2)You must be signed in to star a gist
    • Fork(0)You must be signed in to fork a gist
    Save upsuper/1c60b74ee2968159fe3224cf71af245d to your computer and use it in GitHub Desktop.
    Script to revoke WoSign-related certificates on Firefox for OS X
    #!/bin/bash
    CERTUTIL="/usr/local/opt/nss/bin/certutil"
    if [!-f"$CERTUTIL" ];then
    echo"certutil is not found.">&2
    echo"You can install it via 'brew install nss'.">&2
    exit 1
    fi
    RCC_DIR=RevokeChinaCerts
    RCC_REPO="https://github.com/chengr28/RevokeChinaCerts.git"
    echo"Checking out RevokeChinaCerts..."
    if [!-d"$RCC_DIR" ];then
    git clone --depth 1"$RCC_REPO"
    else
    (cd"$RCC_DIR"; git pull)
    fi
    PROFILES_DIR="$HOME/Library/Application Support/Firefox/Profiles"
    list_profiles() {
    forprofilein$(ls"$PROFILES_DIR");do
    if [-d"$PROFILES_DIR/$profile" ];then
    echo$profile
    fi
    done
    }
    echo
    echo"Available profiles:"
    profiles=($(list_profiles))
    for((i=1; i<=${#profiles[@]}; i++));do
    echo"$i)${profiles[$i-1]}"
    done
    echo -n"Choose from the list:"
    read index
    echo
    profile_name="${profiles[$index-1]}"
    profile="$PROFILES_DIR/$profile_name"
    echo -n"Checking profile$profile_name..."
    if lsof"$profile/.parentlock"> /dev/null;then
    echo"failed"
    echo"the profile is in use.">&2
    exit 1
    fi
    echo"OK"
    list_certs() {
    forfin"$RCC_DIR/Shared/Certificates"/*.crt;do
    cert=$(openssl x509 -noout -text -in"$f")
    ifecho"$cert"| grep -q WoSign;then
    echo$f
    fi
    done
    }
    echo
    forfin$(list_certs);do
    echo"Revoking$(basename${f%.*})..."
    $CERTUTIL -d"$profile" -A -i"$f" -n"${f%.*}" -t"p,p,p"
    done
    Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

    [8]ページ先頭

    ©2009-2025 Movatter.jp