TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #121 · 20 јул.

Регулярно требуется преобразовать какой-либо текст в максимально совместимый текст для URL, имени файла, имени объекта в каком-то софте и тд. Требования совместимости простые: в тексте должны быть только допустимые символы. Обычно это a-z, 0-9 и "_" или "-". То есть, только прописные буквы латинского алфавита и цифры (как пример). Допустим, нам нужно название статьи в блоге преобразовать в slug для добавления его в URL этой статьи. Как это лучше всего сделать? В Django по умолчанию есть готовая функция slugify для таких случаев. Но я её никогда не использую. Почему? Потому что её недостаточно! Приведём пример >>> from django.utils.text import slugify >>> slugify('This is a Title') 'this-is-a-title' Пока всё отлично >>> slugify('This is a "Title!"') 'this-is-a-title' Спец символы удалились, всё хорошо. >>> slugify('Это заголовок статьи') '' Вот и приехали 😢. Если текст не английский то буквы просто игнорируются. Можно это поправить >>> slugify('Это заголовок статьи', allow_unicode=True) 'это-заголовок-статьи' Но тогда мы не вписываемся в условие. У нас появилась кириллица в тексте. Так как я часто пишу сайты для русскоязычных пользователей эта проблема весьма актуальна. Я не использую стандартную функцию и всегда пишу свою. Оригинал я не беру в расчёт и пишу полностью свою функцию. И так, по порядку: 🔸1. Исходный текст: >>> text = 'Мой заголовок №10 😁!' Взял специально посложней со специальными символами. 🔸2. Транслит Необходимо сделать транслит всех символов в латиницу. Здесь очень выручает библиотека unidecode. Помимо простого транслита кириллицы в латиницу она умеет преобразовывать спец символы и иероглифы в текстовые аналоги. from unidecode import unidecode >>> unidecode("Ñ Σ ® µ ¶ ¼ 月 山") 'N S (r) u P 1/4 Yue Shan' Очень крутая библиотека, советую👍 В нашем случае получаем такое преобразование: >>> text = unidecode(text) >>> print(text) 'Moi zagolovok No. 10 !' Отличный транслит. Смайл просто удалился, хотя я ждал что-то вроде :). Ну и ладно, всë равно невалидные символы. А еще наш код уже поддерживает любой язык, будь то хинди или корейский. 🔸4. Фильтр символов Unidecode не занимается фильтрацией по недопустимым символам. Это мы делаем в следующем шаге через regex. Просто заменим все символы на "_" если они вне указанного диапазона. >>> text = re.sub(r'[^a-zA-Z0-9]+', '_', text) >>> print(text) 'Moi_zagolovok_No_10_' Символ "+" в паттерне выручает когда несколько недопустимых символов идут рядом. Все они заменяются на один символ "_". 🔸5. Slugify Осталось удалить лишние символы по краям и сделать нижний регистр >>> text = text.strip('_').lower() >>> print(text) 'moi_zagolovok_no_10' Получаем отличный slug! 😎 🌎 Полный код в виде функции. ______________ PS. Проверку что в строке остался хоть один допустимый символ я бы вынес в отдельную функцию. #libs#tricks#django

Резултати

Пронајдени 12 слични објави

Пребарај: #execute

当前筛选 #execute清除筛选
GitHub 红队武器库🚨

@githubredteam · Post #84135 · 13.05.2026 г., 23:03

🚨 GitHub 监控消息提醒 🚨发现关键词:#Shellcode#Execute 📦项目名称:malforge 👤项目作者:gpamarthy 🛠开发语言: Python ⭐Star数量: 1 | 🍴Fork数量: 0 📅更新时间: 2026-05-13 22:56:13 📝项目描述: Shellcode encryption and payload generator. AMSI/ETW bypass templates for red team and OSEP. 🔗点击访问项目地址

GitHub 红队武器库🚨

@githubredteam · Post #83558 · 09.05.2026 г., 20:03

🚨 GitHub 监控消息提醒 🚨发现关键词:#Shellcode#Execute 📦项目名称:ShellForge 👤项目作者:mr-srxl 🛠开发语言: Python ⭐Star数量: 0 | 🍴Fork数量: 0 📅更新时间: 2026-05-09 20:02:16 📝项目描述: Shellcode Encryption Tool 🔗点击访问项目地址

GitHub 红队武器库🚨

@githubredteam · Post #83483 · 09.05.2026 г., 08:03

🚨 GitHub 监控消息提醒 🚨发现关键词:#Shellcode#Execute 📦项目名称:Artemis 👤项目作者:0x3xp 🛠开发语言: C ⭐Star数量: 0 | 🍴Fork数量: 0 📅更新时间: 2026-05-09 07:59:31 📝项目描述: Artemis is a modular offensive security framework designed for stealthy system call generation and shellcode obfuscation. It features dynamic SSN discovery, multi-algorithm encryption engines, and support for both direct and indirect syscall invocation to bypass modern EDR/AV solutions 🔗点击访问项目地址

GitHub 红队武器库🚨

@githubredteam · Post #83266 · 07.05.2026 г., 22:03

🚨 GitHub 监控消息提醒 🚨发现关键词:#Shellcode#Execute 📦项目名称:dll_wrapper 👤项目作者:MythicAgents 🛠开发语言: Python ⭐Star数量: 0 | 🍴Fork数量: 0 📅更新时间: 2026-05-07 22:02:34 📝项目描述: Simple Native DLL Wrapper for Shellcode Payloads 🔗点击访问项目地址

GitHub 红队武器库🚨

@githubredteam · Post #83113 · 06.05.2026 г., 20:03

🚨 GitHub 监控消息提醒 🚨发现关键词:#Shellcode#Execute 📦项目名称:PEBcraft 👤项目作者:whoamiamleo 🛠开发语言: C++ ⭐Star数量: 4 | 🍴Fork数量: 0 📅更新时间: 2026-05-06 20:02:17 📝项目描述: A utility that transforms C source code into position-independent shellcode which resolves Windows APIs using the PEB (Process Environment Block). 🔗点击访问项目地址

GitHub 红队武器库🚨

@GithubRedTeam · Post #79511 · 09.04.2026 г., 02:03

🚨 GitHub 监控消息提醒 🚨发现关键词:#Shellcode#Execute 📦项目名称:Ada-Execute-PIC 👤项目作者:JohnRyk 🛠开发语言: C ⭐Star数量: 0 | 🍴Fork数量: 0 📅更新时间: 2026-04-09 01:59:53 📝项目描述: AdaptixC2 extension kit for inline execute PIC shellcode prove of concept 🔗点击访问项目地址

GitHub 红队武器库🚨

@GithubRedTeam · Post #78484 · 02.04.2026 г., 16:03

🚨 GitHub 监控消息提醒 🚨发现关键词:#Shellcode#Execute 📦项目名称:x96-combiner 👤项目作者:RTS-Framework 🛠开发语言: Go ⭐Star数量: 1 | 🍴Fork数量: 0 📅更新时间: 2026-04-02 15:58:43 📝项目描述: A tool for building multi-architecture (x86/x64) shellcode that can execute correctly on both platforms. 🔗点击访问项目地址

djangoproject

@djangoproject · Post #257 · 13.02.2017 г., 07:07

https://help.ubuntu.com/community/CronHowto #Cron is a system daemon used to #execute desired #tasks (in the background) at designated times. A crontab file is a simple text file containing a list of commands meant to be run at specified times. It is edited using the crontab command. The commands in the crontab file (and their run times) are checked by the cron daemon, which executes them in the system background.

GitHub 红队武器库🚨

@githubredteam · Post #83030 · 06.05.2026 г., 09:03

🚨 GitHub 监控消息提醒 🚨发现关键词:#Shellcode#Loader#Execute 📦项目名称:MsShellcodeDev 👤项目作者:SodaMtnDew 🛠开发语言: C++ ⭐Star数量: 1 | 🍴Fork数量: 0 📅更新时间: 2026-05-06 09:01:21 📝项目描述: The Solution to help Developing & Debugging as C & Deploying in Shellcode 🔗点击访问项目地址

GitHub 红队武器库🚨

@githubredteam · Post #84091 · 13.05.2026 г., 15:03

🚨 GitHub 监控消息提醒 🚨发现关键词:#Shellcode#Loader#Inject#Execute 📦项目名称:hades_gate 👤项目作者:ekomsSavior 🛠开发语言: None ⭐Star数量: 1 | 🍴Fork数量: 0 📅更新时间: 2026-05-13 14:53:53 📝项目描述: targeted extension of 0xXycs aka JakeSwiz shellcoding research 🔗点击访问项目地址

Business Lessons™

@business_idea4 · Post #4733 · 27.01.2026 г., 17:26

Here are 5 key takeaways from the book "STRATEGIZE TO WIN" - 1. #Know your strengths and weaknesses. This is the foundation of any successful strategy. Once you know what you're good at and what you're not so good at, you can start to build a strategy that plays to your strengths and minimizes your weaknesses. 2. #Set clear goals. What do you want to achieve? What are your long-term and short-term goals? Once you know what you want to achieve, you can start to develop a strategy to get there. 3. #Understand your competition. Who are your competitors? What are their strengths and weaknesses? What are their goals? Once you understand your competition, you can start to develop a strategy that will give you an edge. 4. #Be flexible. The world is constantly changing, so your strategy needs to be flexible enough to adapt to change. Be prepared to adjust your strategy as needed. 5. #Execute your strategy. This is the most important step of all. Once you have a strategy, you need to execute it. This means taking action and making sure that your strategy is working. Here are some additional key takeaways from the book: A. #Strategy is not a one-time event. It is an ongoing process that needs to be reviewed and updated regularly. B. #Strategy is not about perfection. It is about progress. You will never have a perfect strategy, but you can always improve your strategy by learning from your mistakes and by making adjustments as needed. C. #Strategy is about execution. It is not enough to have a good strategy. You also need to be able to execute your strategy effectively. I hope these key takeaways help you on your journey to strategizing to win. 💠Join 🔺 Share @Business_Idea4💠

MONEY SECRETS

@businessideas101 · Post #1247 · 14.06.2025 г., 06:23

Here are 5 key takeaways from the book "STRATEGIZE TO WIN" - 1. #Know your strengths and weaknesses. This is the foundation of any successful strategy. Once you know what you're good at and what you're not so good at, you can start to build a strategy that plays to your strengths and minimizes your weaknesses. 2. #Set clear goals. What do you want to achieve? What are your long-term and short-term goals? Once you know what you want to achieve, you can start to develop a strategy to get there. 3. #Understand your competition. Who are your competitors? What are their strengths and weaknesses? What are their goals? Once you understand your competition, you can start to develop a strategy that will give you an edge. 4. #Be flexible. The world is constantly changing, so your strategy needs to be flexible enough to adapt to change. Be prepared to adjust your strategy as needed. 5. #Execute your strategy. This is the most important step of all. Once you have a strategy, you need to execute it. This means taking action and making sure that your strategy is working. Here are some additional key takeaways from the book: A. #Strategy is not a one-time event. It is an ongoing process that needs to be reviewed and updated regularly. B. #Strategy is not about perfection. It is about progress. You will never have a perfect strategy, but you can always improve your strategy by learning from your mistakes and by making adjustments as needed. C. #Strategy is about execution. It is not enough to have a good strategy. You also need to be able to execute your strategy effectively. I hope these key takeaways help you on your journey to strategizing to win. Thank you for reading 📖