123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #!/usr/bin/env python
- # -*- encoding: utf-8 -*-
- '''
- @Contact : liuyuqi.gov@msn.cn
- @Time : 2023/03/08 20:18:13
- @License : Copyright © 2017-2022 liuyuqi. All Rights Reserved.
- @Desc : 批量生成域名(双拼,双单词,双单词拼接)
- 参考项目: https://git.yoqi.me/lyq/SearchDomain
- '''
- import csv,os
- class GenerateEnDomain(object):
-
- def __init__(self, params: dict):
- '''初始化列表'''
- self.initList=[]
- self.params =params
- # self.keyword=["chat","ai"] # chat+xx
-
- self.keyword= self.params['keyword'].split(',')
- # self.yuming=["com","cn","me","net","co","run","wiki","tech","org","info","vip","cc","app","io","one","tk","xyz"]
- self.yuming=self.params["domain"].split(',')
- self.composeDomain=[]
- self.composePinYin=[]
- def run(self):
- with open(os.path.join(self.params["app_path"], r"data/b.csv"), "r", encoding="utf-8") as f:
- csv_data = f.readlines()
- for row in csv_data:
- self.initList.append(row.strip())
-
- for i in self.initList:
- for j in self.keyword:
- if self.params['position']=="prefix":
- self.composePinYin.append(i+j)
- else:
- self.composePinYin.append(j+i)
- for i in self.composePinYin:
- for j in self.yuming:
- self.composeDomain.append(i+"."+j)
- with open(os.path.join(self.params["app_path"], "domain.txt"),"w",encoding="utf-8") as file:
- for i in self.composeDomain:
- file.write(i+"\n")
|