{"id":22049280,"url":"https://github.com/ning1875/dns_spoof","last_synced_at":"2025-05-08T23:07:41.007Z","repository":{"id":46814415,"uuid":"277721795","full_name":"ning1875/dns_spoof","owner":"ning1875","description":" ansible操作dnsdist做快速劫持","archived":false,"fork":false,"pushed_at":"2021-09-23T23:31:56.000Z","size":16,"stargazers_count":8,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-03-06T22:00:22.978Z","etag":null,"topics":["ansible","dns-spoof","dnsdist","python"],"latest_commit_sha":null,"homepage":"https://ning1875.ke.qq.com/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ning1875.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-07T05:05:23.000Z","updated_at":"2022-01-24T01:10:05.000Z","dependencies_parsed_at":"2022-09-12T03:10:29.738Z","dependency_job_id":null,"html_url":"https://github.com/ning1875/dns_spoof","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ning1875%2Fdns_spoof","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ning1875%2Fdns_spoof/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ning1875%2Fdns_spoof/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ning1875%2Fdns_spoof/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ning1875","download_url":"https://codeload.github.com/ning1875/dns_spoof/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227351598,"owners_count":17768412,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","dns-spoof","dnsdist","python"],"created_at":"2024-11-30T14:14:47.756Z","updated_at":"2024-11-30T14:14:47.845Z","avatar_url":"https://github.com/ning1875.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 项目介绍\n- 使用powerdns dnsdist作为缓存dns服务器\n- dns_spoof 是基于ansible-playbook 操作pipline\n- 在dnsdist配置文件中添加劫持记录实现多view劫持A记录或劫持到指定权威dns解析的目的\n- 支持历史记录查看和回滚\n- 有完整的存量测试和灰度流程\n\n# 整体流程说明:\n- 获取线上dns_dist配置文件到本地备份\n- 在本地装配配置文件\n- 推送到此region的线下测试机上检查配置并重启服务\n- 发起对线下测试机的主域名测试(即存量测试)\n- 发起对线下测试机的劫持测试: case1: 直接劫持的期望直接是A记录 case2: 转发的期望需要去对应的server query一次\n- 测试正常后,灰度一台推送到线上机器(如果线上机器dist重启失败则会摘bird)\n- 全量其余机器\n- 注意:上述流程是链式的,中间任何一部失败都会终止操作\n\n\n# 使用说明\n\n## 安装依赖包\n```\n# 在python2.7环境中运行\npip install -r requirements.txt \n```\n## 环境准备 vars.yaml\n- 各个view的dns_dist ip :每个region包含一个线上同步配置的server和线下测试的机器,以及全量缓存机器\n  view-a:\n    online_ip: 1.1.1.1\n    offline_ip: 1.1.1.4\n    online_all:\n      - 1.1.1.2\n      - 1.1.1.3\n- 修改dnsdist_conf/dns_dist.conf中的标志位:对应就是\n  spoof:\n      # dnsdist配置文件中劫持标志注释行\n      g_dist_spoof_flag_line: --auto spoof by sys sre\n      # dnsdist配置文件中转发标志注释行\n      g_dist_pool_flag_line: --auto forward pool by sys sre  \n\n## 调用参数说明\n- region: 代表劫持生效的region\n- 类型: spoof代表直接劫持,forward代表转发的\n- 域名: 要劫持的域名\n- a记录列表或者dns server ip列表,空格分隔\n\n## 劫持域名到指定ip列表 \n- eg: 将baidu.com在view-a中的记录劫持为1.1.1.1,1.1.1.2两个A记录\n- 参数: region type domain ips \n- 多个域名用空格分隔\n- 触发: python spoof_action.py  -S -r view-a -t spoof  -d baidu.com -i  1.1.1.1 1.1.1.2\n- case1: 劫持型,原纪录为劫持型,变更\n- case2: 劫持型,原纪录为转发型,肯定pool存在,变更\n- case3: 劫持型,原纪录不存在,新增\n\n\n## 劫持域名转发的指定dns server列表\n- eg: 将stackoverflow.com 在view-a中 劫持到8.8.8.8 dns上解析\n- 参数: region type domain ips \n- 多个域名用空格分隔\n- 触发: python spoof_action.py  -S -r view-a -t forward  -d  stackoverflow.com -i  8.8.8.8\n- case1: 转发型,原纪录为劫持型,pool存在\n- case2: 转发型,原纪录为劫持型,pool不存在\n- case3: 转发型,原纪录为转发型,pool存在\n- case4: 转发型,原纪录为转发型,pool不存在\n- case5: 转发型,原纪录不存在,pool存在\n- case6: 转发型,原纪录不存在,pool不存在\n\n## 使用指定的配置文件回滚\n- 参数: region 和配置文件\n- 触发: python spoof_action.py  -R -r view-a -f ./dnsdist_conf/view-a/dnsdist.conf_2_2019-09-19_stackoverflow.com\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fning1875%2Fdns_spoof","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fning1875%2Fdns_spoof","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fning1875%2Fdns_spoof/lists"}