/
.functions
63 lines (51 loc) · 2.02 KB
/
.functions
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
# Clones if a Git repository is given, elsewhere just cd
function cdc() {
name=`sed -e 's/.*\///g' <<< $1`
if [[ ! -d "$1" && $1 =~ ^(github|bitbucket|gitlab)\.[a-z]{2,}/.*$ ]]; then
ssh=`sed -e 's/^/git@/' -e 's/$/.git/' -e 's/\//:/' <<< $1`
git clone $ssh;
fi
cd $name;
}
# Determines size of a file or total size of a directory
function fs() {
if du -b /dev/null > /dev/null 2>&1; then
local arg=-sbh;
else
local arg=-sh;
fi
if [[ -n "$@" ]]; then
du $arg -- "$@";
else
du $arg .[^.]* ./*;
fi;
}
# Creates a data URL from a file
function dataurl() {
local mimeType=$(file -b --mime-type "$1");
if [[ $mimeType == text/* ]]; then
mimeType="${mimeType};charset=utf-8";
fi
echo "data:${mimeType};base64,$(openssl base64 -in "$1" | tr -d '\n')";
}
# Returns useful information using dig tool
function diga() {
dig +nocmd "$1" any +multiline +noall +answer;
}
# Returns information about usual subdomains
function dig_in_parallel() {
dig=$(dig +noall +answer $1);
if [ -n "$dig" ]; then
echo "✔ $dig";
fi
}
function digscan() {
set +m;
subdomains=( alert adm admin administration api apis assets back backend blog bo board build builds ci cloud conf config configuration console contact contacts dashboard database db dev demo directory dl doc documentation download downloads elasticsearch endpoint elk exchange exchanges free files front frontend ftp gateway geo git gitlab github grafana graph graphs group home host hosting int integ integration jenkins jira kibana kube kubectl kubernetes light live logs mail manager market marketing mobile monitor monitoring mongo mongodb mysql open openshift opensource order orders partner partners preprod private prive postgres postgresql recette root share sales source sources stats status stream test vpn webmail wiki www )
echo "Checking...\n";
for subdomain in "${subdomains[@]}"; do
dig_in_parallel "$subdomain.$1" &
done
wait
set -m;
}