mirror of
https://github.com/danielmiessler/SecLists.git
synced 2025-05-31 02:31:26 +00:00
Add shell script to generate GitHub avatars
This commit is contained in:
parent
6b00e5cf53
commit
c1aa6e12a5
86
.bin/generate-contributors
Executable file
86
.bin/generate-contributors
Executable file
@ -0,0 +1,86 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
## Requires jq
|
||||||
|
#
|
||||||
|
## Example: bash github-api-contributors-gen.sh "danielmiessler/SecLists"
|
||||||
|
#
|
||||||
|
|
||||||
|
## https://github.com/<value>
|
||||||
|
githubRepo=${1:-danielmiessler/SecLists}
|
||||||
|
|
||||||
|
## How many avatar's per row
|
||||||
|
avatar_row=5
|
||||||
|
|
||||||
|
## Start at the start
|
||||||
|
page=1
|
||||||
|
|
||||||
|
## Empty the values
|
||||||
|
login=()
|
||||||
|
avatar_url=()
|
||||||
|
url=()
|
||||||
|
|
||||||
|
## Do until there isn't anything returned
|
||||||
|
while true; do
|
||||||
|
## Call the API, to extract the JSON for that page
|
||||||
|
json=$( curl -s "https://api.github.com/repos/${githubRepo}/contributors?page=${page}" )
|
||||||
|
|
||||||
|
## Check to see if its empty or not - if it is, exit the loop
|
||||||
|
[[ -z "$( echo ${json} | jq -r '.[]' )" ]] \
|
||||||
|
&& break
|
||||||
|
|
||||||
|
## Loop over all three values, save to an array (dirty - as multiple loops hardcoded...)
|
||||||
|
for x in $( echo ${json} | jq -r ".[].login" ); do
|
||||||
|
login+=($x)
|
||||||
|
done
|
||||||
|
|
||||||
|
for x in $( echo ${json} | jq -r ".[].avatar_url" ); do
|
||||||
|
avatar_url+=($x)
|
||||||
|
done
|
||||||
|
|
||||||
|
for x in $( echo ${json} | jq -r ".[].url" ); do
|
||||||
|
url+=($x)
|
||||||
|
done
|
||||||
|
|
||||||
|
## Check to make sure all arrays are the same length (dirty - but works...)
|
||||||
|
if [ "${#login[@]}" -ne "${#avatar_url[@]}" ]; then
|
||||||
|
echo "[-] Issues with login & avatar_url"
|
||||||
|
exit 1
|
||||||
|
elif [ "${#login[@]}" -ne "${#url[@]}" ]; then
|
||||||
|
echo "[-] Issues with login & url"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
## Increase the page count
|
||||||
|
(( page ++))
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
## Make markdown headers
|
||||||
|
for x in " " "---"; do
|
||||||
|
echo -n "|"
|
||||||
|
for y in $( seq 1 "${avatar_row}" ); do
|
||||||
|
echo -n "${x}|"
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
## Counter for avatar_row
|
||||||
|
i=1
|
||||||
|
## For every value in the arrays above, do the following
|
||||||
|
for x in $( seq 0 "${#login[@]}" ); do
|
||||||
|
## As array starts at 0, length starts at 1, there will be one extra - skip the end!
|
||||||
|
[ ${x} -eq ${#login[@]} ] \
|
||||||
|
&& break
|
||||||
|
|
||||||
|
echo -n "<img width='50' src='${avatar_url[${x}]}'/><br />[${login[${x}]}](${url[${x}]}) | "
|
||||||
|
|
||||||
|
## Every x rows, do put onto a new line
|
||||||
|
[ $i -ge ${avatar_row} ] \
|
||||||
|
&& i=0 \
|
||||||
|
&& echo
|
||||||
|
|
||||||
|
## Increase the row count
|
||||||
|
(( i ++))
|
||||||
|
done
|
||||||
|
echo
|
@ -39,7 +39,7 @@ This project stays great because of care and love from the [community](https://g
|
|||||||
|
|
||||||
- - -
|
- - -
|
||||||
|
|
||||||
<!-- TABLE-AUTO-GENERATED ~ https://gist.github.com/g0tmi1k/ -->
|
<!-- TABLE-AUTO-GENERATED -->
|
||||||
| | | | | |
|
| | | | | |
|
||||||
|---|---|---|---|---|
|
|---|---|---|---|---|
|
||||||
<img width='50' src='https://avatars.githubusercontent.com/u/535942?v=4'/><br />[g0tmi1k](https://api.github.com/users/g0tmi1k) | <img width='50' src='https://avatars.githubusercontent.com/u/50654?v=4'/><br />[danielmiessler](https://api.github.com/users/danielmiessler) | <img width='50' src='https://avatars.githubusercontent.com/u/3488554?v=4'/><br />[jhaddix](https://api.github.com/users/jhaddix) | <img width='50' src='https://avatars.githubusercontent.com/u/1573775?v=4'/><br />[righettod](https://api.github.com/users/righettod) | <img width='50' src='https://avatars.githubusercontent.com/u/20900400?v=4'/><br />[toxydose](https://api.github.com/users/toxydose) |
|
<img width='50' src='https://avatars.githubusercontent.com/u/535942?v=4'/><br />[g0tmi1k](https://api.github.com/users/g0tmi1k) | <img width='50' src='https://avatars.githubusercontent.com/u/50654?v=4'/><br />[danielmiessler](https://api.github.com/users/danielmiessler) | <img width='50' src='https://avatars.githubusercontent.com/u/3488554?v=4'/><br />[jhaddix](https://api.github.com/users/jhaddix) | <img width='50' src='https://avatars.githubusercontent.com/u/1573775?v=4'/><br />[righettod](https://api.github.com/users/righettod) | <img width='50' src='https://avatars.githubusercontent.com/u/20900400?v=4'/><br />[toxydose](https://api.github.com/users/toxydose) |
|
||||||
|
Loading…
x
Reference in New Issue
Block a user