update scan

This commit is contained in:
2024-07-14 21:28:10 +02:00
parent 85dd43ace4
commit 56cc576e9d
3 changed files with 81 additions and 37 deletions

View File

@@ -1,6 +1,6 @@
---
- name: Scan
hosts: localhost
hosts: tower
become: true
gather_facts: false
vars:
@@ -15,7 +15,8 @@
37653135666331633532653436656461396131623736353962643632316135633562346631313036
6137356332636431643830666461333862613835336631333037
# 163.172.0.0/24
target_network: 163.172.80.0/28
# 163.172.80.0/28
target_network: 163.172.80.139
ansible_user: stephane
ansible_password: stephane
ansible_become_password: stephane
@@ -33,8 +34,17 @@
# # @author Stéphane Gratias (2021).
#
pre_tasks:
# roles:
# - { role: geerlingguy.pip, tags: pip }
tasks:
- name: Update repositories and install packages needed
ansible.builtin.apt:
name: masscan
update_cache: true
# delegate_to: localhost
- ansible.builtin.git:
@@ -45,19 +55,23 @@
delegate_to: localhost
# - ansible.builtin.git:
# repo: https://github.com/danielmiessler/SecLists.git
# dest: "{{ playbook_dir }}/SecLists"
# single_branch: yes
# force: true
# delegate_to: localhost
- ansible.builtin.git:
repo: https://github.com/maurosoria/dirsearch.git
dest: "{{ playbook_dir }}/dirsearch"
single_branch: yes
force: true
delegate_to: localhost
- name: Install specified python requirements
ansible.builtin.pip:
requirements: "{{ playbook_dir }}/dirsearch/requirements.txt"
# apt install masscan
- ansible.builtin.command:
cmd: "masscan {{ target_network }} -p443"
become: true
register: scan_output
delegate_to: localhost
- debug:
msg: "{{ item }}"
@@ -90,18 +104,16 @@
# apt install masscan
- ansible.builtin.command:
cmd: " dirsearch -u https://{{ item.item.split('on')[-1].strip() }} -i 200 -t 100"
cmd: "python3 {{ playbook_dir }}/dirsearch/dirsearch.py -u https://{{ item.item.split('on')[-1].strip() }} -i 200 -t 100"
become: true
loop: "{{ cert.results }}"
# vars:
# ansible_command_timeout: 500
ignore_errors: true
register: fuff
delegate_to: localhost
#ffuf -w SecLists/Discovery/Web-Content/directory-list-1.0.txt -u https://dstrn.if.ua/FUZZ
# - debug:
# msg: "{{ item }}"
# loop: "{{ cert.results }}"
# # loop: "{{ scan443.stdout_lines }}"
# # - "{{ cert.not_after }}"
# # - "{{ ansible_date_time.iso8601_basic }}"
@@ -122,23 +134,27 @@
delegate_to: localhost
- debug:
msg: "{{ item.stdout.split('\n\nError Log')[0].split('Output File: ')[-1] }}"
loop: "{{ fuff.results }}"
# when: item.stdout_lines is search('200 -')
# loop: "{{ scan443.stdout_lines }}"
# - "{{ cert.not_after }}"
# - "{{ ansible_date_time.iso8601_basic }}"
tags: test
ignore_errors: true
delegate_to: localhost
# - debug:
# msg: "{{ item.stdout.split('\n\nError Log')[0].split('Output File: ')[-1] }}"
# loop: "{{ fuff.results }}"
# # when: item.stdout_lines is search('200 -')
# # loop: "{{ scan443.stdout_lines }}"
# # - "{{ cert.not_after }}"
# # - "{{ ansible_date_time.iso8601_basic }}"
# tags: test
# ignore_errors: true
# delegate_to: localhost
- name: Copy a "sudoers" file on the remote machine for editing
- debug:
msg: "{{ fuff }}"
- name: Copy
ansible.builtin.copy:
src: "{{ item.stdout.split('\n\nError Log')[0].split('Output File: ')[-1] }}"
dest: "{{ playbook_dir }}/scan/{{ item.stdout.split('\n\nError Log')[0].split('Output File: ')[-1].split('/')[-2] }}"
src: "{{ playbook_dir }}/reports"
dest: "{{ playbook_dir }}/scan/"
remote_src: yes
loop: "{{ fuff.results }}"
delegate_to: localhost