From 43d77acf073a3720f91ad12c27cc108613c7bc35 Mon Sep 17 00:00:00 2001 From: Rasta Mouse Date: Sun, 30 Jul 2017 15:00:53 +0100 Subject: [PATCH] Add UK NI Datatype --- datatypes/ni_numbers.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 datatypes/ni_numbers.py 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