elceef / dnstwist

Domain name permutation engine for detecting homograph phishing attacks, typo squatting, and brand impersonation
https://dnstwist.it
Apache License 2.0
4.73k stars 753 forks source link

Allow output file to exist #191

Closed jullle3 closed 11 months ago

jullle3 commented 1 year ago

When running dnstwist with

    permutations = dnstwist.run(
        domain=domain,
        registered=True,
        format='list',
        dictionary=f'{ROOT_DIR}/lib/dictionaries/english.dict',
        tld=f'{ROOT_DIR}/lib/dictionaries/abused_tlds.dict',
        output='/dev/null',
    )

it spams stdout with all permutations, and since its also returned as a list (which is all i need), i fix it by redirecting output to /dev/null, however this fails since dnstwist doesn't allow output files to exist before runs. This can be fixed by opening the file with mode w instead of x

In dnstwist.py image

elceef commented 1 year ago

Just pass format='null' argument and skip output='/dev/null' to mute the output.

jullle3 commented 1 year ago

@elceef WIth format='null' it makes DNS requests. I want it to only perform permutations. Is there another solution?

elceef commented 1 year ago

I assumed you want to scan for registered domains since you're passing argument registered=True. Pull the latest code. Writing to os.devnull should be now allowed.

jullle3 commented 1 year ago

Thanks. Will test later

jullle3 commented 1 year ago

@elceef Works like a charm. Looking forward to new pip release