Google Code Jam 2016 Round 1B Problem A in J language

You just made a new friend at an international puzzle conference, and you asked for a way to keep in touch. You found the following note slipped under your hotel room door the next day:

"Salutations, new friend! I have replaced every digit of my phone number with its spelled-out uppercase English representation ("ZERO", "ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE" for the digits 0 through 9, in that order), and then reordered all of those letters in some way to produce a string S. It's up to you to use S to figure out how many digits are in my phone number and what those digits are, but I will tell you that my phone number consists of those digits in nondecreasing order. Give me a call... if you can!"

Continue reading Google Code Jam 2016 Round 1B Problem A in J language

Network traffic over DNS

之前试着实现了一下黑暗幽灵(DCM)木马的数据传输方式,A rather marvelous means to send data anonymously via fake DNS query,于是就想着,DCM是通过DNS包附带信息,传给DNS服务器,然后在关键节点上抓包来实现的数据传输。那么这些数据也会到指定的DNS服务器上,假如我们自己实现这样的一个DNS服务器,那不就可以当作代理使用了?


服务端的构想如下,有一个进程监听UDP 53端口,客户端发送身份请求,服务端回应一串字符作为身份代码(后文作identification),然后就算是建立起了链接。这一步类似于cookie或者session的概念。

随后,客户端带着identification,再去请求各种服务。那么这些服务是怎么来的呢?服务端上,有不同的"应用"向监听在UDP 53端口的进程注册服务。这一点类似于node.js里express的想法。


Continue reading Network traffic over DNS