# Path: beeswarm/drones/client/baits/clientbase.py
# class ClientBase(object):
#     """ Base class for Bees. This should only be used after sub-classing. """
# 
#     def __init__(self, options):
#         """
#             Initializes common values.
#         :param sessions: A dict which is updated every time a new session is created.
#         :param options: A dict containing the options entry for this bait
#         """
#         self.options = options
#         self.sessions = {}
# 
#     def create_session(self, server_host, server_port, honeypot_id):
#         """
#             Creates a new session.
# 
#         :param server_host: IP address of the server
#         :param server_port: Server port
#         :return: A new `BaitSession` object.
#         """
#         protocol = self.__class__.__name__.lower()
#         session = BaitSession(protocol, server_host, server_port, honeypot_id)
#         self.sessions[session.id] = session
#         return session
# 
#     def close_session(self, session):
#         session.end_session()
#         if session.id in self.sessions:
#             del self.sessions[session]
#         else:
#             assert False
# 
# Path: beeswarm/shared/misc/rfbes.py
# class RFBDes(pyDes.des):
#     def setKey(self, key):
#         """RFB protocol for authentication requires client to encrypt
#            challenge sent by server with password using DES method. However,
#            bits in each byte of the password are put in reverse order before
#            using it as encryption key."""
#         newkey = []
#         for ki in range(len(key)):
#             bsrc = ord(key[ki])
#             btgt = 0
#             for i in range(8):
#                 if bsrc & (1 << i):
#                     btgt = btgt | (1 << 7 - i)
#             newkey.append(chr(btgt))
#         super(RFBDes, self).setKey(newkey)


import logging
import socket
from beeswarm.drones.client.baits.clientbase import ClientBase
from beeswarm.shared.vnc_constants import *
from beeswarm.shared.misc.rfbes import RFBDes
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Aniket Panse <contact@aniketpanse.in> grants Johnny Vestergaard <jkv@unixcluster.dk>
# a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
# copyright license to reproduce, prepare derivative works of, publicly
# display, publicly perform, sublicense, relicense, and distribute [the] Contributions
# and such derivative works.




logger = logging.getLogger(__name__)


class Vnc(ClientBase):
    def __init__(self, options):
        super(Vnc, self).__init__(options)


# Path: beeswarm/drones/client/baits/clientbase.py
# class ClientBase(object):
#     """ Base class for Bees. This should only be used after sub-classing. """
# 
#     def __init__(self, options):
#         """
#             Initializes common values.
#         :param sessions: A dict which is updated every time a new session is created.
#         :param options: A dict containing the options entry for this bait
#         """
#         self.options = options
#         self.sessions = {}
# 
#     def create_session(self, server_host, server_port, honeypot_id):
#         """
#             Creates a new session.
# 
#         :param server_host: IP address of the server
#         :param server_port: Server port
#         :return: A new `BaitSession` object.
#         """
#         protocol = self.__class__.__name__.lower()
#         session = BaitSession(protocol, server_host, server_port, honeypot_id)
#         self.sessions[session.id] = session
#         return session
# 
#     def close_session(self, session):
#         session.end_session()
#         if session.id in self.sessions:
#             del self.sessions[session]
#         else:
#             assert False
# 
# Path: beeswarm/shared/misc/rfbes.py
# class RFBDes(pyDes.des):
#     def setKey(self, key):
#         """RFB protocol for authentication requires client to encrypt
#            challenge sent by server with password using DES method. However,
#            bits in each byte of the password are put in reverse order before
#            using it as encryption key."""
#         newkey = []
#         for ki in range(len(key)):
#             bsrc = ord(key[ki])
#             btgt = 0
#             for i in range(8):
#                 if bsrc & (1 << i):
#                     btgt = btgt | (1 << 7 - i)
#             newkey.append(chr(btgt))
#         super(RFBDes, self).setKey(newkey)


# Path: beeswarm/drones/client/baits/vnc.py
import logging
import socket
from beeswarm.drones.client.baits.clientbase import ClientBase
from beeswarm.shared.vnc_constants import *
from beeswarm.shared.misc.rfbes import RFBDes

#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Aniket Panse <contact@aniketpanse.in> grants Johnny Vestergaard <jkv@unixcluster.dk>
# a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
# copyright license to reproduce, prepare derivative works of, publicly
# display, publicly perform, sublicense, relicense, and distribute [the] Contributions
# and such derivative works.




logger = logging.getLogger(__name__)


class Vnc(ClientBase):
    def __init__(self, options):
        super(Vnc, self).__init__(options)


    def start(self):