当前位置: 欣欣网 > 码农

python黑客装逼神器!

2024-01-27码农

大家好!给你们带来了几个实用黑客特效实例,可以在朋友面前展示一下自己。

基础实例:

import osfor root, dirs, files in os.walk('/'):for directory indirs:print(os.path.join(root, directory))

2.0:

import osfrom colorama import init, Fore, Back, style# 初始化 colorama 模块init()for root, dirs, files in os.walk('/'):for directory in dirs:print(Fore.GREEN + os.path.join(root, directory))

3.0:

import osimport randomimport timefrom colorama import init, Fore, Back, style# 初始化 colorama 模块init()defprint_hacker_ style(text):for char in text:if char == " ": print(char, end='', flush=True) time.sleep(0.01)else: print(Fore.GREEN + str(random.randint(0, 1)), end='', flush=True) time.sleep(0.01) print( style.RESET_ALL)for root, dirs, files in os.walk('/'):for directory in dirs: path = os.path.join(root, directory) print_hacker_ style(path)

黑客帝国效果:

import osimport randomimport timeimport shutilfrom colorama import init, Fore# 初始化 colorama 模块init()# 获取终端窗口的大小defget_terminal_size(): columns, rows = shutil.get_terminal_size()return rows, columns# 清屏并定位光标位置defreset_screen_position(rows, columns): print('\033[{};{}H'.format(rows, 1), end='', flush=True)# 清屏defclear_screen():if os.name == 'nt': os.system('cls')else: os.system('clear')# 输出随机字符defprint_random_char(): chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '*', '#', '^', '&', '%'] colors = [Fore.GREEN, Fore.WHITE, Fore.CYAN, Fore.LIGHTGREEN_EX] random_char = random.choice(chars) random_color = random.choice(colors) print(random_color + random_char, end='', flush=True)# 主程序defrun_program(): clear_screen()whileTrue: rows, columns = get_terminal_size() reset_screen_position(rows, columns)for i in range(rows * columns): print_random_char() time.sleep(0.1)run_program()

装逼神器:

import timefrom colorama import init, Fore, stylefrom faker import Fakerinit() # 初始化 coloramadefprint_effect(text):for char in text: print(Fore.GREEN + char, end="", flush=True) time.sleep(0.05) print( style.RESET_ALL) # 恢复终端颜色# 创建 faker 对象fake = Faker()# 生成和打印随机信息whileTrue:# 随机生成信息 name = fake.name() address = fake.address() phone_number = fake.phone_number()# 将信息合并成一个字符串,并在开头和结尾使用 "-" 进行框起来 info = f"姓名: {name}\n 地址: {address}\n 电话: {phone_number} "# 使用特效打印信息 print_effect(info)# 使用 "$$" 进行分隔 print(Fore.YELLOW + "$$" + style.RESET_ALL)