@@ -11,8 +11,26 @@ function install_powershell() {
1111 brew tap caskroom/cask
1212 brew cask install powershell
1313 else
14+ # Deb 10.x
15+ if cat /etc/debian_version | grep 10.* ; then
16+ sudo apt-get install -y apt-transport-https curl
17+ curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
18+ sudo sh -c ' echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-stretch-prod stretch main" > /etc/apt/sources.list.d/microsoft.list'
19+
20+ mkdir /tmp/pwshtmp
21+ (cd /tmp/pwshtmp && \
22+ wget http://http.us.debian.org/debian/pool/main/i/icu/libicu57_57.1-6+deb9u3_amd64.deb && \
23+ wget http://http.us.debian.org/debian/pool/main/u/ust/liblttng-ust0_2.9.0-2+deb9u1_amd64.deb && \
24+ wget http://http.us.debian.org/debian/pool/main/libu/liburcu/liburcu4_0.9.3-1_amd64.deb && \
25+ wget http://http.us.debian.org/debian/pool/main/u/ust/liblttng-ust-ctl2_2.9.0-2+deb9u1_amd64.deb && \
26+ wget http://security.debian.org/debian-security/pool/updates/main/o/openssl1.0/libssl1.0.2_1.0.2t-1~deb9u1_amd64.deb && \
27+ sudo dpkg -i * .deb)
28+ rm -rf /tmp/pwshtmp
29+
30+ sudo apt-get update
31+ sudo apt-get install -y powershell
1432 # Deb 9.x
15- if cat /etc/debian_version | grep 9.* ; then
33+ elif cat /etc/debian_version | grep 9.* ; then
1634 # Install system components
1735 sudo apt-get install -y apt-transport-https curl
1836 # Import the public repository GPG keys
@@ -36,7 +54,7 @@ function install_powershell() {
3654 # Install PowerShell
3755 sudo apt-get install -y powershell
3856 # Ubuntu
39- elif lsb_release -d | grep -q " Ubuntu" ; then
57+ elif lsb_release -d | grep -q " Ubuntu" ; then
4058 # Read Ubuntu version
4159 local ubuntu_version=$( grep ' DISTRIB_RELEASE=' /etc/lsb-release | grep -o -E [[:digit:]]+\\ .[[:digit:]]+ )
4260 # Install system components
@@ -50,7 +68,7 @@ function install_powershell() {
5068 # Install PowerShell
5169 sudo apt-get install -y powershell
5270 # Kali Linux
53- elif cat /etc/lsb-release | grep -i ' Kali' ; then
71+ elif lsb_release -d | grep -q " Kali" ; then
5472 # Install prerequisites
5573 apt-get install -y curl gnupg apt-transport-https
5674 # Import the public repository GPG keys
@@ -59,15 +77,15 @@ function install_powershell() {
5977 sh -c ' echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-stretch-prod stretch main" > /etc/apt/sources.list.d/microsoft.list'
6078 # Update the list of products
6179 apt-get update
62- wget http://archive.ubuntu.com/ubuntu/pool/main/i/icu/libicu57_57.1-6_amd64.deb
63- dpkg -i libicu57_57.1-6_amd64.deb
80+ wget http://archive.ubuntu.com/ubuntu/pool/main/i/icu/libicu57_57.1-6_amd64.deb
81+ dpkg -i libicu57_57.1-6_amd64.deb
6482 # Install PowerShell
6583 apt-get install -y powershell
6684 fi
67- fi
68- if ls /opt/microsoft/powershell/* /DELETE_ME_TO_DISABLE_CONSOLEHOST_TELEMETRY; then
69- rm /opt/microsoft/powershell/* /DELETE_ME_TO_DISABLE_CONSOLEHOST_TELEMETRY
70- fi
85+ fi
86+ if ls /opt/microsoft/powershell/* /DELETE_ME_TO_DISABLE_CONSOLEHOST_TELEMETRY; then
87+ rm /opt/microsoft/powershell/* /DELETE_ME_TO_DISABLE_CONSOLEHOST_TELEMETRY
88+ fi
7189 mkdir -p /usr/local/share/powershell/Modules
7290 cp -r ../lib/powershell/Invoke-Obfuscation /usr/local/share/powershell/Modules
7391}
@@ -80,11 +98,11 @@ IFS='/' read -a array <<< pwd
8098
8199if [[ " $( pwd) " != * setup ]]
82100then
83- cd ./setup
101+ cd ./setup
84102fi
85103
86104if uname | grep -q " Darwin" ; then
87- Xar_version=" xar-1.5.2"
105+ Xar_version=" xar-1.5.2"
88106 install_powershell
89107 sudo pip install -r requirements.txt --global-option=build_ext \
90108 --global-option=" -L/usr/local/opt/openssl/lib" \
@@ -97,43 +115,43 @@ else
97115 version=$( lsb_release -r | grep -oP " [0-9]+" | head -1 )
98116 if lsb_release -d | grep -q " Fedora" ; then
99117 Release=Fedora
100- Xar_version=" xar-1.5.2"
118+ Xar_version=" xar-1.5.2"
101119 sudo dnf install -y make automake gcc gcc-c++ python-devel m2crypto python-m2ext swig libxml2-devel java-openjdk-headless openssl-devel openssl libffi-devel redhat-rpm-config
102120 sudo pip install -r requirements.txt
103121 elif lsb_release -d | grep -q " Kali" ; then
104122 Release=Kali
105- Xar_version=" xar-1.6.1"
123+ Xar_version=" xar-1.6.1"
106124 apt-get update
107125 sudo apt-get install -y make g++ python-dev python-m2crypto swig python-pip libxml2-dev default-jdk zlib1g-dev libssl1.1 build-essential libssl-dev libxml2-dev zlib1g-dev
108126 sudo pip install -r requirements.txt
109127 install_powershell
110128 elif lsb_release -d | grep -q " Ubuntu" ; then
111129 Release=Ubuntu
112130 sudo apt-get update
113- if [ $( lsb_release -rs | cut -d " ." -f 1) -ge 18 ]; then
114- LibSSL_pkgs=" libssl1.1 libssl-dev"
115- Pip_file=" requirements.txt"
116- Xar_version=" xar-1.6.1"
117- else
118- LibSSL_pkgs=" libssl1.0.0 libssl-dev"
119- Pip_file=" requirements_libssl1.0.txt"
120- Xar_version=" xar-1.5.2"
121- fi
131+ if [ $( lsb_release -rs | cut -d " ." -f 1) -ge 18 ]; then
132+ LibSSL_pkgs=" libssl1.1 libssl-dev"
133+ Pip_file=" requirements.txt"
134+ Xar_version=" xar-1.6.1"
135+ else
136+ LibSSL_pkgs=" libssl1.0.0 libssl-dev"
137+ Pip_file=" requirements_libssl1.0.txt"
138+ Xar_version=" xar-1.5.2"
139+ fi
122140 sudo apt-get install -y make g++ python-dev python-m2crypto swig python-pip libxml2-dev default-jdk $LibSSL_pkgs build-essential
123141 sudo pip install -r $Pip_file
124142 install_powershell
125143 else
126144 echo " Unknown distro - Debian/Ubuntu Fallback"
127145 sudo apt-get update
128- if [ $( cut -d " ." -f 1 /etc/debian_version) -ge 9 ]; then
129- LibSSL_pkgs=" libssl1.1 libssl-dev"
130- Pip_file=" requirements.txt"
131- Xar_version=" xar-1.6.1"
132- else
133- LibSSL_pkgs=" libssl1.0.0 libssl-dev"
134- Pip_file=" requirements_libssl1.0.txt"
135- Xar_version=" xar-1.5.2"
136- fi
146+ if [ $( cut -d " ." -f 1 /etc/debian_version) -ge 9 ]; then
147+ LibSSL_pkgs=" libssl1.1 libssl-dev"
148+ Pip_file=" requirements.txt"
149+ Xar_version=" xar-1.6.1"
150+ else
151+ LibSSL_pkgs=" libssl1.0.0 libssl-dev"
152+ Pip_file=" requirements_libssl1.0.txt"
153+ Xar_version=" xar-1.5.2"
154+ fi
137155 sudo apt-get install -y make g++ python-dev python-m2crypto swig python-pip libxml2-dev default-jdk libffi-dev $LibSSL_pkgs build-essential
138156 sudo pip install -r $Pip_file
139157 install_powershell
0 commit comments