id: api-mailchimp

info:
  name: Mailchimp API Test
  author: zzeitlin
  severity: info
  reference:
    - https://mailchimp.com/developer/transactional/docs/smtp-integration/#credentials-and-configuration
  metadata:
    max-request: 1
  tags: token-spray,mailchimp,tcp

self-contained: true

flow: |
  if (template["token"]) {
    tcp();
  }

tcp:
  - inputs:
      - data: "AUTH PLAIN {{base64(hex_decode('00')+'apikey'+hex_decode('00')+token)}}\r\n"
        read: 1024
    host:
      - "tls://smtp.mandrillapp.com:465"
    matchers:
      - type: word
        words:
          - "success"
# digest: 490a0046304402205697b23f38dc9148190b9144455a2931ef17923f141771d477a35d6624e30b490220304f8a94287ca342ec035d63047c9ed7144a069e52bc1f9f53b9099ca796eabd:922c64590222798bb761d5b6d8e72950