Repository Analysis

openwrt-xiaomi/xmir-patcher

Firmware patcher for Xiaomi routers

22.4 Moderate AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of openwrt-xiaomi/xmir-patcher, a Python project with 3,418 GitHub stars. SynthScan v2.0 examined 17,709 lines of code across 103 source files, recording 357 pattern matches distributed across 10 syntactic categories. The overall adjusted score of 22.4 places this repository in the Moderate AI signal band.

The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).

22.4
Adjusted Score
22.4
Raw Score
100%
Time Factor
2026-08-29
Last Push
3.4K
Stars
Python
Language
17.7K
Lines of Code
103
Files
357
Pattern Hits
2026-08-29
Scan Date
0.04
HC Hit Rate

What These Metrics Mean

Adjusted Score
Primary synthetic code indicator. Raw score normalised per 1,000 lines of code and multiplied by the temporal discount factor. This is the definitive comparative metric — use it to rank repositories by AI authorship density.
Raw Score
The unmodified sum of all severity-weighted, context-multiplied pattern match scores before temporal discounting. Reflects the absolute signal strength independent of when the repository was last active.
Time Factor
The temporal discount multiplier (0–100%) applied to the raw score. Repositories last updated before ChatGPT's launch (Nov 2022) receive a 5% factor. Full signal is only assigned to repositories active in the post-adoption era (Jan 2024+).
Pattern Hits
Total count of individual pattern matches across all files and categories. A high hit count with a low score may indicate a very large codebase with isolated AI snippets; a low count with a high score indicates dense, concentrated AI signatures.
HC Hit Rate
High+Critical pattern hits per file, averaged across the repository. This orthogonal signal catches repositories where a few files are densely packed with high-severity AI tells — a strong indicator even when the normalised score appears moderate due to codebase size.
Lines of Code / Files
Total lines and files analysed. The scanner examines 94 file extensions. These denominators are used to normalise the score, enabling fair comparison between repositories of vastly different sizes.

Score History

Longitudinal tracking requires multiple scan runs. Once this repository is re-scanned after new commits land, this chart will visualise how the synthetic code signal evolves over time — enabling you to detect whether AI authorship is growing, stabilising, or being actively corrected by human engineers.

No multi-scan history yet — run the scanner again to build trend data.

Severity Breakdown

Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.

CRITICAL 0HIGH 4MEDIUM 24LOW 329

Directory Score Breakdown

This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.

Pattern Findings

The scanner identified 357 distinct pattern matches across 10 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.

Reading the findings table: The Severity column indicates the diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.

Unused Imports139 hits · 136 pts
SeverityFileLineSnippetContext
LOWshexec.py4CODE
LOWshexec.py5CODE
LOWshexec.py7CODE
LOWshexec.py8CODE
LOWshexec.py9CODE
LOWshexec.py10CODE
LOWshexec.py11CODE
LOWinstall_lang.py10CODE
LOWinstall_lang.py12CODE
LOWdevtree.py6CODE
LOWgateway.py11CODE
LOWgateway.py20CODE
LOWgateway.py22CODE
LOWgateway.py23CODE
LOWgateway.py839CODE
LOWxqimage.py7CODE
LOWxqimage.py11CODE
LOWxqimage.py12CODE
LOWxqimage.py32CODE
LOWpo2lmo.py3CODE
LOWpo2lmo.py5CODE
LOWenvbuffer.py4CODE
LOWenvbuffer.py5CODE
LOWenvbuffer.py6CODE
LOWenvbuffer.py7CODE
LOWconnect.py4CODE
LOWconnect.py6CODE
LOWconnect.py8CODE
LOWconnect.py9CODE
LOWconnect.py28CODE
LOWinstall_bl.py7CODE
LOWconnect3.py4CODE
LOWconnect3.py5CODE
LOWconnect3.py7CODE
LOWconnect3.py8CODE
LOWconnect3.py9CODE
LOWconnect3.py11CODE
LOWconnect3.py12CODE
LOWconnect3.py15CODE
LOWconnect3.py16CODE
LOWconnect3.py17CODE
LOWconnect3.py18CODE
LOWconnect3.py19CODE
LOWconnect7.py8CODE
LOWconnect7.py9CODE
LOWconnect7.py112CODE
LOWconnect6.py4CODE
LOWconnect6.py9CODE
LOWconnect6.py10CODE
LOWlmo2po.py3CODE
LOWread_dmesg.py5CODE
LOWread_dmesg.py6CODE
LOWread_dmesg.py8CODE
LOWread_dmesg.py10CODE
LOWconnect2.py4CODE
LOWconnect2.py5CODE
LOWconnect2.py6CODE
LOWconnect2.py7CODE
LOWconnect2.py8CODE
LOWconnect2.py9CODE
79 more matches not shown…
Excessive Try-Catch Wrapping99 hits · 104 pts
SeverityFileLineSnippetContext
MEDIUMgateway.py775def ssh_close(self):CODE
MEDIUMgateway.py828def check_telnet(self, timeout = 2, port = 23, verbose = 0):CODE
LOWgateway.py516 except Exception as e:CODE
LOWgateway.py524 except Exception:CODE
LOWgateway.py534 except Exception:CODE
LOWgateway.py538 except Exception:CODE
LOWgateway.py680 except Exception as e:CODE
LOWgateway.py685 except Exception as e:CODE
LOWgateway.py689 except Exception:CODE
LOWgateway.py693 except Exception:CODE
LOWgateway.py903 except Exception as e:CODE
LOWgateway.py909 except Exception:CODE
LOWgateway.py918 except Exception:CODE
LOWgateway.py926 except Exception:CODE
LOWgateway.py142 except Exception:CODE
LOWgateway.py155 except Exception:CODE
LOWgateway.py189 except Exception as e:CODE
LOWgateway.py216 except Exception:CODE
LOWgateway.py253 except Exception:CODE
LOWgateway.py326 except Exception:CODE
LOWgateway.py665 except Exception:CODE
LOWgateway.py778 except Exception:CODE
LOWgateway.py782 except Exception:CODE
LOWgateway.py797 except Exception:CODE
LOWgateway.py809 except Exception as e:CODE
LOWgateway.py821 except Exception as e:CODE
LOWgateway.py833 except Exception as e:CODE
LOWgateway.py842 except Exception as e:CODE
LOWgateway.py874 except Exception as e:CODE
LOWgateway.py981 except Exception as e:CODE
LOWgateway.py1025 except Exception as e:CODE
LOWgateway.py1035 except Exception:CODE
LOWgateway.py1097 except Exception:CODE
LOWgateway.py1154 except Exception:CODE
LOWconnect.py74 except Exception:CODE
LOWconnect3.py203 except Exception as e:CODE
MEDIUMconnect3.py194def device_factory_reset(timeout = 17, format_user_data = False):CODE
LOWconnect7.py29 except Exception:CODE
LOWconnect7.py253 except Exception:STRING
LOWread_info.py658 except Exception:CODE
LOWread_info.py668 except Exception:CODE
LOWread_info.py676 except Exception:CODE
LOWread_info.py682 except Exception:CODE
LOWread_info.py115 except Exception:CODE
LOWread_info.py449 except Exception:CODE
LOWread_info.py531 except Exception:CODE
LOWread_info.py591 except Exception:CODE
LOWread_info.py731 except Exception:CODE
LOWread_info.py773 except Exception:CODE
LOWread_info.py872 except Exception:CODE
LOWread_info.py942 except Exception:CODE
LOWread_info.py1007 except Exception:CODE
LOWread_info.py1103 except Exception:CODE
LOWconnect5.py72 except Exception as e:CODE
LOWconnect5.py84 except Exception:CODE
LOWconnect5.py137 except Exception:CODE
LOWconnect5.py155 except Exception:CODE
LOWconnect5.py170 except Exception:CODE
LOWconnect5.py261 except Exception:CODE
LOWconnect5.py266 except Exception:CODE
39 more matches not shown…
Deep Nesting61 hits · 57 pts
SeverityFileLineSnippetContext
LOWdevtree.py52CODE
LOWdevtree.py124CODE
LOWgateway.py280CODE
LOWgateway.py483CODE
LOWgateway.py697CODE
LOWgateway.py947CODE
LOWgateway.py1042CODE
LOWgateway.py1104CODE
LOWgateway.py1195CODE
LOWxqimage.py184CODE
LOWpo2lmo.py128CODE
LOWpo2lmo.py182CODE
LOWlmo2po.py71CODE
LOWlmo2po.py89CODE
LOWread_info.py133CODE
LOWread_info.py161CODE
LOWread_info.py268CODE
LOWread_info.py329CODE
LOWread_info.py824CODE
LOWinstall_fw.py234CODE
LOWinstall_fw.py316CODE
LOWinstall_fw.py416CODE
LOWinstall_fw.py839CODE
LOWinstall_fw.py1027CODE
LOWxmir_base/fdt/__init__.py400CODE
LOWxmir_base/fdt/__init__.py545CODE
LOWxmir_base/fdt/__init__.py608CODE
LOWxmir_base/fdt/__init__.py91CODE
LOWxmir_base/fdt/__init__.py198CODE
LOWxmir_base/fdt/__init__.py258CODE
LOWxmir_base/fdt/items.py582CODE
LOWxmir_base/fdt/items.py680CODE
LOWxmir_base/fdt/__main__.py164CODE
LOWxmir_base/ubireader/utils.py26CODE
LOWxmir_base/ubireader/utils.py84CODE
LOWxmir_base/ubireader/debug.py36CODE
LOWxmir_base/ubireader/ubi/display.py111CODE
LOWxmir_base/ubireader/ubi/display.py136CODE
LOWxmir_base/ubireader/ubi/block/sort.py91CODE
LOWxmir_base/ubireader/ubi/block/__init__.py106CODE
LOWxmir_base/ubireader/ubi/block/__init__.py160CODE
LOWxmir_base/ubireader/ubifs/list.py129CODE
LOWxmir_base/ubireader/ubifs/list.py146CODE
LOWxmir_base/ubireader/ubifs/display.py29CODE
LOWxmir_base/ubireader/ubifs/display.py44CODE
LOWxmir_base/ubireader/ubifs/display.py72CODE
LOWxmir_base/ubireader/ubifs/walk.py25CODE
LOWxmir_base/ubireader/ubifs/output.py61CODE
LOWxmir_base/ubireader/ubifs/output.py175CODE
LOWxmir_base/ubireader/scripts/ubireader_display_info.py34CODE
LOWxmir_base/ubireader/scripts/ubireader_list_files.py36CODE
LOWxmir_base/ubireader/scripts/ubireader_display_blocks.py36CODE
LOWxmir_base/ubireader/scripts/ubireader_utils_info.py50CODE
LOWxmir_base/ubireader/scripts/ubireader_utils_info.py140CODE
LOWxmir_base/ubireader/scripts/ubireader_utils_info.py164CODE
LOWxmir_base/ubireader/scripts/ubireader_extract_images.py41CODE
LOWxmir_base/ubireader/scripts/ubireader_extract_files.py47CODE
LOWxmir_base/telnetlib/telnetlib.py292CODE
LOWxmir_base/telnetlib/telnetlib.py422CODE
LOWxmir_base/telnetlib/telnetlib.py535CODE
1 more matches not shown…
Decorative Section Separators13 hits · 38 pts
SeverityFileLineSnippetContext
MEDIUMgateway.py519 #===============================================================================COMMENT
MEDIUMgateway.py528 #===============================================================================COMMENT
MEDIUMgateway.py590 #===============================================================================COMMENT
MEDIUMgateway.py615 #===============================================================================COMMENT
MEDIUMgateway.py632 #===============================================================================COMMENT
MEDIUMgateway.py653 #===============================================================================COMMENT
MEDIUMgateway.py1359#===============================================================================COMMENT
MEDIUMgateway.py1429#===============================================================================COMMENT
MEDIUMinstall_fw.py1142# =====================================================================COMMENT
MEDIUMinstall_ssh.py141# ---------------------------------------------------------------------------STRING
MEDIUMinstall_ssh.py195# ---------------------------------------------------------------------------STRING
MEDIUMxmir_base/ubireader/ubi/defines.py9# --------------------------COMMENT
MEDIUMxmir_base/ubireader/ubifs/defines.py9# --------------------------COMMENT
Over-Commented Block34 hits · 34 pts
SeverityFileLineSnippetContext
LOWxmir_base/fdt/misc.py1# Copyright 2017 Martin OlejarCOMMENT
LOWxmir_base/fdt/header.py1# Copyright 2017 Martin OlejarCOMMENT
LOWxmir_base/fdt/__init__.py1# Copyright 2017 Martin OlejarCOMMENT
LOWxmir_base/fdt/items.py1# Copyright 2017 Martin OlejarCOMMENT
LOWxmir_base/fdt/__main__.py1#!/usr/bin/env pythonCOMMENT
LOWxmir_base/ubireader/utils.py1#!/usr/bin/env pythonCOMMENT
LOWxmir_base/ubireader/debug.py1#!/usr/bin/env pythonCOMMENT
LOWxmir_base/ubireader/settings.py1#!/usr/bin/env pythonCOMMENT
LOWxmir_base/ubireader/ubi_io.py1#!/usr/bin/env pythonCOMMENT
LOWxmir_base/ubireader/ubi/__init__.py1#!/usr/bin/env pythonCOMMENT
LOWxmir_base/ubireader/ubi/display.py1#!/usr/bin/env pythonCOMMENT
LOWxmir_base/ubireader/ubi/volume.py1#!/usr/bin/env pythonCOMMENT
LOWxmir_base/ubireader/ubi/defines.py1#!/usr/bin/env pythonCOMMENT
LOWxmir_base/ubireader/ubi/defines.py21# the GNU General Public License for more details.COMMENT
LOWxmir_base/ubireader/ubi/headers.py1#!/usr/bin/env pythonCOMMENT
LOWxmir_base/ubireader/ubi/image.py1#!/usr/bin/env pythonCOMMENT
LOWxmir_base/ubireader/ubi/block/layout.py1#!/usr/bin/env pythonCOMMENT
LOWxmir_base/ubireader/ubi/block/sort.py1#!/usr/bin/env pythonCOMMENT
LOWxmir_base/ubireader/ubi/block/__init__.py1#!/usr/bin/env pythonCOMMENT
LOWxmir_base/ubireader/ubifs/misc.py1#!/usr/bin/env pythonCOMMENT
LOWxmir_base/ubireader/ubifs/list.py1#!/usr/bin/env pythonCOMMENT
LOWxmir_base/ubireader/ubifs/__init__.py1#!/usr/bin/env pythonCOMMENT
LOWxmir_base/ubireader/ubifs/display.py1#!/usr/bin/env pythonCOMMENT
LOWxmir_base/ubireader/ubifs/walk.py1#!/usr/bin/env pythonCOMMENT
LOWxmir_base/ubireader/ubifs/defines.py1#!/usr/bin/env pythonCOMMENT
LOWxmir_base/ubireader/ubifs/defines.py21# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License forCOMMENT
LOWxmir_base/ubireader/ubifs/nodes.py1#!/usr/bin/env pythonCOMMENT
LOWxmir_base/ubireader/ubifs/output.py1#!/usr/bin/env pythonCOMMENT
LOWxmir_base/ubireader/scripts/ubireader_display_info.py1#!/usr/bin/env pythonCOMMENT
LOWxmir_base/ubireader/scripts/ubireader_list_files.py1#!/usr/bin/env pythonCOMMENT
LOWxmir_base/ubireader/scripts/ubireader_display_blocks.py1#!/usr/bin/env pythonCOMMENT
LOWxmir_base/ubireader/scripts/ubireader_utils_info.py1#!/usr/bin/env pythonCOMMENT
LOWxmir_base/ubireader/scripts/ubireader_extract_images.py1#!/usr/bin/env pythonCOMMENT
LOWxmir_base/ubireader/scripts/ubireader_extract_files.py1#!/usr/bin/env pythonCOMMENT
Cross-Language Confusion4 hits · 15 pts
SeverityFileLineSnippetContext
HIGHactivate_boot.py155 if ( flag_try_sys1_failed > 1 || flag_try_sys2_failed > 1 || flag_ota_reboot > 1 || flag_last_success > 1 )STRING
HIGHactivate_boot.py158 if ( flag_try_sys1_failed == 1 && flag_try_sys2_failed == 1 )STRING
HIGHinstall_ssh.py65 grep -v "/ssh_patch.sh" $FILE_CRON > $FILE_CRON.new || echo "" > $FILE_CRON.newCODE
HIGHunlock_features.py264 grep -v "/unlockf_patch.sh" $FILE_CRON > $FILE_CRON.new || echo "" > $FILE_CRON.newCODE
Self-Referential Comments3 hits · 9 pts
SeverityFileLineSnippetContext
MEDIUMconnect4.py70 # Create an SSL context object and configure it for the clientCOMMENT
MEDIUMconnect4.py75 # Create a TCP socket objectCOMMENT
MEDIUMxmir_base/ubireader/ubifs/defines.py11# This file is part of UBIFS.COMMENT
AI Structural Patterns2 hits · 2 pts
SeverityFileLineSnippetContext
LOWgateway.py380CODE
LOWconnect4.py87CODE
Modern Structural Boilerplate1 hit · 1 pts
SeverityFileLineSnippetContext
LOWxmir_base/fdt/__init__.py26__all__ = [CODE
Hyper-Verbose Identifiers1 hit · 1 pts
SeverityFileLineSnippetContext
LOWxmir_base/telnetlib/telnetlib.py418 def set_option_negotiation_callback(self, callback):CODE