实验吧-Ascii艺术

  • 今天又来逛了逛实验吧。
  • 找了道编程题玩玩。

  • 像这样, 第一时间考虑到用requests库配合正则表达式进行自动提交。

  • 然鹅…要哭了…

  • 这样的话,只能挨个对应了。

  • 有个大坑点… 这个是 9 而不是 4

  • 脚本附上(Python2): 新手脚本, 勿喷…
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# -*- coding: UTF-8 -*-
import requests
import re
url = 'http://ctf5.shiyanbar.com/ppc/acsii.php'
s = requests.session()

text = s.get(url).content

z = r'red">(.*)</div>'

str = re.search(z,text).group()

res = str.replace('red">','').replace('xxxxx<br />x&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;xxxx<br />&nbsp;&nbsp;&nbsp;&nbsp;x<br />xxxxx','5').replace('&nbsp;xx<br>&nbsp;&nbsp;x&nbsp;x&nbsp;&nbsp;<br>&nbsp;&nbsp;x&nbsp;&nbsp;<br>&nbsp;&nbsp;x&nbsp;&nbsp;<br>xxxxx','1').replace('&nbsp;x&nbsp;&nbsp;&nbsp;x<br />x&nbsp;&nbsp;&nbsp;&nbsp;x<br />&nbsp;xxxxx<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;x<br />&nbsp;&nbsp;&nbsp;&nbsp;x','9').replace('&nbsp;xxx&nbsp;<br />x&nbsp;&nbsp;&nbsp;x<br />&nbsp;&nbsp;xx&nbsp;<br />x&nbsp;&nbsp;&nbsp;x<br />&nbsp;xxx&nbsp;','8').replace('&nbsp;xxx&nbsp;<br />x&nbsp;&nbsp;&nbsp;x<br />x&nbsp;&nbsp;&nbsp;x<br />x&nbsp;&nbsp;&nbsp;x<br />&nbsp;xxx&nbsp;','0').replace('&nbsp;xxx&nbsp;<br />x&nbsp;&nbsp;&nbsp;x&nbsp;<br />&nbsp;&nbsp;xx&nbsp;<br />&nbsp;x&nbsp;&nbsp;&nbsp;<br />xxxxx','2').replace('<br />','').replace('<br/>','').replace('</div>','').replace('<br>','')
print res
data = {'inputNumber':res}
print s.post(url,data = data).content