BM-2cWy7cvHoq3f1rYMerRJp8PT653jjSuEdY
BM-2cWy7cvHoq3f1rYMerRJp8PT653jjSuEdY

Give a try on bitmessagecli.py
Jul 5 16:57 [raw]

I used to fetching bitmsg remotly by bitmessagecli.py. You must blame if you tried, as a new guy in python coding, I try my best to rewrite it allmost totally. Some one may need it, so send it to here for more tester. Attached:------- <!-- Note: File attachment below. Please use a base64 decoder, or Daemon, to save it. --> <!-- Sent using Bitmessage Daemon. https://github.com/Dokument/PyBitmessage-Daemon --> Filename:bitmessagecli.py Filesize:85KB Encoding:base64 <attachment alt="bitmessagecli.py" src="data:file/bitmessagecli.py;base64, IyEvdXNyL2Jpbi9weXRob24yLjcKIyAtKi0gY29kaW5nOiB1dGYtOCAtKi0KIyBweWxpbnQ6IGRp c2FibGU9dG9vLW1hbnktbGluZXMsZ2xvYmFsLXN0YXRlbWVudCx0b28tbWFueS1icmFuY2hlcyx0 b28tbWFueS1zdGF0ZW1lbnRzLGluY29uc2lzdGVudC1yZXR1cm4tc3RhdGVtZW50cwojIHB5bGlu dDogZGlzYWJsZT10b28tbWFueS1uZXN0ZWQtYmxvY2tzLHRvby1tYW55LWxvY2Fscyxwcm90ZWN0 ZWQtYWNjZXNzLHRvby1tYW55LWFyZ3VtZW50cyx0b28tbWFueS1mdW5jdGlvbi1hcmdzCiMgcHls aW50OiBkaXNhYmxlPW5vLW1lbWJlcgoiIiIKQ3JlYXRlZCBieSBBZGFtIE1lbHRvbiAoLmRvaykg cmVmZXJlbmNlaW5nIGh0dHBzOi8vYml0bWVzc2FnZS5vcmcvd2lraS9BUElfUmVmZXJlbmNlIGZv ciBBUEkgZG9jdW1lbnRhdGlvbgpEaXN0cmlidXRlZCB1bmRlciB0aGUgTUlUL1gxMSBzb2Z0d2Fy ZSBsaWNlbnNlLiBTZWUgaHR0cDovL3d3dy5vcGVuc291cmNlLm9yZy9saWNlbnNlcy9taXQtbGlj ZW5zZS5waHAuCgpUaGlzIGlzIGFuIGV4YW1wbGUgb2Y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cbicKICAgICAg ICByZXR1cm4gRmFsc2UKCiAgICAjIHNob3J0ZW4yCiAgICBmb3IgY21kIGluIGNtZFRibDoKICAg ICAgICBsY21kID0gY21kLmxvd2VyKCkKICAgICAgICBmb3Igd29yZHMgaW4gY21kV29yZHMyOgog ICAgICAgICAgICBsd29yZHMgPSB3b3Jkcy5sb3dlcigpCiAgICAgICAgICAgIGxjbWQgPSBsY21k LnJlcGxhY2UobHdvcmRzLCBsd29yZHNbMF0sIDEpCiAgICAgICAgaWYgbGNtZCBub3QgaW4gY21k U2hvcnRzW2NtZF06CiAgICAgICAgICAgIGlmIGxlbihsY21kKSA8IGxlbihjbWRTaG9ydHNbY21k XVsxXSk6CiAgICAgICAgICAgICAgICBjbWRTaG9ydHNbY21kXS5pbnNlcnQoMSwgbGNtZCkKICAg ICAgICAgICAgZWxzZToKICAgICAgICAgICAgICAgIGNtZFNob3J0c1tjbWRdLmFwcGVuZChsY21k KQogICAgICAgICAgICBvdXQuYXBwZW5kKGxjbWQpCgogICAgZGNtZHMgPSBkdXBsaWNhdGVkKG91 dCkKICAgIGlmIGFueShkY21kcyk6CiAgICAgICAgcHJpbnQgJ1xuICAgICBjbWRHdWVzcyBGYWls IScKICAgICAgICBwcmludCAnICAgICBkdXBsaWNhdGVkID0nLCBkY21kcwogICAgICAgIHByaW50 ICcgICAgIENoYW5nZSB5b3VyICJjbWRXb3JkczIiIHBsZWFzZS5cbicKICAgICAgICByZXR1cm4g RmFsc2UKCiAgICByZXR1cm4gVHJ1ZQoKCmRlZiBzaG93Q21kVGJsKCk6CgogICAgZ2xvYmFsIGNt ZFRibCwgY21kU2hvcnRzCgogICAgdXJsID0gJ2h0dHBzOi8vZ2l0aHViLmNvbS9Eb2t1bWVudC9Q eUJpdG1lc3NhZ2UtRGFlbW9uJwogICAgcHJpbnQgJyAnCiAgICBwcmludCAnJy5qb2luKFs1ICog JyAnLCA3MyAqICctJ10pCiAgICBwcmludCAnJy5qb2luKFs1ICogJyAnLCAnfCcsIHVybFs6aW50 KGxlbih1cmwpLzIpXS5yanVzdCgzNSksIHVybFtpbnQobGVuKHVybCkvMik6XS5sanVzdCgzNiks ICd8J10pCiAgICBwcmludCAnJy5qb2luKFs1ICogJyAnLCA3MyAqICctJ10pCiAgICBmb3IgY21k IGluIGNtZFRibDoKICAgICAgICBsY21kID0gKCcnIGlmIGxlbihjbWQpID4gMTggZWxzZSBjbWQg KyAnICcpICsgc3RyKGNtZFNob3J0c1tjbWRdWzE6XSkKICAgICAgICBpZiBsZW4obGNtZCkgPiAy MzoKICAgICAgICAgICAgbGNtZCA9IGxjbWRbOjIwXSArICcuLi4nCiAgICAgICAgZGVzID0gY21k VGJsW2NtZF0KICAgICAgICBpZiBsZW4oZGVzKSA+IDQ1OgogICAgICAgICAgICBkZXMgPSBkZXNb OjQyXSArICcuLi4nCiAgICAgICAgaWYgZGVzID09ICctJzogcHJpbnQgJycuam9pbihbNSAqICcg JywnfCcsIDI0ICogJy0nLCAnfCcsIDQ2ICogJy0nLCAnfCddKQogICAgICAgIGVsc2U6IHByaW50 ICcnLmpvaW4oWzUgKiAnICcsJ3wgJywgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsY21k LmxqdXN0KDIzKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICd8ICcsCiAgICAgICAgICAg ICAgICAgICAgICAgICAgICBkZXMubGp1c3QoNDUpLAogICAgICAgICAgICAgICAgICAgICAgICAg ICAgJ3wnXSkKICAgIHByaW50ICcnLmpvaW4oWzUgKiAnICcsIDczICogJy0nXSkKCgpkZWYgaW5w dXRBZGRyZXNzKHByb21wdD0nV2hhdCBpcyB0aGUgYWRkcmVzcz8nKToKCiAgICBnbG9iYWwgdXNy UHJvbXB0LCByZXRTdHJpbmdzCgogICAgcmV0cmVzID0gJzQnCiAgICBzcmMgPSByZXRTdHJpbmdz W3JldHJlc10KICAgIHdoaWxlIFRydWU6CiAgICAgICAgYWRkcmVzcyA9IHVzZXJJbnB1dChwcm9t cHQgKyAnXG5UcnkgYWdhaW4gb3InKQogICAgICAgIGlmIG5vdCB2YWxpZEFkZHJlc3MoYWRkcmVz cyk6CiAgICAgICAgICAgIHByaW50IHNyYwogICAgICAgICAgICBjb250aW51ZQoKICAgIHJldHVy biBhZGRyZXNzCgoKZGVmIGlucHV0SW5kZXgocHJvbXB0PSdJbnB1dCBhIGluZGV4OiAnLCBtYXhp bXVtPS0xLCBhbHRlcj1bXSk6CgogICAgZ2xvYmFsIHVzclByb21wdCwgcmV0U3RyaW5ncwoKICAg IHdoaWxlIFRydWU6CiAgICAgICAgY2lucHV0ID0gdXNlcklucHV0KHByb21wdCArICdcblRyeSBh Z2FpbiBvcicpLmxvd2VyKCkKICAgICAgICB0cnk6CiAgICAgICAgICAgIGlmIGNpbnB1dCA9PSAi YyI6CiAgICAgICAgICAgICAgICBjaW5wdXQgPSAnLTEnCiAgICAgICAgICAgICAgICBicmVhawog ICAgICAgICAgICBlbGlmIGNpbnB1dCBpbiBhbHRlcjoKICAgICAgICAgICAgICAgIGJyZWFrCiAg ICAgICAgICAgIGVsaWYgaW50KGNpbnB1dCkgPCAwIG9yIChtYXhpbXVtID49IDAgYW5kIGludChj aW5wdXQpID4gbWF4aW11bSk6CiAgICAgICAgICAgICAgICByZXRyZXMgPSAnMycKICAgICAgICAg ICAgICAgIHNyYyA9IHJldFN0cmluZ3NbcmV0cmVzXQogICAgICAgICAgICAgICAgcHJpbnQgc3Jj CiAgICAgICAgICAgIGVsc2U6CiAgICAgICAgICAgICAgICBicmVhawogICAgICAgIGV4Y2VwdDoK ICAgICAgICAgICAgcmV0cmVzID0gJzInCiAgICAgICAgICAgIHNyYyA9IHJldFN0cmluZ3NbcmV0 cmVzXQogICAgICAgICAgICBwcmludCBzcmMKCiAgICByZXR1cm4gY2lucHV0CgoKZGVmIHVzZXJJ bnB1dChtZXNzYWdlKToKICAgICIiIkNoZWNrcyBpbnB1dCBmb3IgZXhpdCBvciBxdWl0LiBBbHNv IGZvcm1hdHMgZm9yIGlucHV0LCBldGMiIiIKCiAgICBnbG9iYWwgdXNyUHJvbXB0LCBjbWRzdHIK CiAgICBzdGFjayA9IGxpc3QoaW5zcGVjdC5zdGFjaygpKQogICAgd2hlcmUgPSAnJwogICAgI2Zv ciBpdGVtIGluIHN0YWNrOgogICAgICAgICAgICAjcHJpbnQgaXRlbQogICAgd2hlcmUgPSAnJy5q b2luKFsKICAgICAgICBzdHIoc3RhY2tbM11bMl0pLAogICAgICAgIHN0YWNrWzNdWzNdLAogICAg ICAgIHN0cihzdGFja1syXVsyXSksCiAgICAgICAgc3RhY2tbMV1bM10sCiAgICAgICAgc3RyKHN0 YWNrWzFdWzJdKSwKICAgICAgICBzdGFja1szXVszXSwKICAgICAgICBjbWRzdHIKICAgICAgICBd KQogICAgbGFzdCA9ICcnIGlmIHdoZXJlIG5vdCBpbiBpbnB1dHMua2V5cygpIGVsc2UgaW5wdXRz W3doZXJlXQogICAgcHJpbnQgJycuam9pbihbCiMgICAgICAgICdcbicsCiMgICAgICAgIHdoZXJl LAogICAgICAgICdcbicsCiAgICAgICAgbWVzc2FnZSwKICAgICAgICAnIChleGl0KSB0byBjYW5j ZWwuJywKICAgICAgICAnXG5QcmVzcyBFbnRlciB0byBpbnB1dCBkZWZhdWx0IFsnLAogICAgICAg IGxhc3QsCiAgICAgICAgJ106ICcsCiAgICAgICAgXSkKICAgIHVJbnB1dCA9IHJhd19pbnB1dCgn PiAnKQoKICAgIGlmIHVJbnB1dC5sb3dlcigpID09ICdleGl0JzogICMgUmV0dXJucyB0aGUgdXNl ciB0byB0aGUgbWFpbiBtZW51CiAgICAgICAgdXNyUHJvbXB0ID0gMQogICAgICAgIG1haW4oKQog ICAgICAgIHJldHVybiAnJwoKICAgIGVsaWYgdUlucHV0ID09ICcnOiAgIyBSZXR1cm4gbGFzdCB2 YWx1ZS4KICAgICAgICByZXR1cm4gbGFzdAoKICAgIGVsc2U6CiAgICAgICAgaW5wdXRzW3doZXJl XSA9IHVJbnB1dAoKICAgIHJldHVybiB1SW5wdXQKCgpkZWYgcmVzdGFydEJtTm90aWZ5KCk6CiAg ICAiIiJQcm9tcHQgdGhlIHVzZXIgdG8gcmVzdGFydCBCaXRtZXNzYWdlIiIiCgogICAgcHJpbnQg JyAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqKicKICAgIHByaW50ICcgICAgIFdBUk5JTkc6IElmIEJpdG1lc3NhZ2Ug aXMgcnVubmluZyBsb2NhbGx5LCB5b3UgbXVzdCByZXN0YXJ0IGl0IG5vdy4nCiAgICBwcmludCAn ICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqXG4nCgoKIyBCZWdpbiBrZXlzLmRhdCBpbnRlcmFjdGlvbnMKCgpkZWYg bG9va3VwQXBwZGF0YUZvbGRlcigpOgogICAgIiIiZ2V0cyB0aGUgYXBwcm9wcmlhdGUgZm9sZGVy cyBmb3IgdGhlIC5kYXQgZmlsZXMgZGVwZW5kaW5nIG9uIHRoZSBPUy4gVGFrZW4gZnJvbSBiaXRt ZXNzYWdlbWFpbi5weSIiIgoKICAgIEFQUE5BTUUgPSAiUHlCaXRtZXNzYWdlIgogICAgaWYgc3lz LnBsYXRmb3JtID09ICdkYXJ3aW4nOgogICAgICAgIGlmICJIT01FIiBpbiBvcy5lbnZpcm9uOgog ICAgICAgICAgICBkYXRhRm9sZGVyID0gb3MucGF0aC5qb2luKG9zLmVudmlyb25bIkhPTUUiXSwg IkxpYnJhcnkvQXBwbGljYXRpb24gc3VwcG9ydC8iLCBBUFBOQU1FKSArICcvJwogICAgICAgIGVs c2U6CiAgICAgICAgICAgIHByaW50KAogICAgICAgICAgICAgICAgJyAgICAgQ291bGQgbm90IGZp bmQgaG9tZSBmb2xkZXIsIHBsZWFzZSByZXBvcnQgJwogICAgICAgICAgICAgICAgJ3RoaXMgbWVz c2FnZSBhbmQgeW91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lnZmlsZSkKCiAgICAg ICAgICAgIHByaW50ICdEb25lJwogICAgICAgICAgICByZXN0YXJ0Qm1Ob3RpZnkoKQogICAgICAg ICAgICByZXR1cm4gVHJ1ZQoKICAgICAgICBlbGlmIHVJbnB1dCA9PSAibiI6CiAgICAgICAgICAg IHByaW50ICcgICAgIFxuKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqKioqJwogICAgICAgICAgICBwcmludCAnICAgICAgICAgICAgRGFlbW9u IHdpbGwgbm90IHdvcmsgd2hlbiB0aGUgQVBJIGlzIGRpc2FibGVkLiAgICAgICAnCiAgICAgICAg ICAgIHByaW50ICcgICAgIFBsZWFzZSByZWZlciB0byB0aGUgQml0bWVzc2FnZSBXaWtpIG9uIGhv dyB0byBzZXR1cCB0aGUgQVBJLicKICAgICAgICAgICAgcHJpbnQgJyAgICAgKioqKioqKioqKioq KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqXG4nCiAgICAg ICAgICAgIHVzclByb21wdCA9IDEKICAgICAgICAgICAgbWFpbigpCgogICAgICAgIGVsc2U6CiAg ICAgICAgICAgIHByaW50ICdcbiAgICAgSW52YWxpZCBFbnRyeVxuJwogICAgICAgICAgICB1c3JQ cm9tcHQgPSAxCiAgICAgICAgICAgIG1haW4oKQoKICAgIGVsaWYgYXBpRW5hYmxlZDogICMgQVBJ IGNvcnJlY3RseSBzZXR1cAogICAgICAgICMgRXZlcnl0aGluZyBpcyBhcyBpdCBzaG91bGQgYmUK ICAgICAgICByZXR1cm4gVHJ1ZQoKICAgIGVsc2U6ICAjIEFQSSBpbmZvcm1hdGlvbiB3YXMgbm90 IHByZXNlbnQuCiAgICAgICAgcHJpbnQgJ1xuICAgICAnICsgc3RyKGtleXNQYXRoKSArICcgbm90 IHByb3Blcmx5IGNvbmZpZ3VyZWQhXG4nCiAgICAgICAgdUlucHV0ID0gdXNlcklucHV0KCdXb3Vs ZCB5b3UgbGlrZSB0byBkbyB0aGlzIG5vdywgKFkpZXMgb3IgKE4pbz8nKS5sb3dlcigpCgogICAg ICAgIGlmIHVJbnB1dCA9PSAieSI6ICAjIFVzZXIgc2FpZCB5ZXMsIGluaXRhbGl6ZSB0aGUgYXBp IGJ5IHdyaXRpbmcgdGhlc2UgdmFsdWVzIHRvIHRoZSBrZXlzLmRhdCBmaWxlCiAgICAgICAgICAg IHByaW50ICcgJwoKICAgICAgICAgICAgYXBpVXNyID0gdXNlcklucHV0KCJBUEkgVXNlcm5hbWUi KQogICAgICAgICAgICBhcGlQd2QgPSB1c2VySW5wdXQoIkFQSSBQYXNzd29yZCIpCiAgICAgICAg ICAgIGFwaVBvcnQgPSB1c2VySW5wdXQoIkFQSSBQb3J0IikKICAgICAgICAgICAgYXBpRW5hYmxl ZCA9IHVzZXJJbnB1dCgiQVBJIEVuYWJsZWQ/IChUcnVlKSBvciAoRmFsc2UpIikubG93ZXIoKQog ICAgICAgICAgICBkYWVtb24gPSB1c2VySW5wdXQoIkRhZW1vbiBtb2RlIEVuYWJsZWQ/IChUcnVl KSBvciAoRmFsc2UpIikubG93ZXIoKQoKICAgICAgICAgICAgaWYgKGRhZW1vbiAhPSAndHJ1ZScg YW5kIGRhZW1vbiAhPSAnZmFsc2UnKToKICAgICAgICAgICAgICAgIHByaW50ICdcbiAgICAgSW52 YWxpZCBFbnRyeSBmb3IgRGFlbW9uLlxuJwogICAgICAgICAgICAgICAgdUlucHV0ID0gMQogICAg ICAgICAgICAgICAgbWFpbigpCiAgICAgICAgICAgICAgICByZXR1cm4gJycKCiAgICAgICAgICAg IHByaW50ICcgICAgIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tXG4nCgogICAg ICAgICAgICAjIHNldHMgdGhlIGJpdG1lc3NhZ2UgcG9ydCB0byBzdG9wIHRoZSB3YXJuaW5nIGFi b3V0IHRoZSBhcGkgbm90IHByb3Blcmx5CiAgICAgICAgICAgICMgYmVpbmc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W5pc2hlZCBjb25maWd1cmluZyB0aGUga2V5cy5kYXQgZmlsZSB3aXRoIEFQSSBpbmZvcm1hdGlv bi5cbicKICAgICAgICAgICAgcmVzdGFydEJtTm90aWZ5KCkKICAgICAgICAgICAgcmV0dXJuIFRy dWUKCiAgICAgICAgZWxpZiB1SW5wdXQgPT0gIm4iOgogICAgICAgICAgICBwcmludCAnICAgICAq KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq KicKICAgICAgICAgICAgcHJpbnQgJyAgICAgUGxlYXNlIHJlZmVyIHRvIHRoZSBCaXRtZXNzYWdl IFdpa2kgb24gaG93IHRvIHNldHVwIHRoZSBBUEkuJwogICAgICAgICAgICBwcmludCAnICAgICAq KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq KlxuJwogICAgICAgICAgICB1c3JQcm9tcHQgPSAxCiAgICAgICAgICAgIG1haW4oKQogICAgICAg IGVsc2U6CiAgICAgICAgICAgIHByaW50ICcgICAgIFxuSW52YWxpZCBlbnRyeVxuJwogICAgICAg ICAgICB1c3JQcm9tcHQgPSAxCiAgICAgICAgICAgIG1haW4oKQoKCmRlZiBhcGlEYXRhKCk6CiAg ICAiIiJUQkMiIiIKCiAgICBnbG9iYWwga2V5c05hbWUKICAgIGdsb2JhbCBrZXlzUGF0aAogICAg Z2xvYmFsIHVzclByb21wdAoKICAgIEJNQ29uZmlnUGFyc2VyKCkucmVhZChrZXlzUGF0aCkgICMg Rmlyc3QgdHJ5IHRvIGxvYWQgdGhlIGNvbmZpZyBmaWxlICh0aGUga2V5cy5kYXQgZmlsZSkgZnJv bSB0aGUgcHJvZ3JhbSBkaXJlY3RvcnkKCiAgICB0cnk6CiAgICAgICAgQk1Db25maWdQYXJzZXIo KS5nZXQoJ2JpdG1lc3NhZ2VzZXR0aW5ncycsICdwb3J0JykKICAgICAgICBhcHBEYXRhRm9sZGVy ID0gJycKICAgIGV4Y2VwdDoKICAgICAgICAjIENvdWxkIG5vdCBsb2FkIHRoZSBrZXlzLmRhdCBm aWxlIGluIHRoZSBwcm9ncmFtIGRpcmVjdG9yeS4gUGVyaGFwcyBpdCBpcyBpbiB0aGUgYXBwZGF0 YSBkaXJlY3RvcnkuCiAgICAgICAgYXBwRGF0YUZvbGRlciA9IGxvb2t1cEFwcGRhdGFGb2xkZXIo KQogICAgICAgIGtleXNQYXRoID0gYXBwRGF0YUZvbGRlciArIGtleXNQYXRoCiAgICAgICAgQk1D b25maWdQYXJzZXIoKS5yZWFkKGtleXNQYXRoKQoKICAgICAgICB0cnk6CiAgICAgICAgICAgIEJN Q29uZmlnUGFyc2VyKCkuZ2V0KCdiaXRtZXNzYWdlc2V0dGluZ3MnLCAncG9ydCcpCiAgICAgICAg ZXhjZXB0OgogICAgICAgICAgICAjIGtleXMuZGF0IHdhcyBub3QgdGhlcmUgZWl0aGVyLCBzb21l dGhpbmcgaXMgd3JvbmcuCiAgICAgICAgICAgIHByaW50ICcgICAgICoqKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKicKICAgICAg ICAgICAgcHJpbnQgJyAgICAgVGhlcmUgd2FzIGEgcHJvYmxlbSB0cnlpbmcgdG8gYWNjZXNzIHRo ZSBCaXRtZXNzYWdlIGtleXMuZGF0IGZpbGUnCiAgICAgICAgICAgIHByaW50ICcgICAgICAgICAg ICAgICAgICAgIG9yIGtleXMuZGF0IGlzIG5vdCBzZXQgdXAgY29ycmVjdGx5JwogICAgICAgICAg ICBwcmludCAnICAgICAgIE1ha2Ugc3VyZSB0aGF0IGRhZW1vbiBpcyBpbiB0aGUgc2FtZSBkaXJl Y3RvcnkgYXMgQml0bWVzc2FnZS4gJwogICAgICAgICAgICBwcmludCAnICAgICAqKioqKioqKioq KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKipc bicKCiAgICAgICAgICAgIHVJbnB1dCA9IHVzZXJJbnB1dCgnV291bGQgeW91IGxpa2UgdG8gY3Jl YXRlIGEga2V5cy5kYXQgaW4gdGhlIGxvY2FsIGRpcmVjdG9yeSwgKFkpZXMgb3IgKE4pbz8nKS5s b3dlcigpCgogICAgICAgICAgICBpZiAodUlucHV0ID09ICJ5IiBvciB1SW5wdXQgPT0gInllcyIp OgogICAgICAgICAgICAgICAgY29uZmlnSW5pdCgpCiAgICAgICAgICAgICAgICBrZXlzUGF0aCA9 IGtleXNOYW1lCiAgICAgICAgICAgICAgICB1c3JQcm9tcHQgPSAwCiAgICAgICAgICAgICAgICBt YWluKCkKICAgICAgICAgICAgICAgIHJldHVybiAnJwoKICAgICAgICAgICAgZWxpZiAodUlucHV0 ID09ICJuIiBvciB1SW5wdXQgPT0gIm5vIik6CiAgICAgICAgICAgICAgICBwcmludCAnXG4gICAg IFRyeWluZyBBZ2Fpbi5cbicKICAgICAgICAgICAgICAgIHVzclByb21wdCA9IDAKICAgICAgICAg ICAgICAgIG1haW4oKQogICAgICAgICAgICAgICAgcmV0dXJuICAnJwoKICAgICAgICAgICAgZWxz ZToKICAgICAgICAgICAgICAgIHByaW50ICdcbiAgICAgSW52YWxpZCBJbnB1dC5cbicKCiAgICAg ICAgICAgIHVzclByb21wdCA9IDEKICAgICAgICAgICAgbWFpbigpCiAgICAgICAgICAgIHJldHVy biAnJwoKICAgIHRyeTogICMgY2hlY2tzIHRvIG1ha2Ugc3VyZSB0aGF0IGV2ZXJ5dGluZyBpcyBj b25maWd1cmVkIGNvcnJlY3RseS4gRXhjbHVkaW5nIGFwaUVuYWJsZWQsIGl0IGlzIGNoZWNrZWQg YWZ0ZXIKICAgICAgICBCTUNvbmZpZ1BhcnNlcigpLmdldCgnYml0bWVzc2FnZXNldHRpbmdzJywg J2FwaXBvcnQnKQogICAgICAgIEJNQ29uZmlnUGFyc2VyKCkuZ2V0KCdiaXRtZXNzYWdlc2V0dGlu Z3MnLCAnYXBpaW50ZXJmYWN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B1dCgnV291bGQg eW91IGxpa2UgdG8gbW9kaWZ5IGFueSBvZiB0aGVzZSBzZXR0aW5ncywgKG4pbyBvciAoWSllcz8n KS5sb3dlcigpCgogICAgaWYgdUlucHV0IG5vdCBpbiBpbnB1dFNob3J0c1snbm8nXToKICAgICAg ICB3aGlsZSBUcnVlOiAgIyBsb29wcyBpZiB0aGV5IG1pc3R5cGUgdGhlIHNldHRpbmcgbmFtZSwg dGhleSBjYW4gZXhpdCB0aGUgbG9vcCB3aXRoICdleGl0JwogICAgICAgICAgICBpbnZhbGlkSW5w dXQgPSBGYWxzZQogICAgICAgICAgICB1SW5wdXQgPSB1c2VySW5wdXQoJ1doYXQgc2V0dGluZyB3 b3VsZCB5b3UgbGlrZSB0byBtb2RpZnk/JykubG93ZXIoKQogICAgICAgICAgICBwcmludCAnICcK CiAgICAgICAgICAgIGlmIHVJbnB1dCA9PSAicG9ydCI6CiAgICAgICAgICAgICAgICBwcmludCAn ICAgICBDdXJyZW50IHBvcnQgbnVtYmVyOiAnICsgcG9ydAogICAgICAgICAgICAgICAgdUlucHV0 ID0gdXNlcklucHV0KCJJbnB1dCB0aGUgbmV3IHBvcnQgbnVtYmVyLiIpCiAgICAgICAgICAgICAg ICBCTUNvbmZpZ1BhcnNlcigpLnNldCgnYml0bWVzc2FnZXNldHRpbmdzJywgJ3BvcnQnLCBzdHIo dUlucHV0KSkKICAgICAgICAgICAgZWxpZiB1SW5wdXQgPT0gInN0YXJ0b25sb2dvbiI6CiAgICAg ICAgICAgICAgICBwcmludCAnICAgICBDdXJyZW50IHN0YXR1czogJyArIHN0cihzdGFydG9ubG9n b24pCiAgICAgICAgICAgICAgICB1SW5wdXQgPSB1c2VySW5wdXQoIklucHV0IHRoZSBuZXcgc3Rh dHVzLiIpCiAgICAgICAgICAgICAgICBCTUNvbmZpZ1BhcnNlcigpLnNldCgnYml0bWVzc2FnZXNl dHRpbmdzJywgJ3N0YXJ0b25sb2dvbicsIHN0cih1SW5wdXQpKQogICAgICAgICAgICBlbGlmIHVJ bnB1dCA9PSAibWluaW1pemV0b3RyYXkiOgogICAgICAgICAgICAgICAgcHJpbnQgJyAgICAgQ3Vy cmVudCBzdGF0dXM6ICcgKyBzdHIobWluaW1pemV0b3RyYXkpCiAgICAgICAgICAgICAgICB1SW5w dXQgPSB1c2VySW5wdXQoIklucHV0IHRoZSBuZXcgc3RhdHVzLiIpCiAgICAgICAgICAgICAgICBC TUNvbmZpZ1BhcnNlcigpLnNldCgnYml0bWVzc2FnZXNldHRpbmdzJywgJ21pbmltaXpldG90cmF5 Jywgc3RyKHVJbnB1dCkpCiAgICAgICAgICAgIGVsaWYgdUlucHV0ID09ICJzaG93dHJheW5vdGlm aWNhdGlvbnMiOgogICAgICAgICAgICAgICAgcHJpbnQgJyAgICAgQ3VycmVudCBzdGF0dXM6ICcg KyBzdHIoc2hvd3RyYXlub3RpZmljYXRpb25zKQogICAgICAgICAgICAgICAgdUlucHV0ID0gdXNl cklucHV0KCJJbnB1dCB0aGUgbmV3IHN0YXR1cy4iKQogICAgICAgICAgICAgICAgQk1Db25maWdQ YXJzZXIoKS5zZXQoJ2JpdG1lc3NhZ2VzZXR0aW5ncycsICdzaG93dHJheW5vdGlmaWNhdGlvbnMn LCBzdHIodUlucHV0KSkKICAgICAgICAgICAgZWxpZiB1SW5wdXQgPT0gInN0YXJ0aW50cmF5IjoK ICAgICAgICAgICAgICAgIHByaW50ICcgICAgIEN1cnJlbnQgc3RhdHVzOiAnICsgc3RyKHN0YXJ0 aW50cmF5KQogICAgICAgICAgICAgICAgdUlucHV0ID0gdXNlcklucHV0KCJJbnB1dCB0aGUgbmV3 IHN0YXR1cy4iKQogICAgICAgICAgICAgICAgQk1Db25maWdQYXJzZXIoKS5zZXQoJ2JpdG1lc3Nh Z2VzZXR0aW5ncycsICdzdGFydGludHJheScsIHN0cih1SW5wdXQpKQogICAgICAgICAgICBlbGlm IHVJbnB1dCA9PSAiZGVmYXVsdG5vbmNldHJpYWxzcGVyYnl0ZSI6CiAgICAgICAgICAgICAgICBw cmludCAnICAgICBDdXJyZW50IGRlZmF1bHQgbm9uY2UgdHJpYWxzIHBlciBieXRlOiAnICsgZGVm YXVsdG5vbmNldHJpYWxzcGVyYnl0ZQogICAgICAgICAgICAgICAgdUlucHV0ID0gdXNlcklucHV0 KCJJbnB1dCB0aGUgbmV3IGRlZmF1bHRub25jZXRyaWFsc3BlcmJ5dGUuIikKICAgICAgICAgICAg ICAgIEJNQ29uZmlnUGFyc2VyKCkuc2V0KCdiaXRtZXNzYWdlc2V0dGluZ3MnLCAnZGVmYXVsdG5v bmNldHJpYWxzcGVyYnl0ZScsIHN0cih1SW5wdXQpKQogICAgICAgICAgICBlbGlmIHVJbnB1dCA9 PSAiZGVmYXVsdHBheWxvYWRsZW5ndGhleHRyYWJ5dGVzIjoKICAgICAgICAgICAgICAgIHByaW50 ICcgICAgIEN1cnJlbnQgZGVmYXVsdCBwYXlsb2FkIGxlbmd0aCBleHRyYSBieXRlczogJyArIGRl ZmF1bHRwYXlsb2FkbGVuZ3RoZXh0cmFieXRlcwogICAgICAgICAgICAgICAgdUlucHV0ID0gdXNl cklucHV0KCJJbnB1dCB0aGUgbmV3IGRlZmF1bHRwYXlsb2FkbGVuZ3RoZXh0cmFieXRlcy4iKQog ICAgICAgICAgICAgICAgQk1Db25maWdQYXJzZXIoKS5zZXQoJ2JpdG1lc3NhZ2VzZXR0aW5ncycs ICdkZWZhdWx0cGF5bG9hZGxlbmd0aGV4dHJhYnl0ZXMnLCBzdHIodUlucHV0KSkKICAgICAgICAg ICAgZWxpZiB1SW5wdXQgPT0gImRhZW1vbiI6CiAgICAgICAgICAgICAgICBwcmludCAnICAgICBD dXJyZW50IHN0YXR1czogJyArIHN0cihkYWVtb24pCiAgICAgICAgICAgICAgICB1SW5wdXQgPSB1 c2VySW5wdXQoIklucHV0IHRoZSBuZXcgc3RhdHVzLiIpLmxvd2VyKCkKICAgICAgICAgICAgICAg IEJNQ29uZmlnUGFyc2VyKCkuc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iKQog ICAgICAgICAgICAgICAgQk1Db25maWdQYXJzZXIoKS5zZXQoJ2JpdG1lc3NhZ2VzZXR0aW5ncycs ICdzb2Nrc3BvcnQnLCBzdHIodUlucHV0KSkKICAgICAgICAgICAgZWxpZiB1SW5wdXQgPT0gInNv Y2tzYXV0aGVudGljYXRpb24iOgogICAgICAgICAgICAgICAgcHJpbnQgJyAgICAgQ3VycmVudCBz dGF0dXM6ICcgKyBzdHIoc29ja3NhdXRoZW50aWNhdGlvbikKICAgICAgICAgICAgICAgIHVJbnB1 dCA9IHVzZXJJbnB1dCgiSW5wdXQgdGhlIG5ldyBzdGF0dXMuIikKICAgICAgICAgICAgICAgIEJN Q29uZmlnUGFyc2VyKCkuc2V0KCdiaXRtZXNzYWdlc2V0dGluZ3MnLCAnc29ja3NhdXRoZW50aWNh dGlvbicsIHN0cih1SW5wdXQpKQogICAgICAgICAgICBlbGlmIHVJbnB1dCA9PSAic29ja3N1c2Vy bmFtZSI6CiAgICAgICAgICAgICAgICBwcmludCAnICAgICBDdXJyZW50IHNvY2tzIHVzZXJuYW1l OiAnICsgc29ja3N1c2VybmFtZQogICAgICAgICAgICAgICAgdUlucHV0ID0gdXNlcklucHV0KCJJ bnB1dCB0aGUgbmV3IHNvY2tzdXNlcm5hbWUuIikKICAgICAgICAgICAgICAgIEJNQ29uZmlnUGFy c2VyKCkuc2V0KCdiaXRtZXNzYWdlc2V0dGluZ3MnLCAnc29ja3N1c2VybmFtZScsIHN0cih1SW5w dXQpKQogICAgICAgICAgICBlbGlmIHVJbnB1dCA9PSAic29ja3NwYXNzd29yZCI6CiAgICAgICAg ICAgICAgICBwcmludCAnICAgICBDdXJyZW50IHNvY2tzIHBhc3N3b3JkOiAnICsgc29ja3NwYXNz d29yZAogICAgICAgICAgICAgICAgdUlucHV0ID0gdXNlcklucHV0KCJJbnB1dCB0aGUgbmV3IHBh c3N3b3JkLiIpCiAgICAgICAgICAgICAgICBCTUNvbmZpZ1BhcnNlcigpLnNldCgnYml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TdWJzY3JpYmUgdG8gYW4gYWRkcmVzcyIiIgoKICAgIGdsb2JhbCB1c3JQcm9tcHQKCiAg ICBsYWJlbCA9IGxhYmVsLmVuY29kZSgnYmFzZTY0JykKICAgIHRyeToKICAgICAgICBwcmludCAn ICAgICBTdWJzY3JpYmluZyBhZGRyZXNzOicsIGxhYmVsCiAgICAgICAgcmVzcG9uc2UgPSBhcGku YWRkU3Vic2NyaXB0aW9uKGFkZHJlc3MsIGxhYmVsKQogICAgICAgIGlmICJBUEkgRXJyb3IiIGlu IHJlc3BvbnNlOgogICAgICAgICAgICByZXR1cm4gJ1xuICAgICAnICsgcmVzcG9uc2UgKydcbicK ICAgIGV4Y2VwdDoKICAgICAgICBwcmludCAnXG4gICAgIENvbm5lY3Rpb24gRXJyb3JcbicKICAg ICAgICB1c3JQcm9tcHQgPSAwCiAgICAgICAgbWFpbigpCiAgICAgICAgcmV0dXJuICcnCgogICAg cmV0dXJuICdcbiAgICAnICsgcmVzcG9uc2UKCgpkZWYgdW5zdWJzY3JpYmUoYWRkcmVzcyk6CiAg ICAiIiJVbnN1c2JjcmliZSBmcm9tIGFuIGFkZHJlc3MiIiIKCiAgICBnbG9iYWwgdXNyUHJvbXB0 CgogICAgdHJ5OgogICAgICAgIHByaW50ICcgICAgIHVuU3Vic2NyaWJpbmcgYWRkcmVzczonLCBh ZGRyZXNzCiAgICAgICAgcmVzcG9uc2UgPSBhcGkuZGVsZXRlU3Vic2NyaXB0aW9uKGFkZHJlc3Mp CiAgICAgICAgaWYgIkFQSSBFcnJvciIgaW4gcmVzcG9uc2U6CiAgICAgICAgICAgIHJldHVybiAn XG4gICAgICcgKyByZXNwb25zZSArJ1xuJwogICAgZXhjZXB0OgogICAgICAgIHByaW50ICdcbiAg ICAgQ29ubmVjdGlvbiBFcnJvclxuJwogICAgICAgIHVzclByb21wdCA9IDAKICAgICAgICBtYWlu KCkKICAgICAgICByZXR1cm4gJycKCiAgICByZXR1cm4gJ1xuICAgICAnICsgcmVzc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IGFuZCBsaXN0cyB0aGVtIG91dAogICAgICAgIGxhYmVsID0gKGpz b25BZGRyZXNzZXNbYWRkTnVtXVsnbGFiZWwnXS5kZWNvZGUoJ2Jhc2U2NCcpKS5lbmNvZGUoCiAg ICAgICAgICAgICd1dGYnKSAgICAgICAgICAgICAgIyBtYXkgc3RpbGwgbWlzZGlwbGF5IGluIHNv bWUgY29uc29sZXMKICAgICAgICBhZGRyZXNzID0gc3RyKGpzb25BZGRyZXNzZXNbYWRkTnVtXVsn YWRkcmVzcyddKQogICAgICAgIGVuYWJsZWQgPSBzdHIoanNvbkFkZHJlc3Nlc1thZGROdW1dWydl bmFibGVkJ10pCgogICAgICAgIGlmIGxlbihsYWJlbCkgPiAxOToKICAgICAgICAgICAgbGFiZWwg PSBsYWJlbFs6MTZdICsgJy4uLicKCiAgICAgICAgcHJpbnQgJycuam9pbihbCiAgICAgICAgICAg ICcgICAgIHwnLAogICAgICAgICAgICBzdHIoYWRkTnVtKS5sanVzdCgzKSwKICAgICAgICAgICAg J3wnLAogICAgICAgICAgICBsYWJlbC5sanVzdCgxOSksCiAgICAgICAgICAgICd8JywKICAgICAg ICAgICAgYWRkcmVzcy5sanVzdCgzNyksCiAgICAgICAgICAgICd8JywKICAgICAgICAgICAgZW5h YmxlZC5sanVzdCg3KSwKICAgICAgICAgICAgJ3wnLAogICAgICAgIF0pCgogICAgcHJpbnQgJycu am9pbihbCiAgICAgICAgJyAgICAgJywKICAgICAgICA3MSAqICctJywKICAgICAgICAnXG4nLAog ICAgXSkKCiAgICByZXR1cm4gJycKCgpkZWYgY3JlYXRlQ2hhbihwYXNzd29yZCk6CiAgICAiIiJD cmVhdGUgYSBjaGFubmVsIiIiCgogICAgZ2xvYmFsIHVzclByb21wdAoKICAgIGJhc2U2NCA9IHBh c3N3b3JkLmVuY29kZSgnYmFzZTY0JykKICAgIHRyeToKICAgICAgICBwcmludCAnICAgICBDaGFu bmVsIGNyZWF0aW5nLi4uJywgcGFzc3dvcmQKICAgICAgICByZXNwb25zZSA9IGFwaS5jcmVhdGVD aGFuKGJhc2U2NCkKICAgICAgICBpZiAiQVBJIEVycm9yIiBpbiByZXNwb25zZToKICAgICAgICAg ICAgcmV0dXJuICdcbiAgICAgJyArIHJlc3BvbnNlICsgJ1xuJwogICAgZXhjZXB0OgogICAgICAg IHByaW50ICdcbiAgICAgQ29ubmVjdGlvbiBFcnJvclxuJwogICAgICAgIHVzclByb21wdCA9IDAK ICAgICAgICBtYWluKCkKICAgICAgICByZXR1cm4gJycKCiAgICByZXR1cm4gJ1xuICAgICAnICsg cmVzcG9uc2UKCgpkZWYgam9pbkNoYW4oKToKICAgICIiIkpvaW4gYSBjaGFubmVsIiIiCgogICAg Z2xvYmFsIHVzclByb21wdAoKICAgIHVJbnB1dCA9ICcnCiAgICBhZGRyZXNzID0gaW5wdXRBZGRy ZXNzKCdFbnRlciBjaGFubmVsIGFkZHJlc3MnKQogICAgd2hpbGUgdUlucHV0ID09ICcnOgogICAg ICAgIHVJbnB1dCA9IHVzZXJJbnB1dCgnRW50ZXIgY2hhbm5lbCBuYW1lWzF+XScpCiAgICBwYXNz d29yZCA9IHVJbnB1dC5lbmNvZGUoJ2Jhc2U2NCcpCgogICAgdHJ5OgogICAgICAgIHByaW50ICcg ICAgIENoYW5uZWwgam9pbmluZy4uLicsIHVJbnB1dAogICAgICAgIHJlc3BvbnNlID0gYXBpLmpv aW5DaGFuKHBhc3N3b3JkLCBhZGRyZXNzKQogICAgICAgIGlmICJBUEkgRXJyb3IiIGluIHJlc3Bv bnNlOgogICAgICAgICAgICByZXR1cm4gJ1xuICAgICAnICsgcmVzcG9uc2UgKyAnXG4nCiAgICBl eGNlcHQ6CiAgICAgICAgcHJpbnQgJ1xuICAgICBDb25uZWN0aW9uIEVycm9yXG4nCiAgICAgICAg dXNyUHJvbXB0ID0gMAogICAgICAgIG1haW4oKQogICAgICAgIHJldHVybiAnJwoKICAgIHJldHVy biAnXG4gICAgICcgKyByZXNwb25zZQoKCmRlZiBsZWF2ZUNoYW4oKToKICAgICIiIkxlYXZlIGEg Y2hhbm5lbCIiIgoKICAgIGdsb2JhbCB1c3JQcm9tcHQKCiAgICBhZGRyZXNzID0gaW5wdXRBZGRy ZXNzKCJFbnRlciBjaGFubmVsIGFkZHJlc3MiKQogICAgdHJ5OgogICAgICAgIHByaW50ICcgICAg IENoYW5uZWwgbGVhdmluZy4uLicsICdhZGRyZXNzJwogICAgICAgIHJlc3BvbnNlID0gYXBpLmxl YXZlQ2hhbihhZGRyZXNzKQogICAgICAgIGlmICJBUEkgRXJyb3IiIGluIHJlc3BvbnNlOgogICAg ICAgICAgICByZXR1cm4gJ1xuICAgICAnICsgcmVzcG9uc2UgKyAnXG4nCiAgICBleGNlcHQ6CiAg ICAgICAgcHJpbnQgJ1xuICAgICBDb25uZWN0aW9uIEVycm9yXG4nCiAgICAgICAgdXNyUHJvbXB0 ID0gMAogICAgICAgIG1haW4oKQogICAgICAgIHJldHVybiAnJwoKICAgIHJldHVybiAnXG4gICAg ICcgKyByZXNwb25zZQoKCmRlZiBsaXN0QWRkKCk6CiAgICAiIiJMaXN0IGFsbCBvZiB0aGUgYWRk cmVzc2VzIGFuZCB0aGVpciBpbmZvIiIiCgogICAgZ2xvYmFsIHVzclByb21wdAoKICAgIHRyeToK ICAgICAgICBwcmludCAnICAgICBSZXRyaXZpbmcuLi4nLCAnU2VuZGVycycKICAgICAgICByZXNw b25zZSA9IGFwaS5saXN0QWRkcmVzc2VzKCkKICAgICAgICBpZiAiQVBJIEVycm9yIiBpbiByZXNw b25zZToKICAgICAgICAgICAgcmV0dXJuICdcbiAgICAgJyArIHJlc3BvbnNlICsgJ1xuJwogICAg ICAgIGpzb25BZGRyZXNzZXMgPSBqc29uLmxvYWRzKHJlc3BvbnNlKVsnYWRkcmVzc2VzJ10KICAg ICAgICBudW1BZGRyZXNzZXMgPSBsZW4oanNvbkFkZHJlc3NlcykgICMgTnVtYmVyIG9mIGFkZHJl c3NlcwogICAgZXhjZXB0Ogog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lmIGxl bihsYWJlbCkgPiAxOToKICAgICAgICAgICAgbGFiZWwgPSBsYWJlbFs6MTZdICsgJy4uLicKCiAg ICAgICAgcHJpbnQgJycuam9pbihbCiAgICAgICAgICAgICcgICAgIHwnLAogICAgICAgICAgICBz dHIoYWRkTnVtKS5sanVzdCgzKSwKICAgICAgICAgICAgJ3wnLAogICAgICAgICAgICBsYWJlbC5s anVzdCgxOSksCiAgICAgICAgICAgICd8JywKICAgICAgICAgICAgYWRkcmVzcy5sanVzdCgzNyks CiAgICAgICAgICAgICd8JywKICAgICAgICAgICAgc3RyZWFtLmxqdXN0KDIpLAogICAgICAgICAg ICAnfCcsCiAgICAgICAgICAgIGVuYWJsZWQubGp1c3QoNyksCiAgICAgICAgICAgICd8JywKICAg ICAgICBdKQoKICAgIHByaW50ICcnLmpvaW4oWwogICAgICAgICcgICAgICcsCiAgICAgICAgNzQg KiAnLScsCiAgICAgICAgJ1xuJywKICAgIF0pCgogICAgcmV0dXJuICcnCgoKZGVmIGdlbkFkZChs YmwsIGRldGVybWluaXN0aWMsIHBhc3NwaHJhc2UsIG51bU9mQWRkLCBhZGRWTnVtLCBzdHJlYW1O dW0sIHJpcGUpOgogICAgIiIiR2VuZXJhdGUgYWRkcmVzcyIiIgoKICAgIGdsb2JhbCB1c3JQcm9t cHQKCiAgICBpZiBkZXRlcm1pbmlzdGljIGlzIEZhbHNlOiAgIyBHZW5lcmF0ZXMgYSBuZXcgYWRk cmVzcyB3aXRoIHRoZSB1c2VyIGRlZmluZWQgbGFiZWwuIG5vbi1kZXRlcm1pbmlzdGljCiAgICAg ICAgYWRkcmVzc0xhYmVsID0gbGJsLmVuY29kZSgnYmFzZTY0JykKICAgICAgICB0cnk6CiAgICAg ICAgICAgIHByaW50ICcgICAgIEFkZHJlc3MgcmVxdWVzdGluZy4uLicsIGxibAogICAgICAgICAg ICByZXNwb25zZSA9IGFwaS5jcmVhdGVSYW5kb21BZGRyZXNzKGFkZHJlc3NMYWJlbCkKICAgICAg ICAgICAgaWYgIkFQSSBFcnJvciIgaW4gcmVzcG9uc2U6CiAgICAgICAgICAgICAgICByZXR1cm4g J1xuICAgICAnICsgcmVzcG9uc2UgKyAnXG4nCiAgICAgICAgZXhjZXB0OgogICAgICAgICAgICBw cmludCAnXG4gICAgIENvbm5lY3Rpb24gRXJyb3JcbicKICAgICAgICAgICAgdXNyUHJvbXB0ID0g MAogICAgICAgICAgICBtYWluKCkKICAgICAgICAgICAgcmV0dXJuICcnCgogICAgZWxzZTogICMg R2VuZXJhdGVzIGEgbmV3IGRldGVybWluaXN0aWMgYWRkcmVzcyB3aXRoIHRoZSB1c2VyIGlucHV0 cy4KICAgICAgICBwYXNzUGhyYXNlID0gcGFzc3BocmFzZS5lbmNvZGUoJ2Jhc2U2NCcpCiAgICAg ICAgdHJ5OgogICAgICAgICAgICBwcmludCAnICAgICBBZGRyZXNzIGRldGVybWluaXN0aWMuLi4n LCBwYXNzcGhyYXNlCiAgICAgICAgICAgIHJlc3BvbnNlID0gYXBpLmNyZWF0ZURldGVybWluaXN0 aWNBZGRyZXNzZXMocGFzc1BocmFzZSwgbnVtT2ZBZGQsIGFkZFZOdW0sIHN0cmVhbU51bSwgcmlw ZSkKICAgICAgICAgICAgaWYgIkFQSSBFcnJvciIgaW4gcmVzcG9uc2U6CiAgICAgICAgICAgICAg ICByZXR1cm4gJ1xuICAgICAnICsgcmVzcG9uc2UgKyAnXG4nCiAgICAgICAgZXhjZXB0OgogICAg ICAgICAgICBwcmludCAnXG4gICAgIENvbm5lY3Rpb24gRXJyb3JcbicKICAgICAgICAgICAgdXNy UHJvbXB0ID0gMAogICAgICAgICAgICBtYWluKCkKICAgICAgICAgICAgcmV0dXJuICcnCgogICAg cmV0dXJuICdcbiAgICAgQWRkcmVzczonLCByZXNwb25zZQoKCmRlZiBkdW1wMkZpbGUoZmlsZU5h bWUsIGZpbGVEYXRhLCBkZUNvZGVkKToKICAgICIiIkFsbG93cyBhdHRhY2htZW50cyBhbmQgbWVz c2F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CgogICAgaWYgbm90IGRlQ29kZWQ6CiAgICAgICAgeCA9 IGZpbGVEYXRhLnJlcGxhY2UoJ1xuJywnJykKICAgICAgICBpZiBsZW4oeCkgJSA0ID09IDA6ICMg Y2hlY2sgYnkgbGVuZ3RoIGJlZm9yZSBkZWNvZGUuCiAgICAgICAgICAgIHRyeToKICAgICAgICAg ICAgICAgIHkgPSB4LmRlY29kZSgnYmFzZTY0JywgJ3N0cmljdCcpCiAgICAgICAgICAgICAgICBp ZiB4ID09IHkuZW5jb2RlKCdiYXNlNjQnKS5yZXBsYWNlKCdcbicsJycpOiAgIyBkb3VibGUgY2hl Y2sgZGVjb2RlZCBzdHJpbmcuCiAgICAgICAgICAgICAgICAgICAgZmlsZURhdGEgPSB5CiAgICAg ICAgICAgICAgICBlbHNlOgogICAgICAgICAgICAgICAgICAgIHByaW50ICdcbiAgICAgRmFpbGVk IG9uICJCQVNFNjQiIHJlLWVuY29kZSBjaGVja2luZy5cbicKICAgICAgICAgICAgZXhjZXB0Ogog ICAgICAgICAgICAgICAgcmV0dXJuICdcbiAgICAgRmFpbGVkIG9uICJCQVNFNjQiIGRlY29kaW5n LlxuJwogICAgICAgIGVsc2U6CiAgICAgICAgICAgIHByaW50ICdcbiAgICAgTm90ICJCQVNFNjQi IHN0cmluZywgZHVtcCB0byBmaWxlIGRpcmVjdGx5LicKCiAgICB0cnk6CiAgICAgICAgd2l0aCBv cGVuKGZpbGVQYXRoLCAnd2IrJykgYXMgcGF0aF90b19maWxlOgogICAgICAgICAgICAgICAgcGF0 aF90b19maWxlLndyaXRlKGZpbGVEYXRhKQogICAgZXhjZXB0OgogICAgICAgIHJldHVybiAnXG4g ICAgIEZhaWxlZCBvbiBvcGVyYXRpbmcgJyArIGZpbGVQYXRoICsgJ1xuJwoKICAgIHJldHVybiAn XG4gICAgIFN1Y2Nlc3NmdWxseSBzYXZlZCB0byAnICsgZmlsZVBhdGgKCgpkZWYgYXR0YWNobWVu dCgpOgogICAgIiIiQWxsb3dzIHVzZXJzIHRvIGF0dGFjaCBhIGZpbGUgdG8gdGhlaXIgbWVzc2Fn ZSBvciBicm9hZGNhc3QiIiIKCiAgICB0aGVBdHRhY2htZW50UyA9ICcnCgogICAgZ2xvYmFsIGlu cHV0U2hvcnRzCgogICAgd2hpbGUgVHJ1ZToKCiAgICAgICAgaXNJbWFnZSA9IEZhbHNlCiAgICAg ICAgdGhlQXR0YWNobWVudCA9ICcnCgogICAgICAgIHdoaWxlIFRydWU6ICAjIGxvb3BzIHVudGls IHZhbGlkIHBhdGggaXMgZW50ZXJlZAogICAgICAgICAgICBmaWxlUGF0aCA9IHVzZXJJbnB1dCgK ICAgICAgICAgICAgICAgICdcblBsZWFzZSBlbnRlciB0aGUgcGF0aCB0byB0aGUgYXR0YWNobWVu dCBvciBqdXN0IHRoZSBhdHRhY2htZW50IG5hbWUgaWYgaW4gdGhpcyBmb2xkZXJbTWF4OjE4ME1C XS4nKQoKICAgICAgICAgICAgdHJ5OgogICAgICAgICAgICAgICAgd2l0aCBvcGVuKGZpbGVQYXRo KToKICAgICAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICBleGNlcHQgSU9FcnJvcjoK ICAgICAgICAgICAgICAgIHByaW50ICdcbiAgICAgJXMgd2FzIG5vdCBmb3VuZCBvbiB5b3VyIGZp bGVzeXN0ZW0gb3IgY2FuIG5vdCBiZSBvcGVuZWQuXG4nICUgZmlsZVBhdGgKCiAgICAgICAgIyBw cmludCBmaWxlc2l6ZSwgYW5kIGVuY29kaW5nIGVzdGltYXRlIHdpdGggY29uZmlybWF0aW9uIGlm IGZpbGUgaXMgb3ZlciBYIHNpemUgKDFtYj8pCiAgICAgICAgaW52U2l6ZSA9IG9zLnBhdGguZ2V0 c2l6ZShmaWxlUGF0aCkKICAgICAgICBpbnZTaXplID0gKGludlNpemUgLyAxMDI0KSAgIyBDb252 ZXJ0cyB0byBraWxvYnl0ZXMKICAgICAgICByb3VuZChpbnZTaXplLCAyKSAgIyBSb3VuZHMgdG8g dHdvIGRlY2ltYWwgcGxhY2VzCgogICAgICAgIGlmIGludlNpemUgPiA1MDAuMDogICMgSWYgb3Zl ciA1MDBLQgogICAgICAgICAgICBwcmludCAnJy5qb2luKFsKICAgICAgICAgICAgICAgICdcbiAg ICAgV0FSTklORzpUaGUgZmlsZSB0aGF0IHlvdSBhcmUgdHJ5aW5nIHRvIGF0dGFjaCBpcyAnLAog ICAgICAgICAgICAgICAgaW52U2l6ZSwKICAgICAgICAgICAgICAgICdLQiBhbmQgd2lsbCB0YWtl IGNvbnNpZGVyYWJsZSB0aW1lIHRvIHNlbmQuXG4nCiAgICAgICAgICAgIF0pCiAgICAgICAgICAg IHVJbnB1dCA9IHVzZXJJbnB1dCgnQXJlIHlvdSBzdXJlIHlvdSBzdGlsbCB3YW50IHRvIGF0dGFj aCBpdCwgKHkpZXMgb3IgKE4pbz8nKS5sb3dlcigpCgogICAgICAgICAgICBpZiB1SW5wdXQgbm90 IGluIGlucHV0U2hvcnRzWyd5ZXMnXToKICAgICAgICAgICAgICAgIHByaW50ICdcbiAgICAgQXR0 YWNobWVudCBkaXNjYXJkZWQuJwogICAgICAgICAgICAgICAgcmV0dXJuICcnCiAgICAgICAgZWxp ZiBpbnZTaXplID4gMTg0MzIwLjA6ICAjIElmIGxhcmdlciB0aGFuIDE4ME1CLCBkaXNjYXJkLgog ICAgICAgICAgICBwcmludCAnXG4gICAgIEF0dGFjaG1lbnQgdG9vIGJpZywgbWF4aW11bSBhbGxv d2VkIHNpemU6MTgwTUInCiAgICAgICAgICAgIG1haW4oKQogICAgICAgICAgICByZXR1cm4gJycK CiAgICAgICAgcGF0aExlbiA9IGxlbihzdHIobnRwYXRoLmJhc2VuYW1lKGZpbGVQYXRoKSkpICAj IEdldHMgdGhlIGxlbmd0aCBvZiB0aGUgZmlsZXBhdGggZXhjbHVkaW5nIHRoZSBmaWxlbmFtZQog ICAgICAgIGZpbGVOYW1lID0gZmlsZVBhdGhbKGxlbihzdHIoZmlsZVBhdGgpKSAtIHBhdGhMZW4p Ol0gICMgcmVhZHMgdGhlIGZpbGVuYW1lCgogICAgICAgIGZpbGV0eXBlID0gaW1naGRyLndoYXQo ZmlsZVBhdGgpICAjIFRlc3RzIGlmIGl0IGlzIGFuIGltYWdlIGZpbGUKICAgICAgICBpZiBmaWxl dHlwZSBpcyBub3QgTm9uZToKICAgICAgICAgICAgcHJpbnQgJyAgICAgLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tJwogICAgICAgICAgICBwcmludCAn ICAgICBBdHRhY2htZW50IGRldGVjdGVkIGFzIGFuIEltYWdlLicKICAgICAgICAgICAgcHJpbnQg JyAgICAgPGltZz4gdGFncyB3aWxsIGF1dG9tYXRpY2FsbHkgYmUgaW5jbHVkZWQsJwogICAgICAg ICAgICBwcmludCAnICAgICBhbGxvd2luZyB0aGUgcmVjaXBpZW50IHRvIHZpZXcgdGhlIGltYWdl JwogICAgICAgICAgICBwcmludCAnICAgICB1c2luZyB0aGUgIlZpZXcgSFRNTCBjb2RlLi4uIiBv cHRpb24gaW4gQml0bWVzc2FnZS4nCiAgICAgICAgICAgIHByaW50ICcgICAgIC0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLVxuJwogICAgICAgICAgICBp c0ltYWdlID0gVHJ1ZQogICAgICAgICAgICB0aW1lLnNsZWVwKDIpCgogICAgICAgICMgQWxlcnQg dGhlIHVzZXIgdGhhdCB0aGUgZW5jb2RpbmcgcHJvY2VzcyBtYXkgdGFrZSBzb21lIHRpbWUuCiAg ICAgICAgcHJpbnQgJyAgICAgRW5jb2RpbmcgQXR0YWNobWVudCwgUGxlYXNlIFdhaXQgLi4uJwoK ICAgICAgICB3aXRoIG9wZW4oZmlsZVBhdGgsICdyYicpIGFzIGY6ICAjIEJlZ2luIHRoZSBhY3R1 YWwgZW5jb2RpbmcKICAgICAgICAgICAgZGF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mUgdGhleSBh cmUgcGFzc2VkLgogICAgIiIiCgogICAgZ2xvYmFsIHVzclByb21wdCwgcmV0U3RyaW5ncywgaW5w dXRTaG9ydHMKCiAgICBpZiB2YWxpZEFkZHJlc3ModG9BZGRyZXNzKSBpcyBGYWxzZToKICAgICAg ICB0b0FkZHJlc3MgPSBpbnB1dEFkZHJlc3MoIldoYXQgaXMgdGhlIFRvIEFkZHJlc3MgaW5kZWVk PyIpCgogICAgaWYgdmFsaWRBZGRyZXNzKGZyb21BZGRyZXNzKSBpcyBGYWxzZToKICAgICAgICB0 cnk6CiAgICAgICAgICAgIHByaW50ICcgICAgIFNlbmRlciByZXRyaXZpbmcuLi4nLCBmcm9tQWRk cmVzcwogICAgICAgICAgICByZXNwb25zZSA9IGFwaS5saXN0QWRkcmVzc2VzKCkKICAgICAgICAg ICAgaWYgIkFQSSBFcnJvciIgaW4gcmVzcG9uc2U6CiAgICAgICAgICAgICAgICByZXR1cm4gJ1xu ICAgICAnICsgcmVzcG9uc2UgKyAnXG4nCiAgICAgICAgICAgIGpzb25BZGRyZXNzZXMgPSBqc29u LmxvYWRzKHJlc3BvbnNlKQogICAgICAgICAgICBudW1BZGRyZXNzZXMgPSBsZW4oanNvbkFkZHJl c3NlcykgICMgTnVtYmVyIG9mIGFkZHJlc3NlcwogICAgICAgIGV4Y2VwdDoKICAgICAgICAgICAg cHJpbnQgJ1xuICAgICBDb25uZWN0aW9uIEVycm9yXG4nCiAgICAgICAgICAgIHVzclByb21wdCA9 IDAKICAgICAgICAgICAgbWFpbigpCiAgICAgICAgICAgIHJldHVybiAnJwoKICAgICAgICBpZiBu dW1BZGRyZXNzZXMgPiAxOiAgIyBBc2sgd2hhdCBhZGRyZXNzIHRvIHNlbmQgZnJvbSBpZiBtdWx0 aXBsZSBhZGRyZXNzZXMKICAgICAgICAgICAgZm91bmQgPSBGYWxzZQogICAgICAgICAgICB3aGls ZSBUcnVlOgogICAgICAgICAgICAgICAgcHJpbnQgJyAnCiAgICAgICAgICAgICAgICBmcm9tQWRk cmVzcyA9IHVzZXJJbnB1dCgnRW50ZXIgYW4gQWRkcmVzcyBvciBBZGRyZXNzIExhYmVsIHRvIHNl bmQgZnJvbS4nKQoKICAgICAgICAgICAgICAgIGlmIGZyb21BZGRyZXNzID09ICJleGl0IjoKICAg ICAgICAgICAgICAgICAgICB1c3JQcm9tcHQgPSAxCiAgICAgICAgICAgICAgICAgICAgbWFpbigp CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnCgogICAgICAgICAgICAgICAgZm9yIGFkZE51 bSBpbiByYW5nZSgwLCBudW1BZGRyZXNzZXMpOiAgIyBwcm9jZXNzZXMgYWxsIG9mIHRoZSBhZGRy ZXNzZXMKICAgICAgICAgICAgICAgICAgICBsYWJlbCA9IGpzb25BZGRyZXNzZXNbYWRkTnVtXVsn bGFiZWwnXQogICAgICAgICAgICAgICAgICAgIGFkZHJlc3MgPSBqc29uQWRkcmVzc2VzW2FkZE51 bV1bJ2FkZHJlc3MnXQogICAgICAgICAgICAgICAgICAgIGlmIGZyb21BZGRyZXNzID09IGxhYmVs OiAgIyBhZGRyZXNzIGVudGVyZWQgd2FzIGEgbGFiZWwgYW5kIGlzIGZvdW5kCiAgICAgICAgICAg ICAgICAgICAgICAgIGZyb21BZGRyZXNzID0gYWRkcmVzcwogICAgICAgICAgICAgICAgICAgICAg ICBmb3VuZCA9IFRydWUKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsKCiAgICAgICAgICAg ICAgICBpZiBmb3VuZCBpcyBGYWxzZToKICAgICAgICAgICAgICAgICAgICBpZiB2YWxpZEFkZHJl c3MoZnJvbUFkZHJlc3MpIGlzIEZhbHNlOgogICAgICAgICAgICAgICAgICAgICAgICBwcmludCAn XG4gICAgIEludmFsaWQgQWRkcmVzcy4gUGxlYXNlIHRyeSBhZ2Fpbi5cbicKCiAgICAgICAgICAg ICAgICAgICAgZWxzZToKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIGFkZE51bSBpbiByYW5n ZSgwLCBudW1BZGRyZXNzZXMpOiAgIyBwcm9jZXNzZXMgYWxsIG9mIHRoZSBhZGRyZXNzZXMKICAg ICAgICAgICAgICAgICAgICAgICAgICAgIGFkZHJlc3MgPSBqc29uQWRkcmVzc2VzW2FkZE51bV1b J2FkZHJlc3MnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgZnJvbUFkZHJlc3MgPT0g YWRkcmVzczogICMgYWRkcmVzcyBlbnRlcmVkIHdhcyBhIGZvdW5kIGluIG91ciBhZGRyZXNzYm9v ay4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3VuZCA9IFRydWUKICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICBicmVhawoKICAgICAgICAgICAgICAgICAgICAgICAgaWYg Zm91bmQgaXMgRmFsc2U6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmludCAnXG4gICAg IFRoZSBhZGRyZXNzIGVudGVyZWQgaXMgbm90IG9uZSBvZiB5b3Vycy4gUGxlYXNlIHRyeSBhZ2Fp bi5cbicKCiAgICAgICAgICAgICAgICBpZiBmb3VuZDoKICAgICAgICAgICAgICAgICAgICBicmVh ayAgIyBBZGRyZXNzIHdhcyBmb3VuZAoKICAgICAgICBlbHNlOiAgIyBPbmx5IG9uZSBhZGRyZXNz IGluIGFkZHJlc3MgYm9vawogICAgICAgICAgICBwcmludCAnXG4gICAgIFVzaW5nIHRoZSBvbmx5 IGFkZHJlc3MgaW4gdGhlIGFkZHJlc3Nib29rIHRvIHNlbmQgZnJvbS5cbicKICAgICAgICAgICAg ZnJvbUFkZHJlc3MgPSBqc29uQWRkcmVzc2VzWzBdWydhZGRyZXNzJ10KCiAgICBpZiBzdWJqZWN0 ID09ICcnOgogICAgICAgIHN1YmplY3QgPSB1c2VySW5wdXQoJ0VudGVyIHlvdXIgU3ViamVjdC4n KQogICAgICAgIHN1YmplY3QgPSBzdWJqZWN0LmVuY29kZSgnYmFzZTY0JykKICAgIGVsaWYgc3Vi amVjdCA9PSAnYyc6CiAgICAgICAgdXNyUHJvbXB0ID0gMQogICAgICAgIHByaW50ICcgJwogICAg ICAgIG1haW4oKQogICAgICAgIHJldHVybiAnJwoKICAgIGlmIG1lc3NhZ2UgPT0gJyc6CiAgICAg ICAgd2hpbGUgVHJ1ZToKICAgICAgICAgICAgdHJ5OgogICAgICAgICAgICAgICAgbWVzc2FnZSAr PSAnJy5qb2luKFsKICAgICAgICAgICAgICAgICAgICAnXG4nLAogICAgICAgICAgICAgICAgICAg IHJhd19pbnB1dCgnQ29udGludWUgZW50ZXIgeW91ciBtZXNzYWdlIGxpbmUgYnkgbGluZSwgZW5k IHdpdGggPENUTC1EPi5cbj4gJyksCiAgICAgICAgICAgICAgICAgICAgXSkKICAgICAgICAgICAg ZXhjZXB0IEVPRkVycm9yOgogICAgICAgICAgICAgICAgYnJlYWsKCiAgICAgICAgdUlucHV0ID0g dXNlcklucHV0KCdXb3VsZCB5b3UgbGlrZSB0byBhZGQgYW4gYXR0YWNobWVudCwgKHkpZXMgb3Ig KE4pbz8nKS5sb3dlcigpCiAgICAgICAgaWYgdUlucHV0IGluIGlucHV0U2hvcnRzWyd5ZXMnXToK ICAgICAgICAgICAgbWVzc2FnZSA9IG1lc3NhZ2UgKyAnXG5cbicgKyBhdHRhY2htZW50KCkKCiAg ICAgICAgbWVzc2FnZSA9IG1lc3NhZ2UuZW5jb2RlKCdiYXNlNjQnKQoKICAgIHRyeToKICAgICAg ICBwcmludCAnICAgICBTZW5kaW5nLi4uJywgc3ViamVjdC5kZWNvZGUoJ2Jhc2U2NCcpCiAgICAg ICAgYWNrRGF0YSA9IGFwaS5zZW5kTWVzc2FnZSh0b0FkZHJlc3MsIGZyb21BZGRyZXNzLCBzdWJq ZWN0LCBtZXNzYWdlKQogICAgICAgIGlmICJBUEkgRXJyb3IiIGluIGFja0RhdGE6CiAgICAgICAg ICAgIHJldHVybiAnICAgICAnICsgYWNrRGF0YSArICdcbicKICAgICAgICBwcmludCAnICAgICBN ZXNzYWdlIFN0YXR1czonLCBhcGkuZ2V0U3RhdHVzKGFja0RhdGEpLCAnXG4nCiAgICBleGNlcHQ6 CiAgICAgICAgcHJpbnQgJ1xuICAgICBDb25uZWN0aW9uIEVycm9yXG4nCiAgICAgICAgdXNyUHJv bXB0ID0gMAogICAgICAgIG1haW4oKQoKICAgIHJldHVybiAnJwoKCmRlZiBzZW5kQnJkKGZyb21B ZGRyZXNzLCBzdWJqZWN0LCBtZXNzYWdlKToKICAgICIiIlNlbmQgYSBicm9hZGNhc3QiIiIKCiAg ICBnbG9iYWwgdXNyUHJvbXB0LCBpbnB1dFNob3J0cwogICAgaWYgZnJvbUFkZHJlc3MgPT0gJyc6 CgogICAgICAgIHRyeToKICAgICAgICAgICAgcHJpbnQgJyAgICAgUmV0cml2aW5nLi4uJywgJ1Nl bmRlcnMnCiAgICAgICAgICAgIHJlc3BvbnNlID0gYXBpLmxpc3RBZGRyZXNzZXMoKQogICAgICAg ICAgICBpZiAiQVBJIEVycm9yIiBpbiByZXNwb25zZToKICAgICAgICAgICAgICAgIHJldHVybiAn XG4gICAgICcgKyByZXNwb25zZSArICdcbicKICAgICAgICAgICAganNvbkFkZHJlc3NlcyA9IGpz b24ubG9hZHMocmVzcG9uc2UpWydhZGRyZXNzZXMnXQogICAgICAgICAgICBudW1BZGRyZXNzZXMg PSBsZW4oanNvbkFkZHJlc3NlcykgICMgTnVtYmVyIG9mIGFkZHJlc3NlcwogICAgICAgIGV4Y2Vw dDoKICAgICAgICAgICAgcHJpbnQgJ1xuICAgICBDb25uZWN0aW9uIEVycm9yXG4nCiAgICAgICAg ICAgIHVzclByb21wdCA9IDAKICAgICAgICAgICAgbWFpbigpCiAgICAgICAgICAgIHJldHVybiAn JwoKICAgICAgICBpZiBudW1BZGRyZXNzZXMgPiAxOiAgIyBBc2sgd2hhdCBhZGRyZXNzIHRvIHNl bmQgZnJvbSBpZiBtdWx0aXBsZSBhZGRyZXNzZXMKICAgICAgICAgICAgZm91bmQgPSBGYWxzZQog ICAgICAgICAgICB3aGlsZSBUcnVlOgogICAgICAgICAgICAgICAgZnJvbUFkZHJlc3MgPSB1c2Vy SW5wdXQoJ0VudGVyIGFuIEFkZHJlc3Mgb3IgQWRkcmVzcyBMYWJlbCB0byBzZW5kIGZyb20uJykK CiAgICAgICAgICAgICAgICBpZiBmcm9tQWRkcmVzcyA9PSAiZXhpdCI6CiAgICAgICAgICAgICAg ICAgICAgdXNyUHJvbXB0ID0gMQogICAgICAgICAgICAgICAgICAgIG1haW4oKQogICAgICAgICAg ICAgICAgICAgIHJldHVybiAnJwoKICAgICAgICAgICAgICAgIGZvciBhZGROdW0gaW4gcmFuZ2Uo MCwgbnVtQWRkcmVzc2VzKTogICMgcHJvY2Vzc2VzIGFsbCBvZiB0aGUgYWRkcmVzc2VzCiAgICAg ICAgICAgICAgICAgICAgbGFiZWwgPSBqc29uQWRkcmVzc2VzW2FkZE51bV1bJ2xhYmVsJ10KICAg ICAgICAgICAgICAgICAgICBhZGRyZXNzID0ganNvbkFkZHJlc3Nlc1thZGROdW1dWydhZGRyZXNz J10KICAgICAgICAgICAgICAgICAgICBpZiBmcm9tQWRkcmVzcyA9PSBsYWJlbDogICMgYWRkcmVz cyBlbnRlcmVkIHdhcyBhIGxhYmVsIGFuZCBpcyBmb3VuZAogICAgICAgICAgICAgICAgICAgICAg ICBmcm9tQWRkcmVzcyA9IGFkZHJlc3MKICAgICAgICAgICAgICAgICAgICAgICAgZm91bmQgPSBU cnVlCiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrCgogICAgICAgICAgICAgICAgaWYgZm91 bmQgaXMgRmFsc2U6CiAgICAgICAgICAgICAgICAgICAgaWYgdmFsaWRBZGRyZXNzKGZyb21BZGRy ZXNzKSBpcyBGYWxzZToKICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnQgJ1xuICAgICBJbnZh bGlkIEFkZHJlc3MuIFBsZWFzZSB0cnkgYWdhaW4uXG4nCgogICAgICAgICAgICAgICAgICAgIGVs c2U6CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciBhZGROdW0gaW4gcmFuZ2UoMCwgbnVtQWRk cmVzc2VzKTogICMgcHJvY2Vzc2VzIGFsbCBvZiB0aGUgYWRkcmVzc2VzCiAgICAgICAgICAgICAg ICAgICAgICAgICAgICBhZGRyZXNzID0ganNvbkFkZHJlc3Nlc1thZGROdW1dWydhZGRyZXNzJ10K ICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIGZyb21BZGRyZXNzID09IGFkZHJlc3M6ICAj IGFkZHJlc3MgZW50ZXJlZCB3YXMgYSBmb3VuZCBpbiBvdXIgYWRkcmVzc2Jvb2suCiAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgZm91bmQgPSBUcnVlCiAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgYnJlYWsKCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIGZvdW5kIGlzIEZh bHNlOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnQgJ1xuICAgICBUaGUgYWRkcmVz cyBlbnRlcmVkIGlzIG5vdCBvbmUgb2YgeW91cnMuIFBsZWFzZSB0cnkgYWdhaW4uXG4nCgogICAg ICAgICAgICAgICAgaWYgZm91bmQ6CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgICMgQWRkcmVz cyB3YXMgZm91bmQKCiAgICAgICAgZWxzZTogICMgT25seSBvbmUgYWRkcmVzcyBpbiBhZGRyZXNz IGJvb2sKICAgICAgICAgICAgcHJpbnQgJyAgICAgVXNpbmcgdGhlIG9ubHkgYWRkcmVzcyBpbiB0 aGUgYWRkcmVzc2Jvb2sgdG8gc2VuZCBmcm9tLlxuJwogICAgICAgICAgICBmcm9tQWRkcmVzcyA9 IGpzb25BZGRyZXNzZXNbMF1bJ2FkZHJlc3MnXQoKICAgIGlmIHN1YmplY3QgPT0gJyc6CiAgICAg ICAgc3ViamVjdCA9IHVzZXJJbnB1dCgnRW50ZXIgeW91ciBTdWJqZWN0LicpCiAgICAgICAgc3Vi amVjdCA9IHN1YmplY3QuZW5jb2RlKCdiYXNlNjQnKQogICAgaWYgbWVzc2FnZSA9PSAnJzoKICAg ICAgICB3aGlsZSBUcnVlOgogICAgICAgICAgICB0cnk6CiAgICAgICAgICAgICAgICBtZXNzYWdl ICs9ICcnLmpvaW4oWwogICAgICAgICAgICAgICAgICAgICdcbicsCiAgICAgICAgICAgICAgICAg ICAgcmF3X2lucHV0KCdDb250aW51ZSBlbnRlciB5b3VyIG1lc3NhZ2UgbGluZSBieSBsaW5lLCBl bmQgd2l0aCA8Q1RMLUQ+LlxuPiAnKSwKICAgICAgICAgICAgICAgICAgICBdKQogICAgICAgICAg ICBleGNlcHQgRU9GRXJyb3I6CiAgICAgICAgICAgICAgICBicmVhawoKICAgICAgICB1SW5wdXQg PSB1c2VySW5wdXQoJ1dvdWxkIHlvdSBsaWtlIHRvIGFkZCBhbiBhdHRhY2htZW50LCAoeSllcyBv ciAoTilvPycpLmxvd2VyKCkKICAgICAgICBpZiB1SW5wdXQgaW4gaW5wdXRTaG9ydHNbJ3llcydd OgogICAgICAgICAgICBtZXNzYWdlID0gbWVzc2FnZSArICdcblxuJyArIGF0dGFjaG1lbnQoKQoK ICAgICAgICBtZXNzYWdlID0gbWVzc2FnZS5lbmNvZGUoJ2Jhc2U2NCcpCgogICAgdHJ5OgogICAg ICAgIHByaW50ICcgICAgIEJyb2FkY2FzdCBtZXNzYWdlIHNlbmRpbmcuLi4nCiAgICAgICAgcmVz cG9uc2UgPSBhcGkuc2VuZEJyb2FkY2FzdChmcm9tQWRkcmVzcywgc3ViamVjdCwgbWVzc2FnZSkK ICAgICAgICBpZiAiQVBJIEVycm9yIiBpbiByZXNwb25zZToKICAgICAgICAgICAgcmV0dXJuICdc biAgICAgJyArIHJlc3BvbnNlICsgJ1xuJwogICAgICAgIHByaW50ICcgICAgIERlY29kaW5nIHJl cGxpZWQgYWNrRGF0YS4uLicKICAgICAgICBzdGF0dXMgPSBhcGkuZ2V0U3RhdHVzKHJlc3BvbnNl KQogICAgICAgIGlmICJBUEkgRXJyb3IiIGluIHN0YXR1czoKICAgICAgICAgICAgcmV0dXJuICdc biAgICAgJyArIHN0YXR1cyArICdcbicKICAgIGV4Y2VwdDoKICAgICAgICBwcmludCAnXG4gICAg IENvbm5lY3Rpb24gRXJyb3JcbicKICAgICAgICB1c3JQcm9tcHQgPSAwCiAgICAgICAgbWFpbigp CiAgICAgICAgcmV0dXJuICcnCgogICAgcHJpbnQgJyAgICAgTWVzc2FnZSBTdGF0dXM6Jywgc3Rh dHVzLCAnXG4nCgogICAgcmV0dXJuICcnCgoKZGVmIGluYm94KHVucmVhZE9ubHk9RmFsc2UsIHBh Z2VOdW09MjApOgogICAgIiIiTGlzdHMgdGhlIG1lc3NhZ2VzIGJ5OiBtZXNzYWdlIGluZGV4LCBU byBBZGRyZXNzIExhYmVsLCBGcm9tIEFkZHJlc3MgTGFiZWwsIFN1YmplY3QsIFJlY2VpdmVkIFRp bWUpIiIiCgogICAgZ2xvYmFsIHVzclByb21wdAogICAgdHJ5OgogICAgICAgIHByaW50ICcgICAg IEluYm94IGluZGV4IGZldGNoaW5nLi4uJwogICAgICAgIHJlc3BvbnNlID0gYXBpLmdldEFsbElu Ym94TWVzc2FnZUlEcygpCiAgICAgICAgaWYgIkFQSSBFcnJvciIgaW4gcmVzcG9uc2U6CiAgICAg ICAgICAgIHJldHVybiAnXG4gICAgICcgKyByZXNwb25zZSArICdcbicKICAgICAgICBtZXNzYWdl SWRzID0ganNvbi5sb2FkcyhyZXNwb25zZSlbJ2luYm94TWVzc2FnZUlkcyddCiAgICAgICAgbnVt TWVzc2FnZXMgPSBsZW4obWVzc2FnZUlkcykKICAgIGV4Y2VwdDoKICAgICAgICBwcmludCAnXG4g ICAgIENvbm5lY3Rpb24gRXJyb3JcbicKICAgICAgICB1c3JQcm9tcHQgPSAwCiAgICAgICAgbWFp bigpCiAgICAgICAgcmV0dXJuICcnCgogICAgbWVzc2Fn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ICAgICAgICAgICAgICBwcmludCAnICAgICBNZXNzYWdlIElEOicsIG1lc3NhZ2Vb J21zZ2lkJ10KICAgICAgICAgICAgICAgIHByaW50ICcgICAgIFJlYWQ6JywgbWVzc2FnZVsncmVh ZCddCiAgICAgICAgICAgICAgICBwcmludCAnICAgICBUbzonLCBnZXRMYWJlbEZvckFkZHJlc3Mo bWVzc2FnZVsndG9BZGRyZXNzJ10pICAjIEdldCB0aGUgdG8gYWRkcmVzcwogICAgICAgICAgICAg ICAgcHJpbnQgJyAgICAgRnJvbTonLCBnZXRMYWJlbEZvckFkZHJlc3MobWVzc2FnZVsnZnJvbUFk ZHJlc3MnXSkgICMgR2V0IHRoZSBmcm9tIGFkZHJlc3MKICAgICAgICAgICAgICAgIHByaW50ICcg ICAgIFN1YmplY3Q6JywgbWVzc2FnZVsnc3ViamVjdCddLmRlY29kZSgnYmFzZTY0JykgICMgR2V0 IHRoZSBzdWJqZWN0CiAgICAgICAgICAgICAgICBwcmludCAnICAgICBSZWNlaXZlZDonLCBkYXRl dGltZS5kYXRldGltZS5mcm9tdGltZXN0YW1wKGZsb2F0KG1lc3NhZ2VbJ3JlY2VpdmVkVGltZSdd KSkuc3RyZnRpbWUoJyVZLSVtLSVkICVIOiVNOiVTJykKICAgICAgICAgICAgICAgIHByaW50ICcg

Latest broadcasts

Address Last message