LandGrey / pydictor

A powerful and useful hacker dictionary builder for a brute-force attack
https://github.com/LandGrey/pydictor
GNU General Public License v3.0
3.22k stars 630 forks source link

--regex just dont work #30

Closed PerchunPak closed 3 years ago

PerchunPak commented 3 years ago

I also tried change value "pyoptions.filter_regex" in pydictor\lib\fun\filter.py:245 to r'[(A-z)]*\d{1}[(A-z)]*' and it doesnt worked. This regex filter all values what have only one number from others. Command which i use python pydictor.py -base dLc -o /test.txt --len 3 3 --regex r'[(A-z)]*\d{1}[(A-z)]*'

I also tried do filter with additional file main.py

import re

file = open("test-passed.txt", "a")
with open('test.txt') as f:
    for line in f:
        resultNum = re.search(r'[(A-z)]*\d{1}[(A-z)]*', line)
        resultNoNum = re.search(r'[(A-z)]{5}', line)
        if not resultNum is None:
            if len(resultNum.group(0)) == 5:
                file.write(line)
        if not resultNoNum is None:
            if len(resultNoNum.group(0)) == 5:
                file.write(line)
file.close()

And it works fine

PerchunPak commented 3 years ago

I also tried use d89b0568a35ab2979ce94442b7c87a97c62847b1 when regex was only added, and it dont work lol

LandGrey commented 3 years ago

I also tried use d89b056 when regex was only added, and it dont work lol

base type word list supported function only containsF1 F2 F3 F4, and not supported F7 regex function. reference https://github.com/LandGrey/pydictor#all-of-pydictor-can-generating-wordlist .

you can use --conf or first use -base generate word list and after use -tool handler to filter word list by --regex.

PerchunPak commented 3 years ago

I make skript which generate same as pydictor, but also have regex support.

import itertools
import re

symbolsForGen = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

with open("generated.txt", "a") as f:
    for i in range(3, 3+1):
        for item in itertools.product(symbolsForGen, repeat=i):
            print("".join(item))
            resultNum = re.search(r'[(A-z)]*\d{1}[(A-z)]*', "".join(item))
            if not resultNum is None:
                print(len(resultNum.group(0)), resultNum.group(0))
                if len(resultNum.group(0)) == 3:
                    f.write("".join(item) + '\n')

Maybe later i will create pull request

LandGrey commented 3 years ago

I make skript which generate same as pydictor, but also have regex support.

import itertools
import re

symbolsForGen = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

with open("generated.txt", "a") as f:
    for i in range(3, 3+1):
        for item in itertools.product(symbolsForGen, repeat=i):
            print("".join(item))
            resultNum = re.search(r'[(A-z)]*\d{1}[(A-z)]*', "".join(item))
            if not resultNum is None:
                print(len(resultNum.group(0)), resultNum.group(0))
                if len(resultNum.group(0)) == 3:
                    f.write("".join(item) + '\n')

Maybe later i will create pull request

-base option supported function only contains F1 F2 F3 F4, that's only for speed generate word list, not other reasons.