Function
draw_box
(stdscr, y, x, height, width, highlight=False)
Source from the content-addressed store, hash-verified
| 2590 | |
| 2591 | def cleanup_bashrc(): |
| 2592 | """Removes all DedSec-related blocks and aliases from bash.bashrc.""" |
| 2593 | try: |
| 2594 | with open(BASHRC_PATH, "r") as f: |
| 2595 | lines = f.readlines() |
| 2596 | except Exception as e: |
| 2597 | print(f"Error reading {BASHRC_PATH}: {e}") |
| 2598 | return False |
| 2599 | |
| 2600 | filtered_lines = [] |
| 2601 | regex_pattern = re.compile(r"(cd\s+.*DedSec/Scripts.*python3\s+.*Settings\.py\s+--menu.*|alias\s+(m|e|g)=.*cd\s+.*DedSec/Scripts.*)") |
| 2602 | |
| 2603 | in_marked_block = False |
| 2604 | |
| 2605 | for line in lines: |
| 2606 | if BASHRC_START_MARKER in line or NETWORK_BASHRC_START_MARKER in line or (line.startswith("# --- DedSec ") and "Background Checker" in line): |
| 2607 | in_marked_block = True |
| 2608 | continue |
| 2609 | if BASHRC_END_MARKER in line or NETWORK_BASHRC_END_MARKER in line or (line.startswith("# --- End DedSec ") and "Background Checker" in line): |
| 2610 | in_marked_block = False |
| 2611 | continue |
| 2612 | |
| 2613 | if in_marked_block: |
| 2614 | continue |
| 2615 | |
| 2616 | if not regex_pattern.search(line): |
Tested by
no test coverage detected