Closed jamesbcook closed 6 years ago
Why not just make an optional flag where the user can set the computer name? Similarly this feature should be a flag, and not the default functionality.
Gentlemen, thanks for taking the time to send in your pull requests. Both points make sense. We should make this configurable by letting people decide which hostnames to query for. When that flag isn't set, we should fall back to random strings as hostnames. @jamesbcook Your commit looks good. I'll test it out in a day or two and will probably add a bit more entropy to the names. Current permutations allow for 108 (3 x 3 x 3 x 4) unique names. I'd probably add a random number to it as well just to defend against a possibility that responder is patched to not answer to these specific 108 names. Very unlikely but possible.
@ahhh Thanks for your pull request. Looks solid, please give me a day or test and merge.
@jamesbcook looks good to me 👍
Merged with following changes. Thanks @jamesbcook @ahhh
rhostname
(rcomputername
) option to make it simpler. Current implementation computes the SHA1 sum of current time and uses random bytes from it as hostname.
Each request will now send a unique computer name. There are 4 different buckets of names to choose from and each is chosen randomly and combined randomly on each function call. Once the computer name is returned the bytes to broadcast are updated.
The Makefile has also been updated to include the new computers.go file.