MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / get_vulnerability_intel

Function get_vulnerability_intel

webapp_modern.py:6559–6928  ·  view source on GitHub ↗

Get interesting intelligence from scan files (not vulnerabilities - those are in threat intel)

()

Source from the content-addressed store, hash-verified

6557 lines = f.readlines()
6558 # Skip header row and count data rows only
6559 data_rows = 0
6560 for i, line in enumerate(lines):
6561 line = line.strip()
6562 if line:
6563 # Skip first line if it contains CSV headers
6564 if i == 0 and ('MAC Address' in line or 'IP Address' in line or 'User' in line or 'Password' in line):
6565 continue
6566 # Count non-empty data rows
6567 data_rows += 1
6568 cred_count += data_rows
6569 break # Success, exit retry loop
6570 except (IOError, OSError) as e:
6571 if attempt == max_retries - 1: # Last attempt
6572 logger.debug(f"Could not read credential file {filepath} after {max_retries} attempts: {e}")
6573 else:
6574 time.sleep(0.1) # Brief pause before retry
6575 except Exception as e:
6576 logger.debug(f"Error processing credential file {filepath}: {e}")
6577 continue
6578
6579 if cred_count > 0 or len(cred_files_found) > 0:
6580 logger.debug(f"Credential count: {cred_count} from {len(cred_files_found)} files")
6581 except Exception as e:
6582 logger.warning(f"Could not list crackedpwd directory: {e}")
6583
6584 # Only update if we have a stable count (prevent flickering)
6585 old_creds = shared_data.crednbr
6586 if old_creds != cred_count:
6587 shared_data.crednbr = cred_count
6588 logger.info(f"WEBAPP: Updated credentials: {old_creds} -> {cred_count} from {len(cred_files_found)} files")
6589 # ── Pushover: new credentials notification ──
6590 if cred_count > old_creds:
6591 try:
6592 _po = getattr(shared_data, '_pushover_service', None)
6593 if _po:
6594 _po.notify_new_credentials(cred_count - old_creds, cred_count)
6595 except Exception as _po_err:
6596 logger.debug(f"Pushover credential notification skipped: {_po_err}")
6597 else:
6598 logger.debug(f"WEBAPP: Credentials stable at: {cred_count} from {len(cred_files_found)} files")
6599 else:
6600 logger.warning(f"Crackedpwd directory does not exist: {cred_results_dir}")
6601
6602 data_stolen_dir = getattr(shared_data, 'datastolendir', os.path.join('data', 'output', 'data_stolen'))
6603 if os.path.exists(data_stolen_dir):
6604 try:
6605 total_data_files = sum([len(files) for r, d, files in os.walk(data_stolen_dir)])
6606 old_data = shared_data.datanbr
6607 shared_data.datanbr = total_data_files
6608 logger.debug(f"Updated data stolen: {old_data} -> {total_data_files}")
6609 except Exception as e:
6610 logger.debug(f"Could not count data stolen files: {e}")
6611
6612 zombies_dir = getattr(shared_data, 'zombiesdir', os.path.join('data', 'output', 'zombies'))
6613 if os.path.exists(zombies_dir):
6614 try:
6615 total_zombies = sum([len(files) for r, d, files in os.walk(zombies_dir)])
6616 old_zombies = shared_data.zombiesnbr

Callers

nothing calls this directly

Calls 11

parse_lynis_datFunction · 0.90
format_lynis_sectionFunction · 0.85
escapeMethod · 0.80
appendMethod · 0.80
errorMethod · 0.80
copyMethod · 0.80
sortMethod · 0.80
getMethod · 0.45
readMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected