def initTTS(self, backendClass=None, changed=False): if not backendClass: backendClass = backends.getBackend() provider = self.setBackend(backendClass()) self.backendProvider = provider self.updateInterval() module_logger.info('Backend: %s' % provider)
def setup(): GPIO.setmode(GPIO.BOARD) # use PHYSICAL GPIO Numbering GPIO.setup(ledPin, GPIO.OUT) # set the ledPin to OUTPUT mode GPIO.output(ledPin, GPIO.LOW) # make ledPin output LOW level print('using pin%d' % ledPin) backend_name = "binary-text" if len(sys.argv) >= 3: backend_name = sys.argv[2] return backends.getBackend(backend_name)(TIME_UNIT)
def setup(): global adc if (adc.detectI2C(0x48)): # Detect the pcf8591. adc = PCF8591() elif (adc.detectI2C(0x4b)): # Detect the ads7830 adc = ADS7830() else: print( "No correct I2C address found, \n" "Please use command 'i2cdetect -y 1' to check the I2C address! \n" "Program Exit. \n") exit(-1) backend_name = "binary-text" if len(sys.argv) >= 3: backend_name = sys.argv[2] return backends.getBackend(backend_name)(TIME_UNIT)
except OSError as e: print("Failed to open Sigma configuration file %s: %s" % (conffile, str(e)), file=sys.stderr) except yaml.parser.ParserError as e: print("Sigma configuration file %s is no valid YAML: %s" % (conffile, str(e)), file=sys.stderr) except SigmaParseError as e: print("Sigma configuration parse error in %s: %s" % (conffile, str(e)), file=sys.stderr) backend_options = backends.BackendOptions(cmdargs.backend_option) try: backend = backends.getBackend(cmdargs.target)(sigmaconfig, backend_options, cmdargs.output) except LookupError as e: print("Backend not found!", file=sys.stderr) sys.exit(2) except IOError: print("Failed to open output file '%s': %s" % (cmdargs.output, str(e)), file=sys.stderr) exit(1) error = 0 for sigmafile in get_inputs(cmdargs.inputs, cmdargs.recurse): print_verbose("* Processing Sigma input %s" % (sigmafile)) try: f = sigmafile.open() parser = SigmaParser(f, sigmaconfig) print_debug("Parsed YAML:\n", json.dumps(parser.parsedyaml, indent=2))
def setup(): backend_name = "binary-text" if len(sys.argv) >= 3: backend_name = sys.argv[2] return backends.getBackend(backend_name)(TIME_UNIT)
sigmaconfig = SigmaConfiguration() if cmdargs.config: try: conffile = cmdargs.config f = open(conffile) sigmaconfig = SigmaConfiguration(f) except OSError as e: print("Failed to open Sigma configuration file %s: %s" % (conffile, str(e)), file=sys.stderr) except yaml.parser.ParserError as e: print("Sigma configuration file %s is no valid YAML: %s" % (conffile, str(e)), file=sys.stderr) except SigmaParseError as e: print("Sigma configuration parse error in %s: %s" % (conffile, str(e)), file=sys.stderr) try: backend = backends.getBackend(cmdargs.target)(sigmaconfig) except LookupError as e: print("Backend not found!", file=sys.stderr) sys.exit(2) error = 0 for sigmafile in get_inputs(cmdargs.inputs, cmdargs.recurse): print_verbose("* Processing Sigma input %s" % (sigmafile)) try: f = sigmafile.open() parser = SigmaParser(f, sigmaconfig) print_debug("Parsed YAML:\n", json.dumps(parser.parsedyaml, indent=2)) parser.parse_sigma() for condtoken in parser.condtoken: print_debug("Condition Tokens:", condtoken) for condparsed in parser.condparsed:
import backends from gcimon.types import Project from gcimon.core import Persistance import logging import time logging.basicConfig(level=logging.DEBUG, \ format='%(asctime)s %(levelname)s %(message)s', \ filename='/tmp/gcimon.log', filemode='a') db1 = Persistance('/tmp/gcimon.db') # project = Project(projectName="GCI Monitor 2",projectHost="http://localhost:8080/hudson",projectBackend="hudson") # db1.newProject(project) # db1.updateProject(project) # db1.deleteProject(project) while 1: for project in db1.getMonitoredProjects(): be1 = backends.getBackend(project.getBackend()).Backend() project.setStatus(be1.getProjectStatus(project)) print "Project Name: %s, Build Status: %s, Last Checked: %s" % (project.getName(), project.getStatus(), str(project.getlastChecked())) db1.updateProject(project) db1.setMonitoringState(Project(projectId=2,projectState=Project.IS_NOT_MONITORED)) time.sleep(10)
action="store_true", help="Be verbose") argparser.add_argument("--debug", "-d", action="store_true", help="Debugging output") argparser.add_argument("inputs", nargs="*", help="Sigma input files") cmdargs = argparser.parse_args() if cmdargs.target_list: for backend in backends.getBackendList(): print("%10s: %s" % (backend.identifier, backend.__doc__)) sys.exit(0) try: backend = backends.getBackend(cmdargs.target)() except LookupError as e: print("Backend not found!") sys.exit(1) for sigmafile in cmdargs.inputs: print_verbose("* Processing Sigma input %s" % (sigmafile)) try: f = open(sigmafile) parser = SigmaParser(f) print_debug("Parsed YAML:\n", json.dumps(parser.parsedyaml, indent=2)) parser.parse_sigma() for condtoken in parser.condtoken: print_debug("Condition Tokens:", condtoken) for condparsed in parser.condparsed: print_debug("Condition Parse Tree:", condparsed)