进入网站看见算法题目发现黏贴被禁用
import requests, json, time, random, re
BASE = "http://160.202.254.160:13177"
c4 = '''your python code
'''
s = requests.Session()
r = s.get(BASE + "/")
m = re.search(r'id="csrfToken" value="([^"]+)"', r.text)
csrf = m.group(1)
payload = {"code": c4, "lang": "python3", "keystroke_log": [], "csrf_token": csrf}
r = s.post(BASE + "/submit", json=payload ,verify=False)
d = r.json()
print(json.dumps(d, ensure_ascii=False, indent=2))
可以使用代码发送请求
或者改前端js代码(有点麻烦)
n = int(input())
dp = [0] * (n + 1)
dp[0] = 1
for coin in range(1, n):
for s in range(coin, n + 1):
dp[s] += dp[s - coin]
print(dp[n]) 这个是这道算法题目标准解法,但是会被检测AI率 100.0% ≥ 5%
尝试修改dp初始化,两行代码合并成一行
n = int(input())
dp = [1] + [0] * n
for coin in range(1, n):
for s in range(coin, n + 1):
dp[s] += dp[s - coin]
print(dp[n]) 发现AI率 80.0% ≥ 5%
再尝试更改dp这样的标准变量名改成d_p
n = int(input())
d_p = [1] + [0] * n
for coin in range(1, n):
for s in range(coin, n + 1):
d_p[s] += d_p[s - coin]
print(d_p[n])ch尝试这段代码发现通过,最终poc:
import requests, json, time, random, re
BASE = "http://160.202.254.160:13177"
c4 = '''n = int(input())
d_p = [1] + [0] * n
for coin in range(1, n):
for s in range(coin, n + 1):
d_p[s] += d_p[s - coin]
print(d_p[n])
'''
s = requests.Session()
r = s.get(BASE + "/")
m = re.search(r'id="csrfToken" value="([^"]+)"', r.text)
csrf = m.group(1)
payload = {"code": c4, "lang": "python3", "keystroke_log": [], "csrf_token": csrf}
r = s.post(BASE + "/submit", json=payload ,verify=False)
d = r.json()
print(json.dumps(d, ensure_ascii=False, indent=2))
注意url地址改成自己的
ps:其实两个反检测方法都是一遍一遍试出来的,不是一遍就成功的