ezmonitormode 1.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ezmonitormode-1.0.1/LICENSE +21 -0
- ezmonitormode-1.0.1/PKG-INFO +82 -0
- ezmonitormode-1.0.1/README.md +65 -0
- ezmonitormode-1.0.1/pyproject.toml +38 -0
- ezmonitormode-1.0.1/src/ezmonitormode/__init__.py +0 -0
- ezmonitormode-1.0.1/src/ezmonitormode/monitor_gui.py +155 -0
- ezmonitormode-1.0.1/src/ezmonitormode/monitor_mode.sh +56 -0
- ezmonitormode-1.0.1/src/ezmonitormode/stop_monitor_mode.sh +45 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 JWL_805
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ezmonitormode
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: A simple GUI to enable/disable monitor mode on wireless interfaces.
|
|
5
|
+
Project-URL: Homepage, https://github.com/ldl805/EZMonitorModeButton
|
|
6
|
+
Project-URL: Bug Tracker, https://github.com/ldl805/EZMonitorModeButton/issues
|
|
7
|
+
Author: ldl805
|
|
8
|
+
License: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Topic :: System :: Networking
|
|
14
|
+
Classifier: Topic :: Utilities
|
|
15
|
+
Requires-Python: >=3.7
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# EZMonitorModeButton
|
|
19
|
+
|
|
20
|
+
A simple Python GUI for the Raspberry Pi to easily enable and disable monitor mode on a wireless interface (default: `wlan1`).
|
|
21
|
+
|
|
22
|
+
## Features
|
|
23
|
+
- **One-click Enable:** Kills conflicting processes and enables monitor mode.
|
|
24
|
+
- **One-click Disable:** Stops monitor mode and restores network services.
|
|
25
|
+
- **Shortcuts:** Quick buttons to launch common security tools like Wifite, Wireshark, and Kismet.
|
|
26
|
+
|
|
27
|
+
## Installation (Recommended)
|
|
28
|
+
|
|
29
|
+
### Option 1: Via PyPI (Modern)
|
|
30
|
+
|
|
31
|
+
You can install `ezmonitormode` directly from PyPI. Note that you still need the system dependencies (see below).
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install ezmonitormode
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Once installed, you can launch it by running `ezmonitormode` in the terminal (usually requires `sudo`).
|
|
38
|
+
|
|
39
|
+
### Option 2: Debian Package (Pi/Ubuntu/Debian)
|
|
40
|
+
|
|
41
|
+
Download the latest `.deb` file from the [Releases](https://github.com/ldl805/EZMonitorModeButton/releases) page and install it using:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
sudo apt update
|
|
45
|
+
sudo apt install ./ezmonitormode_1.0_all.deb
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Once installed, you can launch it from your application menu or by running `ezmonitormode` in the terminal.
|
|
49
|
+
|
|
50
|
+
### Option 3: Running from Source
|
|
51
|
+
|
|
52
|
+
1. **Clone this repository:**
|
|
53
|
+
```bash
|
|
54
|
+
git clone https://github.com/ldl805/EZMonitorModeButton.git
|
|
55
|
+
cd EZMonitorModeButton
|
|
56
|
+
```
|
|
57
|
+
2. **Run the installation script** to install dependencies:
|
|
58
|
+
```bash
|
|
59
|
+
chmod +x install.sh
|
|
60
|
+
./install.sh
|
|
61
|
+
```
|
|
62
|
+
3. **Run the application:**
|
|
63
|
+
```bash
|
|
64
|
+
sudo python3 src/ezmonitormode/monitor_gui.py
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## System Dependencies
|
|
68
|
+
|
|
69
|
+
Before running `ezmonitormode`, ensure you have the following system tools installed:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
sudo apt update
|
|
73
|
+
sudo apt install python3-tk aircrack-ng wireless-tools
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Optional tools for the shortcut buttons:
|
|
77
|
+
```bash
|
|
78
|
+
sudo apt install wifite wireshark kismet
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## License
|
|
82
|
+
MIT License
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# EZMonitorModeButton
|
|
2
|
+
|
|
3
|
+
A simple Python GUI for the Raspberry Pi to easily enable and disable monitor mode on a wireless interface (default: `wlan1`).
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
- **One-click Enable:** Kills conflicting processes and enables monitor mode.
|
|
7
|
+
- **One-click Disable:** Stops monitor mode and restores network services.
|
|
8
|
+
- **Shortcuts:** Quick buttons to launch common security tools like Wifite, Wireshark, and Kismet.
|
|
9
|
+
|
|
10
|
+
## Installation (Recommended)
|
|
11
|
+
|
|
12
|
+
### Option 1: Via PyPI (Modern)
|
|
13
|
+
|
|
14
|
+
You can install `ezmonitormode` directly from PyPI. Note that you still need the system dependencies (see below).
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install ezmonitormode
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Once installed, you can launch it by running `ezmonitormode` in the terminal (usually requires `sudo`).
|
|
21
|
+
|
|
22
|
+
### Option 2: Debian Package (Pi/Ubuntu/Debian)
|
|
23
|
+
|
|
24
|
+
Download the latest `.deb` file from the [Releases](https://github.com/ldl805/EZMonitorModeButton/releases) page and install it using:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
sudo apt update
|
|
28
|
+
sudo apt install ./ezmonitormode_1.0_all.deb
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Once installed, you can launch it from your application menu or by running `ezmonitormode` in the terminal.
|
|
32
|
+
|
|
33
|
+
### Option 3: Running from Source
|
|
34
|
+
|
|
35
|
+
1. **Clone this repository:**
|
|
36
|
+
```bash
|
|
37
|
+
git clone https://github.com/ldl805/EZMonitorModeButton.git
|
|
38
|
+
cd EZMonitorModeButton
|
|
39
|
+
```
|
|
40
|
+
2. **Run the installation script** to install dependencies:
|
|
41
|
+
```bash
|
|
42
|
+
chmod +x install.sh
|
|
43
|
+
./install.sh
|
|
44
|
+
```
|
|
45
|
+
3. **Run the application:**
|
|
46
|
+
```bash
|
|
47
|
+
sudo python3 src/ezmonitormode/monitor_gui.py
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## System Dependencies
|
|
51
|
+
|
|
52
|
+
Before running `ezmonitormode`, ensure you have the following system tools installed:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
sudo apt update
|
|
56
|
+
sudo apt install python3-tk aircrack-ng wireless-tools
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Optional tools for the shortcut buttons:
|
|
60
|
+
```bash
|
|
61
|
+
sudo apt install wifite wireshark kismet
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## License
|
|
65
|
+
MIT License
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "ezmonitormode"
|
|
7
|
+
version = "1.0.1"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name="ldl805" },
|
|
10
|
+
]
|
|
11
|
+
description = "A simple GUI to enable/disable monitor mode on wireless interfaces."
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.7"
|
|
14
|
+
license = { text = "MIT" }
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Operating System :: POSIX :: Linux",
|
|
19
|
+
"Topic :: System :: Networking",
|
|
20
|
+
"Topic :: Utilities",
|
|
21
|
+
]
|
|
22
|
+
dependencies = []
|
|
23
|
+
|
|
24
|
+
[project.scripts]
|
|
25
|
+
ezmonitormode = "ezmonitormode.monitor_gui:main"
|
|
26
|
+
|
|
27
|
+
[project.urls]
|
|
28
|
+
"Homepage" = "https://github.com/ldl805/EZMonitorModeButton"
|
|
29
|
+
"Bug Tracker" = "https://github.com/ldl805/EZMonitorModeButton/issues"
|
|
30
|
+
|
|
31
|
+
[tool.hatch.build.targets.wheel]
|
|
32
|
+
packages = ["src/ezmonitormode"]
|
|
33
|
+
|
|
34
|
+
[tool.hatch.build.targets.sdist]
|
|
35
|
+
include = [
|
|
36
|
+
"/src/ezmonitormode/*.sh",
|
|
37
|
+
"/src/ezmonitormode/*.py",
|
|
38
|
+
]
|
|
File without changes
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
import tkinter as tk
|
|
3
|
+
from tkinter import messagebox
|
|
4
|
+
import subprocess
|
|
5
|
+
import os
|
|
6
|
+
import shutil
|
|
7
|
+
|
|
8
|
+
# Configuration
|
|
9
|
+
INTERFACE = "wlan1"
|
|
10
|
+
# Look for script in the same directory as the python script
|
|
11
|
+
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
12
|
+
STOP_SCRIPT = os.path.join(BASE_DIR, "stop_monitor_mode.sh")
|
|
13
|
+
|
|
14
|
+
class MonitorGUI:
|
|
15
|
+
def __init__(self, master):
|
|
16
|
+
self.master = master
|
|
17
|
+
master.title("Monitor Mode Control")
|
|
18
|
+
master.geometry("400x350")
|
|
19
|
+
master.resizable(False, False)
|
|
20
|
+
|
|
21
|
+
# Title Label
|
|
22
|
+
self.label = tk.Label(master, text="Monitor Mode Switch", font=("Helvetica", 16, "bold"))
|
|
23
|
+
self.label.pack(pady=10)
|
|
24
|
+
|
|
25
|
+
# Status Label
|
|
26
|
+
self.status_var = tk.StringVar()
|
|
27
|
+
self.status_var.set("Ready")
|
|
28
|
+
self.status_label = tk.Label(master, textvariable=self.status_var, fg="blue")
|
|
29
|
+
self.status_label.pack(pady=5)
|
|
30
|
+
|
|
31
|
+
# Monitor Mode Controls Frame
|
|
32
|
+
self.control_frame = tk.Frame(master, borderwidth=2, relief="groove")
|
|
33
|
+
self.control_frame.pack(pady=10, padx=20, fill="x")
|
|
34
|
+
|
|
35
|
+
# ON Button (Enable)
|
|
36
|
+
self.btn_on = tk.Button(self.control_frame, text="ENABLE Monitor Mode",
|
|
37
|
+
bg="#90ee90", activebackground="#32cd32", # Light Green -> Lime Green
|
|
38
|
+
font=("Helvetica", 12, "bold"),
|
|
39
|
+
command=self.enable_monitor)
|
|
40
|
+
self.btn_on.pack(pady=10, fill="x", padx=10)
|
|
41
|
+
|
|
42
|
+
# OFF Button (Disable)
|
|
43
|
+
self.btn_off = tk.Button(self.control_frame, text="DISABLE Monitor Mode",
|
|
44
|
+
bg="#ffcccb", activebackground="#ff6347", # Light Red -> Tomato
|
|
45
|
+
font=("Helvetica", 12, "bold"),
|
|
46
|
+
command=self.disable_monitor)
|
|
47
|
+
self.btn_off.pack(pady=10, fill="x", padx=10)
|
|
48
|
+
|
|
49
|
+
# Tools Label
|
|
50
|
+
self.tools_label = tk.Label(master, text="Tools Shortcuts", font=("Helvetica", 12, "bold"))
|
|
51
|
+
self.tools_label.pack(pady=(15, 5))
|
|
52
|
+
|
|
53
|
+
# Tools Frame
|
|
54
|
+
self.tools_frame = tk.Frame(master)
|
|
55
|
+
self.tools_frame.pack(pady=5)
|
|
56
|
+
|
|
57
|
+
# Tool Buttons
|
|
58
|
+
self.btn_wifite = tk.Button(self.tools_frame, text="Wifite", width=10, command=self.run_wifite)
|
|
59
|
+
self.btn_wifite.grid(row=0, column=0, padx=5)
|
|
60
|
+
|
|
61
|
+
self.btn_wireshark = tk.Button(self.tools_frame, text="Wireshark", width=10, command=self.run_wireshark)
|
|
62
|
+
self.btn_wireshark.grid(row=0, column=1, padx=5)
|
|
63
|
+
|
|
64
|
+
self.btn_kismet = tk.Button(self.tools_frame, text="Kismet", width=10, command=self.run_kismet)
|
|
65
|
+
self.btn_kismet.grid(row=0, column=2, padx=5)
|
|
66
|
+
|
|
67
|
+
def run_command(self, cmd_list, description):
|
|
68
|
+
"""Helper to run commands and update status."""
|
|
69
|
+
self.status_var.set(f"Running: {description}...")
|
|
70
|
+
self.master.update()
|
|
71
|
+
try:
|
|
72
|
+
# check=True will raise CalledProcessError on non-zero exit
|
|
73
|
+
subprocess.run(cmd_list, check=True)
|
|
74
|
+
self.status_var.set(f"Success: {description}")
|
|
75
|
+
return True
|
|
76
|
+
except subprocess.CalledProcessError as e:
|
|
77
|
+
self.status_var.set(f"Error: {description}")
|
|
78
|
+
messagebox.showerror("Error", f"Failed to run {description}.\nExit code: {e.returncode}")
|
|
79
|
+
return False
|
|
80
|
+
except Exception as e:
|
|
81
|
+
self.status_var.set(f"Error: {description}")
|
|
82
|
+
messagebox.showerror("Error", f"An error occurred:\n{str(e)}")
|
|
83
|
+
return False
|
|
84
|
+
|
|
85
|
+
def enable_monitor(self):
|
|
86
|
+
"""Enables monitor mode (logic from monitor_mode.sh without prompts)."""
|
|
87
|
+
if not messagebox.askyesno("Confirm", f"Enable monitor mode on {INTERFACE}?\nThis will kill network processes."):
|
|
88
|
+
return
|
|
89
|
+
|
|
90
|
+
# Step 1: Kill conflicting processes
|
|
91
|
+
if not self.run_command(["sudo", "airmon-ng", "check", "kill"], "Kill processes"):
|
|
92
|
+
if not messagebox.askyesno("Warning", "Failed to kill processes. Continue anyway?"):
|
|
93
|
+
return
|
|
94
|
+
|
|
95
|
+
# Step 2: Start monitor mode
|
|
96
|
+
if self.run_command(["sudo", "airmon-ng", "start", INTERFACE], "Start Monitor Mode"):
|
|
97
|
+
messagebox.showinfo("Success", f"Monitor mode enabled on {INTERFACE}.")
|
|
98
|
+
|
|
99
|
+
def disable_monitor(self):
|
|
100
|
+
"""Disables monitor mode using the stop_monitor_mode.sh script."""
|
|
101
|
+
if not messagebox.askyesno("Confirm", "Disable monitor mode and restore networks?"):
|
|
102
|
+
return
|
|
103
|
+
|
|
104
|
+
# Call the bash script we created
|
|
105
|
+
if self.run_command(["sudo", "bash", STOP_SCRIPT], "Disable Monitor & Restore"):
|
|
106
|
+
messagebox.showinfo("Success", "Monitor mode disabled. Network restarting...")
|
|
107
|
+
|
|
108
|
+
def get_terminal(self):
|
|
109
|
+
"""Finds a suitable terminal emulator."""
|
|
110
|
+
term = shutil.which("x-terminal-emulator")
|
|
111
|
+
if not term:
|
|
112
|
+
term = shutil.which("gnome-terminal")
|
|
113
|
+
if not term:
|
|
114
|
+
term = shutil.which("konsole")
|
|
115
|
+
if not term:
|
|
116
|
+
term = shutil.which("xterm")
|
|
117
|
+
return term
|
|
118
|
+
|
|
119
|
+
def launch_in_terminal(self, cmd, title):
|
|
120
|
+
term = self.get_terminal()
|
|
121
|
+
if not term:
|
|
122
|
+
messagebox.showerror("Error", "No terminal emulator found (x-terminal-emulator, gnome-terminal, etc).")
|
|
123
|
+
return
|
|
124
|
+
|
|
125
|
+
# Construct command based on terminal.
|
|
126
|
+
# most accept -e
|
|
127
|
+
full_cmd = [term, "-e", f"sudo {cmd}"]
|
|
128
|
+
# specialized handling if needed, but -e is standard for xterm/gnome-terminal/x-terminal-emulator
|
|
129
|
+
|
|
130
|
+
try:
|
|
131
|
+
subprocess.Popen(full_cmd) # Non-blocking
|
|
132
|
+
self.status_var.set(f"Launched {title}")
|
|
133
|
+
except Exception as e:
|
|
134
|
+
messagebox.showerror("Error", f"Failed to launch {title}:\n{e}")
|
|
135
|
+
|
|
136
|
+
def run_wifite(self):
|
|
137
|
+
self.launch_in_terminal("wifite", "Wifite")
|
|
138
|
+
|
|
139
|
+
def run_kismet(self):
|
|
140
|
+
self.launch_in_terminal("kismet", "Kismet")
|
|
141
|
+
|
|
142
|
+
def run_wireshark(self):
|
|
143
|
+
try:
|
|
144
|
+
subprocess.Popen(["sudo", "wireshark"]) # Wireshark is GUI
|
|
145
|
+
self.status_var.set("Launched Wireshark")
|
|
146
|
+
except Exception as e:
|
|
147
|
+
messagebox.showerror("Error", f"Failed to launch Wireshark:\n{e}")
|
|
148
|
+
|
|
149
|
+
def main():
|
|
150
|
+
root = tk.Tk()
|
|
151
|
+
app = MonitorGUI(root)
|
|
152
|
+
root.mainloop()
|
|
153
|
+
|
|
154
|
+
if __name__ == "__main__":
|
|
155
|
+
main()
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Script to switch a wireless interface into monitor mode.
|
|
4
|
+
|
|
5
|
+
INTERFACE="wlan1" # The wireless interface to put into monitor mode
|
|
6
|
+
|
|
7
|
+
echo "This script will prepare your system for monitor mode by killing conflicting processes"
|
|
8
|
+
echo "and then attempt to switch $INTERFACE into monitor mode."
|
|
9
|
+
echo "Root privileges (sudo) will be required."
|
|
10
|
+
|
|
11
|
+
read -p "Do you want to proceed? (y/N): " confirm
|
|
12
|
+
if [[ ! "$confirm" =~ ^[yY]$ ]]; then
|
|
13
|
+
echo "Operation cancelled."
|
|
14
|
+
exit 0
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
echo "Step 1: Killing conflicting processes with airmon-ng check kill..."
|
|
18
|
+
if sudo airmon-ng check kill; then
|
|
19
|
+
echo "Conflicting processes killed successfully (or none were running)."
|
|
20
|
+
else
|
|
21
|
+
echo "Error: Failed to kill conflicting processes. Please check the output above."
|
|
22
|
+
read -p "Do you want to continue attempting to put $INTERFACE into monitor mode anyway? (y/N): " continue_anyway
|
|
23
|
+
if [[ ! "$continue_anyway" =~ ^[yY]$ ]]; then
|
|
24
|
+
echo "Operation cancelled."
|
|
25
|
+
exit 1
|
|
26
|
+
fi
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
echo "Step 2: Switching $INTERFACE into monitor mode..."
|
|
30
|
+
# airmon-ng start usually renames the interface, often adding "mon" or changing it.
|
|
31
|
+
# The output will tell us the new monitor interface name.
|
|
32
|
+
MON_INTERFACE_OUTPUT=$(sudo airmon-ng start "$INTERFACE" 2>&1)
|
|
33
|
+
EXIT_CODE=$?
|
|
34
|
+
|
|
35
|
+
echo "$MON_INTERFACE_OUTPUT"
|
|
36
|
+
|
|
37
|
+
if [ "$EXIT_CODE" -eq 0 ]; then
|
|
38
|
+
# Try to extract the new monitor interface name
|
|
39
|
+
NEW_MON_INTERFACE=$(echo "$MON_INTERFACE_OUTPUT" | grep -oP '\s\K\w+mon(?=\s+)' | tail -n 1)
|
|
40
|
+
if [ -z "$NEW_MON_INTERFACE" ]; then
|
|
41
|
+
NEW_MON_INTERFACE=$(echo "$MON_INTERFACE_OUTPUT" | grep -oP '\(monitor mode enabled on \)\K\w+' | tail -n 1)
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
if [ -n "$NEW_MON_INTERFACE" ]; then
|
|
45
|
+
echo "Success: $INTERFACE is now in monitor mode as $NEW_MON_INTERFACE."
|
|
46
|
+
echo "You can now use tools like airodump-ng or Wireshark on $NEW_MON_INTERFACE."
|
|
47
|
+
else
|
|
48
|
+
echo "Success: $INTERFACE should now be in monitor mode, but could not determine new interface name."
|
|
49
|
+
echo "Please check 'iwconfig' or 'ip a' to find the new monitor interface name (e.g., 'wlan1mon')."
|
|
50
|
+
fi
|
|
51
|
+
else
|
|
52
|
+
echo "Error: Failed to switch $INTERFACE into monitor mode. Please check the output above."
|
|
53
|
+
exit 1
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
echo "Script finished."
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Script to disable monitor mode on wlan1 and restore network services.
|
|
4
|
+
# This script is intended to be the counterpart to monitor_mode.sh
|
|
5
|
+
|
|
6
|
+
# The interface usually becomes wlan1mon after airmon-ng start.
|
|
7
|
+
# We will attempt to stop that, or wlan1 if wlan1mon doesn't exist.
|
|
8
|
+
|
|
9
|
+
MON_INTERFACE="wlan1mon"
|
|
10
|
+
ORIG_INTERFACE="wlan1"
|
|
11
|
+
|
|
12
|
+
echo "Attempting to disable monitor mode..."
|
|
13
|
+
|
|
14
|
+
# Try stopping wlan1mon first
|
|
15
|
+
if ip link show "$MON_INTERFACE" > /dev/null 2>&1; then
|
|
16
|
+
echo "Stopping $MON_INTERFACE..."
|
|
17
|
+
sudo airmon-ng stop "$MON_INTERFACE"
|
|
18
|
+
else
|
|
19
|
+
echo "$MON_INTERFACE not found. Checking for $ORIG_INTERFACE in monitor mode..."
|
|
20
|
+
# If wlan1 is in monitor mode (sometimes airmon-ng doesn't rename it)
|
|
21
|
+
sudo airmon-ng stop "$ORIG_INTERFACE"
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
echo "Restarting network services..."
|
|
25
|
+
|
|
26
|
+
# Restart NetworkManager (manages connections)
|
|
27
|
+
if systemctl list-unit-files | grep -q NetworkManager; then
|
|
28
|
+
echo "Restarting NetworkManager..."
|
|
29
|
+
sudo systemctl restart NetworkManager
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
# Restart wpa_supplicant (often handled by NM, but good to ensure)
|
|
33
|
+
if systemctl list-unit-files | grep -q wpa_supplicant; then
|
|
34
|
+
echo "Restarting wpa_supplicant..."
|
|
35
|
+
sudo systemctl restart wpa_supplicant
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
# Restart avahi-daemon (mDNS)
|
|
39
|
+
if systemctl list-unit-files | grep -q avahi-daemon; then
|
|
40
|
+
echo "Restarting avahi-daemon..."
|
|
41
|
+
sudo systemctl restart avahi-daemon
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
echo "Monitor mode disabled and services restoration requested."
|
|
45
|
+
echo "Please wait a few seconds for network to reconnect."
|