def test_intermediate_function( self ) :


		stego_conf = """
		X:_data_:
		Y:_data_:
		Z:_data_:

		simple='''4142XXXXXXXXYYYYYYYY4344'''

		simple_alt='''41420000000000000000XXXX'''
			"""

		orch1 = StegoOrchestrator( "a", stego_conf, "simple", hex_inject = True, streams = ['main'] )
		chunks = orch1.readyMessage( "a", 'main' )
	def setUp(self) :

		self.orch1 = StegoOrchestrator( "a", self.stego_conf, "simple", streams = ['main'] )
		self.orch2 = StegoOrchestrator( "a", self.stego_conf, "simple", streams = ['main'], reverse = True )

		self.orch3 = StegoOrchestrator( "a", self.stego_conf, "simple", self.alt_configuration, streams = ['main'])
		self.orch4 = StegoOrchestrator( "a", self.stego_conf, "simple", self.alt_configuration, streams = ['main'], reverse = True )
Exemplo n.º 3
0
    ret = client_socket.recv(2048)  # Get the HTTP response
    client_socket = None  # The socket will be closed by the HTTP Server
    same_con = False  # unblock the 'send' function to start a new HTTP transaction
    return ret


#==========================================================================

#=============================Handler Creation=============================

passphrase = "App1e5&0raNg3s"  # This is used to generate encryption keys
orch = StegoOrchestrator(
    passphrase,
    stego_config=stego_config,
    main_template="resp",  # The template to be used
    hex_inject=True,  # Inject data in template in hex mode
    reverse=
    True,  # For 2 Orchestrator objects to be compatible one must have 'reverse = True'
    streams=['heartbeat'],
)

handler = ShellHandler(recv, send, orch)

#==========================================================================

# Wait forever as all used threads are daemonized
while True:
    sleep(10)

    #	Magic!
Exemplo n.º 4
0
    global client
    while not client:
        continue  # Wait until there is a client
    client.send(raw)  # Send the data through the socket
    client.shutdown(socket.SHUT_RDWR)  #	Terminate the Socket


#==========================================================================

#=============================Handler Creation============================

passphrase = "zxcvbn2ZXCVBN"  # This is used to generate encryption keys
orch = StegoOrchestrator(
    passphrase,
    stego_config=stego_config,
    main_template="resp",  # The template to be used
    hex_inject=True,  # Inject data in template in hex mode
    streams=['heartbeat'],
)
handler = MyHandler(
    recv, send,
    orch)  # Instantiate the Handler Object using the network wrappers


def serveForever():
    global client
    global client_addr
    while True:  # Make it listen `hard`
        client_new, client_addr = server_socket.accept()
        client = client_new
class Test_StegoOrchestrator( unittest.TestCase ) :


	alt_configuration = [( ('simple_alt:X','simple_alt:X'),('!H','!H'), '_data_+1' )]

	stego_conf = """
X:_data_:
Y:_data_:
Z:_data_:

simple='''4142XXXXXXXXYYYYYYYY4344'''

simple_alt='''41420000000000000000XXXX'''
	"""


	def setUp(self) :

		self.orch1 = StegoOrchestrator( "a", self.stego_conf, "simple", streams = ['main'] )
		self.orch2 = StegoOrchestrator( "a", self.stego_conf, "simple", streams = ['main'], reverse = True )

		self.orch3 = StegoOrchestrator( "a", self.stego_conf, "simple", self.alt_configuration, streams = ['main'])
		self.orch4 = StegoOrchestrator( "a", self.stego_conf, "simple", self.alt_configuration, streams = ['main'], reverse = True )


	def test_functionality( self, n = 30, l = 40 ) :

		for i in range(n) :

			ldata = randint(1,l)
			data = urandom( ldata )

			chunks = self.orch1.readyMessage( data, 'main' )
			# print chunks[0].encode('hex')

			for chunk in chunks :
				stream, message = self.orch2.depositChunk( chunk )
				# print stream, chunk, message
				assert stream != None

			# print message.encode('hex'), data.encode('hex')
			self.assertTrue( data == message )



	def test_transformation( self ) :

		data = "0"*5

		chunks = self.orch3.readyMessage( data, 'main' )
		# print chunks[0].encode('hex')

		for chunk in chunks :
			stream, message = self.orch2.depositChunk( chunk )
			# print chunk
			self.assertTrue( chunk.encode('hex')[-4:] == '4345' )	# Testing the alteration

			# print stream ,message
		self.assertTrue( data == message )




	def test_intermediate_function( self ) :


		stego_conf = """
		X:_data_:
		Y:_data_:
		Z:_data_:

		simple='''4142XXXXXXXXYYYYYYYY4344'''

		simple_alt='''41420000000000000000XXXX'''
			"""

		orch1 = StegoOrchestrator( "a", stego_conf, "simple", hex_inject = True, streams = ['main'] )
		chunks = orch1.readyMessage( "a", 'main' )