def get_host_reputation_table(response_list): data_list = [] header = [ 'Verdict', 'Threat Status', 'Threat Name', 'Threat Type', 'First Seen', 'Last Seen', ] data_list.append(header) response = response_list[0] threat_data = response.get('threatData') data = [ threat_data.get('verdict'), threat_data.get('threatStatus'), threat_data.get('threatName'), threat_data.get('threatType'), threat_data.get('firstSeen'), threat_data.get('lastSeen'), ] data_list.append(data) host_reputation = DoubleTable(data_list) host_reputation.padding_left = 1 host_reputation.padding_right = 1 host_reputation.inner_column_border = True host_reputation.inner_row_border = True return host_reputation.table
def get_lab_info(self, lab_hash=None, machine_name=None, all_users=False): if all_users: raise NotSupportedError("Cannot use `--all` flag.") if lab_hash: lab_hash = lab_hash.lower() table_header = ["LAB HASH", "DEVICE NAME", "STATUS", "ASSIGNED NODE"] stats_table = DoubleTable([]) stats_table.inner_row_border = True while True: machines_stats = self.k8s_machine.get_machines_info(lab_hash=lab_hash, machine_filter=machine_name) machines_data = [ table_header ] for machine_stats in machines_stats: machines_data.append([machine_stats["real_lab_hash"], machine_stats["name"], machine_stats["status"], machine_stats["assigned_node"] ]) stats_table.table_data = machines_data yield "TIMESTAMP: %s" % datetime.now() + "\n\n" + stats_table.table
def get_lab_info(self, lab_hash=None, machine_name=None, all_users=False): user_name = utils.get_current_user_name() if not all_users else None machine_streams = self.docker_machine.get_machines_info( lab_hash, machine_filter=machine_name, user=user_name) table_header = [ "LAB HASH", "USER", "DEVICE NAME", "STATUS", "CPU %", "MEM USAGE / LIMIT", "MEM %", "NET I/O" ] stats_table = DoubleTable([]) stats_table.inner_row_border = True while True: machines_data = [table_header] try: result = next(machine_streams) except StopIteration: return if not result: return for machine_stats in result: machines_data.append([ machine_stats['real_lab_hash'], machine_stats['user'], machine_stats['name'], machine_stats['status'], machine_stats['cpu_usage'], machine_stats['mem_usage'], machine_stats['mem_percent'], machine_stats['net_usage'] ]) stats_table.table_data = machines_data yield "TIMESTAMP: %s" % datetime.now() + "\n\n" + stats_table.table
def print_vulnerability(cls, vulnerability: Vulnerabilities): """ print_vulnerability takes a vulnerability, and well, it prints it """ cvss_score = vulnerability.get_cvss_score() table_data = [ ["ID", vulnerability.get_id()], ["Title", vulnerability.get_title()], ["Description", '\n'.join(wrap(vulnerability.get_description(), 100))], ["CVSS Score", f"{vulnerability.get_cvss_score()} - {cls.get_cvss_severity(cvss_score)}"], ] if vulnerability.get_cvss_vector(): table_data.append( ["CVSS Vector", vulnerability.get_cvss_vector()] ) table_data.extend( [ ["CVE", vulnerability.get_cve()], ["Reference", vulnerability.get_reference()] ] ) table_instance = DoubleTable(table_data) table_instance.inner_heading_row_border = False table_instance.inner_row_border = True cls.do_print(table_instance.table, cvss_score) print("----------------------------------------------------")
def _print_scores(live_feeds, args): if len(live_feeds) == 0: print('No live matches at this time') return if args.refresh > 0: os.system('clear') for feed in live_feeds: live_scores = [] # Add the team scores to the display object live_scores.append(['Current time', "{} ({})".format(datetime.now().strftime('%H:%M:%S'), datetime.utcnow().strftime('%H:%M:%S'))]) live_scores.append(['Match', "{}, {} v {} at {}, {}".format(feed.series[0]['series_name'], feed.details['team1_name'], feed.details['team2_name'], feed.details['ground_name'], feed.details['start_date'])]) # if feed.details['present_datetime_gmt'] <= feed.details['start_datetime_gmt']: # live_scores.append( # [ # 'Start', # "{} in {}".format( # feed.details['start_time_gmt'], # ( # datetime.strptime(feed.details['start_datetime_gmt'], "%Y-%m-%d %H:%M:%S") - datetime.utcnow() # ) # ) # ] # ) live_scores.append(['Status', feed.status()]) if feed.details['present_datetime_gmt'] >= feed.details['start_datetime_gmt']: live_scores.append(['Summary', feed.summary()]) table = DoubleTable(live_scores) table.inner_row_border = True table.justify_columns = {0: 'center', 1: 'center', 2: 'center'} print(table.table)
def echo_table(table, **kwargs): t = DoubleTable([[safe_str(cell) for cell in row] for row in table], **kwargs) t.inner_row_border = True click.echo(t.table)
def get_lab_info(self, recursive, lab_hash=None, machine_name=None, all_users=False): user_name = utils.get_current_user_name() if not all_users else None if not recursive: machines = self.docker_machine.get_machines_by_filters(lab_hash=lab_hash, machine_name=machine_name, user=user_name ) else: machines = self.docker_machine.get_machines_by_filters_rec(lab_hash=lab_hash, machine_name=machine_name, user=user_name ) if not machines: if not lab_hash: raise Exception("No machines running.") else: raise Exception("Lab is not started.") machines = sorted(machines, key=lambda x: x.name) machine_streams = {} for machine in machines: machine_streams[machine] = machine.stats(stream=True, decode=True) table_header = ["LAB HASH", "USER", "MACHINE NAME", "STATUS", "CPU %", "MEM USAGE / LIMIT", "MEM %", "NET I/O"] stats_table = DoubleTable([]) stats_table.inner_row_border = True while True: machines_data = [ table_header ] for (machine, machine_stats) in machine_streams.items(): real_name = machine.labels['name'] if recursive: path = machine.exec_run('hostname')[1].decode('utf-8') real_name_split = path.split('.') real_name = ('.'.join(real_name_split[:-1])) try: result = next(machine_stats) except StopIteration: continue stats = self._get_aggregate_machine_info(result) machines_data.append([machine.labels['lab_hash'], machine.labels['user'], real_name, machine.status, stats["cpu_usage"], stats["mem_usage"], stats["mem_percent"], stats["net_usage"] ]) stats_table.table_data = machines_data yield "TIMESTAMP: %s" % datetime.now() + "\n\n" + stats_table.table
def gh_table(items): """ 生成表格 """ table_instance = DoubleTable(items, "GitHub - 上传文件") table_instance.inner_row_border = True return table_instance.table
def table(items, title): """ 生成表格 """ table_instance = DoubleTable(items, "SM.MS - {}".format(title)) table_instance.inner_row_border = True return table_instance.table
def table(self): table_list = [[white("ID"), white("Name"), white("Path")]] for p in self.data: table_list.append(p.to_row) table = DoubleTable(table_list, title=white('Projects', True)) table.inner_row_border = True return table
def display_table(headers, data): bolded_headers = [bold(header) for header in headers] table_data = [bolded_headers] + data # Issue with less displaying SingleTable so double is needed, appears NOT to be a unicode issue # TODO sort this ^ table = DoubleTable(table_data) table.inner_row_border = True click.echo_via_pager(table.table)
def analyze_bucket(bucket): bucket_location = client.get_bucket_location( Bucket=bucket)['LocationConstraint'] new_client = boto3.client('s3', region_name=bucket_location) bucket_acl = new_client.get_bucket_acl(Bucket=bucket) permission = [] for grants in bucket_acl['Grants']: if ('URI' in grants['Grantee']) and ('AllUser' in grants['Grantee']['URI']): permission.append(grants['Permission']) if len(permission) == 1: if permission[0] == 'READ': globalListAccess = 'YES' globalWriteAccess = 'NO' table_data = [ ['BucketName', 'Region', 'GlobalListAccess', 'GlobalWriteAccess'], [bucket, bucket_location, globalListAccess, globalWriteAccess], ] table = DoubleTable(table_data) table.inner_row_border = True print(table.table) elif len(permission) > 1: if permission[0] == 'READ': globalListAccess = 'YES' if permission[1] == 'WRITE': globalWriteAccess = 'YES' else: globalWriteAccess = 'NO' table_data = [ ['BucketName', 'Region', 'GlobalListAccess', 'GlobalWriteAccess'], [bucket, bucket_location, globalListAccess, globalWriteAccess], ] table = DoubleTable(table_data) table.inner_row_border = True print(table.table)
def analyze_bucket(bucket): bucket_location = client.get_bucket_location(Bucket=bucket)['LocationConstraint'] new_client = boto3.client('s3', region_name=bucket_location) bucket_acl = new_client.get_bucket_acl(Bucket=bucket) permission = [] for grants in bucket_acl['Grants']: if ('URI' in grants['Grantee']) and ('AllUser' in grants['Grantee']['URI']): permission.append(grants['Permission']) if len(permission) == 1: if permission[0] == 'READ': globalListAccess = 'YES' globalWriteAccess = 'NO' table_data = [ ['BucketName', 'Region', 'GlobalListAccess', 'GlobalWriteAccess'], [bucket, bucket_location, globalListAccess, globalWriteAccess], ] table = DoubleTable(table_data) table.inner_row_border = True print(table.table) elif len(permission) > 1: if permission[0] == 'READ': globalListAccess = 'YES' if permission[1] == 'WRITE': globalWriteAccess = 'YES' else: globalWriteAccess = 'NO' table_data = [ ['BucketName', 'Region', 'GlobalListAccess', 'GlobalWriteAccess'], [bucket, bucket_location, globalListAccess, globalWriteAccess], ] table = DoubleTable(table_data) table.inner_row_border = True print(table.table)
def print_terminal_table(table_data, method_used): """ Prints a table with the results in the terminal. :param table_data: the data of the table :param method_used: the method used, to print as the table title :return: None """ table = DoubleTable(table_data) table.title = method_used table.inner_heading_row_border = False table.inner_row_border = True print(table.table)
def analyze_bucket(bucket): client = boto3.client('s3') bucket_acl = client.get_bucket_acl(Bucket=bucket) permission = [] for grants in bucket_acl['Grants']: if ('URI' in grants['Grantee']) and ('AllUser' in grants['Grantee']['URI']): permission.append(grants['Permission']) globalListAccess = 'NO' globalWriteAccess = 'NO' points = 0 if len(permission) >= 1: if len(permission) == 1: if permission[0] == 'READ': globalListAccess = 'YES' points += 1 if permission[0] == 'WRITE': globalWriteAccess = 'YES' points += 1 if len(permission) > 1: if permission[0] == 'READ': globalListAccess = 'YES' points += 1 if permission[0] == 'WRITE': globalWriteAccess = 'YES' points += 1 if permission[1] == 'READ': globalListAccess = 'YES' points += 1 if permission[1] == 'WRITE': globalWriteAccess = 'YES' points += 1 if globalListAccess == 'YES' or globalWriteAccess == 'YES': table_data = [ ['BucketName', 'GlobalListAccess', 'GlobalWriteAccess'], [bucket, globalListAccess, globalWriteAccess], ] table = DoubleTable(table_data) table.inner_row_border = True print(table.table) api.Metric.send( metric="bucket.exposed", host="aws.s3.bucket." + bucket, points=points, #0=ok, 1=read exposed, 2=write exposed tags=["aws", "s3", "s3permissions"])
def make_table(team1,team2=''): data=scrape() table_data=[['Match','Series','Date','Month','Time']] for i in data[:]: row=[] if team1.strip(' ') in i.get('desc') and team2.strip(' ') in i.get('desc') : row.extend((Color('{autoyellow}'+i.get('desc')+'{/autoyellow}'),Color('{autocyan}'+i.get('srs')[5:]+'{/autocyan}'),Color('{autored}'+i.get('ddt')+'{/autored}'),Color('{autogreen}'+i.get('mnth_yr')+'{/autogreen}'),Color('{autoyellow}'+i.get('tm')+'{/autoyellow}'))) table_data.append(row) table_instance = DoubleTable(table_data) table_instance.inner_row_border = True print(table_instance.table) print()
def make_table(result): table_data = [['S.No', 'Name', 'Rating']] for s_no,res in enumerate(result,1): row = [] row.extend((Color('{autoyellow}' + str(s_no) + '.' + '{/autoyellow}'), Color('{autogreen}' + res[0] + '{/autogreen}'), Color('{autoyellow}' + res[1] + '{/autoyellow}'))) table_data.append(row) table_instance = DoubleTable(table_data) table_instance.inner_row_border = True print(table_instance.table) print()
def get_formatted_lab_info(self, lab_hash: str = None, machine_name: str = None, all_users: bool = False) -> str: """Return a formatted string with the information about the running devices. Args: lab_hash (str): If not None, return information of the corresponding network scenario. machine_name (str): If not None, return information of the specified device. all_users (bool): If True, return information about the device of all users. Returns: str: String containing devices info """ table_header = [ "LAB HASH", "USER", "DEVICE NAME", "STATUS", "CPU %", "MEM USAGE / LIMIT", "MEM %", "NET I/O" ] stats_table = DoubleTable([]) stats_table.inner_row_border = True lab_info = self.get_lab_info(lab_hash, machine_name, all_users) while True: machines_data = [table_header] try: result = next(lab_info) except StopIteration: return if not result: return for machine_stats in result: machines_data.append([ machine_stats['real_lab_hash'], machine_stats['user'], machine_stats['name'], machine_stats['status'], machine_stats['cpu_usage'], machine_stats['mem_usage'], machine_stats['mem_percent'], machine_stats['net_usage'] ]) stats_table.table_data = machines_data yield "TIMESTAMP: %s" % datetime.now() + "\n\n" + stats_table.table
def get_formatted_lab_info(self, lab_hash: str = None, machine_name: str = None, all_users: bool = False) -> str: """Return a formatted string with the information about the running devices. Args: lab_hash (str): If not None, return information of the corresponding network scenario. machine_name (str): If not None, return information of the specified device. all_users (bool): If True, return information about the device of all users. Returns: str: String containing devices info """ if all_users: raise NotSupportedError("Cannot use `--all` flag on Megalos.") table_header = ["LAB HASH", "DEVICE NAME", "STATUS", "ASSIGNED NODE"] stats_table = DoubleTable([]) stats_table.inner_row_border = True lab_info = self.get_lab_info(lab_hash=lab_hash, machine_name=machine_name) while True: machines_data = [table_header] try: result = next(lab_info) except StopIteration: return if not result: return for machine_stats in result: machines_data.append([ machine_stats["real_lab_hash"], machine_stats["name"], machine_stats["status"], machine_stats["assigned_node"] ]) stats_table.table_data = machines_data yield "TIMESTAMP: %s" % datetime.now() + "\n\n" + stats_table.table
def weatherTable(city, country=None): if (country == None): request = urlopen('http://api.openweathermap.org/data/2.5/weather?q=' + city + '&units=metric') else: request = urlopen('http://api.openweathermap.org/data/2.5/weather?q=' + city + ',' + country + '&units=metric') response = json.loads(request.read()) weather = response['weather'][0]['description'] current_temp = str(response['main']['temp']) wind = str(response['wind']['speed']) clouds = str(response['clouds']['all']) pressure = str(response['main']['pressure']) humidity = str(response['main']['humidity']) table_data = [[ Color('{autoyellow}Current temp.{/autoyellow}'), Color('{autoyellow}Wind{/autoyellow}'), Color('{autoyellow}Cloudiness{/autoyellow}'), Color('{autoyellow}Pressure{/autoyellow}'), Color('{autoyellow}Humidity{/autoyellow}'), Color('{autoyellow}Description{/autoyellow}') ], [ str(current_temp) + " " + u"\N{DEGREE SIGN}" + "C", str(wind) + " km/h", str(clouds) + " %", str(pressure) + " hPa", str(humidity) + "%", str(weather) ]] table = DoubleTable(table_data, city.capitalize()) table.inner_row_border = True table.justify_columns[0] = 'center' table.justify_columns[1] = 'center' table.justify_columns[2] = 'center' table.justify_columns[3] = 'center' table.justify_columns[4] = 'center' table.justify_columns[5] = 'center' return (table.table)
def make_table(team1, team2=''): data = scrape() table_data = [['Match', 'Series', 'Date', 'Month', 'Time']] for i in data[:]: row = [] if team1.strip(' ') in i.get('desc') and team2.strip(' ') in i.get( 'desc'): row.extend( (Color('{autoyellow}' + i.get('desc') + '{/autoyellow}'), Color('{autocyan}' + i.get('srs')[5:] + '{/autocyan}'), Color('{autored}' + i.get('ddt') + '{/autored}'), Color('{autogreen}' + i.get('mnth_yr') + '{/autogreen}'), Color('{autoyellow}' + i.get('tm') + '{/autoyellow}'))) table_data.append(row) table_instance = DoubleTable(table_data) table_instance.inner_row_border = True print(table_instance.table) print()
def get_api_quota_table(response_list): data_list = [] header = [ 'Licenced Quota', 'Remaining Quota', 'Expiration Date', ] data_list.append(header) response = response_list[0] quota_data = response.get('quotaDetails') data = [ quota_data.get('licensedQuota'), quota_data.get('remainingQuota'), quota_data.get('expiryDate'), ] data_list.append(data) api_quota = DoubleTable(data_list) api_quota.padding_left = 1 api_quota.padding_right = 1 api_quota.inner_column_border = True api_quota.inner_row_border = True return api_quota.table + '\n\nNote: ' + quota_data.get('note')
def get_scan_report_table(response_list, source=0): data_list = [] header = [ 'URL', 'Type', 'Verdict', 'Threat Status', 'Scan ID', 'Threat Name', 'Threat Type', 'First Seen', 'Last Seen', ] data_list.append(header) response = response_list[0] normalize_msg = '' if response.get('errorNo') != 1: if response.get('normalizeData').get('normalizeStatus') == 1: normalize_msg = response.get('normalizeData').get( 'normalizeMessage') + '\n' url = response.get('urlData') threat_data = url.get('threatData') name = url.get('scanId') data = [ url.get('url'), 'Scanned URL', threat_data.get('verdict'), threat_data.get('threatStatus'), name, threat_data.get('threatName'), threat_data.get('threatType'), threat_data.get('firstSeen'), threat_data.get('lastSeen'), ] data_list.append(data) if url.get('finalUrl') is not None: data = [ url.get('finalUrl'), 'Final URL', threat_data.get('verdict'), threat_data.get('threatStatus'), '-', '-', '-', '-', '-', ] data_list.append(data) if url.get('landingUrl') is not None: landing_url = url.get('landingUrl') threat_data = landing_url.get('threatData') data = [ landing_url.get('url'), 'Redirected URL', threat_data.get('verdict'), threat_data.get('threatStatus'), landing_url.get('scanId'), threat_data.get('threatName'), threat_data.get('threatType'), threat_data.get('firstSeen'), threat_data.get('lastSeen'), ] data_list.append(data) scan_report = DoubleTable(data_list) scan_report.padding_left = 1 scan_report.padding_right = 1 scan_report.inner_column_border = True scan_report.inner_row_border = True for i, data in enumerate(data_list): if i > 0: wrapped_url = '\n'.join(wrap(data[0], 35)) wrapped_t = '\n'.join(wrap(data[1], 10)) wrapped_sid = '\n'.join(wrap(data[4], 18)) wrapped_tn = '\n'.join(wrap(data[5], 12)) wrapped_tt = '\n'.join(wrap(data[6], 12)) wrapped_fs = '\n'.join(wrap(data[7], 12)) wrapped_ls = '\n'.join(wrap(data[8], 12)) scan_report.table_data[i][0] = wrapped_url scan_report.table_data[i][1] = wrapped_t scan_report.table_data[i][4] = wrapped_sid scan_report.table_data[i][5] = wrapped_tn scan_report.table_data[i][6] = wrapped_tt scan_report.table_data[i][7] = wrapped_fs scan_report.table_data[i][8] = wrapped_ls else: if source == 1: return 'Your Url Scan request is submitted to the cloud and may take up-to 60 seconds to complete.\n'\ 'Please check back later using "slashnext-scan-report" action with Scan ID = {0} or running the ' \ 'same "slashnext-url-scan" action one more time'.format(response.get('urlData').get('scanId')) elif source == 2: return 'Your Url Scan request is submitted to the cloud and is taking longer than expected to complete.\n' \ 'Please check back later using "slashnext-scan-report" action with Scan ID = {0} or running the ' \ 'same "slashnext-url-scan-sync" action one more time'.format(response.get('urlData').get('scanId')) else: return 'Your Url Scan request is submitted to the cloud and is taking longer than expected to complete.\n' \ 'Please check back later using "slashnext-scan-report" action with Scan ID = {0} one more ' \ 'time'.format(response.get('urlData').get('scanId')) if len(response_list) == 4: download_sc = get_download_sc_file([response_list[1]], name) download_html = get_download_html_file([response_list[2]], name) download_text = get_download_text_file([response_list[3]], name) return normalize_msg + scan_report.table + '\n\nWebpage Forensics\n\n' + \ download_sc + '\n' + download_html + '\n' + download_text else: return normalize_msg + scan_report.table
def printTasks(board_id, board_name): query = "SELECT task_ids FROM boards WHERE board_id = {0}".format(board_id) cursor.execute(query) taskList = [] for task in cursor: taskList.append(task) # print taskList tasks = [] if str(taskList[0]) != "(u'',)": for task in str(taskList[0]).split(","): # print task if task != "'" and task != ")": # print task.strip('()').replace("u'","") query2 = "SELECT task_description,task_state FROM tasks WHERE task_id = {0}".format( task.strip("()").replace("u'", "") ) cursor.execute(query2) for i in cursor: # print i tasks.append(i) # print tasks bl = 0 ip = 0 done = 0 blList = [] ipList = [] doneList = [] i = 0 (width, height) = console.getTerminalSize() for task in tasks: for char in task[0]: if i == width / 3 - 4: task[0] = insert(task[0], "\n", i) i += 1 if task[1] == "0": bl += 1 appender = "{0}".format(i) + ":" + task[0] # appender = '{0}'.format(i)+ ' '+task[0] update_query = "UPDATE tasks SET task_description= '{0}' WHERE task_description='{1}'".format( appender, task[0] ) cursor.execute(update_query) conn.commit() blList.append(appender) if task[1] == "1": update_query = "UPDATE tasks SET task_description= '{0}' WHERE task_description='{1}'".format( appender, task[0] ) cursor.execute(update_query) conn.commit() ip += 1 ipList.append(task[0]) if task[1] == "2": done += 1 update_query = "UPDATE tasks SET task_description= '{0}' WHERE task_description='{1}'".format( appender, task[0] ) cursor.execute(update_query) conn.commit() doneList.append(task[0]) backLogWithSpacing = "Backlog" + " " * (width / 3 - 4 - len("Backlog")) inProgressWithSpacing = "In Progress" + " " * (width / 3 - 4 - len("In Progress")) doneWithSpacing = "Done" + " " * (width / 3 - 4 - len("Done")) allTasks = [[backLogWithSpacing, inProgressWithSpacing, doneWithSpacing]] # print bl # print ip # print done for i in range(0, max(bl, ip, done)): currentList = [] if i < bl: currentList.append(blList[i]) else: currentList.append("") if i < ip: currentList.append[ipList[i]] else: currentList.append("") if i < done: currentList.append(doneList[i]) else: currentList.append("") allTasks.append(currentList) table = DoubleTable(allTasks, board_name) table.inner_row_border = True print(table.table)
def test_multi_line(): """Test multi-lined cells.""" table_data = [ ['Show', 'Characters'], ['Rugrats', 'Tommy Pickles, Chuckie Finster, Phillip DeVille, Lillian DeVille, Angelica Pickles,\nDil Pickles'], ['South Park', 'Stan Marsh, Kyle Broflovski, Eric Cartman, Kenny McCormick'] ] table = DoubleTable(table_data) # Test defaults. actual = table.table expected = ( u'\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2566\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557\n' u'\u2551 Show \u2551 Characters ' u'\u2551\n' u'\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256c\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563\n' u'\u2551 Rugrats \u2551 Tommy Pickles, Chuckie Finster, Phillip DeVille, Lillian DeVille, Angelica Pickles, ' u'\u2551\n' u'\u2551 \u2551 Dil Pickles ' u'\u2551\n' u'\u2551 South Park \u2551 Stan Marsh, Kyle Broflovski, Eric Cartman, Kenny McCormick ' u'\u2551\n' u'\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2569\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255d' ) assert actual == expected # Test inner row border. table.inner_row_border = True actual = table.table expected = ( u'\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2566\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557\n' u'\u2551 Show \u2551 Characters ' u'\u2551\n' u'\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256c\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563\n' u'\u2551 Rugrats \u2551 Tommy Pickles, Chuckie Finster, Phillip DeVille, Lillian DeVille, Angelica Pickles, ' u'\u2551\n' u'\u2551 \u2551 Dil Pickles ' u'\u2551\n' u'\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256c\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563\n' u'\u2551 South Park \u2551 Stan Marsh, Kyle Broflovski, Eric Cartman, Kenny McCormick ' u'\u2551\n' u'\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2569\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255d' ) assert actual == expected # Justify right. table.justify_columns = {1: 'right'} actual = table.table expected = ( u'\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2566\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557\n' u'\u2551 Show \u2551 Characters ' u'\u2551\n' u'\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256c\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563\n' u'\u2551 Rugrats \u2551 Tommy Pickles, Chuckie Finster, Phillip DeVille, Lillian DeVille, Angelica Pickles, ' u'\u2551\n' u'\u2551 \u2551 Dil Pickles ' u'\u2551\n' u'\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256c\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563\n' u'\u2551 South Park \u2551 Stan Marsh, Kyle Broflovski, Eric Cartman, Kenny McCormick ' u'\u2551\n' u'\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2569\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255d' ) assert actual == expected
def get_host_urls_table(response_list): data_list = [] header = [ 'URL', 'Type', 'Verdict', 'Threat Status', 'Scan ID', 'Threat Name', 'Threat Type', 'First Seen', 'Last Seen', ] data_list.append(header) response = response_list[0] url_list = response.get('urlDataList') for url in url_list: threat_data = url.get('threatData') data = [ url.get('url'), 'Scanned URL', threat_data.get('verdict'), threat_data.get('threatStatus'), url.get('scanId'), threat_data.get('threatName'), threat_data.get('threatType'), threat_data.get('firstSeen'), threat_data.get('lastSeen'), ] data_list.append(data) if url.get('finalUrl') is not None: data = [ url.get('finalUrl'), 'Final URL', threat_data.get('verdict'), threat_data.get('threatStatus'), '-', '-', '-', '-', '-', ] data_list.append(data) if url.get('landingUrl') is not None: landing_url = url.get('landingUrl') threat_data = landing_url.get('threatData') data = [ landing_url.get('url'), 'Redirected URL', threat_data.get('verdict'), threat_data.get('threatStatus'), landing_url.get('scanId'), threat_data.get('threatName'), threat_data.get('threatType'), threat_data.get('firstSeen'), threat_data.get('lastSeen'), ] data_list.append(data) host_urls = DoubleTable(data_list) host_urls.padding_left = 1 host_urls.padding_right = 1 host_urls.inner_column_border = True host_urls.inner_row_border = True for i, data in enumerate(data_list): if i > 0: wrapped_url = '\n'.join(wrap(data[0], 35)) wrapped_t = '\n'.join(wrap(data[1], 10)) wrapped_sid = '\n'.join(wrap(data[4], 18)) wrapped_tn = '\n'.join(wrap(data[5], 12)) wrapped_tt = '\n'.join(wrap(data[6], 12)) wrapped_fs = '\n'.join(wrap(data[7], 12)) wrapped_ls = '\n'.join(wrap(data[8], 12)) host_urls.table_data[i][0] = wrapped_url host_urls.table_data[i][1] = wrapped_t host_urls.table_data[i][4] = wrapped_sid host_urls.table_data[i][5] = wrapped_tn host_urls.table_data[i][6] = wrapped_tt host_urls.table_data[i][7] = wrapped_fs host_urls.table_data[i][8] = wrapped_ls return host_urls.table
in_data = 'login' if in_data == 'boards': listBoards = models.database.getBoards(user.getID()) printBoards = [] temp = [] #print listBoards for i in range (1,len(listBoards)+1): temp.append(listBoards[i-1]) if i % 1 == 0: printBoards.append(temp) #print printBoards temp = [] table = DoubleTable(printBoards, 'Boards') table.inner_row_border = True print(table.table) in_data = prompt.query('Pick board(0 to create):') if in_data == '0': boardName = prompt.query('Enter board name:') boardUsers = prompt.query('Enter users(separate by comma):') #print boardUsers boardUsers = boardUsers.split(',') #print boardUsers currentBoard = user.makeBoard(boardName,user,boardUsers) else: (boardid,leaderid, memberid,taskids) = models.database.pickBoard(in_data) currentBoard = Board(boardid,in_data,taskids,leaderid,memberid)
def getSerialData(): table_data = [] try: line = ser.readline() data = line.rstrip('\r') data = data.rstrip('\n') data = data.split(' '); if data != ' ': if (len(data) == 6 ): table_data = [ ['Device','dest','type','seq','bat', 'temp'], [data[0],data[1],data[2],data[3],data[4],data[5]] ] table = DoubleTable(table_data, 'Shiva Home Control') table.inner_row_border = True table.justify_columns[2] = 'right' print(table.table) if('4' == data[0]): with open("test.txt", "a") as myfile: now_utc = datetime.now(timezone('CET')) t = now_utc.strftime("%Y-%m-%d %H:%M:%S") s = "{}: {} {} {} {} {} {}\n".format(t, data[0],data[1],data[2],data[3],data[4],data[5]) myfile.write(s) myfile.close() if('1' == data[0]): with open("test_solar.txt", "a") as myfile: now_utc = datetime.now(timezone('CET')) t = now_utc.strftime("%Y-%m-%d %H:%M:%S") s = "{}: {} {} {} {} {} {}\n".format(t, data[0],data[1],data[2],data[3],data[4],data[5]) myfile.write(s) myfile.close() if('2' == data[0]): with open("test_solar_2.txt", "a") as myfile: now_utc = datetime.now(timezone('CET')) t = now_utc.strftime("%Y-%m-%d %H:%M:%S") s = "{}: {} {} {} {} {} {}\n".format(t, data[0],data[1],data[2],data[3],data[4],data[5]) myfile.write(s) myfile.close() if('3' == data[0]): with open("test_solar_3.txt", "a") as myfile: now_utc = datetime.now(timezone('CET')) t = now_utc.strftime("%Y-%m-%d %H:%M:%S") s = "{}: {} {} {} {} {} {}\n".format(t, data[0],data[1],data[2],data[3],data[4],data[5]) myfile.write(s) myfile.close() if('5' == data[0]): with open("test_solar_5.txt", "a") as myfile: now_utc = datetime.now(timezone('CET')) t = now_utc.strftime("%Y-%m-%d %H:%M:%S") s = "{}: {} {} {} {} {} {}\n".format(t, data[0],data[1],data[2],data[3],data[4],data[5]) myfile.write(s) myfile.close() #sys.stdout.write('%s %s %s %s\r' % (data[0], data[2], data[3], data[4])) #sys.stdout.flush() if('1'==data[0]): loc = "Living Room" elif('2'==data[0]): loc = "out" elif('3'==data[0]): loc = "out" elif('4'==data[0]): loc = "out" elif('5'==data[0]): loc = "out" elif('6'==data[0]): loc = "out" else: loc = "undefined error" return 0 now_utc = datetime.now(timezone('CET')); t = now_utc.strftime("%Y-%m-%d %H:%M:%S"); qry = """UPDATE temperature SET seq=%s, temp=%s, bat=%s WHERE id='%s'""" % (data[3],data[5],data[4],data[0]) sendMySQLQry(qry) if('6' == data[2]): # 0 1 2 3 4 5 6 # ID | DEST | TYPE | SEQ | BAT | TEMP | HUM qry = """INSERT INTO tempMeas (id, room, seq, bat, temp, hum, time) VALUES ('%s', '%s', '%s','%s', '%s', '%s', '%s')""" % (data[0], loc, data[3], data[4],data[5], data[5] ,t); sendMySQLQry(qry) else: print "invalid data" print data except (KeyboardInterrupt, SystemExit): ser.close() closeMySQL()
print('--- Fetching hackathons--- \n') driver = webdriver.PhantomJS() driver.get('https://www.hackerearth.com/challenges/') res = driver.page_source soup = BeautifulSoup(res, 'lxml') upcoming = soup.find('div',{'class':'upcoming challenge-list'}) all_hackathons = upcoming.find_all('div',{'class':'challenge-content'}) table_data = [['S.No', 'Name', 'Type', 'Timings']] for s_no,hackathon in enumerate(all_hackathons,1): row = [] challenge_type = hackathon.find('div',{'class':'challenge-type'}).text.replace("\n"," ").strip() challenge_name = hackathon.find('div',{'class':'challenge-name'}).text.replace("\n"," ").strip() date_time = hackathon.find('div',{'class':'challenge-list-meta challenge-card-wrapper'}).text.replace("\n"," ").strip() row.extend((Color('{autoyellow}' + str(s_no) + '.' + '{/autoyellow}'), Color('{autocyan}' + challenge_name + '{/autogreen}'), Color('{autogreen}' + challenge_type + '{/autoyellow}'), Color('{autoyellow}' + date_time + '{/autoyellow}'))) table_data.append(row) table_instance = DoubleTable(table_data) table_instance.inner_row_border = True print(table_instance.table) print()
def draw_table(title, exchange_list): table = DoubleTable(exchange_list) table.title = title table.inner_row_border = True print(table.table)
def test_multi_line(): """Test multi-lined cells.""" table_data = [ ['Show', 'Characters'], [ 'Rugrats', 'Tommy Pickles, Chuckie Finster, Phillip DeVille, Lillian DeVille, Angelica Pickles,\nDil Pickles' ], [ 'South Park', 'Stan Marsh, Kyle Broflovski, Eric Cartman, Kenny McCormick' ] ] table = DoubleTable(table_data) # Test defaults. actual = table.table expected = ( u'\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2566\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557\n' u'\u2551 Show \u2551 Characters ' u'\u2551\n' u'\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256c\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563\n' u'\u2551 Rugrats \u2551 Tommy Pickles, Chuckie Finster, Phillip DeVille, Lillian DeVille, Angelica Pickles, ' u'\u2551\n' u'\u2551 \u2551 Dil Pickles ' u'\u2551\n' u'\u2551 South Park \u2551 Stan Marsh, Kyle Broflovski, Eric Cartman, Kenny McCormick ' u'\u2551\n' u'\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2569\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255d') assert actual == expected # Test inner row border. table.inner_row_border = True actual = table.table expected = ( u'\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2566\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557\n' u'\u2551 Show \u2551 Characters ' u'\u2551\n' u'\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256c\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563\n' u'\u2551 Rugrats \u2551 Tommy Pickles, Chuckie Finster, Phillip DeVille, Lillian DeVille, Angelica Pickles, ' u'\u2551\n' u'\u2551 \u2551 Dil Pickles ' u'\u2551\n' u'\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256c\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563\n' u'\u2551 South Park \u2551 Stan Marsh, Kyle Broflovski, Eric Cartman, Kenny McCormick ' u'\u2551\n' u'\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2569\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255d') assert actual == expected # Justify right. table.justify_columns = {1: 'right'} actual = table.table expected = ( u'\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2566\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557\n' u'\u2551 Show \u2551 Characters ' u'\u2551\n' u'\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256c\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563\n' u'\u2551 Rugrats \u2551 Tommy Pickles, Chuckie Finster, Phillip DeVille, Lillian DeVille, Angelica Pickles, ' u'\u2551\n' u'\u2551 \u2551 Dil Pickles ' u'\u2551\n' u'\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256c\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563\n' u'\u2551 South Park \u2551 Stan Marsh, Kyle Broflovski, Eric Cartman, Kenny McCormick ' u'\u2551\n' u'\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2569\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255d') assert actual == expected
def test_multi_line(): """Test multi-lined cells.""" table_data = [ ["Show", "Characters"], ["Rugrats", "Tommy Pickles, Chuckie Finster, Phillip DeVille, Lillian DeVille, Angelica Pickles,\nDil Pickles"], ["South Park", "Stan Marsh, Kyle Broflovski, Eric Cartman, Kenny McCormick"], ] table = DoubleTable(table_data) # Test defaults. actual = table.table expected = ( u"\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2566\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557\n" u"\u2551 Show \u2551 Characters " u"\u2551\n" u"\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256c\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563\n" u"\u2551 Rugrats \u2551 Tommy Pickles, Chuckie Finster, Phillip DeVille, Lillian DeVille, Angelica Pickles, " u"\u2551\n" u"\u2551 \u2551 Dil Pickles " u"\u2551\n" u"\u2551 South Park \u2551 Stan Marsh, Kyle Broflovski, Eric Cartman, Kenny McCormick " u"\u2551\n" u"\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2569\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255d" ) assert actual == expected # Test inner row border. table.inner_row_border = True actual = table.table expected = ( u"\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2566\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557\n" u"\u2551 Show \u2551 Characters " u"\u2551\n" u"\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256c\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563\n" u"\u2551 Rugrats \u2551 Tommy Pickles, Chuckie Finster, Phillip DeVille, Lillian DeVille, Angelica Pickles, " u"\u2551\n" u"\u2551 \u2551 Dil Pickles " u"\u2551\n" u"\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256c\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563\n" u"\u2551 South Park \u2551 Stan Marsh, Kyle Broflovski, Eric Cartman, Kenny McCormick " u"\u2551\n" u"\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2569\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255d" ) assert actual == expected # Justify right. table.justify_columns = {1: "right"} actual = table.table expected = ( u"\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2566\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557\n" u"\u2551 Show \u2551 Characters " u"\u2551\n" u"\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256c\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563\n" u"\u2551 Rugrats \u2551 Tommy Pickles, Chuckie Finster, Phillip DeVille, Lillian DeVille, Angelica Pickles, " u"\u2551\n" u"\u2551 \u2551 Dil Pickles " u"\u2551\n" u"\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256c\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563\n" u"\u2551 South Park \u2551 Stan Marsh, Kyle Broflovski, Eric Cartman, Kenny McCormick " u"\u2551\n" u"\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2569\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550" u"\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255d" ) assert actual == expected
def printTasks(board_id,board_name): query = "SELECT task_ids FROM boards WHERE board_id = {0}".format(board_id) cursor.execute(query) taskList = [] for task in cursor: taskList.append(task) print taskList tasks = [] for task in taskList: query2 = "SELECT task_description,task_state FROM tasks WHERE task_id = {0}".format(task) currentTask = cursor.execute(query2) tasks.append(currentTask) print tasks bl = 0 ip = 0 done = 0 blList = [] ipList = [] doneList = [] i = 0 (width, height) = console.getTerminalSize() for task in tasks: for char in task[0]: if i == width/3-4: task[0] = insert(task[0],'\n',i) i+=1 if task[1] == 0: bl += 1 blList.append(task[0]) if task[1] == 1: ip+= 1 ipList.append(task[0]) if task[1] == 2: done += 1 doneList.append(task[0]) backLogWithSpacing = "Backlog" + " " * (width/3-4-len("Backlog")) inProgressWithSpacing = "In Progress" + " " * (width/3-4-len("In Progress")) doneWithSpacing = "Done" + " " * (width/3-4-len("Done")) allTasks = [[backLogWithSpacing,inProgressWithSpacing,doneWithSpacing]] for i in range (0,max(bl,ip,done)): currentList = [] if i < bl: currentList.append(blList[i]) else: currentList.append('') if i < ip: currentList.append[ipList[i]] else: currentList.append('') if i < done: currentList.append(doneList[i]) else: currentList.append('') allTasks.append(currentList) table = DoubleTable(allTasks, board_name) table.inner_row_border = True print(table.table)
def get_statistics(): flag_total = 0 noinfo = [] source_matches = defaultdict(list) mapp_sigable = defaultdict(list) mapp_nonsigable = defaultdict(list) itw_sigable = defaultdict(list) itw_nonsigable = defaultdict(list) try: # Validate input date strings initially if (pendulum.parse(args.fromdate) or pendulum.parse(args.enddate)) and (pendulum.parse( args.enddate) > pendulum.parse(args.fromdate)): for idx in json_data: if (pendulum.parse(idx['date']) >= pendulum.parse( args.fromdate) and pendulum.parse(idx['date']) <= pendulum.parse(args.enddate)): flag_total += 1 if idx['source'] == 'No info': source_matches[idx['source']].append(idx) noinfo.append((idx['cve_id'], idx['vendor'])) elif idx['source'] == 'MAPP': source_matches[idx['source']].append(idx) if idx['sigable'] == 'Yes': mapp_sigable[idx['sigable']].append( (idx['cve_id'], idx['rules'])) elif idx['sigable'] == 'No': mapp_nonsigable[idx['sigable']].append( (idx['cve_id'], idx['reason'], idx['author'])) elif idx['source'] == 'ITW': source_matches[idx['source']].append(idx) if idx['sigable'] == 'Yes': itw_sigable[idx['sigable']].append( (idx['cve_id'], idx['rules'])) elif idx['sigable'] == 'No': itw_nonsigable[idx['sigable']].append( (idx['cve_id'], idx['reason'], idx['author'])) else: print('Invalid date range!\n') exit(0) except ValueError as error: print(error) exit(0) print('--[[ MAPP STATISTICS ]]--\n==========================') print('[*]Total CVEs:\t\t{}'.format(flag_total)) print('[*]MAPP CVEs:') print(' - Sigable:\t\t{}'.format(len(mapp_sigable['Yes']))) print(' - Nonsigable:\t{}'.format(len(mapp_nonsigable['No']))) print('[*]ITW CVEs:') print(' - Sigable:\t\t{}'.format(len(itw_sigable['Yes']))) print(' - Nonsigable:\t{}'.format(len(itw_nonsigable['No']))) print('[*]No info CVEs:\t{}\n'.format(len(source_matches['No info']))) if len(mapp_sigable['Yes']) > 0 and (args.table == 'True' or args.table == 'true'): table = DoubleTable(title=' MAPP Sigable ', table_data=mapp_sigable['Yes']) table.inner_row_border = True table.inner_column_border = True table.justify_columns[0] = 'left' table.justify_columns[0] = 'center' print() print(table.table) if len(itw_sigable['Yes']) > 0 and (args.table == 'True' or args.table == 'true'): table = DoubleTable(title=' ITW Sigable ', table_data=itw_sigable['Yes']) table.inner_row_border = True table.inner_column_border = True table.justify_columns[0] = 'left' table.justify_columns[1] = 'center' print() print(table.table) if len(mapp_nonsigable['No']) > 0 and (args.table == 'True' or args.table == 'true'): table = DoubleTable(title=' MAPP Nonsigable ', table_data=mapp_nonsigable['No']) table.inner_row_border = True table.inner_column_border = True table.justify_columns[0] = 'center' table.justify_columns[1] = 'left' table.justify_columns[2] = 'center' print() print(table.table) if len(itw_nonsigable['No']) > 0 and (args.table == 'True' or args.table == 'true'): table = DoubleTable(title=' ITW Nonsigable ', table_data=itw_nonsigable['No']) table.inner_row_border = True table.inner_column_border = True table.justify_columns[0] = 'center' table.justify_columns[1] = 'left' table.justify_columns[2] = 'center' print() print(table.table) if len(noinfo) > 0 and (args.table == 'True' or args.table == 'true'): table = DoubleTable(title=' No info ', table_data=noinfo) table.inner_row_border = True table.inner_column_border = True table.justify_columns[0] = 'left' table.justify_columns[1] = 'left' print() print(table.table)