Created
October 23, 2013 00:01
-
-
Save thepacketgeek/7110285 to your computer and use it in GitHub Desktop.
Random packet field generators
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Returns a string of a random int between 1 and 254(default) | |
def randOct(end = 254): | |
return str(random.randint(1, end)) | |
## Used for random size or TTL | |
def randTS(max = 256): | |
return str(random.randint(1, max/8) * 8) | |
## Returns a string of a hex number 4 digits long, with the preceding '0x' sliced off | |
def randHex(max = 65535): | |
return str(hex(random.randint(1, max)))[2:] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment