This repository has been archived by the owner on Jan 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 650
/
loic-net4.0.sh
executable file
·122 lines (109 loc) · 2.62 KB
/
loic-net4.0.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
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
#!/bin/bash
# Copyfuck © 2010 q
# Edited by NewEraCracker
#
# This script installs, updates and runs LOIC on Linux.
#
# Supported distributions:
# * Ubuntu
# * Debian
# * Fedora
#
# Before using you must install monodevelop from:
# https://www.monodevelop.com/download/#fndtn-download-lin
#
# Usage: bash ./loic-net4.0.sh <install|update|run>
#
GIT_REPO=https://github.com/NewEraCracker/LOIC.git
GIT_BRANCH=master
DEB_MONO_PKG="monodevelop liblog4net-cil-dev mono-devel mono-runtime-common mono-runtime libmono-system-windows-forms4.0-cil"
FED_MONO_PKG="mono-basic mono-devel monodevelop mono-tools"
lower() {
tr '[A-Z]' '[a-z]'
}
what_distro() {
# if which lsb_release ; then
# echo lsb_release -si | lower
# el
if grep -qri ubuntu /etc/*-release ; then
echo "ubuntu"
elif [[ -e /etc/fedora-release ]] ; then
echo "fedora"
else
# Assume Debian-based
echo "debian"
fi
}
DISTRO=$(what_distro)
ensure_git() {
if ! which git ; then
if [[ $DISTRO = 'ubuntu' || $DISTRO = 'debian' ]] ; then
sudo apt-get install git
elif [[ $DISTRO = 'fedora' ]] ; then
sudo yum install git
fi
fi
}
is_loic() {
is_loic_git || { [[ -d LOIC ]] && cd LOIC && is_loic_git; }
}
is_loic_git() {
[[ -d .git ]] && grep -q LOIC .git/config
}
get_loic() {
ensure_git
if ! is_loic ; then
git clone $GIT_REPO -b $GIT_BRANCH
fi
}
compile_loic() {
get_loic
if ! is_loic ; then
echo "Error: You are not in a LOIC repository."
exit 1
fi
if [[ $DISTRO = 'ubuntu' || $DISTRO = 'debian' ]] ; then
sudo apt-get install $DEB_MONO_PKG
elif [[ $DISTRO = 'fedora' ]] ; then
sudo yum install $FED_MONO_PKG
fi
cd src; xbuild /p:TargetFrameworkVersion="v4.0"
}
run_loic() {
is_loic
if [[ ! -e src/bin/Debug/LOIC.exe ]] ; then
compile_loic
fi
if ! which mono ; then
if [[ $DISTRO = 'ubuntu' || $DISTRO = 'debian' ]] ; then
sudo apt-get install mono-runtime
elif [[ $DISTRO = 'fedora' ]] ; then
sudo yum install mono-runtime
fi
fi
cp -n ./src/app.config ./src/bin/Debug/LOIC.exe.config
mono --runtime=v4.0.30319 src/bin/Debug/LOIC.exe
}
update_loic() {
ensure_git
if is_loic ; then
git pull --rebase
compile_loic
else
echo "Error: You are not in a LOIC repository."
fi
}
case $1 in
install)
compile_loic
;;
update)
update_loic
;;
run)
run_loic
;;
*)
echo "Usage: $0 <install|update|run>"
;;
esac