How To Install golang-github-cli-safeexec-dev on Kali Linux

In this tutorial we learn how to install golang-github-cli-safeexec-dev on Kali Linux. golang-github-cli-safeexec-dev is safer version of exec.LookPath on Windows

Introduction

In this tutorial we learn how to install golang-github-cli-safeexec-dev on Kali Linux.

What is golang-github-cli-safeexec-dev

golang-github-cli-safeexec-dev is:

safeexec is a Go module that provides a safer alternative to exec.LookPath() on Windows.

The following, relatively common approach to running external commands has a subtle vulnerability on Windows:

import “os/exec”

func gitStatus() error { // On Windows, this will result in .\git.exe or .\git.bat being executed // if either were found in the current working directory. cmd := exec.Command(“git”, “status”) return cmd.Run() }

Searching the current directory (surprising behavior) before searching folders listed in the PATH environment variable (expected behavior) seems to be intended in Go and unlikely to be changed: https://github.com/golang/go/issues/38736

Since Go does not provide a version of exec.LookPath() that only searches PATH and does not search the current working directory, this module provides a LookPath function that works consistently across platforms.

Example use:

import ( “os/exec” “github.com/cli/safeexec” )

func gitStatus() error { gitBin, err := safeexec.LookPath(“git”) if err != nil { return err } cmd := exec.Command(gitBin, “status”) return cmd.Run() }

There are three methods to install golang-github-cli-safeexec-dev on Kali Linux. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install golang-github-cli-safeexec-dev Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install golang-github-cli-safeexec-dev using apt-get by running the following command:

sudo apt-get -y install golang-github-cli-safeexec-dev

Install golang-github-cli-safeexec-dev Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install golang-github-cli-safeexec-dev using apt by running the following command:

sudo apt -y install golang-github-cli-safeexec-dev

Install golang-github-cli-safeexec-dev Using aptitude

If you want to follow this method, you might need to install aptitude on Kali Linux first since aptitude is usually not installed by default on Kali Linux. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install golang-github-cli-safeexec-dev using aptitude by running the following command:

sudo aptitude -y install golang-github-cli-safeexec-dev

How To Uninstall golang-github-cli-safeexec-dev on Kali Linux

To uninstall only the golang-github-cli-safeexec-dev package we can use the following command:

sudo apt-get remove golang-github-cli-safeexec-dev

Uninstall golang-github-cli-safeexec-dev And Its Dependencies

To uninstall golang-github-cli-safeexec-dev and its dependencies that are no longer needed by Kali Linux, we can use the command below:

sudo apt-get -y autoremove golang-github-cli-safeexec-dev

Remove golang-github-cli-safeexec-dev Configurations and Data

To remove golang-github-cli-safeexec-dev configuration and data from Kali Linux we can use the following command:

sudo apt-get -y purge golang-github-cli-safeexec-dev

Remove golang-github-cli-safeexec-dev configuration, data, and all of its dependencies

We can use the following command to remove golang-github-cli-safeexec-dev configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge golang-github-cli-safeexec-dev

Dependencies

golang-github-cli-safeexec-dev have the following dependencies:

References

Summary

In this tutorial we learn how to install golang-github-cli-safeexec-dev package on Kali Linux using different package management tools: apt, apt-get and aptitude.