forked from niklasb/libc-database
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get
executable file
·154 lines (140 loc) · 5.2 KB
/
get
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/bin/bash
cd "$(dirname "$0")"
. common/libc.sh
cntr_category=1
declare -a categories
declare -A requirements
categories[cntr_category]="ubuntu"
requirements["ubuntu"]="requirements_debian"
cntr_category=$((cntr_category + 1))
ubuntu() {
get_all_debian ubuntu-eglibc http://archive.ubuntu.com/ubuntu/pool/main/e/eglibc/ libc6
get_all_debian ubuntu-glibc http://archive.ubuntu.com/ubuntu/pool/main/g/glibc/ libc6
get_all_debian ubuntu-musl http://archive.ubuntu.com/ubuntu/pool/universe/m/musl/ musl
get_all_debian ubuntu-dietlibc http://archive.ubuntu.com/ubuntu/pool/universe/d/dietlibc/ dietlibc
get_all_debian ubuntu-security-eglibc http://security.ubuntu.com/ubuntu/pool/main/e/eglibc/ libc6
get_all_debian ubuntu-security-glibc http://security.ubuntu.com/ubuntu/pool/main/g/glibc/ libc6
get_all_debian ubuntu-security-musl http://security.ubuntu.com/ubuntu/pool/universe/m/musl/ musl
get_all_debian ubuntu-security-dietlibc http://security.ubuntu.com/ubuntu/pool/universe/d/dietlibc/ dietlibc
get_all_debian ubuntu-old-eglibc http://old-releases.ubuntu.com/ubuntu/pool/main/e/eglibc/ libc6
get_all_debian ubuntu-old-glibc http://old-releases.ubuntu.com/ubuntu/pool/main/g/glibc/ libc6
get_all_debian ubuntu-old-musl http://old-releases.ubuntu.com/ubuntu/pool/universe/m/musl/ musl
get_all_debian ubuntu-old-dietlibc http://old-releases.ubuntu.com/ubuntu/pool/universe/d/dietlibc/ dietlibc
}
categories[cntr_category]="debian"
requirements["debian"]="requirements_debian"
cntr_category=$((cntr_category + 1))
debian() {
get_all_debian debian-glibc https://deb.debian.org/debian/pool/main/g/glibc/ libc6
get_all_debian debian-musl https://deb.debian.org/debian/pool/main/m/musl/ musl
get_all_debian debian-dietlibc https://deb.debian.org/debian/pool/main/d/dietlibc/ dietlibc
}
categories[cntr_category]="rpm"
requirements["rpm"]="requirements_rpm"
cntr_category=$((cntr_category + 1))
rpm() {
get_all_rpm rpm glibc libc x86_64
get_all_rpm rpm glibc libc i586
get_all_rpm rpm glibc libc i686
get_all_rpm rpm musl musl x86_64
get_all_rpm rpm musl musl i586
get_all_rpm rpm musl musl i686
}
categories[cntr_category]="centos"
requirements["centos"]="requirements_centos"
cntr_category=$((cntr_category + 1))
centos() {
get_from_filelistgz centos-glibc http://mirror.centos.org/centos/ glibc i686
get_from_filelistgz centos-glibc http://mirror.centos.org/centos/ glibc x86_64
}
categories[cntr_category]="arch"
requirements["arch"]="requirements_pkg"
cntr_category=$((cntr_category + 1))
arch() {
get_all_pkg arch-glibc https://archive.archlinux.org/packages/g/glibc/ libc
get_all_pkg arch-lib32-glibc https://archive.archlinux.org/packages/l/lib32-glibc/ libc
get_all_pkg arch-musl https://archive.archlinux.org/packages/m/musl/ musl
}
categories[cntr_category]="alpine"
requirements["alpine"]="requirements_apk"
cntr_category=$((cntr_category + 1))
alpine() {
alpine_versions=(
latest-stable
edge
v3.0
v3.1
v3.2
v3.3
v3.4
v3.5
v3.6
v3.7
v3.8
v3.9
v3.10
v3.11
v3.12
)
for version in "${alpine_versions[@]}"; do
get_all_apk alpine-musl http://dl-cdn.alpinelinux.org/alpine/ "$version" main x86_64 musl
get_all_apk alpine-musl http://dl-cdn.alpinelinux.org/alpine/ "$version" main x86 musl
done
}
categories[cntr_category]="kali"
requirements["kali"]="requirements_debian"
cntr_category=$((cntr_category + 1))
kali() {
get_all_debian kali-glibc https://http.kali.org/pool/main/g/glibc/ libc6
get_all_debian kali-musl https://http.kali.org/pool/main/m/musl/ musl
}
categories[cntr_category]="parrotsec"
requirements["parrotsec"]="requirements_debian"
cntr_category=$((cntr_category + 1))
parrotsec() {
get_all_debian parrotsec-glibc https://download.parrot.sh/parrot/pool/main/g/glibc/ libc6
get_all_debian parrotsec-musl https://download.parrot.sh/parrot/pool/main/m/musl/ musl
}
categories[cntr_category]="launchpad"
requirements["launchpad"]="requirements_launchpad"
cntr_category=$((cntr_category + 1))
launchpad() {
get_all_launchpad launchpad-ubuntu-glibc ubuntu libc6 amd64
get_all_launchpad launchpad-ubuntu-glibc ubuntu libc6 i386
}
help() {
exec 1>&2
echo "Please specify libc categories to download:"
for category in "${categories[@]}" ; do
echo -e "\t* $category"
done
echo ""
echo "You may also specify 'all' to download all categories available."
echo ""
echo "Example:"
echo ""
echo "$ ./get ubuntu rpm arch"
echo "$ ./get all"
exit 1
}
if [[ "$#" -eq 0 ]] ; then
help
fi
if [[ " $@ " == *" all "* ]] ; then
set -- "${categories[@]}"
fi
# Verify arguments, requirements, and display a recap
requirements_general || die "General requirements are not met. Please, refer to README.md for installation instructions"
echo "Will download or update for:"
for category in "$@" ; do
if [[ ! " ${categories[@]} " == *" ${category} "* ]] ; then
die "Invalid category '$category'"
fi
${requirements[$category]} || die "Requirements for download or update '$category' are not met. Please, refer to README.md for installation instructions"
echo -e "\t* $category ; Requirements are met"
done
# Let's start :)
for category in "$@" ; do
echo "Downloading/updating $category"
$category
done