id: api-sendgrid

info:
  name: Sendgrid API Test
  author: zzeitlin
  severity: info
  reference:
    - https://docs.sendgrid.com/for-developers/sending-email/getting-started-smtp
  metadata:
    max-request: 1
  tags: token-spray,sendgrid

self-contained: true
tcp:
  - inputs:
      - data: "ehlo\r\n"
        read: 1024

      - data: "AUTH PLAIN {{base64(hex_decode('00')+'apikey'+hex_decode('00')+token)}}\r\n"
        read: 1024
    host:
      - "tls://smtp.sendgrid.net:465"
    matchers:
      - type: word
        words:
          - "Authentication successful"

# digest: 4b0a004830460221008e0e74cc516e39557ab0c6778b54c5057b78391e494874ccb1cb0affe9888d67022100892b564dc499c64d59217eb15a6fdecdf2c0b5873366ee7093b857e2a2b43e92:922c64590222798bb761d5b6d8e72950
