_____ __ __ _______ _ _ ____ _ _ | __ \\ \ / /|__ __|| | | | / __ \ | \ | | | |__) |\ \_/ / | | | |__| || | | || \| | | ___/ \ / | | | __ || | | || . ` | | | | | | | | | | || |__| || |\ | |_| |_| |_| |_| |_| \____/ |_| \_|

Geek's Guide to Python

KERNEL_VERSION: 2.5 // UPLOADED
0x01: 基础语法 (Syntax)

变量与类型 (Variables)

# 动态类型,无需声明
agent_id = 007          # int
code_name = "Bond"      # str
is_active = True        # bool
price = 19.99           # float

print(f"Agent: {code_name}")

逻辑判断 (Control Flow)

if is_active and agent_id == 7:
    print("Access Granted")
elif agent_id == 0:
    print("Root User")
else:
    print("Access Denied")
0x02: 数据结构 (Data Structures)

列表 (List) - 有序序列

# 类似数组,但更灵活
tools = ["nmap", "wireshark"]

# 添加元素
tools.append("sqlmap")

# 遍历
for tool in tools:
    print(f"Loading {tool}...")

字典 (Dict) - 键值对

# 哈希表/JSON风格
server = {
    "ip": "192.168.1.1",
    "port": 8080,
    "os": "Linux"
}

print(server["ip"])
server["status"] = "Online"
0x03: 进阶逻辑 (Advanced Logic)

循环与范围 (Loop & Range)

# 循环5次 (0 到 4)
for i in range(5):
    print(i)

# While 循环
power = 10
while power > 0:
    power -= 1  # 自减

异常处理 (Try/Except)

try:
    # 尝试执行危险操作
    x = 1 / 0
except ZeroDivisionError:
    # 捕获错误
    print("Error: Infinity detected")
finally:
    print("Cleanup done.")
0x04: 函数与库 (Modules)
import random
import time

def generate_password(length=8):
    chars = "abcdef012345"
    return "".join(random.choice(chars) for _ in range(length))

# 调用函数
pwd = generate_password(12)
print(f"Generated Token: {pwd}")
python3 --interactive [CONNECTED]
Python 3.12.0 Geek Edition (v2.5)
Type "help", "copyright" or "credits" for more information.
Try "import this" for The Zen of Python.

>>>