-
Notifications
You must be signed in to change notification settings - Fork 1
/
orgmem.sh
70 lines (57 loc) · 2.08 KB
/
orgmem.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
pge=500
c=0
banner(){
echo -e ""
echo -e " ██████ ██████ ██████ ███ ███ ███████ ███ ███ "
echo -e "██ ██ ██ ██ ██ ████ ████ ██ ████ ████ "
echo -e "██ ██ ██████ ██ ███ ██ ████ ██ █████ ██ ████ ██ "
echo -e "██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ "
echo -e " ██████ ██ ██ ██████ ██ ██ ███████ ██ ██ "
echo
echo -e "\e[31m\t\tBy @DarkLotusKDB <3\e[0m"
}
Prt_usage(){
echo
echo "Usage: ./orgmem.sh -o <org_username>"
echo "-o: organization username according to github"
echo "Note: Default page limit is up to 500 pages"
echo
echo "Example: ./orgmem.sh -o apple"
}
Ready(){
mkdir -p Output/$org
}
Main_Logic(){
echo -e "\n\e[32m[+] Feteching Public Members Of $org From Github\e[0m"
for (( i=1; i<=$pge; i++))
do
Resp=$(curl -ksi1 "https://github.com/orgs/$org/people?page=$i")
Err=$(echo "This organization has no public members")
if echo "$Resp" | grep -i "$Err" &> /dev/null
then
break
else
echo -e "\n\e[33m[+] Members Found On People Page No: $i\e[0m"
echo "$Resp" | grep -Eo 'href="[^\"]+"' | sed 's/href="\///g' | sed 's/"//g' | grep -v "login\|signup\|features\|http\|^trending$\|^topics$\|^team$\|^sponsors$\|#\|customer-s\|^readme$\|^pricing$\|^mobile$\|\.xml\|\.json\|^events$\|^explore$\|^collections$\|^enterprise$\|^marketplace$\|orgs\/" | grep -vi "^$org$\|^github$" | sort -u | tee Output/$org/page-$i-users.txt
x=$(cat Output/$org/page-$i-users.txt | wc -w)
c=$(($x + $c))
fi
done
echo -e "\n\e[32m[+] Total Number Of Members: \e[0m\e[31m$c\e[0m"
echo -e "\n\e[32m[+] Output: \e[0m\e[33mcat Output/$org/*.txt\e[0m"
}
banner
while getopts 'o:' flag; do
case "${flag}" in
o) org="${OPTARG}" ;;
*) Prt_usage
exit 1 ;;
esac
done
if [ ! -z $org ]; then
Ready
Main_Logic
else
Prt_usage
fi