Explorar el Código

Random Port Generation

Joshua hace 6 años
padre
commit
7ea836dd35
Se han modificado 1 ficheros con 8 adiciones y 0 borrados
  1. 8 0
      code/ID2TLib/genRandPort.py

+ 8 - 0
code/ID2TLib/genRandPort.py

@@ -0,0 +1,8 @@
+import random
+import string
+
+def generateRandomPort(default):
+
+    firstLetter = random.choice(string.ascii_letters);
+    lastLetter = random.choice(string.ascii_letters + string.digits);
+    return (default + ord(firstLetter) * ord(lastLetter));