'''
Created on 10-07-2012

@author: pawelb
'''

import sys
sys.path.append("/opt/hsn2/python/commlib")
from hsn2service import HSN2Service
from hsn2pcapanalyzetaskprocessor import PcapAnalyzeTaskProcessor
from hsn2service import startService
from os import access
from os import path
import logging


class PcapAnalyzeService(HSN2Service):
	serviceName = "pcap-analyze"
	description = "HSN 2 PCAP analyze Service"


	def extraOptions(self, parser):
		'''Arguments specific to this service. Receives a parser with the standard options. Returns a modified parser.'''
		return parser

	def sanityChecks(self, cliargs):
		return HSN2Service.sanityChecks(self, cliargs)

if __name__ == '__main__':
	startService(PcapAnalyzeService, PcapAnalyzeTaskProcessor)
'''
Created on 10-07-2012

@author: pawelb
'''

import sys
sys.path.append("/opt/hsn2/python/commlib")
from hsn2service import HSN2Service
from hsn2pcapextracttaskprocessor import PcapExtractTaskProcessor
from hsn2service import startService
from os import access
from os import path
import logging


class PcapExtractService(HSN2Service):
	serviceName = "pcap-extract"
	description = "HSN 2 PCAP extract Service"


	def extraOptions(self,parser):
		'''Arguments specific to this service. Receives a parser with the standard options. Returns a modified parser.'''
		return parser

	def sanityChecks(self, cliargs):
		return HSN2Service.sanityChecks(self, cliargs)

if __name__ == '__main__':
	startService(PcapExtractService, PcapExtractTaskProcessor)
sys.path.append("/opt/hsn2/python/commlib")
from hsn2service import HSN2Service
from hsn2peepdftaskprocessor import peepdfTaskProcessor
from hsn2service import startService
from os import access
from os import path
import logging

class peepdfService(HSN2Service):
	'''
	This is the HSN2 service which utilizes the Peepdf Python low-interaction honeyclient.
	'''

	serviceName = "peepdf"
	description = "HSN 2 Peepdf Service"

	def extraOptions(self,parser):
		'''Arguments specific to this service. Receives a parser with the standard options. Returns a modified parser.'''
		return parser

	def sanityChecks(self, cliargs):
		passed = HSN2Service.sanityChecks(self, cliargs)
		try:
			from PDFCore import PDFParser
		except ImportError:
			passed = False
		return passed

if __name__ == '__main__':
	startService(peepdfService,peepdfTaskProcessor)
@author: wojciechm
'''

class CuckooService(HSN2Service):
	serviceName = "cuckoo"
	description = "HSN 2 Cuckoo Service"

	'''
	This is the HSN2 service which utilizes the Cuckoo sandbox.
	'''

	def extraOptions(self, parser):
		'''Arguments specific to this service. Receives a parser with the standard options. Returns a modified parser.'''
		parser.add_argument('--cuckoo', '-C', action = 'store', help = 'path to the cuckoo directory', default = "/opt/cuckoo", required = False, dest = 'cuckoo')
		parser.add_argument('--timeout', '-t', action = 'store', help = 'path to the cuckoo directory', type = int , default = 900, required = False, dest = 'timeout')
		return parser

	def sanityChecks(self, cliargs):
		passed = HSN2Service.sanityChecks(self, cliargs)
		if not path.isdir(cliargs.cuckoo):
			logging.error("'%s' is not a dir" % cliargs.cuckoo)
			passed = False
		else:
			if not path.isfile(path.join(cliargs.cuckoo, "cuckoo.py")):
				logging.error("'%s' is not a file" % path.join(cliargs.cuckoo, "cuckoo.py"))
				passed = False
		return passed

if __name__ == '__main__':
	startService(CuckooService, CuckooTaskProcessor)