PortGenerator.py 374 B

1234567891011
  1. import random
  2. import string
  3. def gen_random_server_port():
  4. """
  5. Generates a valid random first and last character for a bots hostname
  6. and computes a port from these two characters.
  7. """
  8. firstLetter = random.choice(string.ascii_letters);
  9. lastLetter = random.choice(string.ascii_letters + string.digits);
  10. return (ord(firstLetter) * ord(lastLetter));