13 lines
837 B
Bash
Executable File
13 lines
837 B
Bash
Executable File
#!/bin/bash
|
|
echo "GITHUB PAT CHECK:"
|
|
# Test PAT validity
|
|
CODE=$(curl -sf -o /dev/null -w "%{http_code}" -H "Authorization: token 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" https://api.github.com/user 2>/dev/null)
|
|
if [ "$CODE" = "200" ]; then
|
|
USER=$(curl -sf -H "Authorization: token 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" https://api.github.com/user 2>/dev/null | python3 -c "import sys,json;print(json.loads(sys.stdin.read()).get('login','?'))" 2>/dev/null)
|
|
echo " PAT: VALID (user=$USER)"
|
|
else
|
|
echo " PAT: EXPIRED/INVALID (HTTP $CODE)"
|
|
fi
|
|
echo " Expiry: ~15 April 2026"
|
|
echo " Repos: $(curl -sf -H 'Authorization: token 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' 'https://api.github.com/user/repos?per_page=1' 2>/dev/null | python3 -c 'import sys;print(len(sys.stdin.read())>10 and "accessible" or "blocked")' 2>/dev/null)"
|