Full Code of ffffffff0x/name-fuzz for AI

main 5f9cbb695073 cached
5 files
39.7 KB
11.0k tokens
15 symbols
1 requests
Download .txt
Repository: ffffffff0x/name-fuzz
Branch: main
Commit: 5f9cbb695073
Files: 5
Total size: 39.7 KB

Directory structure:
gitextract_yljkvgse/

├── .gitignore
├── LICENSE
├── README.md
├── name-fuzz.py
└── suffix.txt

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
.idea
/assets/temp.md
push.sh
output*.txt

================================================
FILE: LICENSE
================================================
                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [yyyy] [name of copyright owner]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.


================================================
FILE: README.md
================================================
# name-fuzz

针对目标已知信息的字典生成工具

> 重构版: https://github.com/ffffffff0x/gendict

> 原理简单粗暴,调用 pypinyin 这个库将中文信息转为拼音,然后与后缀名字典拼接成字符串即可

> 如果有其他的字典生成思路和规则欢迎在 issue 提出来

---

## 开始

**下载 && 安装依赖**
```bash
git clone https://github.com/ffffffff0x/name-fuzz.git
pip3 install pyreadline pypinyin
cd name-fuzz
```

**使用**
```bash
python3 name-fuzz.py
```

![](./assets/img/1.png)

---

## 支持规则

### 基于组织

`公司/单位/组织全称`+`后缀`
- jsxxyxgs123 (江苏XX有限公司)
- jsxxyxgs@123
- ...

`公司/单位/组织简称`+`后缀`
- jiangsuxx123 (江苏XX)
- jiangsuxx@123
- ...

`公司/单位/组织简称(缩写)`+`后缀`
- jsxx123 (江苏XX)
- jsxx@123
- ...

`业务名(缩写)`+`后缀`
- zhjt123 (智慧交通)
- zhjt@123
- ...

`公司/单位/组织简称(缩写)`+`系统/业务简称(缩写)`+`后缀`
- jsxxzhjt123 (江苏XX智慧交通)

### 基于人员

`人员名称`
- zhangsanfeng (拼音)
- zsf (缩写)
- zhangsf (首字拼音+缩写)
- zsfeng (缩写+尾字拼音)
- sanfengzhang (拼音+首字拼音)
- sanfengz (拼音+首字缩写)
- sfz (缩写+首字缩写)
- 张三丰 (中文)

---

## 参考项目

- https://github.com/mozillazg/python-pinyin
- https://github.com/soxoj/username-generation-guide
- https://github.com/WangYihang/ccupp
- https://gist.github.com/yuikns/387be5e9cf450ae3589fa7037c94453e
- https://www.yuque.com/pmiaowu/bomi9w/ougg6d#d70159da

---

## License

[Apache License 2.0](https://github.com/ffffffff0x/name-fuzz/blob/main/LICENSE)

---

> create by ffffffff0x


================================================
FILE: name-fuzz.py
================================================
#!/usr/bin/env python
# -*- encoding: utf-8 -*-

import readline
from pypinyin import pinyin, lazy_pinyin, Style

# suffix 字典
filename="suffix.txt"

# 检验名称输入是否全是中文字符
def is_all_chinese(strs):
    for _char in strs:
        if not '\u4e00' <= _char <= '\u9fa5':
            return False
    return True

# 拼音分词
class PyTrieNode(object):
    def __init__(self, key="", seq=[]):
        self.key = key
        self.end = len(seq) == 0
        self.children = {}
        if len(seq) > 0:
            self.children[seq[0]] = PyTrieNode(seq[0], seq[1:])

    def add(self, seq):
        if len(seq) == 0:
            self.end = True
        else:
            key = seq[0]
            value = seq[1:]
            if key in self.children:
                self.children[key].add(value)
            else:
                self.children[key] = PyTrieNode(key, value)

    def find(self, sent):
        for i in range(len(sent)):
            i = len(sent) - i
            if len(sent) >= i:
                key = sent[:i]
                if key in self.children:
                    buf, succ = self.children[key].find(sent[i:])
                    if succ:
                        return key + buf, True
        return "", self.end

class PyTrie(object):
    def __init__(self):
        self.root = PyTrieNode()
        self.root.end = False

    def setup(self):
        self.add(["a"])
        self.add(["ai"])
        self.add(["an"])
        self.add(["ang"])
        self.add(["ao"])
        self.add(["e"])
        self.add(["ei"])
        self.add(["en"])
        self.add(["er"])
        self.add(["o"])
        self.add(["ou"])
        self.add(["b", "a"])
        self.add(["b", "ai"])
        self.add(["b", "an"])
        self.add(["b", "ang"])
        self.add(["b", "ao"])
        self.add(["b", "ei"])
        self.add(["b", "en"])
        self.add(["b", "eng"])
        self.add(["b", "i"])
        self.add(["b", "ian"])
        self.add(["b", "iao"])
        self.add(["b", "ie"])
        self.add(["b", "in"])
        self.add(["b", "ing"])
        self.add(["b", "o"])
        self.add(["b", "u"])
        self.add(["c", "a"])
        self.add(["c", "ai"])
        self.add(["c", "an"])
        self.add(["c", "ang"])
        self.add(["c", "ao"])
        self.add(["c", "e"])
        self.add(["c", "en"])
        self.add(["c", "eng"])
        self.add(["c", "i"])
        self.add(["c", "ong"])
        self.add(["c", "ou"])
        self.add(["c", "u"])
        self.add(["c", "uan"])
        self.add(["c", "ui"])
        self.add(["c", "un"])
        self.add(["c", "uo"])
        self.add(["ch", "a"])
        self.add(["ch", "ai"])
        self.add(["ch", "an"])
        self.add(["ch", "ang"])
        self.add(["ch", "ao"])
        self.add(["ch", "e"])
        self.add(["ch", "en"])
        self.add(["ch", "eng"])
        self.add(["ch", "i"])
        self.add(["ch", "ong"])
        self.add(["ch", "ou"])
        self.add(["ch", "u"])
        self.add(["ch", "uai"])
        self.add(["ch", "uan"])
        self.add(["ch", "uang"])
        self.add(["ch", "ui"])
        self.add(["ch", "un"])
        self.add(["ch", "uo"])
        self.add(["d", "a"])
        self.add(["d", "ai"])
        self.add(["d", "an"])
        self.add(["d", "ang"])
        self.add(["d", "ao"])
        self.add(["d", "e"])
        self.add(["d", "eng"])
        self.add(["d", "i"])
        self.add(["d", "ia"])
        self.add(["d", "ian"])
        self.add(["d", "iao"])
        self.add(["d", "ie"])
        self.add(["d", "ing"])
        self.add(["d", "iu"])
        self.add(["d", "ong"])
        self.add(["d", "ou"])
        self.add(["d", "u"])
        self.add(["d", "uan"])
        self.add(["d", "ui"])
        self.add(["d", "un"])
        self.add(["d", "uo"])
        self.add(["f", "a"])
        self.add(["f", "an"])
        self.add(["f", "ang"])
        self.add(["f", "ei"])
        self.add(["f", "en"])
        self.add(["f", "eng"])
        self.add(["f", "o"])
        self.add(["f", "ou"])
        self.add(["f", "u"])
        self.add(["g", "a"])
        self.add(["g", "ai"])
        self.add(["g", "an"])
        self.add(["g", "ang"])
        self.add(["g", "ao"])
        self.add(["g", "e"])
        self.add(["g", "ei"])
        self.add(["g", "en"])
        self.add(["g", "eng"])
        self.add(["g", "ong"])
        self.add(["g", "ou"])
        self.add(["g", "u"])
        self.add(["g", "ua"])
        self.add(["g", "uai"])
        self.add(["g", "uan"])
        self.add(["g", "uang"])
        self.add(["g", "ui"])
        self.add(["g", "un"])
        self.add(["g", "uo"])
        self.add(["h", "a"])
        self.add(["h", "ai"])
        self.add(["h", "an"])
        self.add(["h", "ang"])
        self.add(["h", "ao"])
        self.add(["h", "e"])
        self.add(["h", "ei"])
        self.add(["h", "en"])
        self.add(["h", "eng"])
        self.add(["h", "ong"])
        self.add(["h", "ou"])
        self.add(["h", "u"])
        self.add(["h", "ua"])
        self.add(["h", "uai"])
        self.add(["h", "uan"])
        self.add(["h", "uang"])
        self.add(["h", "ui"])
        self.add(["h", "un"])
        self.add(["h", "uo"])
        self.add(["j", "i"])
        self.add(["j", "ia"])
        self.add(["j", "ian"])
        self.add(["j", "iang"])
        self.add(["j", "iao"])
        self.add(["j", "ie"])
        self.add(["j", "in"])
        self.add(["j", "ing"])
        self.add(["j", "iong"])
        self.add(["j", "iu"])
        self.add(["j", "u"])
        self.add(["j", "uan"])
        self.add(["j", "ue"])
        self.add(["j", "un"])
        self.add(["k", "a"])
        self.add(["k", "ai"])
        self.add(["k", "an"])
        self.add(["k", "ang"])
        self.add(["k", "ao"])
        self.add(["k", "e"])
        self.add(["k", "en"])
        self.add(["k", "eng"])
        self.add(["k", "ong"])
        self.add(["k", "ou"])
        self.add(["k", "u"])
        self.add(["k", "ua"])
        self.add(["k", "uai"])
        self.add(["k", "uan"])
        self.add(["k", "uang"])
        self.add(["k", "ui"])
        self.add(["k", "un"])
        self.add(["k", "uo"])
        self.add(["l", "a"])
        self.add(["l", "ai"])
        self.add(["l", "an"])
        self.add(["l", "ang"])
        self.add(["l", "ao"])
        self.add(["l", "e"])
        self.add(["l", "ei"])
        self.add(["l", "eng"])
        self.add(["l", "i"])
        self.add(["l", "ia"])
        self.add(["l", "ian"])
        self.add(["l", "iang"])
        self.add(["l", "iao"])
        self.add(["l", "ie"])
        self.add(["l", "in"])
        self.add(["l", "ing"])
        self.add(["l", "iu"])
        self.add(["l", "ong"])
        self.add(["l", "ou"])
        self.add(["l", "u"])
        self.add(["l", "u:"])
        self.add(["l", "u:e"])
        self.add(["l", "uan"])
        self.add(["l", "un"])
        self.add(["l", "uo"])
        self.add(["m", ""])
        self.add(["m", "a"])
        self.add(["m", "ai"])
        self.add(["m", "an"])
        self.add(["m", "ang"])
        self.add(["m", "ao"])
        self.add(["m", "e"])
        self.add(["m", "ei"])
        self.add(["m", "en"])
        self.add(["m", "eng"])
        self.add(["m", "i"])
        self.add(["m", "ian"])
        self.add(["m", "iao"])
        self.add(["m", "ie"])
        self.add(["m", "in"])
        self.add(["m", "ing"])
        self.add(["m", "iu"])
        self.add(["m", "o"])
        self.add(["m", "ou"])
        self.add(["m", "u"])
        self.add(["n", "a"])
        self.add(["n", "ai"])
        self.add(["n", "an"])
        self.add(["n", "ang"])
        self.add(["n", "ao"])
        self.add(["n", "e"])
        self.add(["n", "ei"])
        self.add(["n", "en"])
        self.add(["n", "eng"])
        self.add(["n", "g"])
        self.add(["n", "i"])
        self.add(["n", "ian"])
        self.add(["n", "iang"])
        self.add(["n", "iao"])
        self.add(["n", "ie"])
        self.add(["n", "in"])
        self.add(["n", "ing"])
        self.add(["n", "iu"])
        self.add(["n", "ong"])
        self.add(["n", "ou"])
        self.add(["n", "u"])
        self.add(["n", "u:"])
        self.add(["n", "u:e"])
        self.add(["n", "uan"])
        self.add(["n", "uo"])
        self.add(["p", "a"])
        self.add(["p", "ai"])
        self.add(["p", "an"])
        self.add(["p", "ang"])
        self.add(["p", "ao"])
        self.add(["p", "ei"])
        self.add(["p", "en"])
        self.add(["p", "eng"])
        self.add(["p", "i"])
        self.add(["p", "ian"])
        self.add(["p", "iao"])
        self.add(["p", "ie"])
        self.add(["p", "in"])
        self.add(["p", "ing"])
        self.add(["p", "o"])
        self.add(["p", "ou"])
        self.add(["p", "u"])
        self.add(["q", "i"])
        self.add(["q", "ia"])
        self.add(["q", "ian"])
        self.add(["q", "iang"])
        self.add(["q", "iao"])
        self.add(["q", "ie"])
        self.add(["q", "in"])
        self.add(["q", "ing"])
        self.add(["q", "iong"])
        self.add(["q", "iu"])
        self.add(["q", "u"])
        self.add(["q", "uan"])
        self.add(["q", "ue"])
        self.add(["q", "un"])
        self.add(["r", "an"])
        self.add(["r", "ang"])
        self.add(["r", "ao"])
        self.add(["r", "e"])
        self.add(["r", "en"])
        self.add(["r", "eng"])
        self.add(["r", "i"])
        self.add(["r", "ong"])
        self.add(["r", "ou"])
        self.add(["r", "u"])
        self.add(["r", "uan"])
        self.add(["r", "ui"])
        self.add(["r", "un"])
        self.add(["r", "uo"])
        self.add(["s", "a"])
        self.add(["s", "ai"])
        self.add(["s", "an"])
        self.add(["s", "ang"])
        self.add(["s", "ao"])
        self.add(["s", "e"])
        self.add(["s", "en"])
        self.add(["s", "eng"])
        self.add(["s", "i"])
        self.add(["s", "ong"])
        self.add(["s", "ou"])
        self.add(["s", "u"])
        self.add(["s", "uan"])
        self.add(["s", "ui"])
        self.add(["s", "un"])
        self.add(["s", "uo"])
        self.add(["sh", "a"])
        self.add(["sh", "ai"])
        self.add(["sh", "an"])
        self.add(["sh", "ang"])
        self.add(["sh", "ao"])
        self.add(["sh", "e"])
        self.add(["sh", "ei"])
        self.add(["sh", "en"])
        self.add(["sh", "eng"])
        self.add(["sh", "i"])
        self.add(["sh", "ou"])
        self.add(["sh", "u"])
        self.add(["sh", "ua"])
        self.add(["sh", "uai"])
        self.add(["sh", "uan"])
        self.add(["sh", "uang"])
        self.add(["sh", "ui"])
        self.add(["sh", "un"])
        self.add(["sh", "uo"])
        self.add(["t", "a"])
        self.add(["t", "ai"])
        self.add(["t", "an"])
        self.add(["t", "ang"])
        self.add(["t", "ao"])
        self.add(["t", "e"])
        self.add(["t", "eng"])
        self.add(["t", "i"])
        self.add(["t", "ian"])
        self.add(["t", "iao"])
        self.add(["t", "ie"])
        self.add(["t", "ing"])
        self.add(["t", "ong"])
        self.add(["t", "ou"])
        self.add(["t", "u"])
        self.add(["t", "uan"])
        self.add(["t", "ui"])
        self.add(["t", "un"])
        self.add(["t", "uo"])
        self.add(["w", "a"])
        self.add(["w", "ai"])
        self.add(["w", "an"])
        self.add(["w", "ang"])
        self.add(["w", "ei"])
        self.add(["w", "en"])
        self.add(["w", "eng"])
        self.add(["w", "o"])
        self.add(["w", "u"])
        self.add(["x", "i"])
        self.add(["x", "ia"])
        self.add(["x", "ian"])
        self.add(["x", "iang"])
        self.add(["x", "iao"])
        self.add(["x", "ie"])
        self.add(["x", "in"])
        self.add(["x", "ing"])
        self.add(["x", "iong"])
        self.add(["x", "iu"])
        self.add(["x", "u"])
        self.add(["x", "uan"])
        self.add(["x", "ue"])
        self.add(["x", "un"])
        self.add(["y", "a"])
        self.add(["y", "an"])
        self.add(["y", "ang"])
        self.add(["y", "ao"])
        self.add(["y", "e"])
        self.add(["y", "i"])
        self.add(["y", "iao"])
        self.add(["y", "in"])
        self.add(["y", "ing"])
        self.add(["y", "o"])
        self.add(["y", "ong"])
        self.add(["y", "ou"])
        self.add(["y", "u"])
        self.add(["y", "uan"])
        self.add(["y", "ue"])
        self.add(["y", "un"])
        self.add(["z", "a"])
        self.add(["z", "ai"])
        self.add(["z", "an"])
        self.add(["z", "ang"])
        self.add(["z", "ao"])
        self.add(["z", "e"])
        self.add(["z", "ei"])
        self.add(["z", "en"])
        self.add(["z", "eng"])
        self.add(["z", "i"])
        self.add(["z", "ong"])
        self.add(["z", "ou"])
        self.add(["z", "u"])
        self.add(["z", "uan"])
        self.add(["z", "ui"])
        self.add(["z", "un"])
        self.add(["z", "uo"])
        self.add(["zh", "a"])
        self.add(["zh", "ai"])
        self.add(["zh", "an"])
        self.add(["zh", "ang"])
        self.add(["zh", "ao"])
        self.add(["zh", "e"])
        self.add(["zh", "en"])
        self.add(["zh", "eng"])
        self.add(["zh", "i"])
        self.add(["zh", "ong"])
        self.add(["zh", "ou"])
        self.add(["zh", "u"])
        self.add(["zh", "ua"])
        self.add(["zh", "uai"])
        self.add(["zh", "uan"])
        self.add(["zh", "uang"])
        self.add(["zh", "ui"])
        self.add(["zh", "un"])
        self.add(["zh", "uo"])

    def add(self, seq):
        self.root.add(seq)

    def scan(self, sent):
        words = []
        while len(sent) > 0:
            buf, succ = self.root.find(sent)
            # print("buf: {}, succ: {}".format(buf, succ))
            if succ:
                words.append(buf)
                sent = sent[len(buf):]
            else:
                words.append('invalid:' + sent[0])
                sent = sent[1:]
        return words

# 生成相应规则(基于组织)
def results_list_A():

    results_list_0 = []
    results_list_A = []

    # 例如: 江苏XX有限公司
    if CompanyName:
        CompanyName_array1=pinyin(CompanyName, style=Style.NORMAL, strict=False)
        CompanyName_array2=pinyin(CompanyName, style=Style.FIRST_LETTER, strict=False)
        CompanyName_str1 = ""
        CompanyName_str2 = ""

        for tempvar in CompanyName_array1:
            temp_str1 = "".join(tempvar)
            CompanyName_str1 = CompanyName_str1 + temp_str1

        for tempvar in CompanyName_array2:
            temp_str2 = "".join(tempvar)
            CompanyName_str2 = CompanyName_str2 + temp_str2

        CompanyName_str3 = CompanyName_str2[0].upper()+CompanyName_str2[1:]

        results_list_0.append(CompanyName_str1)
        results_list_0.append(CompanyName_str2)
        results_list_0.append(CompanyName_str3)

        # jiangsuxxyouxiangongsi
        print("CompanyName_str1      : ",CompanyName_str1)
        # jsxxyxgs
        print("CompanyName_str2      : ",CompanyName_str2)
        # Jsxxyxgs
        print("CompanyName_str3      : ",CompanyName_str3)

        # jsxxyxgs + 后缀
        f1 = open(filename, "r")
        for line in f1:
            results_list_A.append(CompanyName_str2+line.replace('\n', '').replace('\r', ''))
        f1.close()

    # 例如: 江苏XX
    if ShortCompanyName:
        ShortCompanyName_array1=pinyin(ShortCompanyName, style=Style.NORMAL, strict=False)
        ShortCompanyName_array2=pinyin(ShortCompanyName, style=Style.FIRST_LETTER, strict=False)
        ShortCompanyName_str1 = ""
        ShortCompanyName_str2 = ""

        for tempvar in ShortCompanyName_array1:
            temp_str3 = "".join(tempvar)
            ShortCompanyName_str1 = ShortCompanyName_str1 + temp_str3

        for tempvar in ShortCompanyName_array2:
            temp_str4 = "".join(tempvar)
            ShortCompanyName_str2 = ShortCompanyName_str2 + temp_str4

        ShortCompanyName_str3 = ShortCompanyName_str1[0].upper()+ShortCompanyName_str1[1:]

        ShortCompanyName_str4 = ShortCompanyName_str2[0].upper()+ShortCompanyName_str2[1:]

        ShortCompanyName_str5 = ShortCompanyName_str2.upper()

        results_list_0.append(ShortCompanyName_str1)
        results_list_0.append(ShortCompanyName_str2)
        results_list_0.append(ShortCompanyName_str3)
        results_list_0.append(ShortCompanyName_str4)
        results_list_0.append(ShortCompanyName_str5)

        # jiangsuxx
        print("ShortCompanyName_str1 : ",ShortCompanyName_str1)
        # jsxx
        print("ShortCompanyName_str2 : ",ShortCompanyName_str2)
        # Jiangsuxx
        print("ShortCompanyName_str3 : ",ShortCompanyName_str3)
        # Jsxx
        print("ShortCompanyName_str4 : ",ShortCompanyName_str4)
        # JSXX
        print("ShortCompanyName_str5 : ",ShortCompanyName_str5)

        # jiangsuxx + 后缀
        f1 = open(filename, "r")
        for line in f1:
            results_list_A.append(ShortCompanyName_str1+line.replace('\n', '').replace('\r', ''))
        f1.close()

        # jsxx + 后缀
        f1 = open(filename, "r")
        for line in f1:
            results_list_A.append(ShortCompanyName_str2+line.replace('\n', '').replace('\r', ''))
        f1.close()

        # Jsxx + 后缀
        f1 = open(filename, "r")
        for line in f1:
            results_list_A.append(ShortCompanyName_str4+line.replace('\n', '').replace('\r', ''))
        f1.close()

        # JSXX + 后缀
        f1 = open(filename, "r")
        for line in f1:
            results_list_A.append(ShortCompanyName_str5+line.replace('\n', '').replace('\r', ''))
        f1.close()

    # 例如: 智慧交通
    if SystemName:
        SystemName_array1=pinyin(SystemName, style=Style.NORMAL, strict=False)
        SystemName_array2=pinyin(SystemName, style=Style.FIRST_LETTER, strict=False)
        SystemName_str1 = ""
        SystemName_str2 = ""

        for tempvar in SystemName_array1:
            temp_str5 = "".join(tempvar)
            SystemName_str1 = SystemName_str1 + temp_str5

        for tempvar in SystemName_array2:
            temp_str6 = "".join(tempvar)
            SystemName_str2 = SystemName_str2 + temp_str6

        SystemName_str3 = SystemName_str2[0].upper()+SystemName_str2[1:]

        SystemName_str4 = SystemName_str2.upper()

        results_list_0.append(SystemName_str1)
        results_list_0.append(SystemName_str2)
        results_list_0.append(SystemName_str3)
        results_list_0.append(SystemName_str4)

        # zhihuijiaotong
        print("SystemName_str1       : ",SystemName_str1)
        # zhjt
        print("SystemName_str2       : ",SystemName_str2)
        # Zhjt
        print("SystemName_str3       : ",SystemName_str3)
        # ZHJT
        print("SystemName_str4       : ",SystemName_str4)

        # zhjt + 后缀
        f1 = open(filename, "r")
        for line in f1:
            results_list_A.append(SystemName_str2+line.replace('\n', '').replace('\r', ''))
        f1.close()

        # Zhjt + 后缀
        f1 = open(filename, "r")
        for line in f1:
            results_list_A.append(SystemName_str3+line.replace('\n', '').replace('\r', ''))
        f1.close()

        # ZHJT + 后缀
        f1 = open(filename, "r")
        for line in f1:
            results_list_A.append(SystemName_str4+line.replace('\n', '').replace('\r', ''))
        f1.close()

    # 输出至 output0.txt
    if len(results_list_0) > 1:
        f = open("output0.txt", "w")
        for x in results_list_0:
            f.write(x+"\n")
        f.close()
        print("基于组织的简写内容已生成至 output0.txt")

    # 输出至 output1.txt
    if len(results_list_A) > 1:
        f = open("output1.txt", "w")
        for x in results_list_A:
            f.write(x+"\n")
        f.close()
        print("基于组织的字典内容已生成至 output1.txt")
        print("\n")

# 生成相应规则(基于人员)
def results_list_B():

    results_list_B = []
    results_list_B2 = []

    if PersonName:
        PersonName_array1=pinyin(PersonName, style=Style.NORMAL, strict=False)
        PersonName_array2=pinyin(PersonName, style=Style.FIRST_LETTER, strict=False)
        PersonName_B1 = ""
        PersonName_B2 = ""
        PersonName_B4 = ""
        PersonName_B5 = ""
        PersonName_B6 = ""
        PersonName_B7 = ""

        for tempvar in PersonName_array1:
            temp_str1 = "".join(tempvar)
            PersonName_B1 = PersonName_B1 + temp_str1

        for tempvar in PersonName_array2:
            temp_str2 = "".join(tempvar)
            PersonName_B2 = PersonName_B2 + temp_str2

        PersonName_B3 = "".join(PersonName_array1[0])
        for tempvar in PersonName_array2[1:]:
            temp_str2 = "".join(tempvar)
            PersonName_B3 = PersonName_B3 + temp_str2

        for tempvar in PersonName_array2[0:-1]:
            temp_str2 = "".join(tempvar)
            PersonName_B4 = PersonName_B4 + temp_str2
        PersonName_B4 += "".join(PersonName_array1[-1])

        for tempvar in PersonName_array1[1:]:
            temp_str2 = "".join(tempvar)
            PersonName_B5 = PersonName_B5 + temp_str2
        PersonName_B5 += "".join(PersonName_array1[0])

        for tempvar in PersonName_array1[1:]:
            temp_str2 = "".join(tempvar)
            PersonName_B6 = PersonName_B6 + temp_str2
        PersonName_B6 += "".join(PersonName_array2[0])

        for tempvar in PersonName_array2[1:]:
            temp_str2 = "".join(tempvar)
            PersonName_B7 = PersonName_B7 + temp_str2
        PersonName_B7 += "".join(PersonName_array2[0])

        results_list_B.append(PersonName_B1)
        results_list_B.append(PersonName_B2)
        results_list_B.append(PersonName_B3)
        results_list_B.append(PersonName_B4)
        results_list_B.append(PersonName_B5)
        results_list_B.append(PersonName_B6)
        results_list_B.append(PersonName_B7)
        results_list_B.append(PersonName)

        # zhangsanfeng
        print("PersonName_B1       : ",PersonName_B1)
        # zsf
        print("PersonName_B2       : ",PersonName_B2)
        # zhangsf
        print("PersonName_B3       : ",PersonName_B3)
        # zsfeng
        print("PersonName_B4       : ",PersonName_B4)
        # sanfengzhang
        print("PersonName_B5       : ",PersonName_B5)
        # sanfengz
        print("PersonName_B6       : ",PersonName_B6)
        # sfz
        print("PersonName_B7       : ",PersonName_B7)
        # 张三丰
        print("PersonName_B8       : ",PersonName)

    # 输出至 output2.txt
    if len(results_list_B) > 1:
        f = open("output2.txt", "w")
        for x in results_list_B:
            f.write(x+"\n")
        f.close()
        print("基于人员的字典规则已生成至 output2.txt")

        f1 = open("output2.txt", "r")
        for line1 in f1:
            f2 = open(filename, "r")
            for line2 in f2:
                results_list_B2.append(line1.replace('\n', '').replace('\r', '') + line2.replace('\n', '').replace('\r', ''))
                #print(line1.replace('\n', '').replace('\r', '') + line2.replace('\n', '').replace('\r', ''))
            f2.close()
        f1.close()

    # 输出至 output3.txt
    if len(results_list_B2) > 1:
        f = open("output3.txt", "w")
        for x in results_list_B2:
            f.write(x+"\n")
        f.close()
        print("基于用户的字典内容已生成至 output3.txt")
        print("\n")

# 生成相应规则(基于人员拼音)
def results_list_C():

    results_list_C = []
    results_list_C2 = []

    if PersonName:
        pyt = PyTrie()
        pyt.setup()
        PersonName_array3 = pyt.scan(PersonName)
        PersonName_C1 = ""
        PersonName_C2 = ""
        PersonName_C4 = ""
        PersonName_C5 = ""
        PersonName_C6 = ""
        PersonName_C7 = ""

        for tempvar in PersonName_array3:
            temp_str1 = "".join(tempvar)
            PersonName_C1 = PersonName_C1 + temp_str1

        for tempvar in PersonName_array3:
            temp_str2 = "".join(tempvar)[0]
            PersonName_C2 = PersonName_C2 + temp_str2

        PersonName_C3 = "".join(PersonName_array3[0])
        for tempvar in PersonName_array3[1:]:
            temp_str3 = "".join(tempvar)[0]
            PersonName_C3 = PersonName_C3 + temp_str3

        for tempvar in PersonName_array3[0:-1]:
            temp_str3 = "".join(tempvar)[0]
            PersonName_C4 = PersonName_C4 + temp_str3
        PersonName_C4 += "".join(PersonName_array3[-1])

        for tempvar in PersonName_array3[1:]:
            temp_str2 = "".join(tempvar)
            PersonName_C5 = PersonName_C5 + temp_str2
        PersonName_C5 += "".join(PersonName_array3[0])

        for tempvar in PersonName_array3[1:]:
            temp_str2 = "".join(tempvar)
            PersonName_C6 = PersonName_C6 + temp_str2
        PersonName_C6 += "".join(PersonName_array3[0][0])

        for tempvar in PersonName_array3[1:]:
            temp_str2 = "".join(tempvar)[0]
            PersonName_C7 = PersonName_C7 + temp_str2
        PersonName_C7 += "".join(PersonName_array3[0][0])

        results_list_C.append(PersonName_C1)
        results_list_C.append(PersonName_C2)
        results_list_C.append(PersonName_C3)
        results_list_C.append(PersonName_C4)
        results_list_C.append(PersonName_C5)
        results_list_C.append(PersonName_C6)
        results_list_C.append(PersonName_C7)

        # zhangsanfeng
        print("PersonName_C1       : ",PersonName_C1)
        # zsf
        print("PersonName_C2       : ",PersonName_C2)
        # zhangsf
        print("PersonName_C3       : ",PersonName_C3)
        # zsfeng
        print("PersonName_C4       : ",PersonName_C4)
        # sanfengzhang
        print("PersonName_C5       : ",PersonName_C5)
        # sanfengz
        print("PersonName_C6       : ",PersonName_C6)
        # sfz
        print("PersonName_C7       : ",PersonName_C7)

    # 输出至 output2.txt
    if len(results_list_C) > 1:
        f = open("output2.txt", "w")
        for x in results_list_C:
            f.write(x+"\n")
        f.close()
        print("基于人员的字典内容已生成至 output2.txt")

        f1 = open("output2.txt", "r")
        for line1 in f1:
            f2 = open(filename, "r")
            for line2 in f2:
                results_list_C2.append(line1.replace('\n', '').replace('\r', '') + line2.replace('\n', '').replace('\r', ''))
                #print(line1.replace('\n', '').replace('\r', '') + line2.replace('\n', '').replace('\r', ''))
            f2.close()
        f1.close()

    # 输出至 output3.txt
    if len(results_list_C2) > 1:
        f = open("output3.txt", "w")
        for x in results_list_C2:
            f.write(x+"\n")
        f.close()
        print("基于用户的字典内容已生成至 output3.txt")
        print("\n")

# 生成相应规则(基于地点)
def results_list_D():

    results_list_D = []

    # print("省份名称: " + ProvinceName)
    # print("城市名称: " + CityName)
    # print("区县名称: " + DistrictName)

def main():

    global CompanyName
    global ShortCompanyName
    global SystemName
    global StreetName
    global PersonName
    global PersonPhoneNumber
    global PersonEmail
    #global ProvinceName
    #global CityName
    #global DistrictName

    CompanyName = input("公司/单位/组织全称  (例如: 江苏XX有限公司):").lower()
    ShortCompanyName = input("公司/单位/组织简称  (例如: 江苏XX):").lower()
    SystemName = input("系统/业务简称       (例如: 智慧交通):").lower()
    PersonName = input("人员名称            (例如: 申田由甲):").lower()

    #PhoneNumber = input("电话号码(例如:13333333333 可为空): ").lower()
    #Email = input("电子邮箱(例如:test@163.com 可为空): ").lower()
    #ProvinceName = input("省份名称(例如:江苏 ,可为空): ").lower()
    #CityName = input("城市名称(例如:南京 ,可为空): ").lower()
    #DistrictName = input("区县名称(例如:江宁 ,可为空): ").lower()

    print("\n")
    results_list_A()

    if is_all_chinese(PersonName):
        results_list_B()
    else:
        results_list_C()

if __name__ == '__main__':
    main()


================================================
FILE: suffix.txt
================================================
123
1234
123456
12345
888
666
2022
2021
2020
2019
2018
2017
@123
@1234
@123456
@12345
@888
@666
@2022
@2021
@2020
@2019
@2018
@2017
#123
#1234
#123456
#12345
#888
#666
#2022
#2021
#2020
#2019
#2018
#2017
_123
_1234
_123456
_12345
_888
_666
_2022
_2021
_2020
_2019
_2018
_2017
!@#
!@#$
~!@
Download .txt
gitextract_yljkvgse/

├── .gitignore
├── LICENSE
├── README.md
├── name-fuzz.py
└── suffix.txt
Download .txt
SYMBOL INDEX (15 symbols across 1 files)

FILE: name-fuzz.py
  function is_all_chinese (line 11) | def is_all_chinese(strs):
  class PyTrieNode (line 18) | class PyTrieNode(object):
    method __init__ (line 19) | def __init__(self, key="", seq=[]):
    method add (line 26) | def add(self, seq):
    method find (line 37) | def find(self, sent):
  class PyTrie (line 48) | class PyTrie(object):
    method __init__ (line 49) | def __init__(self):
    method setup (line 53) | def setup(self):
    method add (line 460) | def add(self, seq):
    method scan (line 463) | def scan(self, sent):
  function results_list_A (line 477) | def results_list_A():
  function results_list_B (line 647) | def results_list_B():
  function results_list_C (line 748) | def results_list_C():
  function results_list_D (line 847) | def results_list_D():
  function main (line 855) | def main():
Condensed preview — 5 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (45K chars).
[
  {
    "path": ".gitignore",
    "chars": 41,
    "preview": ".idea\n/assets/temp.md\npush.sh\noutput*.txt"
  },
  {
    "path": "LICENSE",
    "chars": 11357,
    "preview": "                                 Apache License\n                           Version 2.0, January 2004\n                   "
  },
  {
    "path": "README.md",
    "chars": 1246,
    "preview": "# name-fuzz\n\n针对目标已知信息的字典生成工具\n\n> 重构版: https://github.com/ffffffff0x/gendict\n\n> 原理简单粗暴,调用 pypinyin 这个库将中文信息转为拼音,然后与后缀名字典拼接"
  },
  {
    "path": "name-fuzz.py",
    "chars": 27753,
    "preview": "#!/usr/bin/env python\n# -*- encoding: utf-8 -*-\n\nimport readline\nfrom pypinyin import pinyin, lazy_pinyin, Style\n\n# suff"
  },
  {
    "path": "suffix.txt",
    "chars": 288,
    "preview": "123\n1234\n123456\n12345\n888\n666\n2022\n2021\n2020\n2019\n2018\n2017\n@123\n@1234\n@123456\n@12345\n@888\n@666\n@2022\n@2021\n@2020\n@2019\n"
  }
]

About this extraction

This page contains the full source code of the ffffffff0x/name-fuzz GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 5 files (39.7 KB), approximately 11.0k tokens, and a symbol index with 15 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!