浏览代码

Random Port Generation

Joshua 6 年之前
父节点
当前提交
7ea836dd35
共有 1 个文件被更改,包括 8 次插入0 次删除
  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));