m8sec / CrossLinked

LinkedIn enumeration tool to extract valid employee names from an organization through search engine scraping
GNU General Public License v3.0
1.3k stars 183 forks source link

Update utils.py fixed Error file not found error message. #36

Closed a7t0fwa7 closed 9 months ago

a7t0fwa7 commented 10 months ago

The error message FileNotFoundError: [Errno 2] No such file or directory: 'filename' is being thrown because the tool is trying to open a file named 'filename' instead of the file you specified.

This issue arises from the file_exists function in the utils.py file of the crosslinked package. The function is supposed to check if the file you specified exists, but due to a bug, it's trying to open a file named 'filename' instead of the file you specified.

Here's the problematic code:

def file_exists(filename, contents=False):
    if not os.path.isfile(filename):
        print(f"[!] Input file not found: {filename}")
        exit(1)
    return [line.strip() for line in open('filename')] if contents else filename

As you can see, the open function is trying to open 'filename' instead of the file you specified. The correct code should be:

def file_exists(filename, contents=False):
    if not os.path.isfile(filename):
        print(f"[!] Input file not found: {filename}")
        exit(1)
    return [line.strip() for line in open(filename)] if contents else filename

Fix: modifying the file_exists function in the utils.py file of the crosslinked package.

m8sec commented 9 months ago

Good catch thank you 😄

a7t0fwa7 commented 8 months ago

No problems mate! 🤗