From e92f20e471e5fb766cc7a1144439b06c176940f3 Mon Sep 17 00:00:00 2001 From: Luxferre Date: Tue, 12 Mar 2024 09:57:02 +0200 Subject: [PATCH] Added imeigen.awk --- README | 2 +- games/awlite | 2 +- utils/imeigen.awk | 30 ++++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 utils/imeigen.awk diff --git a/README b/README index b35496e..b016c56 100644 --- a/README +++ b/README @@ -31,6 +31,6 @@ Other AWK scripts have the usage described in their comment headers. * utils/textereo.awk: ASCII art stereogram generator * utils/tgl.awk: The Great Library of useful functions missing in POSIX AWK - +* utils/imeigen.awk: Random valid IMEI generator (with optional TAC prefix) --- Luxferre --- diff --git a/games/awlite b/games/awlite index 026c365..5fe34df 160000 --- a/games/awlite +++ b/games/awlite @@ -1 +1 @@ -Subproject commit 026c365e50d9e602a5ec22501eb016a3ae515345 +Subproject commit 5fe34dfc944d5b05d326fb3675a1fa0ca4d37039 diff --git a/utils/imeigen.awk b/utils/imeigen.awk new file mode 100644 index 0000000..68594d4 --- /dev/null +++ b/utils/imeigen.awk @@ -0,0 +1,30 @@ +# Valid IMEI generator script +# +# Usage: awk -f imeigen.awk [TAC] +# you can pass any amount of digits, if less than 15 then the rest +# is randomized and the checksum is calculated accordingly +# if more, then it's truncated to 14 and the checksum is calculated +# if no TAC is passed, a fully random valid IMEI is generated +# +# Created by Luxferre in 2024, released into public domain + +# Luhn checksum (picoLuhn variation for 14 digits) +function luhn(imeistr, acc, i, l, d) { + acc = 0 + l = length(imeistr) # must be even in this variation + for(i=0;i