def main(): server_ip = discover() server_port = 5555 client_port = 7777 sender = Sender(server_ip, server_port=server_port, client_port=client_port) # Run frame generator for sender framegen = FrameGenerator(sender.settings, sender.framebuf) framegen.start() # Start sending frames to client sender.start() # Wait for sensor server init sleep(1) client = SensorClient(server_ip, server_port=server_port, callback_objects=[OpenVR()]) client.start() client.join() sender.join() framegen.join()
def main(): server_ip = discover() server_port = 4242 client_port = 7777 sender = Sender(server_ip, server_port=server_port, client_port=client_port) # Run frame generator for sender framegen = XwdFrameGenerator(sender.settings, sender.framebuf) framegen.start() # Start sending frames to client sender.start() # Wait for sensor server init sleep(1) # TODO: doesnt connect to existing driver.. client = SensorClient(server_ip, server_port=server_port, callback_objects=[OpenVR()]) client.start() client.join() sender.join() framegen.join()
def main(): print("\n\n") args = init_args() if args.host is None: dev = discover.discover(args.device, timeout=args.timeout) else: if args.type is str: dev_type = int(args.type, 0) else: dev_type = args.type dev = discover.gendevice(dev_type, args.host, bytearray.fromhex(args.mac)) if dev is None: print('No device founded') exit(1) # print(dev.host) # print(''.join('{:02x}'.format(x) for x in dev.mac)) if args.timezone: utils.set_default_timezone(timezone(args.timezone)) if network_tools.check_network_connection(url=args.network_test_url, timeout=args.network_timeout): print("{} Network status is good!".format(utils.get_datetime_string())) else: print("{} Network status is disconnected\nreset cable modem".format( utils.get_datetime_string())) dev.auth() print("Power Off") dev.set_power(False) time.sleep(2) print("Power On") dev.set_power(True) print('wait for network connected') for i in range(0, 300, 5): print('check network connection status') args.network_test_url = 'http://clients3.google.com/generate_204' if network_tools.check_network_connection( url=args.network_test_url, timeout=args.network_timeout): print('network connected') targets = {} if args.slack: targets['slack'] = args.slack status_notifier.notify('Network recovered', args.name, targets) exit(0) break else: time.sleep(5) print('network recovery failed') exit(1)
def __init__(self, source_ip=None): self.services = discover(source_ip) self.max_version = sorted(self.request('getVersions')['result'])[0][-1] self.methods_info = {} methods = self.request('getMethodTypes', params=(self.max_version, ))['results'] for m in methods: api_name, request_parameters, response_parameters, api_version = m self.methods_info[api_name] = { 'request': request_parameters, 'response': response_parameters, 'api_version': api_version }
def test(args, session): # Parse the values from the vectors file. vectors = parseVectors(args["vectors"]) # Parse the sensitive values from the sensitive file. sensitive = parseSensitive(args["sensitive"]) # Get the dictionary return from running discover. discovered = discover.discover(args, session) # Run the tests using the discovered information, list of vectors, and slow parameter. run_tests(vectors, discovered, args["slow"], sensitive) print("-" * 50, "Testing completed", "-" * 50, sep="\n")
def connectQ(): while True: (host, name) = discover('_commcomm._tcp', 1) name = name.replace('._commcomm._tcp.local.', '') name = name.encode('ascii', 'ignore') # turn unicode to ascii host = host.encode('ascii', 'ignore') # turn unicode to ascii host = host[:-1] if (host, name) not in connections and name != username: connections.append((host, name)) print 'Connection incoming from', name print connections time.sleep(1) time.sleep(2)
def test1(): """Exercise a 3 column dataframe to check 2 relationships""" X = pd.DataFrame({ 'a': np.ones(10), 'b': np.arange(0, 10), 'c': np.arange(0, 20, 2) }) df_results = discover(X) print(df_results) assert (df_results.query("feature=='b' and target=='a'")['score'].iloc[0] ) == 1, "Expect b to predict a" assert (df_results.query("feature=='a' and target=='b'")['score'].iloc[0] ) == 0, "Expect a not to predict b"
def sync(service, catalog, state, start_date): if not catalog: catalog = discover(service) selected_streams = catalog.streams else: selected_streams = catalog.get_selected_streams(state) for stream in selected_streams: if not stream.tap_stream_id == 'companies': mdata = metadata.to_map(stream.metadata) update_current_stream(state, stream.tap_stream_id) sync_stream(service, catalog, state, start_date, stream, mdata) update_current_stream(state)
def main(): args = utils.parse_args(REQUIRED_CONFIG_KEYS) url = "https://api.businesscentral.dynamics.com/v2.0/{}/{}/api/BCSItera/dashboards/v1.0/".format(args.config["tenantId"], args.config["environment"]) service = ODataService( url, reflect_entities=True, auth=requests.auth.HTTPBasicAuth(args.config["username"], args.config["password"]) ) catalog = args.catalog or do_discover(service) if args.discover: catalog = discover(service) catalog.dump() else: sync(service, catalog, args.state, args.config["start_date"],)
def on_discover(self, widget): """ Discover the glasses via ethernet. Glasses must be connected before discovering """ if self.is_Discovered: print("Glasses already discovered. Not action required.") else: self.glasses_ip = discover.discover() if not self.glasses_ip: print("Glasses not found") else: print("Glasses found") self.is_Discovered = True #Start video peer = (self.glasses_ip, PORT) # Create Video, Eye Tracking and BufferSync self.video = vg.Video() self.eye_tracking = vg.EyeTracking() self.buffersync = vg.BufferSync(self.video.draw_gaze) # Start eyetracking and video print("Initializing eye tracking ...") self.eye_tracking.start(peer, self.buffersync) print("Starting video ...") self.video.start(peer, self.buffersync, self.video_window_handle)
def main(passed_args): args = init.getArgs(passed_args) # If auth arg is present, use it for 'get' calls. # Create the requests session to use for later 'get' calls. session = requests.session() # If there is an 'auth' arg, post the session the correct login info for the session if 'custom-auth' in args.keys(): if args['custom-auth'] == 'dvwa': payload = {'password': '******', 'username': '******'} response = session.post('http://127.0.0.1/dvwa/login.php', data=payload) session.cookies = response.cookies #Call the appropriate function using the mode param. if args['mode'] == 'discover': discovered = discover.discover(args, session) outputResults(discovered) elif args['mode'] == 'test': test.test(args, session) else: # This else is somewhat redundant. Mode input is verified in getArgs. print('Not a valid <mode> param. Must be \'discover\' or \'test\'') sys.exit(0)
def do_discover(service): LOGGER.info("Starting discovery") catalog = discover(service) return catalog
def ask(self, options): #Load header: try: self.header = json.load( open(options.in_diagnostic_headers_file, 'r'))['header'] except ValueError as e: print 'The input diagnostic file ' + options.in_diagnostic_headers_file + ' does not conform to JSON standard. Make sure to check its syntax' raise if 'username' in dir(options) and options.username != None: if not options.password_from_pipe: user_pass = getpass.getpass('Enter Credential phrase:') else: user_pass = sys.stdin.readline() else: user_pass = None options.password = user_pass #Simplify the header: self.union_header() if options.list_only_field != None: #Only a listing of a few fields was requested. for field_name in discover.discover(self, options): print field_name return else: if ('catalogue_missing_simulations_desc' in dir(self.drs) and self.drs.catalogue_missing_simulations_desc): #This allows some projects to be inconsistent in their publications: filepath = discover.discover(self, options) try: os.rename(filepath, filepath.replace('.pid' + str(os.getpid()), '')) except OSError: pass else: #Check if this is an update and if this an update find the previous simulations list: prev_simulations_list = self.load_previous_simulations(options) simulations_list = discover.discover_simulations_recursive( self, options, self.drs.simulations_desc) simulations_list = sorted( list( set(simulations_list).difference( prev_simulations_list))) print "This is a list of simulations that COULD satisfy the query:" for simulation in simulations_list: print ','.join(simulation) print "cdb_query will now attempt to confirm that these simulations have all the requested variables." print "This can take some time. Please abort if there are not enough simulations for your needs." import random random.shuffle(simulations_list) manager = multiprocessing.Manager() output = distributed_recovery(discover.discover, self, options, simulations_list, manager) #Close dataset output.close() return