poush
This commit is contained in:
23
scan.yml
23
scan.yml
@@ -82,9 +82,10 @@
|
|||||||
register: cert
|
register: cert
|
||||||
tags: test
|
tags: test
|
||||||
|
|
||||||
- ansible.builtin.command: "dig -x {{ item.split('on')[-1].strip() }} +short"
|
# - ansible.builtin.command: "dig -x {{ item.split('on')[-1].strip() }} +short"
|
||||||
register: reverse_dns
|
# register: reverse_dns
|
||||||
loop: "{{ scan_output.stdout_lines }}"
|
# ignore_errors: true
|
||||||
|
# loop: "{{ scan_output.stdout_lines }}"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -108,32 +109,32 @@
|
|||||||
path: "{{ playbook_dir }}/scan/https/{{ item.invocation.module_args.host.split('.')[0] }}/{{ item.invocation.module_args.host.split('.')[1] }}/"
|
path: "{{ playbook_dir }}/scan/https/{{ item.invocation.module_args.host.split('.')[0] }}/{{ item.invocation.module_args.host.split('.')[1] }}/"
|
||||||
state: directory
|
state: directory
|
||||||
loop: "{{ cert.results }}"
|
loop: "{{ cert.results }}"
|
||||||
run_once: true
|
# run_once: true
|
||||||
when: item.invocation is defined
|
when: item.invocation is defined
|
||||||
|
|
||||||
#! take time, can be better
|
#! take time, can be better
|
||||||
- ansible.builtin.lineinfile:
|
- ansible.builtin.lineinfile:
|
||||||
path: "{{ playbook_dir }}/scan/https/{{ item.invocation.module_args.host.split('.')[0] }}/{{ item.invocation.module_args.host.split('.')[1] }}/{{ item.invocation.module_args.host.split('.')[2] }}.csv"
|
path: "{{ playbook_dir }}/scan/https/{{ item.invocation.module_args.host.split('.')[0] }}/{{ item.invocation.module_args.host.split('.')[1] }}/{{ item.invocation.module_args.host.split('.')[2] }}.csv"
|
||||||
line: "IP,PORT,CN,ISSUER COUNTRY,ISSUER ORGA,REVERSE"
|
line: "IP,PORT,CN,ISSUER COUNTRY,ISSUER ORGA"
|
||||||
insertbefore: BOF
|
insertbefore: BOF
|
||||||
create: yes
|
create: yes
|
||||||
loop: "{{ cert.results }}"
|
loop: "{{ cert.results }}"
|
||||||
loop_control:
|
# loop_control:
|
||||||
index_var: my_idx
|
# index_var: my_idx
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
#run_once: true
|
#run_once: true
|
||||||
when:
|
when:
|
||||||
- item.invocation is defined
|
- item.invocation is defined
|
||||||
- cert.results[my_idx].invocation.module_args.host.split('.')[2] != cert.results[my_idx+1].invocation.module_args.host.split('.')[2]
|
# - cert.results[my_idx].invocation.module_args.host.split('.')[2] != cert.results[my_idx+1].invocation.module_args.host.split('.')[2]
|
||||||
|
|
||||||
- ansible.builtin.lineinfile:
|
- ansible.builtin.lineinfile:
|
||||||
path: "{{ playbook_dir }}/scan/https/{{ item.invocation.module_args.host.split('.')[0] }}/{{ item.invocation.module_args.host.split('.')[1] }}/{{ item.invocation.module_args.host.split('.')[2] }}.csv"
|
path: "{{ playbook_dir }}/scan/https/{{ item.invocation.module_args.host.split('.')[0] }}/{{ item.invocation.module_args.host.split('.')[1] }}/{{ item.invocation.module_args.host.split('.')[2] }}.csv"
|
||||||
line: "{{ item.invocation.module_args.host }},{{ item.invocation.module_args.port }},{{ item.subject.CN | default('no CN') }},{{ item.issuer.C | default('no issuer Country') }},{{ item.issuer.O| default('no issuer Orga') }},{{ reverse_dns_list[my_idx]|default('no reverse') }}"
|
line: "{{ item.invocation.module_args.host }},{{ item.invocation.module_args.port }},{{ item.subject.CN | default('no CN') }},{{ item.issuer.C | default('no issuer Country') }},{{ item.issuer.O| default('no issuer Orga') }}"
|
||||||
create: yes
|
create: yes
|
||||||
state: present
|
state: present
|
||||||
loop: "{{ cert.results }}"
|
loop: "{{ cert.results }}"
|
||||||
loop_control:
|
# loop_control:
|
||||||
index_var: my_idx
|
# index_var: my_idx
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
when: item.invocation is defined
|
when: item.invocation is defined
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user