Twisted web python kali linux

Содержание
  1. Issue with installing sslstrip #27
  2. Comments
  3. anonymous187 commented May 5, 2020
  4. anonymous187 commented May 5, 2020
  5. pip3 install sslstrip Collecting sslstrip Downloading sslstrip-0.9.2.tar.gz (9.2 kB) Collecting Twisted==13.1.0 Downloading Twisted-13.1.0.tar.bz2 (2.7 MB) |████████████████████████████████| 2.7 MB 74 kB/s Collecting pyOpenSSL==0.13.1 Downloading pyOpenSSL-0.13.1.tar.gz (254 kB) |████████████████████████████████| 254 kB 135 kB/s Requirement already satisfied: zope.interface>=3.6.0 in /usr/lib/python3/dist-packages (from Twisted==13.1.0->sslstrip) (4.7.1) Building wheels for collected packages: sslstrip, Twisted, pyOpenSSL Building wheel for sslstrip (setup.py) . done Created wheel for sslstrip: filename=sslstrip-0.9.2-py3-none-any.whl size=14796 sha256=b5c3a7e8ae8768510e5cab995b0387523d48c55d14bee307c1c3730c45a37ef3 Stored in directory: /root/.cache/pip/wheels/fc/9d/90/1e5bc8d868e08c73037090addb2a01cc7b8444151828b5d7fa Building wheel for Twisted (setup.py) . done Created wheel for Twisted: filename=Twisted-13.1.0-cp38-cp38-linux_x86_64.whl size=2920570 sha256=735c6c41bc7f0e6a0969ff28db00af15916a87b14d57ddfebcaf61332402a6d9 Stored in directory: /root/.cache/pip/wheels/9c/fb/12/2c2371bd134a8ce5ad854b5b5eb8d4ebf37b1e60bc31c182aa Building wheel for pyOpenSSL (setup.py) . error ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘»‘»‘/tmp/pip-install-8wdgl596/pyOpenSSL/setup.py'»‘»‘; file='»‘»‘/tmp/pip-install-8wdgl596/pyOpenSSL/setup.py'»‘»‘;f=getattr(tokenize, ‘»‘»‘open'»‘»‘, open)(file);code=f.read().replace(‘»‘»‘\r\n'»‘»‘, ‘»‘»‘\n'»‘»‘);f.close();exec(compile(code, file, ‘»‘»‘exec'»‘»‘))’ bdist_wheel -d /tmp/pip-wheel-fcirrlto cwd: /tmp/pip-install-8wdgl596/pyOpenSSL/ Complete output (36 lines): running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-3.8 creating build/lib.linux-x86_64-3.8/OpenSSL copying OpenSSL/init.py -> build/lib.linux-x86_64-3.8/OpenSSL copying OpenSSL/tsafe.py -> build/lib.linux-x86_64-3.8/OpenSSL copying OpenSSL/version.py -> build/lib.linux-x86_64-3.8/OpenSSL creating build/lib.linux-x86_64-3.8/OpenSSL/test copying OpenSSL/test/init.py -> build/lib.linux-x86_64-3.8/OpenSSL/test copying OpenSSL/test/util.py -> build/lib.linux-x86_64-3.8/OpenSSL/test copying OpenSSL/test/test_crypto.py -> build/lib.linux-x86_64-3.8/OpenSSL/test copying OpenSSL/test/test_rand.py -> build/lib.linux-x86_64-3.8/OpenSSL/test copying OpenSSL/test/test_ssl.py -> build/lib.linux-x86_64-3.8/OpenSSL/test running build_ext building ‘OpenSSL.crypto’ extension creating build/temp.linux-x86_64-3.8 creating build/temp.linux-x86_64-3.8/OpenSSL creating build/temp.linux-x86_64-3.8/OpenSSL/crypto x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.8 -c OpenSSL/crypto/crypto.c -o build/temp.linux-x86_64-3.8/OpenSSL/crypto/crypto.o OpenSSL/crypto/crypto.c: In function ‘crypto_sign’: OpenSSL/crypto/crypto.c:626:16: error: storage size of ‘md_ctx’ isn’t known 626 | EVP_MD_CTX md_ctx; | ^
  6. Python и Twisted — Заметки о параллельной обработке данных (мультипроцессности)
  7. Twisted
  8. Особенности сборки Twisted в Сизифе [ править ]
  9. Twisted web python kali linux
  10. Keeping backwards compatibility in Kali
  11. Frequently Asked Questions
  12. I have downloaded a Python script, what should I do?
  13. How can I get rid of the login message?
  14. I have a Python 2 script that doesn’t run, what should I do?
  15. I want pip for Python 2, how can I get it back?
  16. I wrote a Python script, what should I do?

Issue with installing sslstrip #27

Comments

anonymous187 commented May 5, 2020

Hi,
I am facing some issues while installing the sslstrip
I run the following command:
python setup.py build && python setup.py install
then when i run:
sslstrip -h
Traceback (most recent call last):
File «/usr/local/bin/sslstrip», line 27, in
from twisted.web import http
ImportError: No module named twisted.web

I have tried installing twisted module using apt-get but unfortunately it is not there anymore
apt-get install python-twisted
Reading package lists. Done
Building dependency tree
Reading state information. Done
Package python-twisted is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package ‘python-twisted’ has no installation candidate

when i install it using pip3 is shows that it is there
pip3 install twisted
Requirement already satisfied: twisted in /usr/lib/python3/dist-packages (18.9.0)

so please can you guide me for the proper way to install it

The text was updated successfully, but these errors were encountered:

anonymous187 commented May 5, 2020

adding to what i have posted earlier
i tried installing it using the below command:

pip3 install sslstrip
Collecting sslstrip
Downloading sslstrip-0.9.2.tar.gz (9.2 kB)
Collecting Twisted==13.1.0
Downloading Twisted-13.1.0.tar.bz2 (2.7 MB)
|████████████████████████████████| 2.7 MB 74 kB/s
Collecting pyOpenSSL==0.13.1
Downloading pyOpenSSL-0.13.1.tar.gz (254 kB)
|████████████████████████████████| 254 kB 135 kB/s
Requirement already satisfied: zope.interface>=3.6.0 in /usr/lib/python3/dist-packages (from Twisted==13.1.0->sslstrip) (4.7.1)
Building wheels for collected packages: sslstrip, Twisted, pyOpenSSL
Building wheel for sslstrip (setup.py) . done
Created wheel for sslstrip: filename=sslstrip-0.9.2-py3-none-any.whl size=14796 sha256=b5c3a7e8ae8768510e5cab995b0387523d48c55d14bee307c1c3730c45a37ef3
Stored in directory: /root/.cache/pip/wheels/fc/9d/90/1e5bc8d868e08c73037090addb2a01cc7b8444151828b5d7fa
Building wheel for Twisted (setup.py) . done
Created wheel for Twisted: filename=Twisted-13.1.0-cp38-cp38-linux_x86_64.whl size=2920570 sha256=735c6c41bc7f0e6a0969ff28db00af15916a87b14d57ddfebcaf61332402a6d9
Stored in directory: /root/.cache/pip/wheels/9c/fb/12/2c2371bd134a8ce5ad854b5b5eb8d4ebf37b1e60bc31c182aa
Building wheel for pyOpenSSL (setup.py) . error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘»‘»‘/tmp/pip-install-8wdgl596/pyOpenSSL/setup.py'»‘»‘; file='»‘»‘/tmp/pip-install-8wdgl596/pyOpenSSL/setup.py'»‘»‘;f=getattr(tokenize, ‘»‘»‘open'»‘»‘, open)(file);code=f.read().replace(‘»‘»‘\r\n'»‘»‘, ‘»‘»‘\n'»‘»‘);f.close();exec(compile(code, file, ‘»‘»‘exec'»‘»‘))’ bdist_wheel -d /tmp/pip-wheel-fcirrlto
cwd: /tmp/pip-install-8wdgl596/pyOpenSSL/
Complete output (36 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/OpenSSL
copying OpenSSL/init.py -> build/lib.linux-x86_64-3.8/OpenSSL
copying OpenSSL/tsafe.py -> build/lib.linux-x86_64-3.8/OpenSSL
copying OpenSSL/version.py -> build/lib.linux-x86_64-3.8/OpenSSL
creating build/lib.linux-x86_64-3.8/OpenSSL/test
copying OpenSSL/test/init.py -> build/lib.linux-x86_64-3.8/OpenSSL/test
copying OpenSSL/test/util.py -> build/lib.linux-x86_64-3.8/OpenSSL/test
copying OpenSSL/test/test_crypto.py -> build/lib.linux-x86_64-3.8/OpenSSL/test
copying OpenSSL/test/test_rand.py -> build/lib.linux-x86_64-3.8/OpenSSL/test
copying OpenSSL/test/test_ssl.py -> build/lib.linux-x86_64-3.8/OpenSSL/test
running build_ext
building ‘OpenSSL.crypto’ extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/OpenSSL
creating build/temp.linux-x86_64-3.8/OpenSSL/crypto
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.8 -c OpenSSL/crypto/crypto.c -o build/temp.linux-x86_64-3.8/OpenSSL/crypto/crypto.o
OpenSSL/crypto/crypto.c: In function ‘crypto_sign’:
OpenSSL/crypto/crypto.c:626:16: error: storage size of ‘md_ctx’ isn’t known
626 | EVP_MD_CTX md_ctx;
| ^

OpenSSL/crypto/crypto.c:626:16: warning: unused variable ‘md_ctx’ [-Wunused-variable]
OpenSSL/crypto/crypto.c: In function ‘crypto_verify’:
OpenSSL/crypto/crypto.c:673:16: error: storage size of ‘md_ctx’ isn’t known
673 | EVP_MD_CTX md_ctx;
| ^

Читайте также:  Microsoft windows home basic 64 bit

OpenSSL/crypto/crypto.c:673:16: warning: unused variable ‘md_ctx’ [-Wunused-variable]
At top level:
OpenSSL/crypto/crypto.c:743:13: warning: ‘locking_function’ defined but not used [-Wunused-function]
743 | static void locking_function(int mode, int n, const char * file, int line) <
| ^

error: command ‘x86_64-linux-gnu-gcc’ failed with exit status 1

Источник

Python и Twisted — Заметки о параллельной обработке данных (мультипроцессности)

Twisted — это фреймворк на Python для разработки сетевых приложений, который среди многих других применений, может быть использован и для параллельной обработки данных — мультипроцессности. Это замечательно, но мне пришлось попотеть для того, чтобы найти то, что мне нужно.

Я листал документацию Twisted и книгу O’Reilly Twisted. Существует также рецепт в Python Cookbook. Однако, самое интересное я нашел в статье Брюса Эккель — Параллельность с Python, Twisted и Flex. Также стоит прочитать первоначальные статьи Брюса Эккель про Twisted: Grokking Twisted.

Вот мои замечания о текущем примере Брюса.

Я убрал Flex — отчасти потому, что мне это не нужно и я ничего не хочу знать об этом. В примере запускается контроллер, который инициализирует ряд отдельных параллельных процессов-вычислителей, в которых уже запускаются какие-то сложные действия (эти процессы называют solvers). Также тут имеется взаимодействие между контроллером и вычислителями. Хотя этот пример запускается только на одной машине, те принципы, о которых говориться в статье — не трудно распространить и на систему из нескольких компьютеров.

Для хорошего примера, как это работает, пожалуйста, смотрите оригинал статьи .

Вот solver.py который скопирован с оригинала. Настоящая «работа» происходит в методе step(). Я только добавил некоторую отладочную информацию для себя.

Вот controller.py. Он также скопирован из оригинальной статьи, но я убрал Flex и создал сигналы start и terminate в классе контроллера. Я не уверен, что это имеет смысл, но, по крайней мере, это позволило мне нормально использовать пример. Я также перенес метод terminate из FlexInterface в Controller.

Читайте также:  Параметры временной папки windows

Чтобы запустить программу, положите оба файла в одну папку и запустите

Вы должны увидеть, как загрузка двух процессоров (если их, конечно, у вас — 2 😉 ) поднимется до 100%. А вот и вывод скрипта на экран:

Источник

Twisted

Twisted — это сетевой фреймворк, написанный на Python. Он поддерживает множество протоколов, имеет модули для создания web-серверов, чат-клиентов и серверов, почтовых серверов, ssh-серверов и т. д. Twisted состоит из подпроектов, каждый из которых развивается относительно самостоятельно. Здесь можно найти их список. Twisted лицензирован под MIT Free Software licence.

Особенности сборки Twisted в Сизифе [ править ]

Twisted разбит на модули-составляющие и два псевдопакета.

  • python-module-twisted-core-doc — Documentation for Twisted Core
  • python-module-twisted-core-test — Unit tests for Twisted Core
  • python-module-twisted-lore — Twisted documentation system
  • python-module-twisted-mail — A Twisted Mail library, server and client
  • python-module-twisted-names — A Twisted DNS implementation
  • python-module-twisted-news — Twisted News is an NNTP server and programming library
  • python-module-twisted-runner — Twisted Runner process management library and inetd replacement
  • python-module-twisted-web2 — Twisted HTTP/1.1 Server Framework, programmable in Python
  • python-module-twisted-words — Twisted Words contains Instant Messaging implementations
  • python-module-twisted-core — An asynchronous networking framework written in Python
  • python-module-twisted-conch — Twisted SSHv2 implementation
  • python-module-twisted-web — Twisted web server, programmable in Python

Структура модулей в точности повторяет структуру подпроектов Twisted, за исключением проекта TwistedСore, который разбит на три части:

  • python-module-twisted-core-doc
  • python-module-twisted-core-test
  • python-module-twisted-core

Разработчики Twisted включают в свой фреймворк и GUI-утилиты, что создаёт некоторые неудобства: владельцы серверов, устанавливающие twisted ругаются на то, что он вытягивает за собой GUI-библиотеки и прочий ненужный на сервере софт. Неплохо бы выделить эти утилиты в отдельный под-проект, или научить наш rpm «мягким» зависимостям, но это задача для светлого будущего, а пока — от всех пакетов, включающих GUI-утилиты и как следствие тянущих за собой по зависимостям GUI-библиотеки, эти зависимости отключены. Два вышеупомянутых псевдопакета предназначены для варьирования типов установки twisted.

  • python-module-twisted-mini установит Twisted без зависимостей для работы с GUI.
  • python-module-twisted — это полная установка.

Итак, у вас три варианта: установить отдельные пакеты twisted, установить python-module-twisted-mini и получить «серверный» набор или «десктопный» вариант python-module-twisted.

Источник

Twisted web python kali linux

Kali Linux fully switched to Python 3. This means that any tool packaged by Kali that was using Python 2 has been either dropped or converted to use Python 3. Any tool converted to Python 3 contains only scripts with /usr/bin/python3 as their shebang.

Concerning the packages that come straight from Debian, they did the same on most packages, but there are a few exceptions where packages are allowed to continue to rely on Python 2. However those packages have been updated so that all their scripts use /usr/bin/python2 as their shebang and so that they depend on the python2 binary package (instead of the former python ).

Thanks to those changes, Debian no longer need to provide /usr/bin/python and recent upgrades will effectively get rid of that symlink.

Unfortunately, when you download a Python script on the web, it will likely have /usr/bin/python as its shebang. If you try to execute it without fixing the shebang line, you will end up with an error like this one:

In Debian, you can reinstate the /usr/bin/python symlink by installing:

  • python-is-python2 if you want to have it point to python2
  • python-is-python3 if you want to have it point to python3
Читайте также:  Не отображаются значки linux

Keeping backwards compatibility in Kali

Given the large number of users that would not know how to avoid the above error, we decided that Kali would continue to ship Python 2 by default (as long as Debian still provides it) and that /usr/bin/python would point to it. We are also keeping a few common external modules (like requests ) so that random exploit scripts have a reasonable chance to run successfully.

Howewer, pip for Python2 (aka python-pip) is gone, /usr/bin/pip is the same as /usr/bin/pip3 and it will install modules for Python 3. See the FAQ below for more information.

This compatibility has been implemented by having kali-linux-headless recommend python2 , python-is-python2 and offsec-awae-python2 so that they are installed by default while being removable by users that would like to get rid of them.

To make users aware of this situation, we are displaying a promiment message on login:

The hope is that they will read this article and know how do deal with the various issues that they will encounter.

Frequently Asked Questions

I have downloaded a Python script, what should I do?

You need to inspect its shebang line. The shebang line is the first line of a script and it starts with #! followed by the path of the interpreter that will be used to execute the script.

If the interpreter is /usr/bin/python , you should read the documentation to see whether the script can run with Python 3. If yes, then you should update the shebang line to point to /usr/bin/python3 . Otherwise you should update it to point to /usr/bin/python2 .

Good shebang lines that can be kept:

  • #!/usr/bin/python3
  • #!/usr/bin/python2
  • #!/usr/bin/env python3
  • #!/usr/bin/env python2

Bad shebang lines that need to be updated:

How can I get rid of the login message?

The message will only be displayed as long as /usr/bin/python points to the deprecated Python 2. Now that you know about this situation and that you know how to fix the shebang line of old scripts, you can safely get rid of /usr/bin/python :

Or you can decide to make it point to Python 3:

Either of those actions will get rid of the login message.

Alternatively, if you want to keep /usr/bin/python pointing to python2 and you still want to disable the message, you can do this:

I have a Python 2 script that doesn’t run, what should I do?

If your Python 2 script uses modules that are not among those that we ship in the offsec-awae-python2 compatibility package (see list here), then you can try pyenv to setup a fully isolated Python 2 environment where you can use pip to install supplementary modules. See our Using EoL Python versions on Kali article.

I want pip for Python 2, how can I get it back?

I wrote a Python script, what should I do?

Be nice with end users:

  • document clearly whether your code runs with Python 3 or Python 2
  • use /usr/bin/python3 or /usr/bin/python2 as the shebang line, it’s more expressive than /usr/bin/python and is more likely to have the desired result
  • update it for Python 3 compatibility if that’s not the case yet

Updated on: 2021-Sep-27
Author: rhertzog

Источник

Оцените статью