Skip to content

Commit

Permalink
Merge pull request #6 from Rajchowdhury420/patch-2
Browse files Browse the repository at this point in the history
Added MacOS Support (arm - Apple silicon - M1/M2/M3)
  • Loading branch information
hideckies authored Jul 11, 2024
2 parents e8c3cdb + 6ed6a50 commit 56c1001
Showing 1 changed file with 45 additions and 18 deletions.
63 changes: 45 additions & 18 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@ is_linux() {
fi
}

get_linux_ditro() {
is_macos() {
if [[ $(uname) == "Darwin" ]]; then
return 0
else
return 1
fi
}

get_linux_distro() {
if [ -f /etc/os-release ]; then
. /etc/os-release
distro=$NAME
Expand Down Expand Up @@ -59,7 +67,6 @@ get_linux_ditro() {
}

install_pkg_with_apk() {
log_success
sudo apk -y update
if [[ $target == "server" ]]; then
sudo apk -y add git alpine-sdk cmake nasm mingw-w64-gcc protobuf-compiler openssl python3-impacket python3-pefile
Expand Down Expand Up @@ -88,6 +95,16 @@ install_pkg_with_dnf() {
fi
}

install_pkg_with_brew() {
brew update
if [[ $target == "server" ]]; then
brew install git cmake nasm mingw-w64 protobuf openssl python3
pip3 install impacket pefile
elif [[ $target == "client" ]]; then
brew install git cmake nasm mingw-w64 protobuf openssl
fi
}

install_pkg() {
log "Installing packages..."

Expand Down Expand Up @@ -153,25 +170,35 @@ install_c2_client() {
fi
}

if ! is_linux; then
log_error "Your're running the program on non-Linux system. Hermit C2 is intended for Linux."
log_error "Stop the installation."
exit 1
fi
if is_linux; then
get_linux_distro
if [[ $distro == "Unknown" ]]; then
exit 1
fi
log "Linux Distribution: $distro"

get_linux_ditro
if [[ $distro == "Unknown" ]]; then
exit 1
fi
log "Linux Distribution: $distro"
if [[ $target == "server" ]]; then
install_c2_server
elif [[ $target == "client" ]]; then
install_c2_client
else
log_error "Invalid target."
fi
elif is_macos; then
log "macOS detected."

if [[ $target == "server" ]]; then
install_c2_server
elif [[ $target == "client" ]]; then
install_c2_client
if [[ $target == "server" ]]; then
install_pkg_with_brew
elif [[ $target == "client" ]]; then
install_pkg_with_brew
else
log_error "Invalid target."
fi
else
log_error "Invalid target."
log_error "Your're running the program on a non-Linux/non-macOS system. Hermit C2 is intended for Linux and macOS."
log_error "Stop the installation."
exit 1
fi

log_success "Dependencies installed successfully."
exit 0
exit 0

0 comments on commit 56c1001

Please sign in to comment.