Created
August 1, 2024 13:44
-
-
Save Kahn/01dfa3ea73a4362481768975a09a5987 to your computer and use it in GitHub Desktop.
Quick number system parser to block Symbio networks
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
Following on from the nice work at https://gist.github.com/wtfiwtz/317a075c6a4d60ef62944245557c79ad using Number Shield app on iOS | |
I'm super tired and I am sure there is a regex way to make this work but in the meantime here is the dumb way with python | |
Run `./python.exe file.py` after downloading the full ZIP from https://www.thenumberingsystem.com.au/#!/number-register/search | |
--- | |
import csv | |
import re | |
def parse_csv(filename): | |
data = [] | |
with open(filename, 'r') as file: | |
reader = csv.reader(file) | |
for row in reader: | |
if row[0] == 'Local service': | |
if re.search(r"SYMBIO", row[9]): | |
if row[6] == '10': | |
data.append(row[4][:-1]+'#') | |
elif row[6] == '100': | |
data.append(row[4][:-2]+"##") | |
elif row[6] == '1000': | |
data.append(row[4][:-3]+"###") | |
elif row[6] == '10000': | |
data.append(row[4][:-4]+"####") | |
elif row[6] == '100000': | |
data.append(row[4][:-5]+"#####") | |
elif row[6] == '1000000': | |
data.append(row[4][:-6]+"######") | |
return data | |
filename = 'EnhancedFullDownload.csv' | |
parsed_data = parse_csv(filename) | |
with open('out.txt', 'w') as file: | |
for item in parsed_data: | |
file.write(item + '\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment