dougy147 / mcbash

Find MAC addresses on IPTV providers.
GNU General Public License v3.0
102 stars 35 forks source link

Minor bugfixes and added Dockerfile #15

Closed jojo141185 closed 1 year ago

jojo141185 commented 1 year ago

Thanks for your contribution. Would you mind consider reviewing my steps in the README for Docker instructions?

That looks good! Thank's for adding.

jojo141185 commented 1 year ago

I don't want to open a new PR, but I think the following regexp in your last code update is broken:

        # Check if DNS is well formed URL or IP
        if ! [[ $(echo "${1}" | grep -Eo '((https?|ftp)://)?([a-Z0-9-]+\.)?[a-Z0-9-]+\.[a-Z0-9-]+((:)[0-9]{1,5})?(/.*)?') == "${1}" ||

This one should work: ((https?|ftp):\/\/)?([a-zA-Z0-9-]+.)?[a-zA-Z0-9-]+.[a-zA-Z0-9-]+((:)[0-9]{1,5})?(\/.*)?

Additionally, you should check whether the current proxy server used is working. Some proxies do not time out. They return an error on the handshake and mcbash assumes the request worked and just continues...

---------------------------------
        Handshake token : error code: 1001
[26] 00:1A:79:EF:17:8D 
---------------------------------
        Handshake token : error code: 1001
[27] 00:1A:79:EF:17:8E 

In this case it should rotate to the next proxy server in the list.

dougy147 commented 1 year ago

I've changed the regexp to ((https?|ftp)://)?([-a-zA-Z0-9]+\.)?[-a-zA-Z0-9]+\.[-a-zA-Z0-9]+((:)[0-9]{1,5})?(/.*)? (the dash should be placed first in a class of characters, also not sure if a-Z == a-zA-Z but let's go for the latter).

Additionally, you should check whether the current proxy server used is working. Some proxies do not time out. They return an error on the handshake and mcbash assumes the request worked and just continues...

Yes, I've been decomposing the handshake function yesterday to facilitate those kind of adjustements, I will soon take a look at requests success/failure handling.

I don't want to open a new PR, but [...]

PR will not bother me ;)

jojo141185 commented 1 year ago

Thanks for updating. it's working now! With the previous regexp I received an "ERROR: invalid DNS format.". The regexp range [a-Z] matches any character that falls between 'a' and 'Z' in the ASCII character set, which includes some non-alphabetical characters including '[' (91), '\' (92), ']' (93), '^' (94), '_' (95), and '`' (96). Accordingly, [a-zA-Z] is more accurate and what we need here.