hackthis攻略(Coding Level)

博客提到Coding Level 1要求在5秒内完成排序,需编写程序实现,可使用Python编写脚本来解决该排序问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Coding Level 1

这里写图片描述
要我们排个序,限时5秒,所以我们得写个程序来实现
用python写个脚本就好了

import requests, re

# 创建session对象
r = requests.session()
postdata = {'username': '****',
            'password': '****'}
# 我使用了代理,这个可以看情况要不要
proxy = {'https': '127.0.0.1:1080'}
# 登录
r.post('https://www.hackthis.co.uk/?login', data=postdata, proxies=proxy)
# 获取coding第一关的页面内容
resp = r.get('https://www.hackthis.co.uk/levels/coding/1', proxies=proxy)
# 正则取需要排序的单词
wordlist = re.findall('<textarea>(.*?)</textarea>', resp.text)[0].split(',')
# 排序
wordlist.sort()
# 转为字符串
wordlist = str(wordlist).replace('[', '').replace(']', '').replace("'", '')
# 提交
postdata = {'answer': wordlist}
r.post('https://www.hackthis.co.uk/levels/coding/1', data=postdata, proxies=proxy)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值