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

bug in try-except clause makes header_scan.py impossible to use #16

Open
michalmikulasi opened this issue Jul 6, 2020 · 0 comments
Open

Comments

@michalmikulasi
Copy link

in header_scan.py is this code snippet:

for domain in domains:
        if domain != "":
                try:
                        **_r = requests.head("https://"+domain, timeout=5)_**
                except:
                        print("[-]Error on https://"+domain)
                headers_found = []
                for header in headers:
                        _**current_header = r.headers.get(header.lower())**_
                        if current_header != None and "nginx" not in current_header.lower():
                                headers_found.append(str(current_header))
                if headers_found != []:
                        if is_closed:
                                file = open(output_file,"w+")
                                is_closed = False
                        print("[+]"+domain+" - "+str(headers_found))
                        file.write(domain+" - "+str(headers_found)+"\n")
                else:
                        print("[-]"+domain+" - "+str(headers_found))
        else:

So there is defined variable "r" and the variable is in try-except clause. Later the same variable is referenced again. The problem is, that if the TRY fails, the variable "r" is not defined, and therefore we get error(on the right side of the picture), we get "NameError: name 'r' is not defined"

try-except-error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant