Skip to content

Commit 958e1bc

Browse files
feature: add smb_brute command (#1070)
* Update dependencies in poetry.lock and pyproject.toml for new packages * feat: add SMB brute force module * feat: add unit tests for SMB brute force module * ran make pre-commit --------- Co-authored-by: Sam Stepanyan <[email protected]>
1 parent af7abb6 commit 958e1bc

File tree

5 files changed

+305
-21
lines changed

5 files changed

+305
-21
lines changed

nettacker/core/lib/smb.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
from impacket.smbconnection import SMBConnection
2+
3+
from nettacker.core.lib.base import BaseEngine, BaseLibrary
4+
5+
6+
def create_connection(host, port):
7+
return SMBConnection(host, remoteHost=host, sess_port=port)
8+
9+
10+
class SmbLibrary(BaseLibrary):
11+
def brute_force(self, *args, **kwargs):
12+
host = kwargs["host"]
13+
port = kwargs["port"]
14+
username = kwargs["username"]
15+
16+
response = {
17+
"host": host,
18+
"port": port,
19+
"username": username,
20+
}
21+
22+
domain = "."
23+
if "domain" in kwargs:
24+
domain = kwargs["domain"]
25+
response.update({"domain": domain})
26+
27+
password = ""
28+
if "password" in kwargs:
29+
password = kwargs["password"]
30+
response.update({"password": password})
31+
32+
lm = ""
33+
if "lm" in kwargs:
34+
lm = kwargs["lm"]
35+
response.update({"lm": lm})
36+
37+
nt = ""
38+
if "nt" in kwargs:
39+
nt = kwargs["nt"]
40+
response.update({"nt": nt})
41+
42+
connection = create_connection(host, port)
43+
connection.login(username, password, domain, lm, nt)
44+
45+
return response
46+
47+
48+
class SmbEngine(BaseEngine):
49+
library = SmbLibrary

nettacker/modules/brute/smb.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
info:
2+
name: smb_brute
3+
author: OWASP Nettacker Team
4+
severity: 3
5+
description: SMB Bruteforcer
6+
reference:
7+
profiles:
8+
- brute
9+
- brute_force
10+
- smb
11+
12+
payloads:
13+
- library: smb
14+
steps:
15+
- method: brute_force
16+
timeout: 3
17+
host: '{target}'
18+
ports:
19+
- 445
20+
usernames:
21+
- administrator
22+
- admin
23+
- root
24+
- user
25+
- test
26+
- guest
27+
passwords:
28+
nettacker_fuzzer:
29+
input_format: '{{passwords}}'
30+
prefix:
31+
suffix:
32+
interceptors:
33+
data:
34+
passwords:
35+
read_from_file: passwords/top_1000_common_passwords.txt
36+
response:
37+
condition_type: or
38+
conditions:
39+
successful_login:
40+
regex: ''
41+
reverse: false

0 commit comments

Comments
 (0)