Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 92eb3ba5 authored by autodistries's avatar autodistries
Browse files

run multiple sniffer.py at once on a single node device

parent 93f44ce6
No related branches found
No related tags found
1 merge request!1Refactoring, new features
- hosts: sniffers
user: gta
#become: yes
#become_user: root
vars_prompt:
# - name: _file
# prompt: Enter the folder name to save traces in the sniffer
# private: no
- name: _workdir
prompt: Enter the folder name to save traces in the sniffer
default: "/home/tribe/mitik-sens-mod/"
private: no
# This will always be the mitik-sens-mod folder
# - name: _location
......@@ -57,19 +57,28 @@
- set_fact:
_interfaces: "{{ _interfaces_csv.split(',') }}"
_channels: "{{ _channels_csv.split(',') }}"
delegate_to: 127.0.0.1
run_once: True
- name: Create Folder
file:
path: "{{ _file }}"
owner: gta
group: gta
#mode: 0755
state: directory
- name: Double-check input variables
assert:
that: "{{ _interfaces|length }} == _channels"
delegate_to: 127.0.0.1
run_once: True
- name: start scapy-sniffer
# - name: Create Folder
# file:
# path: "{{ _workdir }}"
# owner: tribe
# group: tribe
# #mode: 0755
# state: directory
- name: start scapy-sniffer
cron:
name: "ansible_scapy-sniffer {{ _hour }} {{ _minute }} {{ _channel }}"
name: "ansible_scapy-sniffer {{ _hour }} {{ _minute }} {{ item }}"
minute: "{{ _minute }}"
hour: "{{ _hour }}"
job: "sudo python3 /home/gta/sniffers/scapy-sniffer/sniffer_GPS.py -F {{ _file }} -L {{ _location }} -i {{ _interface }} -c {{ _channel }} -f {{ _filter }} -e {{ _hash_function}} -p {{ _hash_pattern }} -t {{ _timeout }}"
job: "cd {{_workdir}}; sudo python ./sniffer.py -s {{_timeout}} -i {{item}} -c {{}} -sf {{_filter}} -p {{_hash_pattern}} -e {{_hash_function}}"
loop: "{{_interfaces}}"
# /etc/ansible/broadcast.yml
---
- name: Echoed stuff
hosts: all
hosts: ss1
vars_prompt:
# - name: _file
# prompt: Enter the folder name to save traces in the sniffer
# private: no
# This will always be the mitik-sens-mod folder
# - name: _location
# prompt: Enter the location of the experiments
# private: no
# I don't know what this parameter is (was) for
# - name: _hour
# prompt: Enter an hour to start the experiment
# default: 17
# private: no
#
# - name: _minute
# prompt: Enter minutes to start the experiment
# private: no
- name: _interfaces_csv
prompt: Please specify the interface(s) separated by commas (e.g. wlan0,wlan7). For default just press enter
default: 'wlan5,wlan6'
private: no
- name: _channels_csv
prompt: Please specify the starting channels (integer between 1-11 separated by commas, default=system). For default just press enter
default: "1,8"
private: no
tasks:
- name: say things to tty1
ansible.builtin.shell: "cd ~;eval $(ssh-agent -s); ssh-add .ssh/gitlab_rsa ; git clone git@gitlab.inria.fr:gfarhiri/mitik-sens-mod.git"
- set_fact:
_interfaces: "{{ _interfaces_csv.split(',') }}"
_channels: "{{ _channels_csv.split(',') }}"
delegate_to: 127.0.0.1
run_once: True
- name: Double-check input variables
assert:
that: "{{ _interfaces|length }} == {{ _channels|length }}"
delegate_to: 127.0.0.1
run_once: True
- debug:
msg: "{{ item }}"
loop: "{{_interfaces}}"
delegate_to: 127.0.0.1
run_once: True
- debug:
msg: "{{ item }}"
loop: "{{_channels}}"
delegate_to: 127.0.0.1
run_once: True
- shell: "echo {{ item }} {{_channels[lp_idx]}} !! | sudo tee /dev/tty1 "
loop: "{{_interfaces}}"
loop_control:
index_var: lp_idx
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment