moriarty-project 0.1.19__py3-none-any.whl → 0.1.21__py3-none-any.whl

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.
@@ -0,0 +1,223 @@
1
+ """
2
+ Módulo de utilidades de rede para o WiFiPPLER.
3
+
4
+ Fornece funções para manipulação de interfaces de rede, endereçamento e operações relacionadas.
5
+ """
6
+ import os
7
+ import re
8
+ import socket
9
+ import fcntl
10
+ import struct
11
+ import array
12
+ import platform
13
+ from typing import Dict, List, Optional, Union, Any
14
+
15
+ # Constantes para chamadas de sistema
16
+ SIOCGIFHWADDR = 0x8927 # Get hardware address
17
+ SIOCGIFADDR = 0x8915 # Get IP address
18
+ SIOCGIFNETMASK = 0x891B # Get netmask
19
+ SIOCGIFBRDADDR = 0x8919 # Get broadcast address
20
+ SIOCGIFMTU = 0x8921 # Get MTU
21
+ SIOCGIFINDEX = 0x8933 # Get interface index
22
+ SIOCGIFNAME = 0x8910 # Get interface name
23
+ SIOCGIFFLAGS = 0x8913 # Get interface flags
24
+ SIOCSIFFLAGS = 0x8914 # Set interface flags
25
+
26
+ # Flags de interface
27
+ IFF_UP = 0x1
28
+ IFF_BROADCAST = 0x2
29
+ IFF_DEBUG = 0x4
30
+ IFF_LOOPBACK = 0x8
31
+ IFF_POINTOPOINT = 0x10
32
+ IFF_NOTRAILERS = 0x20
33
+ IFF_RUNNING = 0x40
34
+ IFF_NOARP = 0x80
35
+ IFF_PROMISC = 0x100
36
+ IFF_ALLMULTI = 0x200
37
+ IFF_MASTER = 0x400
38
+ IFF_SLAVE = 0x800
39
+ IFF_MULTICAST = 0x1000
40
+ IFF_PORTSEL = 0x2000
41
+ IFF_AUTOMEDIA = 0x4000
42
+ IFF_DYNAMIC = 0x8000
43
+ IFF_LOWER_UP = 0x10000
44
+ IFF_DORMANT = 0x20000
45
+ IFF_ECHO = 0x40000
46
+
47
+ def get_interface_mac(interface: str) -> Optional[str]:
48
+ """Obtém o endereço MAC de uma interface de rede.
49
+
50
+ Args:
51
+ interface: Nome da interface de rede
52
+
53
+ Returns:
54
+ str: Endereço MAC formatado ou None se não encontrado
55
+ """
56
+ try:
57
+ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
58
+ info = fcntl.ioctl(s.fileno(), SIOCGIFHWADDR, struct.pack('256s', interface[:15].encode('utf-8')))
59
+ return ':'.join(f'{b:02x}' for b in info[18:24])
60
+ except (IOError, OSError):
61
+ return None
62
+
63
+ def get_interface_ip(interface: str) -> Optional[str]:
64
+ """Obtém o endereço IP de uma interface de rede.
65
+
66
+ Args:
67
+ interface: Nome da interface de rede
68
+
69
+ Returns:
70
+ str: Endereço IP ou None se não encontrado
71
+ """
72
+ try:
73
+ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
74
+ return socket.inet_ntoa(fcntl.ioctl(
75
+ s.fileno(),
76
+ SIOCGIFADDR,
77
+ struct.pack('256s', interface[:15].encode('utf-8'))
78
+ )[20:24])
79
+ except (IOError, OSError):
80
+ return None
81
+
82
+ def get_interface_netmask(interface: str) -> Optional[str]:
83
+ """Obtém a máscara de rede de uma interface.
84
+
85
+ Args:
86
+ interface: Nome da interface de rede
87
+
88
+ Returns:
89
+ str: Máscara de rede ou None se não encontrada
90
+ """
91
+ try:
92
+ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
93
+ return socket.inet_ntoa(fcntl.ioctl(
94
+ s.fileno(),
95
+ SIOCGIFNETMASK,
96
+ struct.pack('256s', interface[:15].encode('utf-8'))
97
+ )[20:24])
98
+ except (IOError, OSError):
99
+ return None
100
+
101
+ def get_interface_gateway(interface: str) -> Optional[str]:
102
+ """Obtém o gateway padrão de uma interface.
103
+
104
+ Args:
105
+ interface: Nome da interface de rede
106
+
107
+ Returns:
108
+ str: Endereço do gateway ou None se não encontrado
109
+ """
110
+ try:
111
+ # Lê a tabela de roteamento
112
+ with open('/proc/net/route') as f:
113
+ for line in f:
114
+ fields = line.strip().split()
115
+ if len(fields) >= 2 and fields[0] == interface and fields[1] == '00000000':
116
+ # Converte o endereço hex para IP
117
+ return socket.inet_ntoa(struct.pack('<L', int(fields[2], 16)))
118
+ except (IOError, OSError):
119
+ pass
120
+ return None
121
+
122
+ def is_wireless_interface(interface: str) -> bool:
123
+ """Verifica se uma interface é sem fio.
124
+
125
+ Args:
126
+ interface: Nome da interface de rede
127
+
128
+ Returns:
129
+ bool: True se for uma interface sem fio, False caso contrário
130
+ """
131
+ # Verifica se a interface existe em /sys/class/net/
132
+ if not os.path.exists(f'/sys/class/net/{interface}'):
133
+ return False
134
+
135
+ # Verifica se é uma interface wireless
136
+ wireless_path = f'/sys/class/net/{interface}/wireless'
137
+ return os.path.exists(wireless_path)
138
+
139
+ def get_wireless_interfaces() -> List[Dict[str, Any]]:
140
+ """Obtém uma lista de interfaces de rede sem fio.
141
+
142
+ Returns:
143
+ List[Dict[str, Any]]: Lista de dicionários com informações das interfaces
144
+ """
145
+ interfaces = []
146
+
147
+ # Lista todos os diretórios em /sys/class/net
148
+ for iface in os.listdir('/sys/class/net'):
149
+ if is_wireless_interface(iface):
150
+ interfaces.append({
151
+ 'name': iface,
152
+ 'mac': get_interface_mac(iface),
153
+ 'ip': get_interface_ip(iface),
154
+ 'wireless': True,
155
+ 'up': is_interface_up(iface),
156
+ 'mtu': get_interface_mtu(iface)
157
+ })
158
+
159
+ return interfaces
160
+
161
+ def is_interface_up(interface: str) -> bool:
162
+ """Verifica se uma interface de rede está ativa.
163
+
164
+ Args:
165
+ interface: Nome da interface de rede
166
+
167
+ Returns:
168
+ bool: True se a interface estiver ativa, False caso contrário
169
+ """
170
+ try:
171
+ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
172
+ flags = struct.unpack('H', fcntl.ioctl(
173
+ s.fileno(),
174
+ SIOCGIFFLAGS,
175
+ struct.pack('256s', interface[:15].encode('utf-8'))
176
+ )[16:18])[0]
177
+ return bool(flags & IFF_UP)
178
+ except (IOError, OSError):
179
+ return False
180
+
181
+ def get_interface_mtu(interface: str) -> int:
182
+ """Obtém o MTU de uma interface de rede.
183
+
184
+ Args:
185
+ interface: Nome da interface de rede
186
+
187
+ Returns:
188
+ int: Valor do MTU ou 1500 (padrão) se não for possível obter
189
+ """
190
+ try:
191
+ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
192
+ return struct.unpack('I', fcntl.ioctl(
193
+ s.fileno(),
194
+ SIOCGIFMTU,
195
+ struct.pack('256s', interface[:15].encode('utf-8'))
196
+ )[16:20])[0]
197
+ except (IOError, OSError):
198
+ return 1500 # MTU padrão
199
+
200
+ def get_network_interfaces() -> List[Dict[str, Any]]:
201
+ """Obtém uma lista de todas as interfaces de rede.
202
+
203
+ Returns:
204
+ List[Dict[str, Any]]: Lista de dicionários com informações das interfaces
205
+ """
206
+ interfaces = []
207
+
208
+ # Lista todos os diretórios em /sys/class/net
209
+ for iface in os.listdir('/sys/class/net'):
210
+ # Ignora interfaces de loopback
211
+ if iface == 'lo':
212
+ continue
213
+
214
+ interfaces.append({
215
+ 'name': iface,
216
+ 'mac': get_interface_mac(iface),
217
+ 'ip': get_interface_ip(iface),
218
+ 'wireless': is_wireless_interface(iface),
219
+ 'up': is_interface_up(iface),
220
+ 'mtu': get_interface_mtu(iface)
221
+ })
222
+
223
+ return interfaces
@@ -0,0 +1,153 @@
1
+ """
2
+ Módulo de utilidades do sistema para o WiFiPPLER.
3
+
4
+ Fornece funções para verificação de permissões, dependências e outras operações do sistema.
5
+ """
6
+ import os
7
+ import sys
8
+ import subprocess
9
+ import shutil
10
+ from typing import List, Optional, Union, Dict, Any
11
+
12
+ def is_root() -> bool:
13
+ """Verifica se o script está sendo executado como root.
14
+
15
+ Returns:
16
+ bool: True se for root, False caso contrário
17
+ """
18
+ return os.geteuid() == 0
19
+
20
+ def command_exists(cmd: str) -> bool:
21
+ """Verifica se um comando existe no sistema.
22
+
23
+ Args:
24
+ cmd: Nome do comando a ser verificado
25
+
26
+ Returns:
27
+ bool: True se o comando existir, False caso contrário
28
+ """
29
+ return shutil.which(cmd) is not None
30
+
31
+ def check_dependencies() -> List[str]:
32
+ """Verifica as dependências necessárias para o funcionamento do WiFiPPLER.
33
+
34
+ Returns:
35
+ List[str]: Lista de dependências ausentes
36
+ """
37
+ required_commands = [
38
+ 'iwconfig',
39
+ 'ifconfig',
40
+ 'iw',
41
+ 'aircrack-ng',
42
+ 'airodump-ng',
43
+ 'aireplay-ng',
44
+ 'airmon-ng',
45
+ 'macchanger'
46
+ ]
47
+
48
+ missing = []
49
+ for cmd in required_commands:
50
+ if not command_exists(cmd):
51
+ missing.append(cmd)
52
+
53
+ return missing
54
+
55
+ def get_os_info() -> Dict[str, str]:
56
+ """Obtém informações sobre o sistema operacional.
57
+
58
+ Returns:
59
+ Dict[str, str]: Dicionário com informações do sistema
60
+ """
61
+ import platform
62
+
63
+ return {
64
+ 'system': platform.system(),
65
+ 'node': platform.node(),
66
+ 'release': platform.release(),
67
+ 'version': platform.version(),
68
+ 'machine': platform.machine(),
69
+ 'processor': platform.processor(),
70
+ 'python_version': platform.python_version()
71
+ }
72
+
73
+ def ensure_root() -> None:
74
+ """Verifica se o script está sendo executado como root.
75
+
76
+ Raises:
77
+ RuntimeError: Se não estiver sendo executado como root
78
+ """
79
+ if not is_root():
80
+ raise RuntimeError("Este script requer privilégios de superusuário (root). Execute com sudo.")
81
+
82
+ def ensure_dependencies() -> None:
83
+ """Verifica se todas as dependências estão instaladas.
84
+
85
+ Raises:
86
+ RuntimeError: Se alguma dependência estiver faltando
87
+ """
88
+ missing = check_dependencies()
89
+ if missing:
90
+ raise RuntimeError(
91
+ f"As seguintes dependências estão faltando: {', '.join(missing)}\n"
92
+ "Por favor, instale-as antes de continuar."
93
+ )
94
+
95
+ def get_available_interfaces() -> List[str]:
96
+ """Obtém uma lista de interfaces de rede disponíveis.
97
+
98
+ Returns:
99
+ List[str]: Lista de nomes de interfaces de rede
100
+ """
101
+ try:
102
+ return [
103
+ iface for iface in os.listdir('/sys/class/net/')
104
+ if iface != 'lo' # Ignora interface de loopback
105
+ ]
106
+ except (OSError, IOError):
107
+ return []
108
+
109
+ def get_wireless_interfaces() -> List[str]:
110
+ """Obtém uma lista de interfaces de rede sem fio disponíveis.
111
+
112
+ Returns:
113
+ List[str]: Lista de nomes de interfaces sem fio
114
+ """
115
+ try:
116
+ return [
117
+ iface for iface in os.listdir('/sys/class/net/')
118
+ if os.path.exists(f'/sys/class/net/{iface}/wireless')
119
+ ]
120
+ except (OSError, IOError):
121
+ return []
122
+
123
+ def get_interface_info(interface: str) -> Dict[str, Any]:
124
+ """Obtém informações detalhadas sobre uma interface de rede.
125
+
126
+ Args:
127
+ interface: Nome da interface de rede
128
+
129
+ Returns:
130
+ Dict[str, Any]: Dicionário com informações da interface
131
+ """
132
+ return {
133
+ 'name': interface,
134
+ 'wireless': os.path.exists(f'/sys/class/net/{interface}/wireless'),
135
+ 'state': get_interface_state(interface),
136
+ 'mac_address': get_interface_mac(interface),
137
+ 'ip_address': get_interface_ip(interface)
138
+ }
139
+
140
+ def get_interface_state(interface: str) -> str:
141
+ """Obtém o estado atual de uma interface de rede.
142
+
143
+ Args:
144
+ interface: Nome da interface de rede
145
+
146
+ Returns:
147
+ str: Estado da interface (up/down/unknown)
148
+ """
149
+ try:
150
+ with open(f'/sys/class/net/{interface}/operstate', 'r') as f:
151
+ return f.read().strip()
152
+ except (OSError, IOError):
153
+ return 'unknown'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: moriarty-project
3
- Version: 0.1.19
3
+ Version: 0.1.21
4
4
  Summary: Client-side OSINT toolkit with forensic-grade evidence handling.
5
5
  Project-URL: Homepage, https://github.com/DonatoReis/moriarty
6
6
  Project-URL: Documentation, https://github.com/DonatoReis/moriarty#readme
@@ -98,7 +98,7 @@ Description-Content-Type: text/markdown
98
98
  <!-- Badges -->
99
99
  <p align="center">
100
100
  <a href="https://pypi.org/project/moriarty-project/">
101
- <img src="https://img.shields.io/badge/version-0.1.19-blue" alt="Version 0.1.19">
101
+ <img src="https://img.shields.io/badge/version-0.1.21-blue" alt="Version 0.1.21">
102
102
  </a>
103
103
  <a href="https://www.python.org/downloads/">
104
104
  <img src="https://img.shields.io/pypi/pyversions/moriarty-project?color=blue" alt="Python Versions">
@@ -1,4 +1,4 @@
1
- moriarty/__init__.py,sha256=Yp4hHBhcnDfq44XpeeKzEotfwBbiVdxlSb_WrbBfoCQ,85
1
+ moriarty/__init__.py,sha256=aoAdbR341XKzTKGpzkkUW_cvd6QvGp7hmKljL9qjoog,85
2
2
  moriarty/adapters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  moriarty/agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  moriarty/assets/modules/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -400,12 +400,13 @@ moriarty/modules/vuln_scanner.py,sha256=-sRWOPzmrzUP9Mly471JCbP7iAxSwoho9DVn-6bF
400
400
  moriarty/modules/waf_detector.py,sha256=5biF5OVBHbLAj_5x0ZXzCS-94bQeJNzIcYm7kMDAX0I,20744
401
401
  moriarty/modules/wayback_discovery.py,sha256=sJN9at7Py-ZiUWuwnMU7fHOc_F3WwN1R3Y72qNSmxck,8573
402
402
  moriarty/modules/web_crawler.py,sha256=hxWbnD2GO_IbIb2FChCxCesgGu4dNhlloVqr5u1MC1k,5890
403
- moriarty/modules/wifippler/__init__.py,sha256=x3Qs7_qVtVjaf8V2hVJxbjEJNK66tOcic1NCS6ZQNQ4,1316
404
- moriarty/modules/wifippler/core/__init__.py,sha256=2WBNJv6ipNpG3McJ3sBu4zJrFshP6Aan6dch_LHvDM4,1832
403
+ moriarty/modules/wifippler/__init__.py,sha256=Xb04yiG7hhKYj9d_fvxwYeH1Ss30w9ar6m92zFA0LBg,2080
404
+ moriarty/modules/wifippler/cli/__init__.py,sha256=HrNoCBUKri_rkGJnE9GTFOUPK_CIDIwmeeoWuU_d9V4,273
405
+ moriarty/modules/wifippler/cli/commands.py,sha256=XOARaL0YHwfUILXEfvYUo1tDJjcg5ucoZspxsc-B-NQ,4236
406
+ moriarty/modules/wifippler/core/__init__.py,sha256=HV1W43MqT7UQ2Ab4GOFzJYjyHPwdplBBAa9hKHjh4O0,1962
405
407
  moriarty/modules/wifippler/core/scanner.py,sha256=bjCBwDAybUMintwfUORZEl24Wr0zRJHfVg-j8-OUoKg,34193
406
- moriarty/modules/wifippler/core/utils.py,sha256=byGdpd0TrwYi9-HrqSDWRIvCTCpPZ9Xw7-ZYQqSnTx4,28135
407
- moriarty/modules/wifippler/core/attacks/__init__.py,sha256=Ch9qg0PUB1Q8aSiZuoJRJl5iVyy7muMgZ88e2bkG_Zs,370
408
- moriarty/modules/wifippler/core/attacks/deauth.py,sha256=ikOmHLb5NzuhiLRP1xBVzSM8JivjZh7zyFJffKWTwuY,13127
408
+ moriarty/modules/wifippler/core/attacks/__init__.py,sha256=Eg9KX2l_l1uIZO6pMq-XNTiPrdzrW4Fz2u29UjYpg1A,4788
409
+ moriarty/modules/wifippler/core/attacks/deauth.py,sha256=WdAES4XZVrNRCFVfIF7SveGLtQs7pr3yTd4BjNR8ruM,10372
409
410
  moriarty/modules/wifippler/core/attacks/handshake.py,sha256=OGGtL9V69SukJXMrPyQ-NMXHGpDBsZU1-K5_Nm-iufM,16029
410
411
  moriarty/modules/wifippler/core/attacks/pmkid.py,sha256=gc83t2ejr_nH2GIom_Pui4xqKSbhr4AUa8vQ-zxQ1tg,16992
411
412
  moriarty/modules/wifippler/core/attacks/wep.py,sha256=GPr30ZcFwECjjs2-A7g-TutgSO3oZAZ4spjMPBOXZ0I,17299
@@ -413,7 +414,10 @@ moriarty/modules/wifippler/core/attacks/wpa.py,sha256=meYN_ZOeAghXnht2GWUpLcXAbz
413
414
  moriarty/modules/wifippler/core/attacks/wps.py,sha256=yYx6VITE3QYGBwM8J1RO6yu_r45ZLWNDWwdVMaU6xho,17504
414
415
  moriarty/modules/wifippler/core/models/__init__.py,sha256=J6GPV457hbFy7Tdk2PNKzT8LnO9Cj3xqRDaQ8IoDptA,148
415
416
  moriarty/modules/wifippler/core/models/network.py,sha256=xUi1Ac7LWWsrihq8RfDu9dHLZFN4oALlNvfJhHxWgok,6709
416
- moriarty/modules/wifippler/core/utils/__init__.py,sha256=rI06D6Ke0TfhBt-kU_uBTE46yOWIosNejlPdqRh3i3k,20422
417
+ moriarty/modules/wifippler/core/utils/__init__.py,sha256=RVv0pmO8XwN44tJ56XxvJ0c0vT7aQYeNJfRWrDH_WrU,20708
418
+ moriarty/modules/wifippler/core/utils/exec.py,sha256=Dngsd3J49LMqUKEkunwIyJwjl8kjJLwCiiRfaVrQZ30,5766
419
+ moriarty/modules/wifippler/core/utils/network.py,sha256=CF4DFoAxnIaJ513wy_gP-mgoyW4UU9qy0wp0HGeVT94,6707
420
+ moriarty/modules/wifippler/core/utils/system.py,sha256=xNrSQT1jUow46RvY8RFaNR1thUJhqW2DWhUkpuux_hY,4289
417
421
  moriarty/net/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
418
422
  moriarty/net/dns_cache.py,sha256=JwuDYKqmuSD-hl7PMyyQAen57ut-uvIszYrMKT-i8pY,6022
419
423
  moriarty/net/dns_client.py,sha256=iem7FekC79ruwxWzG6eFkicYJi-urkRV0kNvj9uakM0,6591
@@ -427,7 +431,7 @@ moriarty/tests/test_email_service.py,sha256=mWqimjQRlljZNBuNePvSzhfq5FZ4mljrILGW
427
431
  moriarty/tests/test_models.py,sha256=etklIISEUts3banaSRDSjhv-g6kd4wxucchCmlJkx6Y,1282
428
432
  moriarty/tests/test_orchestrator.py,sha256=Do3M1qnbqPf_1pR3v89FXxhiwfYPZfXRvcfl05isQvs,856
429
433
  moriarty/tests/test_tls_client.py,sha256=bQ46yXlIYNZwPTd8WGs6eUynHj56hVosxBycSU1gJe4,461
430
- moriarty_project-0.1.19.dist-info/METADATA,sha256=YSht8jqV46n-YX4YuMesdIKlkKIsBtCcus1p-rrh7vE,11709
431
- moriarty_project-0.1.19.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
432
- moriarty_project-0.1.19.dist-info/entry_points.txt,sha256=L4TAUKy7HAy5hT46ZqS6eNOCmUTMi4x7ehZkIkTNnuE,51
433
- moriarty_project-0.1.19.dist-info/RECORD,,
434
+ moriarty_project-0.1.21.dist-info/METADATA,sha256=LPP5fMR2oM5g8oXUXyuksPxOhPdTjKmfiIM3gFKT3sw,11709
435
+ moriarty_project-0.1.21.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
436
+ moriarty_project-0.1.21.dist-info/entry_points.txt,sha256=L4TAUKy7HAy5hT46ZqS6eNOCmUTMi4x7ehZkIkTNnuE,51
437
+ moriarty_project-0.1.21.dist-info/RECORD,,