Generate IBAN and Validate the Regex.
Currently no BIC validation support but i will work on it.
How does it work
The IBAN is generated by pure numbers and gets validated by two methods. Either Schwifty or pure Python. You can enable "use_schwifty" by typing 1 instead of 0 on line 24. Finally the IBANs are generated, validated and save into iban-valid.txt.
In the next version i will support 100% IBAN validation + BIC by country and sort code.
You can enable or disable settings by using 0 and 1 from line 22-25
CURRENTLY ONLY GERMAN IBANS ARE SUPPORTED
Usage
python3 iban-gen.py
Coder: f4c3r100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
+-----------------------------------------+
| PROJECT : IBAN GEN |
| DESCRIPTION : IBAN GEN & VALIDATOR
+-----------------------------------------+
'''
import schwifty
import random
import sys
import os
class Iban():
def __init__(self):
self.country_code = 'DE'
self.iban = ''
self.use_schwifty = 1
self.report_invalid = 0
def gen(self):
iban = self.country_code
string = ''
for i in range(2):
string += str(random.randint(0,9))
for i in range(8):
string += str(random.randint(0,9))
for i in range(10):
string += str(random.randint(0,9))
iban += string
self.iban = iban
return iban
def validate(self, IBAN):
if self.use_schwifty:
try:
if schwifty.IBAN(IBAN):
return True
except:
return False
else:
if IBAN[0:2] == 'DE':
testNumber = IBAN[2:4]
bankNumber = IBAN[4:12]
accNumber = IBAN[12:]
valNumber= int(bankNumber+accNumber+str(1314)+testNumber)
if (valNumber%97)==1:
return True
else:
return False
def save(self,filename,content):
temp = open(filename,'a')
temp.write(content)
temp.close()
def main(self):
while True:
if self.validate(self.gen()):
print('\033[34;1m[\033[32m+\033[34m] \033[37mValid IBAN : \033[32m' + self.iban)
self.save('iban-valid.txt',f'{self.iban}\n')
break
else:
if self.report_invalid:
print('\033[34;1m[\033[31m!\033[34m] \033[37mInValid IBAN : \033[31m' + self.iban)
continue
def main():
def clear():
if sys.platform == "win32":
os.system('cls')
elif sys.platform == "darwin" or sys.platform == "linux":
os.system('clear')
clear()
print("""\033[32m,--.,-----. ,---. ,--. ,--. ,----. ,------.,--. ,--. \n| || |) /_ / O \\ | ,'.| | ' .-./ | .---'| ,'.| | \n| || .-. \\| .-. || |' ' | | | .---.| `--, | |' ' | \n| || '--' /| | | || | ` | ' '--' || `---.| | ` |\n`--'`------' `--' `--'`--' `--' `------' `------'`--' `--'\n\t\t\t\033[37;1mS C A R L E T T A\n""")
gen = input('\033[34;1m(\033[33mHow Many IBANs To Generate ?\033[34m)>\033[37m ')
for i in range(0, int(gen)):
Iban().main()
if __name__ == '__main__':
main()
Currently no BIC validation support but i will work on it.
How does it work

The IBAN is generated by pure numbers and gets validated by two methods. Either Schwifty or pure Python. You can enable "use_schwifty" by typing 1 instead of 0 on line 24. Finally the IBANs are generated, validated and save into iban-valid.txt.
In the next version i will support 100% IBAN validation + BIC by country and sort code.
You can enable or disable settings by using 0 and 1 from line 22-25

Usage
python3 iban-gen.py
Coder: f4c3r100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
+-----------------------------------------+
| PROJECT : IBAN GEN |
| DESCRIPTION : IBAN GEN & VALIDATOR
+-----------------------------------------+
'''
import schwifty
import random
import sys
import os
class Iban():
def __init__(self):
self.country_code = 'DE'
self.iban = ''
self.use_schwifty = 1
self.report_invalid = 0
def gen(self):
iban = self.country_code
string = ''
for i in range(2):
string += str(random.randint(0,9))
for i in range(8):
string += str(random.randint(0,9))
for i in range(10):
string += str(random.randint(0,9))
iban += string
self.iban = iban
return iban
def validate(self, IBAN):
if self.use_schwifty:
try:
if schwifty.IBAN(IBAN):
return True
except:
return False
else:
if IBAN[0:2] == 'DE':
testNumber = IBAN[2:4]
bankNumber = IBAN[4:12]
accNumber = IBAN[12:]
valNumber= int(bankNumber+accNumber+str(1314)+testNumber)
if (valNumber%97)==1:
return True
else:
return False
def save(self,filename,content):
temp = open(filename,'a')
temp.write(content)
temp.close()
def main(self):
while True:
if self.validate(self.gen()):
print('\033[34;1m[\033[32m+\033[34m] \033[37mValid IBAN : \033[32m' + self.iban)
self.save('iban-valid.txt',f'{self.iban}\n')
break
else:
if self.report_invalid:
print('\033[34;1m[\033[31m!\033[34m] \033[37mInValid IBAN : \033[31m' + self.iban)
continue
def main():
def clear():
if sys.platform == "win32":
os.system('cls')
elif sys.platform == "darwin" or sys.platform == "linux":
os.system('clear')
clear()
print("""\033[32m,--.,-----. ,---. ,--. ,--. ,----. ,------.,--. ,--. \n| || |) /_ / O \\ | ,'.| | ' .-./ | .---'| ,'.| | \n| || .-. \\| .-. || |' ' | | | .---.| `--, | |' ' | \n| || '--' /| | | || | ` | ' '--' || `---.| | ` |\n`--'`------' `--' `--'`--' `--' `------' `------'`--' `--'\n\t\t\t\033[37;1mS C A R L E T T A\n""")
gen = input('\033[34;1m(\033[33mHow Many IBANs To Generate ?\033[34m)>\033[37m ')
for i in range(0, int(gen)):
Iban().main()
if __name__ == '__main__':
main()