{"id":1195,"date":"2022-08-19T10:33:50","date_gmt":"2022-08-19T08:33:50","guid":{"rendered":"http:\/\/dety.net.ua\/?p=1195"},"modified":"2022-08-19T10:33:50","modified_gmt":"2022-08-19T08:33:50","slug":"test-smtp-ntlm-auth-with-telnet-hint","status":"publish","type":"post","link":"https:\/\/dety.net.ua\/?p=1195","title":{"rendered":"Test SMTP NTLM AUTH with TELNET + hint"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The process:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>220 server.local.com Microsoft ESMTP MAIL Service ready at Thu, 18 Aug 2022 08:13:52 -0700\n<strong>helo<\/strong>\n250 server.local.com Hello &#91;2.12.2.14]\n<strong>ehlo<\/strong>\n250-server.local.com Hello &#91;2.12.2.14]\n250-SIZE 37748736\n250-PIPELINING\n250-DSN\n250-ENHANCEDSTATUSCODES\n250-STARTTLS\n250-X-ANONYMOUSTLS\n250-AUTH NTLM LOGIN\n250-X-EXPS GSSAPI NTLM\n250-8BITMIME\n250-BINARYMIME\n250-CHUNKING\n250-SMTPUTF8\n250 XRDST\n<strong>AUTH LOGIN<\/strong>\n334 VXNlcm5hbWU6\n<strong>hidden base64 username<\/strong>\n334 UGFzc3dvcmQ6\n<strong>hidden base64 password<\/strong>\n235 2.7.0 Authentication successful\n<strong>mail from:user@local.com<\/strong>\n250 2.1.0 Sender OK\n<strong>rcpt to:admin@local.com<\/strong>\n250 2.1.5 Recipient OK\n<strong>data<\/strong>\n354 Start mail input; end with &lt;CRLF>.&lt;CRLF>\n<strong>test\n.<\/strong>\n250 2.6.0 &lt;792e2375-0efd-4232-8b7c-51802a1a3b45@server.local.com> &#91;InternalId=21350282428684, Hostname=server.local.com] 1360 bytes in 2.929, 0.453 KB\/sec Queued mail for delivery\n<strong>quit<\/strong>\n221 2.0.0 Service closing transmission channel\n\n\nConnection to host lost.<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Notice: the base64 linux and windows encoding are different.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The command to encode in powershell: <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">[System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.<a href=\"https:\/\/uatrac.akvelon.net\/IFST\/wiki\/GetBytes\">GetBytes<\/a>(&#8220;password&#8221;))<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">hint: https:\/\/stackoverflow.com\/questions\/37996640\/how-can-i-base64-encode-a-string-on-linux-so-it-matches-windows-unicode-getbyte<a href=\"https:\/\/stackoverflow.com\/questions\/37996640\/how-can-i-base64-encode-a-string-on-linux-so-it-matches-windows-unicode-getbyte\">https:\/\/stackoverflow.com\/questions\/37996640\/how-can-i-base64-encode-a-string-on-linux-so-it-matches-windows-unicode-getbyte<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you plan to bring a string encoded in Powershell into Linux then do the following, first encode in Powershell<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$string = \"That's no moon!\"\n&#91;system.convert]::ToBase64String(&#91;System.Text.Encoding]::unicode.getbytes($String))\n\nVABoAGEAdAAnAHMAIABuAG8AIABtAG8AbwBuACEA\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then in Linux do the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>echo VABoAGEAdAAnAHMAIABuAG8AIABtAG8AbwBuACEA | base64 -d | iconv -f utf-16 -t utf-8; echo\n\nThat's no moon!\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The process: Notice: the base64 linux and windows encoding are different. The command to encode in powershell: [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes(&#8220;password&#8221;)) hint: https:\/\/stackoverflow.com\/questions\/37996640\/how-can-i-base64-encode-a-string-on-linux-so-it-matches-windows-unicode-getbytehttps:\/\/stackoverflow.com\/questions\/37996640\/how-can-i-base64-encode-a-string-on-linux-so-it-matches-windows-unicode-getbyte If you plan to bring a string encoded in Powershell into Linux then do the following, first encode in Powershell Then in Linux do the following:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1195","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/posts\/1195","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dety.net.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1195"}],"version-history":[{"count":1,"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/posts\/1195\/revisions"}],"predecessor-version":[{"id":1196,"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/posts\/1195\/revisions\/1196"}],"wp:attachment":[{"href":"https:\/\/dety.net.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1195"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dety.net.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1195"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dety.net.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}