A numbers game
(code50, solved by 370)
Description: People either love or hate math. Do you love it? Prove it! You just need to solve a bunch of equations without a mistake.
Service: 188.166.133.53:11027
指定されたIPアドレス:ポートに接続すると、1次方程式の問題が次々に出題されますので、Rubyプログラムで自動的に解かせます。
require "socket"
begin
sock = TCPSocket.open("188.166.133.53", 11027)
rescue
puts "TCPSocket.open failed : #$!\n"
else
while sock.gets
ary = ""
buf = $_
printf( buf )
if buf.include?(".:") then
ary = buf.split(" ")
case ary[3]
when "*" then
ans = ary[6].to_i / ary[4].to_i
printf( ans.to_s )
sock.write(ans.to_s + "\n")
when "/" then
ans = ary[6].to_i * ary[4].to_i
printf( ans.to_s )
sock.write(ans.to_s + "\n")
when "+" then
ans = ary[6].to_i - ary[4].to_i
printf( ans.to_s )
sock.write(ans.to_s + "\n")
when "-" then
ans = ary[6].to_i + ary[4].to_i
printf( ans.to_s )
sock.write(ans.to_s + "\n")
end
STDOUT.flush
else
end
end
sock.close
end
実行すると、次のとおり100問正解でフラグが表示されました。
Hi, I heard that you're good in math. Prove it!
Level 1.: x * 9 = 81
9Yay, that's right!
(略)Level 100.: x * 48 = 41232
Yay, that's right!
859
IW{M4TH_1S_34SY}
フラグは、
IW{M4TH_1S_34SY}
です。









