How To Install python3-asteval on Kali Linux

In this tutorial we learn how to install python3-asteval on Kali Linux. python3-asteval is minimalistic evaluator of Python 3 expression using ast module

Introduction

In this tutorial we learn how to install python3-asteval on Kali Linux.

What is python3-asteval

python3-asteval is:

ASTEVAL is a safe(ish) evaluator of Python expressions and statements, using Python’s ast module. The idea is to provide a simple, safe, and robust miniature mathematical language that can handle user-input. The emphasis here is on mathematical expressions, and so many functions from numpy are imported and used if available.

Many Python lanquage constructs are supported by default, These include slicing, subscripting, list comprehension, conditionals (if-elif-else blocks and if expressions), flow control (for loops, while loops, and try-except-finally blocks). All data are Python objects, and built-in data structures (dictionaries, tuple, lists, numpy arrays, strings) are fully supported by default.

Many of the standard builtin Python functions are available, as are all mathemetical functions from the math module. If the numpy module is installed, many of its functions will also be available. Users can define and run their own functions within the confines of the limitations of asteval.

There are several absences and differences with Python, and asteval is by no means an attempt to reproduce Python with its own ast module. Some of the most important differences and absences are:

  • Variable and function symbol names are held in a simple symbol table (a single dictionary), giving a flat namespace.
  • creating classes is not supported.
  • importing modules is not supported.
  • function decorators, yield, lambda, exec, and eval are not supported.
  • files can only be opened in read-only mode.

In addition, accessing many internal methods and classes of objects is forbidden in order to strengthen asteval against malicious user code. .

This package installs the library for Python 3.

There are three methods to install python3-asteval 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 python3-asteval Using apt-get

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

sudo apt-get update

After updating apt database, We can install python3-asteval using apt-get by running the following command:

sudo apt-get -y install python3-asteval

Install python3-asteval Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install python3-asteval using apt by running the following command:

sudo apt -y install python3-asteval

Install python3-asteval 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 python3-asteval using aptitude by running the following command:

sudo aptitude -y install python3-asteval

How To Uninstall python3-asteval on Kali Linux

To uninstall only the python3-asteval package we can use the following command:

sudo apt-get remove python3-asteval

Uninstall python3-asteval And Its Dependencies

To uninstall python3-asteval and its dependencies that are no longer needed by Kali Linux, we can use the command below:

sudo apt-get -y autoremove python3-asteval

Remove python3-asteval Configurations and Data

To remove python3-asteval configuration and data from Kali Linux we can use the following command:

sudo apt-get -y purge python3-asteval

Remove python3-asteval configuration, data, and all of its dependencies

We can use the following command to remove python3-asteval configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge python3-asteval

Dependencies

python3-asteval have the following dependencies:

References

Summary

In this tutorial we learn how to install python3-asteval package on Kali Linux using different package management tools: apt, apt-get and aptitude.