diff --git a/datatypes/ni_numbers.py b/datatypes/ni_numbers.py new file mode 100644 index 0000000..830c4e1 --- /dev/null +++ b/datatypes/ni_numbers.py @@ -0,0 +1,40 @@ +''' + +This module generates UK National Insurance Numbers. + +Format is 2 prefix letters, 6 digits, 1 suffix letter: +AB123456C + +They are sometimes printed with spaces: +AB 12 34 56 C + +This modules doesn't take correct letter prefixing into account, +it just generates them randomly. But this is probably good +enough for basic regex-type filters to detect. + +''' + +from common import helpers + + +class Datatype: + + def __init__(self, cli_object): + self.cli = "ni" + self.description = "UK National Insurance Numbers" + self.filetype = "text" + self.datasize = int(cli_object.data_size) + + def create_ni(self): + ni_n = helpers.randomNumbers(6) + ni_s = (helpers.randomString(3)).upper() + ni = ni_s[0:2] + ni_n[0:6] + ni_s[2:3] + return ni + + def generate_data(self): + print "[*] Generating data..." + nis = '' + # This is approx 1 meg of ni's (not including ", ") + for single_ni in range(0, 100000 * self.datasize): + nis += self.create_ni() + ', ' + return nis