dougy147 / mcbash

bash script to find valid MAC addresses on some IPTV platform
GNU General Public License v3.0
89 stars 34 forks source link

Read MAC list from file instead of built in generation? #14

Closed frozen905 closed 12 months ago

frozen905 commented 1 year ago

Would it be very difficult to be able to read from a file full of MAC addresses instead of relying on the built-in range option, or random option?

Would be much easier to use files full of MAC as the source so you can ensure you are never checking a same MAC twice. I realize you can use the range option to get around this, but then it only scans sequentially, and you also need to take careful note of the ranges you've already checked.

dougy147 commented 1 year ago

Hi @frozen905,

Keeping track of the last MAC checked when in sequential mode isn't a problem anymore : I added a checkpoint system to circumvent it. Users can now start back from the last checked MAC if they want.

Adding the option to read from a file should not be a big deal and I'd be open to a pull request ! Even if :

  1. Checking the same MAC more than once with the (pseudo-)random built-in function is quite improbable. And I wonder if avoiding the "risk" of checking twice in random mode is worth the pain of storing each checked MAC in a file and compare every randomly generated MAC to that file.

  2. From xx:xx:xx:00:00:00 to xx:xx:xx:FF:FF:FF (for example) it's a bit less than 17million MACs we would want to store in a file (~200Mo IIRC). That's why I prefered lighter methods.

As of now, I think mcbash would need some refacto before extending it. Indeed, you point out an ambiguity in my code : the --range option sets lower/upper bounds (which is fine), but it also forces sequential mode, while sequential mode should be a mode of its own.

So, next step for me is to correct that before adding a file-reading option. Again I'm cool with pull request!

Cheers

dougy147 commented 12 months ago

This issue has been resolved : last version of mcbash is able to read from a file full of MAC addresses. Give it the option --mac-file file_you_want_to_read_from.txt.

Moreover, the ambiguity between "range" and "sequential screening" has been fixed. The option --range specifies lower and higher boundaries and can now be used with both random and sequential screening. The option --seq enables sequential screening (and forces --range).