Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dodanie chce_moje_klucze_ssh.sh #198

Merged
merged 2 commits into from
Dec 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions actions/chce_moje_klucze_ssh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash
# Author: Koliw (https://github.com/koliwbr/)
# Platformy: all
# Kompatybilne z serwerami frog

# Skrypt pobiera klucze podanego użytkownika z GitHub i dodaje je do zaufanych

if [[ ! "$1" =~ [a-z]{4,38} ]]; then
echo -e "\033[5;31m[!]\033[0m\033[1;31m Jako paramert skryptu podaj nazwę użytkownika GitHub\033[0m"
echo -e "\033[5;31m[!]\033[0m Na przykład \033[0;32m$0 koliwbr\033[0m pobiera klucze użytkownika koliwbr."
echo -e "\033[5;31m[!]\033[0m Koniecznie zamień na własną nazwę użytkownika!"
exit 1
fi

TMPFILENAME=`mktemp`

if curl "https://github.com/$1.keys" -sf > $TMPFILENAME; then echo -n; else
echo -e "\033[5;31m[!]\033[0m Nie znaleziono użytkownika $1 na GitHub"
rm $TMPFILENAME
exit 2

fi

if [[ ! -s $TMPFILENAME ]]; then
echo -e "\033[5;31m[!]\033[0m Znaleziono użytkownika $1 na GitHub ale nie masz żadnich kluczy SSH"
echo -e "\033[5;31m[!]\033[0m Poniżej informacja jak je dodać do konta GitHub"
echo -e "\033[5;31m[!]\033[0m \033[4mhttps://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account#prerequisites\033[0m"
rm $TMPFILENAME
exit 3

fi

mkdir $HOME/.ssh -p
cat $TMPFILENAME >> $HOME/.ssh/authorized_keys
echo Dodano `cat $TMPFILENAME | wc -l` klucz/e/y! Teraz możesz się logować swoimi kluczem/ami z GitHub!
rm $TMPFILENAME