Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of a new module #643

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions core/module_protocols/smb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import copy
import smbprotocol
from core.utility import process_conditions
from core.utility import get_dependent_results_from_database
from core.utility import replace_dependent_values

class NettackSMB:
def smb_brute_force(self, host, ports, usernames, passwords, timeout):
smb_client = smbprotocol.SMBClient(host, int(ports))
try:
smb_client.login(usernames, passwords, timeout=int(timeout))
smb_client.logout()
return {
"host": host,
"username": usernames,
"password": passwords,
"port": ports
}
except smbprotocol.exceptions.AuthenticationError as _:
pass
return {}

class Engine:
def run(
sub_step,
module_name,
target,
scan_unique_id,
options,
process_number,
module_thread_number,
total_module_thread_number,
request_number_counter,
total_number_of_requests
):
backup_method = copy.deepcopy(sub_step['method'])
backup_response = copy.deepcopy(sub_step['response'])
del sub_step['method']
del sub_step['response']
if 'dependent_on_temp_event' in backup_response:
temp_event = get_dependent_results_from_database(
target,
module_name,
scan_unique_id,
backup_response['dependent_on_temp_event']
)
sub_step = replace_dependent_values(
sub_step,
temp_event
)
action = NettackSMB()
response = action.smb_brute_force(**sub_step)
sub_step['method'] = backup_method
sub_step['response'] = backup_response
sub_step['response']['conditions_results'] = response
return process_conditions(
sub_step,
module_name,
target,
scan_unique_id,
options,
response,
process_number,
module_thread_number,
total_module_thread_number,
request_number_counter,
total_number_of_requests
)
40 changes: 40 additions & 0 deletions modules/brute/smb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
info:
name: smb_brute
author: OWASP Nettacker Team
severity: 3
description: smb Bruteforcer
reference:
profiles:
- brute
- brute_force
- smb

payloads:
- library: smb
steps:
- method: smb_brute_force
timeout: 3
host: "{target}"
ports:
- 445
- 139
usernames:
- root
- admin
- user
- test
passwords:
nettacker_fuzzer:
input_format: '{{passwords}}'
prefix:
suffix:
interceptors:
data:
passwords: fuzzer_function_read_file_as_array('passwords/top_1000_common_passwords.txt')
response:
condition_type: or
conditions:
successful_login:
regex: ""
reverse: false