Что делать если нужно поставить какую-то Python-библиотеку а root-прав нет? То есть в систему библиотеку никак и ничего не поставить.
Есть как минимум два способа это решить правильно!
🔸 Сделать виртуальное окружение и ставить там что угодно.
Это позволит создать полностью независимое исполняемое окружение для ваших приложений.
Все библиотеки будут храниться в домашней директории юзера а значит доступ на запись имеется.
Создать очень просто:
python3 -m venv ~/venvs/myenvname
Теперь активируем окружение
# Linux
source ~/venvs/myenvname/bin/activate
# Windows
%userprofile%\venvs\myenvname\Scripts\activate.bat
Можно ставить любые библиотеки и запускать приложение.
Это стандартный метод работы с любым проектом. Если еще не используете его, то пора начинать. Даже при наличии root доступа!
🔸 Бывает, что нет возможности запустить приложение из своего виртуального окружения. Например, его запускает какой-то сервис от вашего юзера и вставить активацию окружения вы не можете.
В этом случае можно установить библиотеки для Python не глобально в систему, а только для юзера.
Выполните этот код в консоли:
python3 -m site
Вы получите что-то такое:
sys.path = [
'/home/user',
'/usr/lib/python37.zip',
'/usr/lib/python3.7',
'/usr/lib/python3.7/lib-dynload',
'/home/user/.local/lib/python3.7/site-packages',
...
]
USER_BASE: '/home/user/.local'
USER_SITE: '/home/user/.local/lib/python3.7/site-packages'
ENABLE_USER_SITE: True
Нас интересует параметр USER_SITE. Это путь к пользовательским библиотекам, которые доступны по умолчанию, если они есть.
Именно сюда будут устанавливаться модули если добавить флаг --user при установке чего-либо через pip
pip install --user requests
Для этой команды не нужны root-права.
После неё можно запускать системный интерпретатор без виртуальных окружений и установленная библиотека будет доступна для текущего юзера.
Параметр USER_BASE показывает корневую директорию для хранения user-библиотек. Её можно изменить с помощью переменной окружения PYTHONUSERBASE
export PYTHONUSERBASE=~/pylibs
python3 -m site
...
USER_BASE: '/home/user/pylibs'
USER_SITE: '/home/user/pylibs/lib/python3.7/site-packages'
Получается некоторое подобие виртуального окружения для бедных 😁 которое можно менять через эту переменную (не делайте так!Лучше venv!)
🔸 Дописывание пути в PYTHONPATH
Этот способ не входит в список "двух правильных", но тоже рабочий. Здесь придётся сделать всё несколько сложней.
Сначала ставим библиотеку в любое место указывая путь установки
pip3 install -t ~/mylibs modulename
Библиотека установится без привязки к какому-либо интерпретатору. То есть по умолчанию не будет видна. Теперь в нужный момент добавляем этот путь в sys.path или в PYTHONPATH.
Не буду советовать так делать. Единственный раз когда этот способ мне пригодился и решил поставленную задачу, это при создании общей библиотеки для кластера компьютеров.
Модули лежат в сети и подгружаются для всех из одного и того же места. То есть обновлять файлы требуется только один раз а не на всех хосты отдельно.
Минусы такого подхода:
▫️Нужно всем хостам пробить нужный путь в .bashrc или ещё куда-то чтобы он сетапился на старте.
▫️Чем больше хостов тем больше нагрузка на сеть. Иногда такой способ не подходит именно по этой причине. Тогда Ansible вам в помощь.
▫️Не очень подходит если хосты с разными операционками. Некоторые библиотеки различаются для Linux и Windows (там, где есть бинарники) и приходится мудрить более сложные схемы.
#tricks#basic
WPair
app for testing #Bluetooth#WhisperPair#vulnerability in Google's Fast Pair protocol (CVE-2025-36911)
https://github.com/zalexdev/wpair-app
Hijacking Bluetooth Accessories Using Google Fast Pair. You can check if your device is vulnerable
https://whisperpair.eu
#bt
#Bluetooth#vulnerability allows unauthorized user to record & play audio on Bluetooth speaker via #BlueSpy
Prevention section explains how you can check if your Bluetooth LE speakers/headsets are vulnerable to this attack using nRF Connect app
https://www.mobile-hacker.com/2024/03/22/bluetooth-vulnerability-allows-unauthorized-user-to-record-and-play-audio-on-bluetooth-speakers/
#BlueDucky automates exploitation of Bluetooth pairing vulnerability that leads to 0-click code execution
▪️automatically scans for devices
▪️store MAC addresses of devices that are no longer visible but have enabled Bluetooth
▪️uses Rubber Ducky payloads
https://www.mobile-hacker.com/2024/03/26/blueducky-automates-exploitation-of-bluetooth-pairing-vulnerability-that-leads-to-0-click-code-execution/
Demonstration of using BlueDucky to exploit 0-click Bluetooth vulnerability of unpatched Android smartphone (CVE-2023-45866)
Exploit was triggered by Raspberry Pi 4 and then by Android running NetHunter
https://youtu.be/GOGW7U1f2RA
@androidMalware
https://securityonline.info/telegram-critical-zero-click-vulnerability-zdi-can-30207/
its real apparently, just thankfully not in the wild https://www.zerodayinitiative.com/advisories/upcoming/
In the search result of "ZDI-CAN-30207":
https://old.reddit.com/r/Android/comments/1s5xyi1/critical_alert_telegram_vulnerability_zdican30207/
https://news.ycombinator.com/item?id=47546545
#telegram#tg#0click#exploit#vulnerability
#python#security#security_tools#vulnerability#vulnerability_databases#vulnerability_management#vulnerability_scanners
OSV is a free, open-source database and toolset that helps you find and manage security vulnerabilities in open source software you use. It collects vulnerability data from many sources, including official advisories and automated scans, and presents it in a clear, machine-readable format. You can use the OSV scanner tool to automatically check your software dependencies for known security issues, helping you fix them quickly. This improves your software’s security by focusing on real risks and making vulnerability management easier and more efficient. OSV also offers APIs and integrates with other tools for automation and alerts.
https://github.com/google/osv.dev
🚀 Android SDK Vulnerability Poses Risk to Crypto Wallet Apps
A vulnerability in an Android Software Development Kit (SDK) could potentially expose sensitive data from crypto wallet applications, according to Microsoft Defender researchers. The flaw, which affects apps downloaded over 30 million times, may lead to the leakage of personally identifiable information, user credentials, and financial data. According to NS3.AI, there have been no reported instances of attackers exploiting this vulnerability so far.
#AndroidSDK#vulnerability#cryptowallet#MicrosoftDefender#NS3AI#dataleak#personallyidentifiableinformation#usercredentials#financialdata#cybersecurity
🚀 AI TRENDS | Wall Street Banks Test Anthropic's Mythos Model for Vulnerability Detection
Wall Street banks have begun internal testing of Anthropic's Mythos model, as reported by Bloomberg on X. The initiative comes amid encouragement from U.S. President Donald Trump's administration officials, who are advocating for its use in identifying potential vulnerabilities. The Mythos model, developed by Anthropic, is designed to enhance security measures within financial institutions by leveraging advanced AI capabilities. This move reflects a growing trend among major banks to integrate cutting-edge technology to bolster their defenses against emerging threats.
#AI#trends#WallStreet#banks#Anthropic#Mythos#model#vulnerability#detection#security#financialinstitutions#AItechnology#emergingthreats
#python#bounty#bugbounty#bypass#cheatsheet#enumeration#hacking#hacktoberfest#methodology#payload#payloads#penetration_testing#pentest#privilege_escalation#redteam#security#vulnerability#web_application
Payloads All The Things is a comprehensive collection of useful payloads and bypass techniques for web application security testing and penetration testing. It offers detailed documentation for each vulnerability, including how to exploit it and ready-to-use payloads, plus files for tools like Burp Intruder. You can contribute your own payloads or improvements, making it a collaborative resource. It also links to related projects for internal network and hardware pentesting, and provides learning resources like books and videos. Using this resource helps you efficiently find and test security weaknesses in web applications, improving your pentesting effectiveness and knowledge.
https://github.com/swisskyrepo/PayloadsAllTheThings