Python программирование и установка в Kali linux
Python 3 пакет содержит среду разработки Python. Это полезно для объектно-ориентированного программирования, написания очень полезных скриптов, демо версиях больших программ или разработки приложения.
Но мы же не разработчики мы хакеры. И нам нужно извлечь из питона как можно больше полезного для наших действий. Но об этом мы поговорим позже.
Даю подсказку! Питон позволит нам писать скрипты которые обходят антивирус и вирусы которые антивирус не видит, и также с его же помощью мы сможем взламывать пароли от многих социальных сетей.
Сначала мы установим это чудо в наш Kali linux дистрибутив.
Есть два метода. Оба очень легкие.
Отрываем терминал и пишем:
Чтобы открыть питон напишите в терминале
В Kali linux есть Software Manager
Открываем его и ищем Python3 Там выявитса большой список паков.
Выберите python3 base и idle-python3 package
Нажмите на apply и пусть начнётся магия!
Вуаля. Пакеты устанавливаются непосредственно из репозитория без каких-либо забот.
Имея большой опыт с различными версиями питона я только что обнаружил, что если вы хотите иметь чистую систему просто попробуйте в первую очередь работать с Software Manager и в качестве второго варианта вы можете перейти вручную.
Python on Kali Linux: A beginner’s guide to get started
Python is now the most used programming language in the world, with usage ranging from artificial intelligence to web development or even smartphone applications. For hackers and pen-testers, Python can also become a great ally on Kali Linux, to save time on many processes. Let’s see how to install and use Python on your favorite distribution.
On Kali Linux, a recent version of Python is already installed with dozens of libraries ready to use. No code editor is present, but most of them are available in the default repository and can be installed easily with APT.
Let’s start by checking your system installation, making sure Python is ready to use, and I’ll show you a few things you can try with Python on Kali Linux.
Table of Contents
Getting Started with Python on Kali Linux
Even if coding in Python is maybe not the main goal for the typical Kali Linux user, everything is already set up for you on a fresh installation. Except choosing a text editor, there is almost nothing to do.
How to install Python on Kali Linux
Python is already installed by default on Kali Linux. I kept the default options during the installation (including the essentials tools), and it was already there.
You can use this command to make sure Python is installed, and see which version:
python —version
It should be Python 3, maybe not the latest version, but one that is pretty recent. You can always uninstall it and get the latest version manually, but in most cases it’s not worth the effort. Just do regular updates with APT, and it will get updated when ready:
sudo apt update
sudo apt upgrade
By the way, if for any reason Python is not present on your system, you can install it with APT too:
sudo apt install python
How to install PIP on Kali Linux
PIP is a package manager for Python. It’s connected to a large database of libraries available online (Pyhton Package Index, or PyPi). It’s already installed by default on Kali Linux, so you can use it right away.
You can use this command to make sure it’s available and see the version:
pip —version 
I’ll elaborate on libraries in the next paragraph, but basically, if you need any random library that is not available with APT (or pre-installed on Kali Linux), you can use this tool to download and install them quickly.
Python libraries on Kali Linux
Python is nothing without its libraries. Each library adds new functions that you can use in your Python scripts. You don’t have to code everything yourself, you can rely on projects created by other developers, and just reuse their work in yours.
Dozens of libraries are pre-installed on a fresh Kali Linux system (probably more than 100 in fact). So, for most Python projects, you’ll already have the libraries you need available.
Here is a screenshot of some of them: 
I got this list by using the “dpkg” command:
sudo dpkg -l | grep python3
I’ll take and example later, but if you need a library that is not pre-installed, you can generally install it with APT, by using this syntax:
sudo apt install python3-<library>
Or by using the PIP tool I introduce earlier, like this:
pip install <library>
We’re almost done, the only thing missing might be a fancy code editor, if you don’t want to use the default notepad or a text editor in a terminal.
Python code editors you can use on Kali Linux
Except the default notepad or Nano, Kali Linux doesn’t include any graphic text editor. However, Kali Linux is based on Debian, so most of them can be installed manually from the default repository, or by using packages provided by the developers.
That’s a bit strange that they didn’t include anything, when we see that everything else is taken care of. But I guess they weren’t able to decide which one to choose :-).
Anyway, I tried to install VS Code and Geany, and it was done easily.
VS Code is not open-source, but the open-source version (code-oss) is available in the default repository. If you are used to Visual Studio Code, it should be good enough. You can install it with APT:
sudo apt install code-oss 
Same thing for Geany, that is available with:
sudo apt install geany
For other editors, you’ll find either find repositories that you can add, Debian packages or source files to compile and install manually. For example, if you prefer Sublime Text, you can download the Debian package here (a repository is also available).
Kali Linux: From Zero To Hero
How to master Kali Linux like a pro hacker
Even if you never used Linux before.
Nano is available directly by default, several options are available in the default repository, and plenty of editors have a Linux version that works on Kali. So make your choice and move on once you’re ready.
Practical applications with Python on Kali Linux
All of this is very interesting, but Kali Linux is not really the first choice for Python developers. So, why should you use Python, and what can you do with it? Let’s see a few real-life examples.
Scan network and run attacks based on the results
Kali Linux comes with many tools, that are generally used in command lines. So, basically, you rely on tools, but you do everything manually, in a terminal (or via the graphic interface is there is one).
For example, Nmap is a popular tool to scan hosts on a network, but do you know that there is a library (python3-nmap) available to do it inside your Python scripts?
This way you can scan the network, and run actions based on the results you get. Maybe it’s a deeper scan on specific devices, or adding the IP addresses in the queue list for other scripts or tools you have.
Strangely, the Nmap library is not installed by default, but you can install it with:
sudo apt install python3-nmap 
You can then use it in your scripts to detect open ports on the network.
Here is a basic example: 
This script will scan the ports open on my target (192.168.222.100), for a specific range (between 22 and 80). I then use the has_tcp() function to display a message to tell if SSH or HTTP are responding.
In a more concrete example, I could scan all the devices on the local network, and do something specific when I find one with the SSH port open (a brute force attack or something like that).
Note: If you use the version available on PyPi, the syntax will be slightly different, so make sure to follow the documentation corresponding to the library you use.
Packets sniffing and manipulation
Scapy is another tool you can use on Kali Linux to interact with network packets. It comes with a Python library, so you can do everything directly within your Python scripts.
Scapy and the corresponding Python library are installed by default on Kali Linux.
You can for example use the sniff() function to analyze packets on your network, and do specific actions depending on their content or destination. Or you can simply send a “ping” to any IP address, and do something if there is a response (like the port scanner code with Nmap). 
You get the idea. It’s the same thing as with Nmap. We take a tool that is available on Kali Linux, but use it in Python, so we can use loops, conditions and run different actions based on the results. All the good stuff that programmers like.
If you want to give it a try, pick the library corresponding to a tool you know and read the online documentation for more details about the functions available.
Coding malware
You may not know it, but most malware is written in Python. So whether you’re a pen-tester or a budding hacker, you can use Python not only to make your life easier, but also to send attacks directly to a target and see how users react to the threat.
I do not endorse this type of practice, so I won’t give you more details about this, but it’s not a coincidence if Python is pre-installed on Kali Linux. Both types of users can benefit from it.
Building tools for you
Overall, Python is a good way to create custom tools or scripts for pen testing, auditing, etc.
Learning Python shouldn’t be that complicated, whether you already have some experience with other languages or not. In most cases, you can rely on existing libraries, and follow the examples available in their documentation to quickly get results.
- The complete Ethical Hacking course (Python & Kali Linux)
Perfect for beginners in Python, as most of the course is about Python.
It merges with ethical hacking near the end, but it’s mostly a Python course. - Ethical Hacking Bootcamp: Zero to mastery
The 5 phases of ethical hacking, with Python practice for each of them (port scanner, password cracking, etc.) - Applied Ethical Hacking
It’s like the top-level of ethical hacking course, once you already know the basics.
You’ll use most of the Kali Linux tools, Python, but also discover broader concepts like social engineering.
I gave you the basics to get started, now it’s up to you to apply them in your projects and environment. Following a complete course can save you a lot of time, but it’s not mandatory (you can always learn by yourself, it just requires more effort in general).
Hi, my name is Patrick, I’m a web developer and network administrator. I have always been interested in security, and I created this website to share my findings with you.
Sorry, you have been blocked
This website is using a security service to protect itself from online attacks. The action you just performed triggered the security solution. There are several actions that could trigger this block including submitting a certain word or phrase, a SQL command or malformed data.
What can I do to resolve this?
You can email the site owner to let them know you were blocked. Please include what you were doing when this page came up and the Cloudflare Ray ID found at the bottom of this page.
Cloudflare Ray ID: 7d475cf64f192d30 • Your IP: Click to reveal 88.135.219.175 • Performance & security by Cloudflare
Как установить python на кали линукс
In December of 2019 we released a blog post talking about how we will deal with Python 2’s End-of-Life. Since then there has been quite a lot of tools that users use that have not been ported to Python 3, causing issues when they try to use them. This page will cover a way of using the depreciated version in a safe way.
pyenv
Python 2 is no longer being maintained in the Debian repositories. This means that we must find a way to work around this issue. pyenv solves this problem by allowing us to install multiple versions of Python that do not conflict with each other. Currently it is not in the Debian or Kali repository, so we will need to install it from source. Thankfully, there is a handy installation script that the authors have released. Let’s go through the installation and setup together:
We will next be quickly running the bash install script. If ZSH is the default shell we will have to edit the .zshrc file after this:
If we are using ZSH then we will now add the proper lines to our .zshrc :
Lets continue with the setup
We can now install Python 2 and set it as our default Python version:
We can now install dependencies as needed for whatever tools we are using. When we want to swap back to Python 3, we just need to set the global to be system.
One thing to keep in mind is to stick with installing the dependencies via pip . apt will not be very kind if you are trying to install Python 2 dependencies through it and through pip, so just stick with pip in this case.