#!/usr/bin/env python3

import socket, ssl, base64

HOSTNAME, PORT = 'imap-mail.outlook.com', 993

USER = 'mazafaka14@hotmail.com'
TOKEN = 'abracadabra'

AUTH = base64.b64encode('user={}\x01auth=Bearer {}\x01\x01'.format(USER, TOKEN).encode('ascii'))

with socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) as s:
    with ssl.SSLContext().wrap_socket(s) as ss:
        ss.connect((HOSTNAME, PORT))
        print(ss.recv().decode())

        ss.sendall(b'1 AUTHENTICATE XOAUTH2 {}\r\n'.fomat(AUTH))
        print(ss.recv().decode())

        ss.sendall(b'2 LIST "" ""\r\n')
        print(ss.recv().decode())

280e8621889d7fc7493c3516d1354bdff02ab0f1
<mask token>

<mask token>
with socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) as s:
    with ssl.SSLContext().wrap_socket(s) as ss:
        ss.connect((HOSTNAME, PORT))
        print(ss.recv().decode())
        ss.sendall(b'1 AUTHENTICATE XOAUTH2 {}\r\n'.fomat(AUTH))
        print(ss.recv().decode())
        ss.sendall(b'2 LIST "" ""\r\n')
        print(ss.recv().decode())

<mask token>
HOSTNAME, PORT = 'imap-mail.outlook.com', 993
USER = 'mazafaka14@hotmail.com'
TOKEN = 'abracadabra'
AUTH = base64.b64encode('user={}\x01auth=Bearer {}\x01\x01'.format(USER,
    TOKEN).encode('ascii'))
with socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) as s:
    with ssl.SSLContext().wrap_socket(s) as ss:
        ss.connect((HOSTNAME, PORT))
        print(ss.recv().decode())
        ss.sendall(b'1 AUTHENTICATE XOAUTH2 {}\r\n'.fomat(AUTH))
        print(ss.recv().decode())
        ss.sendall(b'2 LIST "" ""\r\n')
        print(ss.recv().decode())

import socket, ssl, base64
HOSTNAME, PORT = 'imap-mail.outlook.com', 993
USER = 'mazafaka14@hotmail.com'
TOKEN = 'abracadabra'
AUTH = base64.b64encode('user={}\x01auth=Bearer {}\x01\x01'.format(USER,
    TOKEN).encode('ascii'))
with socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) as s:
    with ssl.SSLContext().wrap_socket(s) as ss:
        ss.connect((HOSTNAME, PORT))
        print(ss.recv().decode())
        ss.sendall(b'1 AUTHENTICATE XOAUTH2 {}\r\n'.fomat(AUTH))
        print(ss.recv().decode())
        ss.sendall(b'2 LIST "" ""\r\n')
        print(ss.recv().decode())

#!/usr/bin/env python3

import socket, ssl, base64

HOSTNAME, PORT = 'imap-mail.outlook.com', 993

USER = 'mazafaka14@hotmail.com'
TOKEN = 'abracadabra'

AUTH = base64.b64encode('user={}\x01auth=Bearer {}\x01\x01'.format(USER, TOKEN).encode('ascii'))

with socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) as s:
    with ssl.SSLContext().wrap_socket(s) as ss:
        ss.connect((HOSTNAME, PORT))
        print(ss.recv().decode())

        ss.sendall(b'1 AUTHENTICATE XOAUTH2 {}\r\n'.fomat(AUTH))
        print(ss.recv().decode())

        ss.sendall(b'2 LIST "" ""\r\n')
        print(ss.recv().decode())
