Enterprise Linux Security Patching with YUM and Red Hat Security Advisories (RHSA)

Red Hat Enterprise Linux (RHEL) and derivative distributions classify package fixes into structured advisories: RHSA (Red Hat Security Advisory): Contains fixes for security vulnerabilities and assigned CVEs. RHBA (Red Hat Bug Advisory): Contains stability, performance, and bug fixes. RHEA (Red Hat Enhancement Advisory): Introduces non-critical product enhancements or feature additions. Using the yum-plugin-security extension (standard in RHEL 6/7 and integrated directly into dnf on RHEL 8/9), system administrators can audit and apply security-only patches without risking unexpected major version upgrades. ...

June 29, 2015 · 2 min · 340 words · Ahmad Mahfouz

Converting VirtualBox Disk Images (VHD / VDI) to VMware (VMDK)

When migrating virtual machines from Oracle VirtualBox to VMware Workstation, Fusion, or ESXi, virtual disk formats must be converted to VMware’s native format (VMDK). There are two primary methods to accomplish this: using the universal qemu-img utility or VirtualBox’s native VBoxManage CLI tool. Method 1: Using qemu-img (Recommended) qemu-img is a versatile disk management tool capable of converting between raw, qcow2, VMDK, VDI, and VHD/VPC images. Installation On Ubuntu/Debian: sudo apt-get install -y qemu-utils On Fedora/RHEL/CentOS: ...

January 12, 2015 · 1 min · 191 words · Ahmad Mahfouz

Bypassing Foreign Key Constraints for Table Deletion in MySQL

When maintaining or purging relational data in MySQL and MariaDB, deleting rows from a parent table that are referenced by existing foreign keys in child tables triggers a constraint violation error: ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails While referential integrity is essential during standard application execution, administrative migrations, database seeding, or emergency data cleanup frequently require temporarily suspending constraint validation. Suspending Constraint Checks To allow MySQL to delete or truncate rows without evaluating foreign key dependencies, disable FOREIGN_KEY_CHECKS in the active database session: ...

December 13, 2014 · 1 min · 197 words · Ahmad Mahfouz

Dictionary Enumeration of Blind FTP Directories and Files in Python

During penetration testing assessments, FTP services (such as vsftpd or ProFTPD) are sometimes configured to disable directory listings (LIST or NLST commands return 550 Access is denied). While users cannot browse the file hierarchy interactively, read and traversal permissions may still allow direct path navigation (CWD) and file retrieval (RETR). In such “blind” scenarios, dictionary-based brute forcing reveals hidden folders and downloadable assets. 1. Directory Fuzzing via CWD This Python script tests candidate directory names against the FTP server using the CWD (Change Working Directory) command. If the directory exists and permissions permit traversal, the server returns a positive status code rather than error_perm (550). ...

December 6, 2014 · 2 min · 333 words · Ahmad Mahfouz

Building Lightweight Terminal Progress Bars in Pure Python

When developing CLI utilities, long-running batch jobs, or automation scripts, providing real-time visual feedback improves user experience. While libraries like tqdm or rich are excellent, standalone scripts or restricted production environments often benefit from a pure standard-library implementation without external dependencies. Minimal Standard-Library Progress Bar By leveraging the carriage return character (\r), the terminal cursor returns to the start of the current line rather than advancing to a new line. Pairing this with sys.stdout.flush() forces immediate buffer rendering: ...

December 4, 2014 · 1 min · 190 words · Ahmad Mahfouz

Duplicate File Finder via Cryptographic Hashes in Python

Redundant and duplicated files consume valuable disk capacity and complicate backup management. Because identical files often have different names or modification timestamps, simple filename comparisons are insufficient. By computing cryptographic checksums (MD5 or SHA-256) for each file’s binary content, we can reliably group and identify duplicate files across extensive filesystem trees. Python Duplicate File Scanner This script traverses the target directory recursively, calculates chunked cryptographic checksums to minimize memory usage, and prompts interactively to safely delete redundant copies. ...

December 4, 2014 · 2 min · 387 words · Ahmad Mahfouz

Django Architecture Cheat Sheet: ORM, Signals, Sessions, and Auth

A quick-reference architectural guide covering essential patterns in Django web applications: querysets, signals, raw database queries, session handling, and authentication. 1. Django ORM Query Patterns # Query basic datasets Article.objects.all() Article.objects.all().count() Article.objects.filter(is_published=True).exists() # Slicing (LIMIT and OFFSET) Article.objects.filter(is_published=True)[:5] # Specific field projections Article.objects.filter(is_published=True).values('title', 'created_at')[:5] # Ordering Article.objects.filter(is_published=True).order_by('-created_at') # Field lookups and date filtering from datetime import datetime Article.objects.filter(created_at__gte=datetime(2025, 1, 1)) Article.objects.filter(created_at__year=2025).order_by('id') # Inspect underlying compiled SQL query = Article.objects.filter(is_published=True) print(str(query.query)) 2. Raw SQL and Database Connections When complex reporting queries or performance bottlenecks require bypassing the ORM: ...

December 4, 2014 · 2 min · 388 words · Ahmad Mahfouz

Automated Flight Ticket Booking and Availability Monitoring with Splinter

During peak holiday seasons, securing airline seats on heavily booked routes often requires repeatedly checking booking engines for cancellations. Using browser automation frameworks like Splinter (an abstraction layer built on top of Selenium WebDriver), we can automate the search loop, detect flight inventory releases, fill passenger details, and hold reservations automatically. What is Splinter? Splinter provides a pythonic API for browser automation. It allows developers to: Navigate web portals and wait for elements. Select radio buttons, dropdowns, and checkboxes. Fill form fields and submit via JavaScript execution. Inspect rendered DOM structures and handle session timeouts. Automated Booking Workflow The script continuously queries available flight options for specific routes and travel dates. If the airline portal reports “no flights available” or sessions expire, it automatically restarts the search until seats open up, then populates passenger credentials: ...

December 4, 2014 · 2 min · 340 words · Ahmad Mahfouz

Building an Audio & Desktop Cryptocurrency Price Alert in Python

Monitoring volatile market movements often requires immediate notifications without constantly watching browser tabs or mobile trading apps. By combining public REST APIs with native Linux desktop notification tools (notify-send) and speech synthesis engines (espeak), we can build a lightweight background tracker that speaks out when price targets are reached. Prerequisites On Debian/Ubuntu systems, install espeak and libnotify-bin: sudo apt-get install -y espeak libnotify-bin Python Price Alert Script The script queries a public ticker API, evaluates target price thresholds, and delivers desktop notifications alongside synthesized voice alerts: ...

December 4, 2014 · 2 min · 232 words · Ahmad Mahfouz

Forwarding Client Real IPs from Nginx Reverse Proxy to Apache

A common high-performance web architecture deploys Nginx on the public frontend (port 80/443) to handle TLS termination, static asset caching, and request routing, reverse-proxying dynamic requests to an Apache backend (e.g., listening on port 8080 or localhost). However, without explicit header forwarding, Apache logs will show all incoming requests originating from 127.0.0.1 (the reverse proxy IP) rather than the client’s actual public IP. This disrupts geolocation, fraud detection, rate-limiting, and security audit trails. ...

November 30, 2014 · 2 min · 297 words · Ahmad Mahfouz