<reponame>Rasoul-Jahanshahi/Hardware_Performance_Counters_Can_Detect_Malware_Myth_or_Fact
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 15 00:21:16 2017

@author: bobzhou
"""

#!/usr/bin/env python
import pika, os, socket
from multiprocessing import Process

def child(body):
	os.system(body)

if __name__ == '__main__':
	heartbeat_interval = 0
	connection = pika.BlockingConnection(pika.ConnectionParameters(
	        host='192.168.1.2', port=5672, heartbeat_interval=heartbeat_interval))
	print 'heartbeat_interval is ' + str(heartbeat_interval)
	
	channel = connection.channel()

	channel.queue_declare(queue='intel_queue', durable=True)
	print(' [*] Waiting for messages. To exit press CTRL+C')


	def callback(ch, method, properties, body):
	    print(" [x] Received %r" % body)
	    p = Process(target=child, args=(body,))
	    p.start()
	    ch.basic_ack(delivery_tag = method.delivery_tag)
	    print(" [x] Done")
	    p.join()

	#channel.basic_qos(prefetch_count=1)
	channel.basic_consume(callback,
	                      queue='intel_queue')

	channel.start_consuming()
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 15 00:21:16 2017

@author: bobzhou
"""

#!/usr/bin/env python
import pika, os, socket
from multiprocessing import Process

def child(body):
	os.system(body)

if __name__ == '__main__':
	heartbeat_interval = 0
	connection = pika.BlockingConnection(pika.ConnectionParameters(
	        host='192.168.1.2', port=5672, heartbeat_interval=heartbeat_interval))
	print 'heartbeat_interval is ' + str(heartbeat_interval)
	
	channel = connection.channel()

	channel.queue_declare(queue='intel_queue', durable=True)
	print(' [*] Waiting for messages. To exit press CTRL+C')


	def callback(ch, method, properties, body):
	    print(" [x] Received %r" % body)
	    p = Process(target=child, args=(body,))
	    p.start()
	    ch.basic_ack(delivery_tag = method.delivery_tag)
	    print(" [x] Done")
	    p.join()

	#channel.basic_qos(prefetch_count=1)
	channel.basic_consume(callback,
	                      queue='intel_queue')

	channel.start_consuming()
# -*- coding: utf-8 -*- Created on Wed Mar 15 00:21:16 2017
 
 @author: bobzhou #!/usr/bin/env python #channel.basic_qos(prefetch_count=1)