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

TGINSIGHT SIMILAR POSTS

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

Изворен канал @pythonotes · Post #241 · 5 мај

Можно ли в Python создавать бинарные файлы? Конечно можно. Для этого в Python есть следующие инструменты: ▫️ тип данных bytes и bytearray ▫️ открытие файла в режиме wb (write binary) или rb (read binary) ▫️ модуль struct Про модуль struct поговорим в первую очередь. Файл в формате JSON или Yaml внутри себя содержит разметку данных. Всегда можно определить где список начался а где закончился. Где записана строка а где словарь. То есть формат записи данных содержит в себе элементы разметки данных. В binary-файле данные не имеют визуальной разметки. Это просто байты, записанные один за другим. Правила записи и чтения находятся вне файла. Модуль struct как раз и помогает с организацией данных в таком файле с помощью определения форматов записи для разных частей файла. Модуль struct преобразует Python-объекты в массив байт, готовый к записи в файл и имеющий определённый вид. Для этого всегда следует указывать формат преобразования (или, как оно здесь называется - запаковки). Формат нужен для того, чтобы выделить достаточное количество байт для записи конкретного типа объекта. В последствии с помощью того же формата будет производиться чтение. При этом следует помнить что мы говорим о типах языка С а не Python. Именно формат определяет, что записано в конкретном месте файла, число, строка или что-то еще. Вот какие токены формата у нас есть. Помимо этого, первым символом можно указать порядок байтов. На разных системах одни и те же типы данных могут записываться по-разному, поэтому желательно указать конкретный способ из доступных. Если этого не сделать, то используется символ '@', то есть нативный для текущей системы. В строке формата мы пишем в каком порядке и какие типы собираемся преобразовать в байты. Запакуем в байты простое число, токен "i". >>> import struct >>> struct.pack('=i', 10) b'\n\x00\x00\x00' Теперь несколько float, при этом нужно передавать элементы не массивом а последовательностью аргументов. >>> struct.pack('=fff', 1.0, 2.5, 4.1) b'\x00\x00\x80?\x00\x00 @33\x83@' Вместо нескольких токенов можно просто указать нужное количество элементов перед одним токеном, результат будет тот же. >>> struct.pack('=3f', 1.0, 2.5, 4.1) b'\x00\x00\x80?\x00\x00 @33\x83@' Теперь запакуем разные типы >>> data = struct.pack('=fiQ', 1.0, 4, 100500) я запаковал типы float, int и unsigned long long (очень большой int, на 8 байт) b'\x00\x00\x80?\x04\x00\x00...' Распаковка происходит аналогично, но нужно указать тот же формат, который использовался при запаковке. Результат возвращается всегда в виде кортежа. >>> struct.unpack('=fiQ', data) (1.0, 4, 100500) Как видите, ничего страшного! #lib#basic

Hashtags

Резултати

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

Пребарај: #hacking

当前筛选 #hacking清除筛选
Repositorio data science

@repo_science · Post #4067 · 14.03.2024 г., 16:13

#Hacking 😱 Learn Wi-Fi Password Penetration Testing (WEP/WPA/WPA2) 46+ Videos to teach you how to hack and secure Wi-Fi (WEP, WPA, WPA2, WPA/WPA2 Enterprise) 🗣: Zaid Sabih, z Security ----- Main channel: @repo_science Coupons: @freecoupons_reposcience -----

Hashtags

Repositorio data science

@repo_science · Post #4016 · 07.02.2024 г., 14:36

#Hacking 🥷 Complete Ethical Hacking Bootcamp (2023) Learn Ethical Hacking + Penetration Testing! Use real techniques by black hat hackers then learn to defend against them! ----- Main channel: @repo_science Coupons: @freecoupons_reposcience -----

Hashtags

Repositorio data science

@repo_science · Post #3515 · 13.08.2023 г., 22:18

#hacking 🛠 Automobile Hacking and Security v2 0 Description Have you ever thought the car you drive can also be hacked and it’s also vulnerable to hackers ? Welcome to the second course on Automobile Hacking and Security version 2.0. In this course we will look at some advanced and interesting concepts and see how deep the rabbit hole goes. We will start this course with the overview of the first course so all things revised and clear. 🌐En 🔗Link ----- Main channel:@repo_science Coupons:@freecoupons_reposcience -----

Hashtags

Repositorio data science

@repo_science · Post #3476 · 26.07.2023 г., 16:29

#hacking 📊 Exclusive Hacker House Trainings Description: Hacker House Hands-On Hacking course is an intensive introductory course that teaches applied hacking methodologies in a hands-on practical orientated approach. Our course is engineered from decades of experienced cyber security practitioner’s knowledge to educate students on common cyber security tasks. Our course is delivered by expert hackers to prepare students on adversarial thinking and equip them for tasks conducted in a number of different cyber security roles. 🌐En 🔗Link ----- Main channel:@repo_science Coupons:@freecoupons_reposcience -----

Hashtags

djangoproject

@djangoproject · Post #387 · 19.07.2017 г., 20:28

https://www.youtube.com/watch?v=3bZNhMcv4Y8 #Hacking Cars with Python Modern cars are networks of computers, and a high end vehicle could have nearly 100 different computers inside. These devices control everything from the engine to the airbags. By understanding how these systems work, we can interface with vehicles to read data, perform diagnostics, and even modify operation.

Hashtags

Repositorio data science

@repo_science · Post #3501 · 07.08.2023 г., 20:51

#hacking#python 🐍 Python Hacking | Real Ethical Hacking with Python | PYCEH23+ Description: This immersive and comprehensive course is designed to equip you with the knowledge and hands-on skills necessary to excel in the exciting world of ethical hacking. With a focus on practical applications, this course covers everything you need to know about Python programming, making it accessible to both beginners and experienced programmers. You’ll embark on an exciting journey where you’ll learn how to harness the power of Python to manipulate MAC addresses, develop network scanners, execute Man-in-the-Middle attacks, intercept network traffic, create your own pentesting RAT (Remote Access Trojan) malware, and much more. 🌐En 🔗Link ----- Main channel:@repo_science Coupons:@freecoupons_reposcience -----

Repositorio data science

@repo_science · Post #3563 · 06.09.2023 г., 02:45

#hacking#Cybersecurity 🛠 Certified in Cybersecurity 2023 – ISC2-CC Complete Training Description About this courseThe CC training course is designed to provide you with a detailed understanding of information security management, risk management, and incident management. The course is divided into four domains, each of which is covered in-depth:The course is designed to help you develop the necessary skills to become a successful information security manager by providing you with practical knowledge and hands-on experience.Additional NotesCourse Requirements:No requirements Certification:Upon completion of the course, you will be eligible to sit for the CC certification exam. The exam is administered by ISC2 Enroll in the CC training course today and take the first step towards becoming a certified in cybersecurity! 🌐En ⚖️1.01 GB 🔗Link ----- Main channel:@repo_science Coupons:@freecoupons_reposcience -----

Repositorio data science

@repo_science · Post #3498 · 06.08.2023 г., 01:12

#hacking#Cybersecurity 📊 Cyber Security From Beginner to Expert Description: A beginner level comprehensive course that includes step-by-step explanations of core security concepts along with follow-up quizzes and hands on labs to ensure a solid learning for the course taker. 🌐En 🔗Link ----- Main channel:@repo_science Coupons:@freecoupons_reposcience -----

Repositorio data science

@repo_science · Post #3478 · 27.07.2023 г., 17:08

#hacking#Cybersecurity 📊 Complete Cybersecurity Bootcamp Description: The Cybersecurity Bootcamp that will take you from ZERO to HIRED as a Cyber Security Engineer. You'll learn the latest best practices, techniques, and tools used for network security so that you can build a fortress for digital assets and prevent black hat hackers from penetrating your systems. 🌐En 🔗Link ----- Main channel:@repo_science Coupons:@freecoupons_reposcience -----

ПретходнаСтраница 1 од 4Следна