Skip to content

Instantly share code, notes, and snippets.

@YDKK

YDKK/reiwa.cs Secret

Created April 30, 2019 17:28
Show Gist options
  • Save YDKK/930500a0033053805c66bdf249ea00eb to your computer and use it in GitHub Desktop.
Save YDKK/930500a0033053805c66bdf249ea00eb to your computer and use it in GitHub Desktop.
using System;
using System.IO;
using System.Net.Sockets;
using System.Threading.Tasks;
using org.mariuszgromada.math.mxparser;
namespace reiwaCTF
{
class Program
{
static async Task Main(string[] args)
{
var client = new TcpClient();
client.Connect("zerois-o-reiwa.seccon.jp", 23615);
var stream = client.GetStream();
var sr = new StreamReader(stream);
var sw = new StreamWriter(stream);
while (true)
{
var input = sr.ReadLine(); Console.WriteLine(input);
input = sr.ReadLine(); Console.WriteLine(input);
var q = input.Replace("0=", "");
sr.Read(); sr.Read();
var ex = new Expression($"solve({q.Replace("?", "x")}, x, 0, 10000000)");
var result = ex.calculate();
Console.WriteLine(result);
sw.WriteLine(result);
sw.Flush();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment