[
  {
    "path": ".dockerignore",
    "content": "# Python\n__pycache__/\n*.py[cod]\n*$py.class\n*.so\n.Python\nenv/\nvenv/\nENV/\nenv.bak/\nvenv.bak/\n\n# IDE\n.vscode/\n.idea/\n*.swp\n*.swo\n*~\n\n# OS\n.DS_Store\n.DS_Store?\n._*\n.Spotlight-V100\n.Trashes\nehthumbs.db\nThumbs.db\n\n# Git\n.git/\n.gitignore\n\n# Documentation\n*.md\n!README.md\n\n# Logs\n*.log\n\n# Test files\ntest_*.py\n*_test.py\n\n# Development files\nstart_api.py\n"
  },
  {
    "path": ".gitignore",
    "content": "### JetBrains template\n# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider\n# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839\n\n# User-specific stuff\n.idea/**/workspace.xml\n.idea/**/tasks.xml\n.idea/**/usage.statistics.xml\n.idea/**/dictionaries\n.idea/**/shelf\n\n# AWS User-specific\n.idea/**/aws.xml\n\n# Generated files\n.idea/**/contentModel.xml\n\n# Sensitive or high-churn files\n.idea/**/dataSources/\n.idea/**/dataSources.ids\n.idea/**/dataSources.local.xml\n.idea/**/sqlDataSources.xml\n.idea/**/dynamic.xml\n.idea/**/uiDesigner.xml\n.idea/**/dbnavigator.xml\n\n# Gradle\n.idea/**/gradle.xml\n.idea/**/libraries\n\n# Gradle and Maven with auto-import\n# When using Gradle or Maven with auto-import, you should exclude module files,\n# since they will be recreated, and may cause churn.  Uncomment if using\n# auto-import.\n# .idea/artifacts\n# .idea/compiler.xml\n# .idea/jarRepositories.xml\n# .idea/modules.xml\n# .idea/*.iml\n# .idea/modules\n# *.iml\n# *.ipr\n\n# CMake\ncmake-build-*/\n\n# Mongo Explorer plugin\n.idea/**/mongoSettings.xml\n\n# File-based project format\n*.iws\n\n# IntelliJ\nout/\n\n# mpeltonen/sbt-idea plugin\n.idea_modules/\n\n# JIRA plugin\natlassian-ide-plugin.xml\n\n# Cursive Clojure plugin\n.idea/replstate.xml\n\n# SonarLint plugin\n.idea/sonarlint/\n\n# Crashlytics plugin (for Android Studio and IntelliJ)\ncom_crashlytics_export_strings.xml\ncrashlytics.properties\ncrashlytics-build.properties\nfabric.properties\n\n# Editor-based Rest Client\n.idea/httpRequests\n\n# Android studio 3.1+ serialized cache file\n.idea/caches/build_file_checksums.ser\n\n### VirtualEnv template\n# Virtualenv\n# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/\n.Python\n[Bb]in\n[Ii]nclude\n[Ll]ib\n[Ll]ib64\n[Ll]ocal\n[Ss]cripts\npyvenv.cfg\n.venv\npip-selfcheck.json\n\n### Python template\n# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n*$py.class\n\n# C extensions\n*.so\n\n# Distribution / packaging\n.Python\nbuild/\ndevelop-eggs/\ndist/\ndownloads/\neggs/\n.eggs/\nlib/\nlib64/\nparts/\nsdist/\nvar/\nwheels/\nshare/python-wheels/\n*.egg-info/\n.installed.cfg\n*.egg\nMANIFEST\n\n# PyInstaller\n#  Usually these files are written by a python script from a template\n#  before PyInstaller builds the exe, so as to inject date/other infos into it.\n*.manifest\n*.spec\n\n# Installer logs\npip-log.txt\npip-delete-this-directory.txt\n\n# Unit test / coverage reports\nhtmlcov/\n.tox/\n.nox/\n.coverage\n.coverage.*\n.cache\nnosetests.xml\ncoverage.xml\n*.cover\n*.py,cover\n.hypothesis/\n.pytest_cache/\ncover/\n\n# Translations\n*.mo\n*.pot\n\n# Django stuff:\n*.log\nlocal_settings.py\ndb.sqlite3\ndb.sqlite3-journal\n\n# Flask stuff:\ninstance/\n.webassets-cache\n\n# Scrapy stuff:\n.scrapy\n\n# Sphinx documentation\ndocs/_build/\n\n# PyBuilder\n.pybuilder/\ntarget/\n\n# Jupyter Notebook\n.ipynb_checkpoints\n\n# IPython\nprofile_default/\nipython_config.py\n\n# pyenv\n#   For a library or package, you might want to ignore these files since the code is\n#   intended to run in multiple environments; otherwise, check them in:\n# .python-version\n\n# pipenv\n#   According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.\n#   However, in case of collaboration, if having platform-specific dependencies or dependencies\n#   having no cross-platform support, pipenv may install dependencies that don't work, or not\n#   install all needed dependencies.\n#Pipfile.lock\n\n# poetry\n#   Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.\n#   This is especially recommended for binary packages to ensure reproducibility, and is more\n#   commonly ignored for libraries.\n#   https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control\n#poetry.lock\n\n# pdm\n#   Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.\n#pdm.lock\n#   pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it\n#   in version control.\n#   https://pdm.fming.dev/#use-with-ide\n.pdm.toml\n\n# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm\n__pypackages__/\n\n# Celery stuff\ncelerybeat-schedule\ncelerybeat.pid\n\n# SageMath parsed files\n*.sage.py\n\n# Environments\n.env\n.venv\nenv/\nvenv/\nENV/\nenv.bak/\nvenv.bak/\n\n# Spyder project settings\n.spyderproject\n.spyproject\n\n# Rope project settings\n.ropeproject\n\n# mkdocs documentation\n/site\n\n# mypy\n.mypy_cache/\n.dmypy.json\ndmypy.json\n\n# Pyre type checker\n.pyre/\n\n# pytype static type analyzer\n.pytype/\n\n# Cython debug symbols\ncython_debug/\n\n# PyCharm\n#  JetBrains specific template is maintained in a separate JetBrains.gitignore that can\n#  be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore\n#  and can be added to the global gitignore or merged into this file.  For a more nuclear\n#  option (not recommended) you can uncomment the following to ignore the entire idea folder.\n#.idea/\n\n"
  },
  {
    "path": "Dockerfile",
    "content": "# 使用Python 3.11官方镜像作为基础镜像\nFROM python:3.11-slim\n\n# 设置工作目录\nWORKDIR /app\n\n# 设置环境变量\nENV PYTHONDONTWRITEBYTECODE=1 \\\n    PYTHONUNBUFFERED=1 \\\n    PIP_NO_CACHE_DIR=1 \\\n    PIP_DISABLE_PIP_VERSION_CHECK=1\n\n# 安装系统依赖\nRUN apt-get update && apt-get install -y \\\n    libglib2.0-0 \\\n    libsm6 \\\n    libxext6 \\\n    libxrender-dev \\\n    libgomp1 \\\n    libglib2.0-0 \\\n    libgtk-3-0 \\\n    && rm -rf /var/lib/apt/lists/*\n\n# 复制requirements.txt并安装Python依赖\nCOPY requirements.txt .\nRUN pip install --no-cache-dir -r requirements.txt\n\n# 复制应用代码和模型文件\nCOPY . .\n\n# 创建非root用户\nRUN useradd --create-home --shell /bin/bash app && chown -R app:app /app\nUSER app\n\n# 暴露端口\nEXPOSE 8000\n\n# 健康检查\nHEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \\\n    CMD python -c \"import requests; requests.get('http://localhost:8000/health')\" || exit 1\n\n# 启动命令\nCMD [\"python\", \"-m\", \"uvicorn\", \"app:app\", \"--host\", \"0.0.0.0\", \"--port\", \"8000\"]\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU AFFERO GENERAL PUBLIC LICENSE\n                       Version 3, 19 November 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU Affero General Public License is a free, copyleft license for\nsoftware and other kinds of works, specifically designed to ensure\ncooperation with the community in the case of network server software.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nour General Public Licenses are intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  Developers that use our General Public Licenses protect your rights\nwith two steps: (1) assert copyright on the software, and (2) offer\nyou this License which gives you legal permission to copy, distribute\nand/or modify the software.\n\n  A secondary benefit of defending all users' freedom is that\nimprovements made in alternate versions of the program, if they\nreceive widespread use, become available for other developers to\nincorporate.  Many developers of free software are heartened and\nencouraged by the resulting cooperation.  However, in the case of\nsoftware used on network servers, this result may fail to come about.\nThe GNU General Public License permits making a modified version and\nletting the public access it on a server without ever releasing its\nsource code to the public.\n\n  The GNU Affero General Public License is designed specifically to\nensure that, in such cases, the modified source code becomes available\nto the community.  It requires the operator of a network server to\nprovide the source code of the modified version running there to the\nusers of that server.  Therefore, public use of a modified version, on\na publicly accessible server, gives the public access to the source\ncode of the modified version.\n\n  An older license, called the Affero General Public License and\npublished by Affero, was designed to accomplish similar goals.  This is\na different license, not a version of the Affero GPL, but Affero has\nreleased a new version of the Affero GPL which permits relicensing under\nthis license.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU Affero General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Remote Network Interaction; Use with the GNU General Public License.\n\n  Notwithstanding any other provision of this License, if you modify the\nProgram, your modified version must prominently offer all users\ninteracting with it remotely through a computer network (if your version\nsupports such interaction) an opportunity to receive the Corresponding\nSource of your version by providing access to the Corresponding Source\nfrom a network server at no charge, through some standard or customary\nmeans of facilitating copying of software.  This Corresponding Source\nshall include the Corresponding Source for any work covered by version 3\nof the GNU General Public License that is incorporated pursuant to the\nfollowing paragraph.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the work with which it is combined will remain governed by version\n3 of the GNU General Public License.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU Affero General Public License from time to time.  Such new versions\nwill be similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU Affero General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU Affero General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU Affero General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU Affero General Public License as published\n    by the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU Affero General Public License for more details.\n\n    You should have received a copy of the GNU Affero General Public License\n    along with this program.  If not, see <https://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If your software can interact with users remotely through a computer\nnetwork, you should also make sure that it provides a way for users to\nget its source.  For example, if your program is a web application, its\ninterface could display a \"Source\" link that leads users to an archive\nof the code.  There are many ways you could offer source, and different\nsolutions will be better for different programs; see section 13 for the\nspecific requirements.\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU AGPL, see\n<https://www.gnu.org/licenses/>.\n"
  },
  {
    "path": "README_API.md",
    "content": "# ICP备案查询API\n\n这是一个基于FastAPI的ICP备案信息查询服务，可以通过域名查询相关的ICP备案信息。\n\n## 功能特性\n\n- 🚀 基于FastAPI框架，性能优异\n- 🔄 自动重试机制，最多重试5次\n- 🛡️ 自动处理验证码识别\n- 📋 RESTful API接口\n- 📖 自动生成API文档\n\n## 安装依赖\n\n```bash\npip install -r requirements.txt\n```\n\n## 启动服务\n\n### 方法1：使用Docker (推荐)\n\n```bash\n# 构建并启动\ndocker-compose up -d --build\n\n# 查看日志\ndocker-compose logs -f\n\n# 停止服务\ndocker-compose down\n```\n\n### 方法2：本地开发\n```bash\n# 安装依赖\npip install -r requirements.txt\n\n# 启动服务\npython -m uvicorn app:app --host 0.0.0.0 --port 8000 --reload\n```\n\n## API接口\n\n### 查询域名ICP备案信息\n\n**GET** `/query?domain={domain}`\n\n#### 参数\n- `domain` (必需): 要查询的域名，例如 `scgzyun.com`\n\n#### 示例请求\n```bash\ncurl \"http://localhost:8000/query?domain=scgzyun.com\"\n```\n\n#### 示例响应\n```json\n{\n  \"code\": 200,\n  \"msg\": \"操作成功\",\n  \"params\": {\n    \"endRow\": 0,\n    \"firstPage\": 1,\n    \"hasNextPage\": false,\n    \"hasPreviousPage\": false,\n    \"isFirstPage\": true,\n    \"isLastPage\": true,\n    \"lastPage\": 1,\n    \"list\": [\n      {\n        \"contentTypeName\": \"\",\n        \"domain\": \"scgzyun.com\",\n        \"domainId\": 990004509801,\n        \"leaderName\": \"\",\n        \"limitAccess\": \"否\",\n        \"mainId\": 110001964865,\n        \"mainLicence\": \"蜀ICP备19011193号\",\n        \"natureName\": \"企业\",\n        \"serviceId\": 990005092743,\n        \"serviceLicence\": \"蜀ICP备19011193号-6\",\n        \"unitName\": \"成都七淘网络科技有限公司\",\n        \"updateRecordTime\": \"2024-03-01 09:25:43\"\n      }\n    ],\n    \"navigatePages\": 8,\n    \"navigatepageNums\": [1],\n    \"nextPage\": 1,\n    \"pageNum\": 1,\n    \"pageSize\": 10,\n    \"pages\": 1,\n    \"prePage\": 1,\n    \"size\": 1,\n    \"startRow\": 0,\n    \"total\": 1\n  },\n  \"success\": true\n}\n```\n\n### 健康检查\n\n**GET** `/health`\n\n#### 示例请求\n```bash\ncurl \"http://localhost:8000/health\"\n```\n\n#### 示例响应\n```json\n{\n  \"status\": \"healthy\",\n  \"timestamp\": 1704362400\n}\n```\n\n## API文档\n\n启动服务后，可以访问以下地址查看自动生成的API文档：\n\n- Swagger UI: http://localhost:8000/docs\n- ReDoc: http://localhost:8000/redoc\n\n## 错误处理\n\n- 自动重试机制：当查询失败时，会自动重试最多5次\n- 详细错误信息：返回具体的错误原因\n- HTTP状态码：标准的HTTP状态码响应\n\n## 测试\n\n### 本地测试\n```bash\npython test_api.py\n```\n\n### Docker测试\n```bash\n# 在容器中运行测试\ndocker-compose exec icp-spider-api python test_api.py\n\n# 或者直接测试API接口\ncurl \"http://localhost:8000/health\"\ncurl \"http://localhost:8000/query?domain=scgzyun.com\"\n```\n\n## 注意事项\n\n1. 服务依赖于外部的验证码识别模型文件：`yolov8.onnx` 和 `siamese.onnx`\n2. 确保这些模型文件在项目根目录中\n3. 首次运行可能需要一些时间来加载模型\n4. 建议在生产环境中使用更强的错误处理和日志记录\n\n## 项目结构\n\n```\nICP-spider/\n├── app.py              # FastAPI应用主文件\n├── test_api.py         # 测试脚本\n├── main.py             # 原始脚本\n├── crack.py            # 验证码识别模块\n├── requirements.txt    # 依赖列表\n├── Dockerfile          # Docker镜像构建文件\n├── docker-compose.yml  # Docker编排文件\n├── .dockerignore       # Docker忽略文件\n├── yolov8.onnx        # YOLO模型文件\n├── siamese.onnx       # Siamese模型文件\n└── README_API.md      # 项目说明\n```\n\n## Docker部署\n\n### 构建和运行\n```bash\n# 构建镜像\ndocker build -t icp-spider-api .\n\n# 运行容器\ndocker run -d -p 8000:8000 --name icp-spider-api icp-spider-api\n\n# 或使用docker-compose\ndocker-compose up -d --build\n```\n\n### 生产环境部署\n```bash\n# 使用docker-compose部署\ndocker-compose -f docker-compose.yml up -d\n\n# 查看日志\ndocker-compose logs -f\n\n# 停止服务\ndocker-compose down\n```\n"
  },
  {
    "path": "app.py",
    "content": "from fastapi import FastAPI, HTTPException, Query\nfrom fastapi.responses import JSONResponse\nimport base64\nimport json\nimport requests\nimport hashlib\nimport time\nfrom urllib import parse\nfrom crack import Crack\nimport uuid\nfrom cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes\nfrom cryptography.hazmat.backends import default_backend\nimport logging\n\n# 配置日志\nlogging.basicConfig(level=logging.INFO)\nlogger = logging.getLogger(__name__)\n\napp = FastAPI(title=\"ICP备案查询API\", description=\"通过域名查询ICP备案信息\", version=\"1.0.0\")\n\n# 全局变量\ncrack = Crack()\n\n\ndef auth():\n    \"\"\"获取认证token\"\"\"\n    t = str(round(time.time()))\n    data = {\n        \"authKey\": hashlib.md5((\"testtest\" + t).encode()).hexdigest(),\n        \"timeStamp\": t\n    }\n    headers = {\n        \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36\",\n        \"Referer\": \"https://beian.miit.gov.cn/\",\n        \"Content-Type\": \"application/x-www-form-urlencoded\",\n        \"Connection\": \"keep-alive\",\n        \"Accept\": \"application/json, text/plain, */*\",\n        \"Accept-Encoding\": \"gzip, deflate, br\",\n        \"Accept-Language\": \"zh-CN,zh;q=0.9\",\n        \"Origin\": \"https://beian.miit.gov.cn\"\n    }\n    \n    resp = requests.post(\"https://hlwicpfwc.miit.gov.cn/icpproject_query/api/auth\", \n                        headers=headers, data=parse.urlencode(data)).text\n    return json.loads(resp)[\"params\"][\"bussiness\"]\n\n\ndef getImage(token):\n    \"\"\"获取验证码图片\"\"\"\n    headers = {\n        \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36\",\n        \"Referer\": \"https://beian.miit.gov.cn/\",\n        \"Token\": token,\n        \"Connection\": \"keep-alive\",\n        \"Accept\": \"application/json, text/plain, */*\",\n        \"Accept-Encoding\": \"gzip, deflate, br\",\n        \"Accept-Language\": \"zh-CN,zh;q=0.9\",\n        \"Origin\": \"https://beian.miit.gov.cn\"\n    }\n    payload = {\n        \"clientUid\": \"point-\" + str(uuid.uuid4())\n    }\n    \n    resp = requests.post(\"https://hlwicpfwc.miit.gov.cn/icpproject_query/api/image/getCheckImagePoint\",\n                        headers=headers, json=payload).json()\n    return resp[\"params\"], payload[\"clientUid\"]\n\n\ndef aes_ecb_encrypt(plaintext: bytes, key: bytes, block_size=16):\n    \"\"\"AES ECB加密\"\"\"\n    backend = default_backend()\n    cipher = Cipher(algorithms.AES(key), modes.ECB(), backend=backend)\n\n    padding_length = block_size - (len(plaintext) % block_size)\n    plaintext_padded = plaintext + bytes([padding_length]) * padding_length\n\n    encryptor = cipher.encryptor()\n    ciphertext = encryptor.update(plaintext_padded) + encryptor.finalize()\n\n    return base64.b64encode(ciphertext).decode('utf-8')\n\n\ndef generate_pointjson(big_img, small_img, secretKey):\n    \"\"\"生成点击坐标JSON\"\"\"\n    boxes = crack.detect(big_img)\n    if not boxes:\n        raise Exception(\"文字检测失败\")\n        \n    points = crack.siamese(small_img, boxes)\n    new_points = [[p[0] + 20, p[1] + 20] for p in points]\n    pointJson = [{\"x\": p[0], \"y\": p[1]} for p in new_points]\n    enc_pointJson = aes_ecb_encrypt(json.dumps(pointJson).replace(\" \", \"\").encode(), secretKey.encode())\n    return enc_pointJson\n\n\ndef checkImage(token, uuid_token, secretKey, clientUid, pointJson):\n    \"\"\"验证图片点击\"\"\"\n    headers = {\n        \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36\",\n        \"Referer\": \"https://beian.miit.gov.cn/\",\n        \"Token\": token,\n        \"Connection\": \"keep-alive\",\n        \"Accept\": \"application/json, text/plain, */*\",\n        \"Accept-Encoding\": \"gzip, deflate, br\",\n        \"Accept-Language\": \"zh-CN,zh;q=0.9\",\n        \"Origin\": \"https://beian.miit.gov.cn\"\n    }\n    data = {\n        \"token\": uuid_token,\n        \"secretKey\": secretKey,\n        \"clientUid\": clientUid,\n        \"pointJson\": pointJson\n    }\n    resp = requests.post(\"https://hlwicpfwc.miit.gov.cn/icpproject_query/api/image/checkImage\", \n                        headers=headers, json=data).json()\n    if resp[\"code\"] == 200:\n        return resp[\"params\"][\"sign\"]\n    return False\n\n\ndef query_domain(token, sign, uuid_token, domain):\n    \"\"\"查询域名ICP信息\"\"\"\n    headers = {\n        \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36\",\n        \"Referer\": \"https://beian.miit.gov.cn/\",\n        \"Token\": token,\n        \"Sign\": sign,\n        \"Uuid\": uuid_token,\n        \"Connection\": \"keep-alive\",\n        \"Accept\": \"application/json, text/plain, */*\",\n        \"Accept-Encoding\": \"gzip, deflate, br\",\n        \"Accept-Language\": \"zh-CN,zh;q=0.9\",\n        \"Origin\": \"https://beian.miit.gov.cn\",\n        \"Content-Type\": \"application/json\",\n        \"Cookie\": \"__jsluid_s=\" + str(uuid.uuid4().hex[:32])\n    }\n    data = {\"pageNum\": \"\", \"pageSize\": \"\", \"unitName\": domain, \"serviceType\": 1}\n    resp = requests.post(\"https://hlwicpfwc.miit.gov.cn/icpproject_query/api/icpAbbreviateInfo/queryByCondition\",\n                        headers=headers, data=json.dumps(data).replace(\" \", \"\")).text\n    return json.loads(resp)\n\n\ndef query_icp_with_retry(domain: str, max_retries: int = 5):\n    \"\"\"带重试机制的ICP查询\"\"\"\n    for attempt in range(max_retries):\n        try:\n            logger.info(f\"尝试查询域名 {domain}，第 {attempt + 1} 次\")\n            \n            # 获取token\n            token = auth()\n            time.sleep(0.1)\n            \n            # 获取验证码\n            params, clientUid = getImage(token)\n            \n            # 生成点击坐标\n            pointjson = generate_pointjson(params[\"bigImage\"], params[\"smallImage\"], params[\"secretKey\"])\n            time.sleep(0.5)\n            \n            # 验证图片\n            sign = checkImage(token, params[\"uuid\"], params[\"secretKey\"], clientUid, pointjson)\n            time.sleep(0.5)\n            \n            if not sign:\n                raise Exception(\"验证码验证失败\")\n            \n            # 查询域名信息\n            result = query_domain(token, sign, params[\"uuid\"], domain)\n            logger.info(f\"域名 {domain} 查询成功\")\n            return result\n            \n        except Exception as e:\n            logger.error(f\"第 {attempt + 1} 次尝试失败: {str(e)}\")\n            if attempt == max_retries - 1:\n                raise HTTPException(status_code=500, detail=f\"查询失败，已重试{max_retries}次: {str(e)}\")\n            time.sleep(1)  # 重试前等待1秒\n\n\n@app.get(\"/\")\nasync def root():\n    \"\"\"根路径\"\"\"\n    return {\"message\": \"ICP备案查询API\", \"version\": \"1.0.0\"}\n\n\n@app.get(\"/query\")\nasync def query_icp(domain: str = Query(..., description=\"要查询的域名\", example=\"scgzyun.com\")):\n    \"\"\"\n    查询域名的ICP备案信息\n    \n    - **domain**: 要查询的域名\n    \"\"\"\n    try:\n        result = query_icp_with_retry(domain)\n        return JSONResponse(content=result)\n    except HTTPException:\n        raise\n    except Exception as e:\n        logger.error(f\"查询域名 {domain} 时发生未知错误: {str(e)}\")\n        raise HTTPException(status_code=500, detail=f\"查询失败: {str(e)}\")\n\n\n@app.get(\"/health\")\nasync def health_check():\n    \"\"\"健康检查接口\"\"\"\n    return {\"status\": \"healthy\", \"timestamp\": int(time.time())}\n"
  },
  {
    "path": "crack.py",
    "content": "import base64\nimport onnxruntime\nimport cv2\nimport numpy as np\n\n\nclass Crack:\n    def __init__(self):\n        pass\n\n    def read_base64_image(self, base64_string):\n        # 解码Base64字符串为字节串\n        img_data = base64.b64decode(base64_string)\n\n        # 将解码后的字节串转换为numpy数组（OpenCV使用numpy作为其基础）\n        np_array = np.frombuffer(img_data, np.uint8)\n\n        # 使用OpenCV的imdecode函数将字节数据解析为cv::Mat对象\n        img = cv2.imdecode(np_array, cv2.IMREAD_COLOR)\n        return img\n\n    def detect(self, big_img):\n        confidence_thres = 0.7\n        iou_thres = 0.7\n        session = onnxruntime.InferenceSession(\"yolov8.onnx\")\n        model_inputs = session.get_inputs()\n\n        self.big_img = self.read_base64_image(big_img)\n        img_height, img_width = self.big_img.shape[:2]\n        img = cv2.cvtColor(self.big_img, cv2.COLOR_BGR2RGB)\n        img = cv2.resize(img, (512, 192))\n        image_data = np.array(img) / 255.0\n        image_data = np.transpose(image_data, (2, 0, 1))\n        image_data = np.expand_dims(image_data, axis=0).astype(np.float32)\n        input = {model_inputs[0].name: image_data}\n        output = session.run(None, input)\n        outputs = np.transpose(np.squeeze(output[0]))\n        rows = outputs.shape[0]\n        boxes, scores = [], []\n        x_factor = img_width / 512\n        y_factor = img_height / 192\n        for i in range(rows):\n            classes_scores = outputs[i][4:]\n            max_score = np.amax(classes_scores)\n            if max_score >= confidence_thres:\n                x, y, w, h = outputs[i][0], outputs[i][1], outputs[i][2], outputs[i][3]\n                left = int((x - w / 2) * x_factor)\n                top = int((y - h / 2) * y_factor)\n                width = int(w * x_factor)\n                height = int(h * y_factor)\n                boxes.append([left, top, width, height])\n                scores.append(max_score)\n        indices = cv2.dnn.NMSBoxes(boxes, scores, confidence_thres, iou_thres)\n        new_boxes = [boxes[i] for i in indices]\n        # print(new_boxes)\n        if len(new_boxes) != 5:\n            return False\n        return new_boxes\n\n    def siamese(self, small_img, boxes):\n        session = onnxruntime.InferenceSession(\"siamese.onnx\")\n        positions = [165, 200, 231, 265]\n        result_list = []\n        for x in positions:\n            if len(result_list) == 4:\n                break\n            raw_image2 = self.read_base64_image(small_img)\n            raw_image2 = raw_image2[11:11 + 28, x:x + 26]\n            img2 = cv2.cvtColor(raw_image2, cv2.COLOR_BGR2RGB)\n            img2 = cv2.resize(img2, (105, 105))\n            image_data_2 = np.array(img2) / 255.0\n            image_data_2 = np.transpose(image_data_2, (2, 0, 1))\n            image_data_2 = np.expand_dims(image_data_2, axis=0).astype(np.float32)\n            for box in boxes:\n                raw_image1 = self.big_img[box[1]:box[1] + box[3] + 2, box[0]:box[0] + box[2] + 2]\n                img1 = cv2.cvtColor(raw_image1, cv2.COLOR_BGR2RGB)\n                img1 = cv2.resize(img1, (105, 105))\n\n                image_data_1 = np.array(img1) / 255.0\n                image_data_1 = np.transpose(image_data_1, (2, 0, 1))\n                image_data_1 = np.expand_dims(image_data_1, axis=0).astype(np.float32)\n\n                inputs = {'input': image_data_1, \"input.53\": image_data_2}\n                output = session.run(None, inputs)\n                output_sigmoid = 1 / (1 + np.exp(-output[0]))\n                res = output_sigmoid[0][0]\n                # print(res)\n                if res >= 0.7:\n                    # print(\"\\n\")\n                    # print(res)\n                    # print(box)\n                    result_list.append([box[0], box[1]])\n                    break\n        return result_list\n\n\nif __name__ == '__main__':\n    crack = Crack()\n    boxes = crack.detect(\"./1.png\")\n    print(crack.siamese(\"./2.png\", boxes))\n"
  },
  {
    "path": "docker-compose.yml",
    "content": "version: '3.8'\n\nservices:\n  icp-spider-api:\n    build: .\n    container_name: icp-spider-api\n    ports:\n      - \"8000:8000\"\n    environment:\n      - PYTHONPATH=/app\n    restart: unless-stopped\n    healthcheck:\n      test: [\"CMD\", \"python\", \"-c\", \"import requests; requests.get('http://localhost:8000/health')\"]\n      interval: 30s\n      timeout: 10s\n      retries: 3\n      start_period: 40s\n    volumes:\n      # 如果需要在开发时挂载代码，取消注释下面这行\n      # - .:/app\n      - /dev/shm:/dev/shm  # 共享内存，提高性能\n    networks:\n      - icp-network\n\nnetworks:\n  icp-network:\n    driver: bridge\n"
  },
  {
    "path": "docker.sh",
    "content": "#!/bin/bash\n\n# ICP备案查询API Docker管理脚本\n\nset -e\n\n# 颜色定义\nRED='\\033[0;31m'\nGREEN='\\033[0;32m'\nYELLOW='\\033[1;33m'\nBLUE='\\033[0;34m'\nNC='\\033[0m' # No Color\n\n# 打印带颜色的消息\nprint_info() {\n    echo -e \"${BLUE}[INFO]${NC} $1\"\n}\n\nprint_success() {\n    echo -e \"${GREEN}[SUCCESS]${NC} $1\"\n}\n\nprint_warning() {\n    echo -e \"${YELLOW}[WARNING]${NC} $1\"\n}\n\nprint_error() {\n    echo -e \"${RED}[ERROR]${NC} $1\"\n}\n\n# 显示帮助信息\nshow_help() {\n    echo \"ICP备案查询API Docker管理脚本\"\n    echo \"\"\n    echo \"使用方法: $0 [选项]\"\n    echo \"\"\n    echo \"选项:\"\n    echo \"  build    构建Docker镜像\"\n    echo \"  start    启动服务\"\n    echo \"  stop     停止服务\"\n    echo \"  restart  重启服务\"\n    echo \"  logs     查看日志\"\n    echo \"  status   查看服务状态\"\n    echo \"  clean    清理容器和镜像\"\n    echo \"  test     测试API接口\"\n    echo \"  help     显示此帮助信息\"\n    echo \"\"\n    echo \"示例:\"\n    echo \"  $0 build    # 构建镜像\"\n    echo \"  $0 start    # 启动服务\"\n    echo \"  $0 logs     # 查看日志\"\n}\n\n# 构建镜像\nbuild_image() {\n    print_info \"开始构建Docker镜像...\"\n    docker-compose build\n    print_success \"镜像构建完成\"\n}\n\n# 启动服务\nstart_service() {\n    print_info \"启动ICP备案查询API服务...\"\n    docker-compose up -d\n    print_success \"服务启动完成\"\n    print_info \"API地址: http://localhost:8000\"\n    print_info \"API文档: http://localhost:8000/docs\"\n    print_info \"查看日志: $0 logs\"\n}\n\n# 停止服务\nstop_service() {\n    print_info \"停止服务...\"\n    docker-compose down\n    print_success \"服务已停止\"\n}\n\n# 重启服务\nrestart_service() {\n    print_info \"重启服务...\"\n    docker-compose restart\n    print_success \"服务重启完成\"\n}\n\n# 查看日志\nshow_logs() {\n    print_info \"显示服务日志...\"\n    docker-compose logs -f icp-spider-api\n}\n\n# 查看状态\nshow_status() {\n    print_info \"服务状态:\"\n    docker-compose ps\n    echo \"\"\n    print_info \"检查API健康状态...\"\n    if curl -s http://localhost:8000/health > /dev/null 2>&1; then\n        print_success \"API服务正常运行\"\n    else\n        print_warning \"API服务未响应\"\n    fi\n}\n\n# 清理容器和镜像\nclean_up() {\n    print_warning \"这将删除所有相关的容器和镜像，是否继续? (y/N)\"\n    read -r response\n    if [[ \"$response\" =~ ^([yY][eE][sS]|[yY])$ ]]; then\n        print_info \"停止并删除容器...\"\n        docker-compose down --volumes --remove-orphans\n        print_info \"删除镜像...\"\n        docker rmi icp-spider_icp-spider-api 2>/dev/null || true\n        print_success \"清理完成\"\n    else\n        print_info \"取消清理操作\"\n    fi\n}\n\n# 测试API\ntest_api() {\n    print_info \"测试API接口...\"\n    \n    # 测试健康检查\n    print_info \"测试健康检查接口...\"\n    if response=$(curl -s http://localhost:8000/health); then\n        print_success \"健康检查: $response\"\n    else\n        print_error \"健康检查失败\"\n        return 1\n    fi\n    \n    # 测试域名查询\n    print_info \"测试域名查询接口...\"\n    test_domain=\"scgzyun.com\"\n    print_info \"查询域名: $test_domain\"\n    \n    if response=$(curl -s \"http://localhost:8000/query?domain=$test_domain\"); then\n        if echo \"$response\" | grep -q '\"code\":200'; then\n            print_success \"域名查询成功\"\n            echo \"$response\" | python3 -m json.tool\n        else\n            print_warning \"域名查询返回错误\"\n            echo \"$response\"\n        fi\n    else\n        print_error \"域名查询请求失败\"\n        return 1\n    fi\n}\n\n# 主逻辑\ncase \"${1:-help}\" in\n    build)\n        build_image\n        ;;\n    start)\n        start_service\n        ;;\n    stop)\n        stop_service\n        ;;\n    restart)\n        restart_service\n        ;;\n    logs)\n        show_logs\n        ;;\n    status)\n        show_status\n        ;;\n    clean)\n        clean_up\n        ;;\n    test)\n        test_api\n        ;;\n    help|*)\n        show_help\n        ;;\nesac\n"
  },
  {
    "path": "main.py",
    "content": "import base64\nimport json\nimport requests\nimport hashlib\nimport time\nfrom urllib import parse\nfrom crack import Crack\nimport uuid\nfrom cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes\nfrom cryptography.hazmat.backends import default_backend\n\n\ndef auth():\n    t = str(round(time.time()))\n    data = {\n        \"authKey\": hashlib.md5((\"testtest\" + t).encode()).hexdigest(),\n        \"timeStamp\": t\n    }\n    headers = {\n        \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36\",\n        \"Referer\": \"https://beian.miit.gov.cn/\",\n        \"Content-Type\": \"application/x-www-form-urlencoded\",\n        \"Connection\": \"keep-alive\",\n        \"Accept\": \"application/json, text/plain, */*\",\n        \"Accept-Encoding\": \"gzip, deflate, br\",\n        \"Accept-Language\": \"zh-CN,zh;q=0.9\",\n        \"Origin\": \"https://beian.miit.gov.cn\"\n    }\n    try:\n        resp = requests.post(\"https://hlwicpfwc.miit.gov.cn/icpproject_query/api/auth\", headers=headers,\n                             data=parse.urlencode(data)).text\n        return json.loads(resp)[\"params\"][\"bussiness\"]\n    except Exception:\n        time.sleep(5)\n        resp = requests.post(\"https://hlwicpfwc.miit.gov.cn/icpproject_query/api/auth\", headers=headers,\n                             data=parse.urlencode(data)).text\n        return json.loads(resp)[\"params\"][\"bussiness\"]\n\n\ndef getImage():\n    headers = {\n        \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36\",\n        \"Referer\": \"https://beian.miit.gov.cn/\",\n        \"Token\": token,\n        \"Connection\": \"keep-alive\",\n        \"Accept\": \"application/json, text/plain, */*\",\n        \"Accept-Encoding\": \"gzip, deflate, br\",\n        \"Accept-Language\": \"zh-CN,zh;q=0.9\",\n        \"Origin\": \"https://beian.miit.gov.cn\"\n    }\n    payload = {\n        \"clientUid\": \"point-\" + str(uuid.uuid4())\n    }\n    try:\n        resp = requests.post(\"https://hlwicpfwc.miit.gov.cn/icpproject_query/api/image/getCheckImagePoint\",\n                             headers=headers, json=payload).json()\n        return resp[\"params\"], payload[\"clientUid\"]\n    except Exception:\n        time.sleep(5)\n        resp = requests.post(\"https://hlwicpfwc.miit.gov.cn/icpproject_query/api/image/getCheckImagePoint\",\n                             headers=headers, json=payload).json()\n        return resp[\"params\"], payload[\"clientUid\"]\n\n\ndef aes_ecb_encrypt(plaintext: bytes, key: bytes, block_size=16):\n    backend = default_backend()\n    cipher = Cipher(algorithms.AES(key), modes.ECB(), backend=backend)\n\n    padding_length = block_size - (len(plaintext) % block_size)\n    plaintext_padded = plaintext + bytes([padding_length]) * padding_length\n\n    encryptor = cipher.encryptor()\n    ciphertext = encryptor.update(plaintext_padded) + encryptor.finalize()\n\n    return base64.b64encode(ciphertext).decode('utf-8')\n\n\ndef generate_pointjson(big_img, small_img, secretKey):\n    boxes = crack.detect(big_img)\n    if boxes:\n        print(\"文字检测成功\")\n    else:\n        print(\"文字检测失败,请重试\")\n        raise Exception(\"文字检测失败,请重试\")\n    points = crack.siamese(small_img, boxes)\n    print(\"文字匹配成功\")\n    new_points = [[p[0] + 20, p[1] + 20] for p in points]\n    pointJson = [{\"x\": p[0], \"y\": p[1]} for p in new_points]\n    # print(json.dumps(pointJson))\n    enc_pointJson = aes_ecb_encrypt(json.dumps(pointJson).replace(\" \", \"\").encode(), secretKey.encode())\n    return enc_pointJson\n\n\ndef checkImage(uuid_token, secretKey, clientUid, pointJson):\n    headers = {\n        \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36\",\n        \"Referer\": \"https://beian.miit.gov.cn/\",\n        \"Token\": token,\n        \"Connection\": \"keep-alive\",\n        \"Accept\": \"application/json, text/plain, */*\",\n        \"Accept-Encoding\": \"gzip, deflate, br\",\n        \"Accept-Language\": \"zh-CN,zh;q=0.9\",\n        \"Origin\": \"https://beian.miit.gov.cn\"\n    }\n    data = {\n        \"token\": uuid_token,\n        \"secretKey\": secretKey,\n        \"clientUid\": clientUid,\n        \"pointJson\": pointJson\n    }\n    resp = requests.post(\"https://hlwicpfwc.miit.gov.cn/icpproject_query/api/image/checkImage\", headers=headers,\n                         json=data).json()\n    if resp[\"code\"] == 200:\n        # print(resp[\"params\"])\n        return resp[\"params\"][\"sign\"]\n    return False\n\n\ndef query(sign, uuid_token, domain):\n    headers = {\n        \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36\",\n        \"Referer\": \"https://beian.miit.gov.cn/\",\n        \"Token\": token,\n        \"Sign\": sign,\n        \"Uuid\": uuid_token,\n        \"Connection\": \"keep-alive\",\n        \"Accept\": \"application/json, text/plain, */*\",\n        \"Accept-Encoding\": \"gzip, deflate, br\",\n        \"Accept-Language\": \"zh-CN,zh;q=0.9\",\n        \"Origin\": \"https://beian.miit.gov.cn\",\n        \"Content-Type\": \"application/json\",\n        \"Cookie\": \"__jsluid_s=\"+str(uuid.uuid4().hex[:32])\n    }\n    data = {\"pageNum\": \"\", \"pageSize\": \"\", \"unitName\": domain, \"serviceType\": 1}\n    resp = requests.post(\"https://hlwicpfwc.miit.gov.cn/icpproject_query/api/icpAbbreviateInfo/queryByCondition\",\n                         headers=headers, data=json.dumps(data).replace(\" \",\"\")).text\n    return resp\n\n\ncrack = Crack()\ntoken = auth()\ntime.sleep(0.1)\nprint(\"正在获取验证码\")\nparams, clientUid = getImage()\npointjson = generate_pointjson(params[\"bigImage\"], params[\"smallImage\"], params[\"secretKey\"])\ntime.sleep(0.5)\nsign = checkImage(params[\"uuid\"], params[\"secretKey\"], clientUid, pointjson)\ntime.sleep(0.5)\nif sign:\n    print(query(sign, params[\"uuid\"],\"scgzyun.com\"))\nelse:\n    print(\"failed\")\n"
  },
  {
    "path": "readme.md",
    "content": "# ICP备案查询工具\n\n## 警告\n\n本项目仅限用于学习研究\n\n禁止售卖本项目，禁止用于违法目的\n\n任何后果与本人无关\n\n## 特点\n\n- 使用yolov8+孪生网络解决点选验证码\n\n- 准确率高，只要不是这种阴间图片，基本没问题\n\n  ![image-20240403142830308](https://s21.ax1x.com/2024/04/03/pFH4pKU.png)\n\n- 识别一次用时2~3秒\n\n- 使用ONNX模型\n\n## 使用方法\n\n安装依赖\n\n```shell\npip install -r requirements.txt\n```\n\n修改`main.py`中要查询的域名\n\n运行 `main.py` 即可\n\n## 备注\n\n- 官网反爬策略较为玄学，请勿疯狂请求\n- 运行结果为原始响应，如有需要请自行解析\n\n## 鸣谢\n\n[Siamese-pytorch](https://github.com/bubbliiiing/Siamese-pytorch) 孪生神经网络\n\n[ultralytics](https://github.com/ultralytics/ultralytics) YOLOv8\n\n没有他们的付出就没有本项目的诞生\n\n## 开源协议\n\n依据上游项目 [ultralytics](https://github.com/ultralytics/ultralytics) 所使用的AGPLv3协议，现以相同协议开源本项目，请自觉遵守。\n"
  },
  {
    "path": "requirements.txt",
    "content": "requests~=2.31.0\ncryptography~=42.0.5\nonnxruntime~=1.17.1\nnumpy~=1.26.4\nopencv-python-headless~=4.10.0.84\nfastapi~=0.104.1\nuvicorn[standard]~=0.24.0"
  },
  {
    "path": "test_api.py",
    "content": "#!/usr/bin/env python3\n\"\"\"\n测试ICP备案查询API\n\"\"\"\nimport requests\nimport json\n\ndef test_api():\n    \"\"\"测试API接口\"\"\"\n    base_url = \"http://localhost:8000\"\n    \n    # 测试健康检查\n    print(\"测试健康检查接口...\")\n    try:\n        response = requests.get(f\"{base_url}/health\")\n        print(f\"健康检查: {response.status_code} - {response.json()}\")\n    except Exception as e:\n        print(f\"健康检查失败: {e}\")\n        return\n    \n    # 测试域名查询\n    test_domain = \"scgzyun.com\"\n    print(f\"\\n测试域名查询: {test_domain}\")\n    try:\n        response = requests.get(f\"{base_url}/query?domain={test_domain}\")\n        print(f\"状态码: {response.status_code}\")\n        if response.status_code == 200:\n            result = response.json()\n            print(\"查询结果:\")\n            print(json.dumps(result, ensure_ascii=False, indent=2))\n        else:\n            print(f\"查询失败: {response.text}\")\n    except Exception as e:\n        print(f\"查询请求失败: {e}\")\n\nif __name__ == \"__main__\":\n    test_api()\n"
  },
  {
    "path": "逆向分析.md",
    "content": "# 新版备案查询验证码分析\n\n## 获取Token\n\nURL: https://hlwicpfwc.miit.gov.cn/icpproject_query/api/auth\n\nPayload:\n\n```json\n{\n    \"authKey\": hashlib.md5((\"testtest\" + t).encode()).hexdigest(),\n    \"timeStamp\": str(round(time.time()))\n}\n```\n\nResponse:\n\n```json\n{\n    \"code\":200,\n    \"msg\":\"操作成功\",\n    \"params\":{\n        \"bussiness\":\"Token\",\n        \"expire\":300000,\n        \"refresh\":\"RefreshToken\"\n    },\n    \"success\":true\n}\n\n```\n\n> 注意: 以下所有请求均需携带Token请求头\n\n## 获取验证码图片\n\nURL: https://hlwicpfwc.miit.gov.cn/icpproject_query/api/image/getCheckImagePoint\n\nPayload:\n\n```json\n{\n    clientUid: \"point-\"+\"随机UUID\"\n}\n```\n\nResponse:\n\n```json\n{\n    \"code\": 200,\n    \"msg\": \"操作成功\",\n    \"params\": {\n        \"bigImage\": \"base64图片\",\n        \"secretKey\": \"随机AES密钥\",\n        \"smallImage\": \"base64图片\",\n        \"uuid\": \"随机字符串\",\n        \"wordCount\": 4\n    },\n    \"success\": true\n}\n\n```\n\n\n\n## 校验结果\n\nURL: https://hlwicpfwc.miit.gov.cn/icpproject_query/api/image/checkImage\n\nPayload:\n\n```json\n{\n    \"token\":\"uuid\",\n    \"secretKey\":\"secretKey\",\n    \"clientUid\":\"clientUid\",\n    \"pointJson\":\"\"\n}\n```\n\npointJson算法：\n\n- 加密方法 AES-128-ECB\n- 填充方法 pkcs7\n\n- 密钥 `secretKey`\n\n- 内容 `'[{\"x\":135,\"y\":43},{\"x\":43,\"y\":119},{\"x\":402,\"y\":61},{\"x\":179,\"y\":78}]'`\n\n  其中x,y分别对应每个字的坐标，有顺序要求\n\n- 输出 Base64\n\n\n\nResponse:\n\n```json\n{\n    \"code\": 200,\n    \"msg\": \"操作成功\",\n    \"params\": {\n        \"sign\": \"签名\",\n        \"smallImage\": \"验证成功的base64图片\"\n    },\n    \"success\": true\n}\n\n```\n\n\n\n## 查询备案\n\nURL: https://hlwicpfwc.miit.gov.cn/icpproject_query/api/icpAbbreviateInfo/queryByCondition\n\nPayload\n\n```json\n{\n    \"pageNum\":\"\",\n    \"pageSize\":\"\",\n    \"unitName\":\"域名\",\n    \"serviceType\":1\n}\n```\n\nResponse\n\n```json\n{\n    \"code\": 200,\n    \"msg\": \"操作成功\",\n    \"params\": {\n        \"endRow\": 0,\n        \"firstPage\": 1,\n        \"hasNextPage\": false,\n        \"hasPreviousPage\": false,\n        \"isFirstPage\": true,\n        \"isLastPage\": true,\n        \"lastPage\": 1,\n        \"list\": [\n            {\n                \"contentTypeName\": \"\",\n                \"domain\": \"\",\n                \"domainId\": \"\",\n                \"leaderName\": \"\",\n                \"limitAccess\": \"\",\n                \"mainId\": \"\",\n                \"mainLicence\": \"\",\n                \"natureName\": \"\",\n                \"serviceId\": \"\",\n                \"serviceLicence\": \"\",\n                \"unitName\": \"\",\n                \"updateRecordTime\": \"\"\n            }\n        ],\n        \"navigatePages\": 8,\n        \"navigatepageNums\": [\n            1\n        ],\n        \"nextPage\": 1,\n        \"pageNum\": 1,\n        \"pageSize\": 10,\n        \"pages\": 1,\n        \"prePage\": 1,\n        \"size\": 1,\n        \"startRow\": 0,\n        \"total\": 1\n    },\n    \"success\": true\n}\n```\n\n"
  }
]