The Complete Ethical Hacking Bootcamp

Sir,
Following have my python code,
#!/usr/bin/env python

import requests

import pyfiglet

from threading import Thread

import sys

import getopt

from colorama import Fore

result = pyfiglet.figlet_format(“Bruteforcer”)

print(Fore.YELLOW + result)
print(Fore.RESET)

global hit

hit = “1”

class request_performer(Thread):

def __init__(self, name, user, url):

    Thread.__init__(self)

    self.password = name.split("\n")[0]

    self.username = user

    self.url = url

    print(Fore.WHITE + "-" + self.password + "-")

    print(Fore.RESET)

def run(self):

    global hit

    if hit == "1":

        try:

            r = requests.get(self, url, auth=(self.password))

            if r.status_code == 200:

                hit = "0"

                print(Fore.GREEN + "[+] Password Found - " + self.password)

                print(Fore.Red + "[+] Quitting .....")

                sys.exit()

            else:

                print ("[!!] - " + self.password + "Is not Valid")

                i[0] = i[0] -1

        except Exception:

def start(argv):

try:

    opts, args = getopt.getopt(argv, "u:w:f:t")

except getopt.GetoptError:

    print (Fore.RED + "[-] Error on your arguments !!!")

    sys.exit()

for opt, arg in opts:

    if opt == '-u':

        user = arg

    elif opt == '-w':

        url = arg

    elif opt == '-f':

        passlist = arg

    elif opt == '-t':

        threads = arg

try:

    f = open (passlist, "r")

    passwords = f.readlines()

except:

    print (Fore.Red + "[-] Can't Open Your Password File")

    sys.exit()

launcher_thread(passwords, threads, user, url)

def launcher_thread(passwords, th, username, url):

global i

i = []

i.append(0)

while len(passwords):

    if hit == "1"

    try:

        if i[0] < th:

            passwd = passwords.pop(0)

            i[0] = i[0] + 1

            thread = request_performer(passwd, username, url)

            thread.start()

        except KeyboardInterrupt:

            print(Fore.RED + "[-] Interrupted!!!")

            sys.exit()

        threads.join()

if name == “main”:

try:

    start(sys.argv[1:])

except KeyboardInterrupt:

    print(Fore.RED + "[-] Interrupted!!!")

Above code is show me to following error code.
def start(argv):
^
IndentationError: expected an indented block

Can you help me to correct this ?

Regards,
@Sithum

Hi @Sithum, Can you upload your code at some site like https://pastebin.com/ and share me that link? It is very hard for me to read your code this way. Or attach screenshots of your code if you can.

Hello @Apurv-StationX,
I have uploaded it to pastebin.You can checkout it following link,

Regards,
Sithum Nimlaka.

Hello @Apurv-StationX,
I have uploaded it to pastebin.You can checkout it following link,
https://pastebin.com/GtVuzx6d

Regards,
Sithum Nimlaka.

In your code on line 43, you haven’t finished the except block (That’s an error). Also, your function both functions (def start and def launcher_thread) from line 45 is not within the class request_performer. There is nothing wrong with that but just keep that in mind

Hello @Apurv-StationX now it was show me following error
except Exception, e:
^
SyntaxError: invalid syntax

Hello @Apurv-StationX,
Do you have original source code in bruteforcer. If it have you can you give it me ? Because i want compare original source code and my code.

Regards,
Sithum Nimlaka.

I would suggest you first learn Python programming language as these are the basic programming constructs, and if you go on further without it, you may not be able to create your python scripts. Try google searching how to create try-catch block in Python