- Learning Python for Forensics
- Preston Miller Chapin Bryce
- 194字
- 2021-08-20 10:17:06
Python packages
A Python package is a directory containing Python modules and a __init__.py file. When we import a package, the __init__.py code is executed. This file contains the imports and code that's required to run other modules in the package. These packages can be nested within subdirectories. For example, the __init__.py file can contain import statements that bring in each Python file in the directory and all of the available classes or functions when the folder is imported. The following is an example directory structure and below that is the __init__.py file, which shows us how the two interact when imported. The last line in the following code block imports all specified items in the subdirectory's __init__.py file.
The hypothetical folder structure is as follows:
| -- packageName/
| -- __init__.py
| -- script1.py
| -- script2.py
| -- subDirectory/
| -- __init__.py
| -- script3.py
| -- script4.py
The top-level __init__.py file's contents is as follows:
from script1 import *
from script2 import function_name
from subDirectory import *
The code mentioned below executes the __init__ script we mentioned previously, and it will import all functions from script1.py, only function_name from script2.py, and any additional specifications from subDirectory/__init__.py:
import packageName
- unidbg逆向工程:原理與實踐
- SASE原理、架構與實踐
- 黑客攻防入門秘笈
- Python Penetration Testing Cookbook
- 云原生安全技術實踐指南
- Digital Forensics with Kali Linux
- 信息安全案例教程:技術與應用(第2版)
- 從實踐中學習Kali Linux滲透測試
- 物聯網安全滲透測試技術
- 數據安全與流通:技術、架構與實踐
- CTF特訓營:技術詳解、解題方法與競賽技巧
- Cybersecurity Threats,Malware Trends,and Strategies
- 網絡空間安全實戰基礎
- 2023—2024年中國網絡安全發展藍皮書
- 網絡空間安全實踐能力分級培養(I)