Hmm, why don't you incorporate it with fake GTS server?
It was researched long ago, here's on of implementations ...but it's on PHP with comments in Russian, so it's only as good as a reference.
Also to avoid updating the scripts each time something new gets released, you can use veekun's...