ISCC——AI

得到一个T4.pyc

回编译一下

得到下面代码

python 复制代码
import base64

def encrypt_and_compare(user_input, offset_str, target_base64):
    if len(user_input) != 24:
        return 'Please enter a string with a length of 24'
    encrypted = None
    for i, char in enumerate(user_input):
        offset = int(offset_str[i])
        ascii_val = ord(char)
        if i % 2 == 0:
            new_ascii = ascii_val + offset
        else:
            new_ascii = ascii_val - offset
        encrypted_char = chr(new_ascii ^ offset)
        encrypted.append(encrypted_char)
    encrypted_bytes = ''.join(encrypted).encode('utf-8')
    encrypted_base64 = base64.b64encode(encrypted_bytes).decode('utf-8')
    print('Encrypted result:{}'.format(encrypted_base64))
    if encrypted_base64 == target_base64:
        return 'Find key'
    return None

offset_str = '123456789012345678901234'
target_base64 = 'TWF/c1sse19GMW5gYVRoWWFrZ3lhd0B9'
user_input = input('Please enter a string with a length of 24:')
result = encrypt_and_compare(user_input, offset_str, target_base64)
print(result)

很简单逻辑,你解密出来就是第一段密码(这个我不想再写了,相信各位都会,不会私信我,嘿嘿)

第一段密码拿去解压缩出来

就有这些东西

这是一个处理png文件的模型

我让AI修改一下(我肯定是不会的)

python 复制代码
import torch
from torch import nn
from torchvision import transforms
from PIL import Image
import os


# 定义网络结构
class Net(nn.Module):
    def __init__(self):
        super(Net, self).__init__()
        self.fc1 = nn.Linear(28 * 28, 128)
        self.fc2 = nn.Linear(128, 64)
        self.fc3 = nn.Linear(64, 10)

    def forward(self, x):
        x = x.view(-1, 28 * 28)
        x = torch.relu(self.fc1(x))
        x = torch.relu(self.fc2(x))
        x = self.fc3(x)
        return x


# 直接加载整个模型实例
model_instance = torch.load('D:/CTF/problem/iscc/AI/AI-23/confused_digit_recognition_model.pt', map_location='cpu')

# 确保模型处于评估模式
model_instance.eval()

# 定义图像预处理变换
transform = transforms.Compose([
    transforms.Grayscale(num_output_channels=1),
    transforms.Resize((28, 28)),
    transforms.ToTensor(),
    transforms.Normalize((0.5,), (0.5,))
])

# 图像文件所在目录
image_folder = "D:\\CTF\\problem\\iscc\\AI\\AI-23\\"

# 遍历编号从1到24的图像文件并进行预测
for i in range(1, 25):
    # 构建完整的图像路径
    image_path = os.path.join(image_folder, f"{i}.png")

    try:
        # 加载并预处理图像
        image = Image.open(image_path)
        image = transform(image)
        image = image.unsqueeze(0)

        # 模型预测
        with torch.no_grad():
            outputs = model_instance(image)
            _, predicted = torch.max(outputs.data, 1)

        # 打印预测结果
        print( predicted.item(),end='')
    except IOError as e:
        print(f"Error opening {image_path}: {e}")
    except Exception as e:
        print(f"An error occurred during prediction for {image_path}: {e}")

得到第二段密码

这就是对照表的内容啦

然后写个脚本就OK

python 复制代码
def toint(a):
    b=ord(a)-ord('0')
    return b
a='384362683985682257091427'
for i in range(24):
    enc=toint(a[i])
    if(enc==0):
        print('@nd',end='')
    elif(enc==1):
        print('a!',end='')
    elif (enc == 2):
        print('_',end='')
    elif (enc == 3):
        print('F',end='')
    elif (enc == 4):
        print('SSS',end='')
    elif (enc == 5):
        print('W@',end='')
    elif (enc == 6):
        print('K',end='')
    elif (enc == 7):
        print('1',end='')
    elif (enc == 8):
        print('C',end='')
    elif (enc == 9):
        print('d',end='')
相关推荐
SwBack25 分钟前
【综合应急】单机取证
sqlserver·ctf·应急响应·密码破解·单机取证·solar应急响应
JM丫1 小时前
buuctf-ciscn_2019_c_1
网络安全·ctf
重生之我在番茄自学网安拯救世界2 小时前
网络安全中级阶段学习笔记(一):DVWA靶场安装配置教程与网络空间搜索语法
笔记·学习·网络安全·靶场·dvwa·fofa·google hack
Whoami!2 小时前
❼⁄₅ ⟦ OSCP ⬖ 研记 ⟧ 查找漏洞的公共利用 ➱ 实操案例(下)
网络安全·信息安全·漏洞利用
小菜今天没吃饱4 小时前
DVWA-XSS(stored)
前端·网络安全·xss·dvwa
Bruce_Liuxiaowei5 小时前
[特殊字符] 安全日志分析的关键技术与知识体系
安全·网络安全
百度安全5 小时前
企业人员安全意识解决方案 帮助企业构建可持续的安全意识培养生态
安全·网络安全·安全威胁分析
北京耐用通信5 小时前
协议转换新标杆!耐达讯自动化Ethernet IP转CC-Link方案,让编码器‘说话‘更高效“
人工智能·物联网·网络协议·网络安全·自动化·信息与通信
汤愈韬5 小时前
知识点1:防火墙是如何方式IP欺骗的
网络协议·网络安全·security·huawei
重生之我在番茄自学网安拯救世界5 小时前
网络安全中级阶段学习笔记(一):弱口令与暴力破解核心知识点梳理
网络安全·暴力破解·弱口令