scan update

This commit is contained in:
2024-07-15 22:49:02 +02:00
parent 954f45c387
commit fa5db92f3a

101
scan.yml
View File

@@ -16,7 +16,7 @@
6137356332636431643830666461333862613835336631333037
# 163.172.0.0/24
# 163.172.80.0/28
target_network: 163.172.80.10
target_network: 163.172.80.0/28
ansible_user: stephane
ansible_password: stephane
ansible_become_password: stephane
@@ -40,12 +40,9 @@
tasks:
- name: Update repositories and install packages needed
ansible.builtin.apt:
- ansible.builtin.apt:
name: masscan
update_cache: true
# delegate_to: localhost
- ansible.builtin.git:
repo: https://{{ user }}:{{ token }}@gitea.jingoh.fr/staffadmin/scan.git
@@ -57,14 +54,13 @@
- ansible.builtin.git:
repo: https://github.com/maurosoria/dirsearch.git
dest: "{{ playbook_dir }}/dirsearch"
dest: "/home/stephane/dirsearch"
single_branch: yes
force: true
delegate_to: localhost
- name: Install specified python requirements
ansible.builtin.pip:
requirements: "{{ playbook_dir }}/dirsearch/requirements.txt"
requirements: "/home/stephane/dirsearch/requirements.txt"
# apt install masscan
- ansible.builtin.command:
@@ -73,13 +69,13 @@
register: scan_output
- debug:
msg: "{{ item }}"
loop: "{{ scan_output.stdout_lines }}"
# - "{{ cert.not_after }}"
# - "{{ ansible_date_time.iso8601_basic }}"
tags: test
delegate_to: localhost
# - debug:
# msg: "{{ item }}"
# loop: "{{ scan_output.stdout_lines }}"
# # - "{{ cert.not_after }}"
# # - "{{ ansible_date_time.iso8601_basic }}"
# tags: test
# delegate_to: localhost
- name: Get a cert from an https por
community.crypto.get_certificate:
@@ -92,19 +88,19 @@
register: cert
tags: test
# item.subject.CN
- debug:
msg: "{{ item.item.split('on')[-1].strip() }}"
loop: "{{ cert.results }}"
# - "{{ cert.not_after }}"
# - "{{ ansible_date_time.iso8601_basic }}"
tags: test
delegate_to: localhost
# # item.subject.CN
# - debug:
# msg: "{{ item.item.split('on')[-1].strip() }}"
# loop: "{{ cert.results }}"
# # - "{{ cert.not_after }}"
# # - "{{ ansible_date_time.iso8601_basic }}"
# tags: test
# delegate_to: localhost
# apt install masscan
- ansible.builtin.command:
cmd: "python3 {{ playbook_dir }}/dirsearch/dirsearch.py -u https://{{ item.item.split('on')[-1].strip() }} -i 200 -t 100"
cmd: "python3 /home/root/dirsearch/dirsearch.py -u https://{{ item.item.split('on')[-1].strip() }} --max-time 300"
become: true
loop: "{{ cert.results }}"
# vars:
@@ -122,16 +118,16 @@
# tags: test
- debug:
msg: " URL =======> {{ item.subject }} || Host ====> {{ item.invocation.module_args.host }} || port ======> {{ item.invocation.module_args.port }} || proxy_port =========> {{ item.invocation.module_args.proxy_port }}"
loop: "{{ cert.results }}"
when: item.subject is defined
# loop: "{{ scan443.stdout_lines }}"
# - "{{ cert.not_after }}"
# - "{{ ansible_date_time.iso8601_basic }}"
tags: test
ignore_errors: true
delegate_to: localhost
# - debug:
# msg: " URL =======> {{ item.subject }} || Host ====> {{ item.invocation.module_args.host }} || port ======> {{ item.invocation.module_args.port }} || proxy_port =========> {{ item.invocation.module_args.proxy_port }}"
# loop: "{{ cert.results }}"
# when: item.subject is defined
# # loop: "{{ scan443.stdout_lines }}"
# # - "{{ cert.not_after }}"
# # - "{{ ansible_date_time.iso8601_basic }}"
# tags: test
# ignore_errors: true
# delegate_to: localhost
# - debug:
@@ -147,19 +143,38 @@
- debug:
msg: "{{ fuff }}"
# - debug:
# msg: "{{ fuff }}"
- name: Copy
ansible.builtin.copy:
src: "{{ playbook_dir }}/reports"
- ansible.builtin.find:
paths: "/home/stephane/reports"
recurse: yes
register: scan_path
# - debug:
# msg: "{{ item.path }}"
# loop: "{{ scan_path.files }}"
# # - "{{ cert.not_after }}"
# # - "{{ ansible_date_time.iso8601_basic }}"
# delegate_to: localhost
- ansible.builtin.fetch:
src: "{{ item.path }}"
dest: "{{ playbook_dir }}/scan/"
remote_src: yes
flat: false
loop: "{{ scan_path.files }}"
- debug:
msg: "{{ item.path }}"
loop: "{{ scan_path.files }}"
# - "{{ cert.not_after }}"
# - "{{ ansible_date_time.iso8601_basic }}"
delegate_to: localhost
- name: Push backup to git
ansible.builtin.shell: |
- ansible.builtin.shell: |
git config user.email "stephane.gratiasquiquandon@gmail.com"
git config user.name "staffadmin"
git add .