From 207820fdf5a7716418383ee516af5576a14f16dd Mon Sep 17 00:00:00 2001 From: Minoplhy Date: Thu, 3 Jun 2021 12:58:01 +0700 Subject: [PATCH] Solved Problem with number in unbound and dnsmasq and hosts --- to-rpz/dnsmasq_rpz_argv.py | 6 ++++-- to-rpz/host_rpz_argv.py | 4 +++- to-rpz/unbound_rpz_argv.py | 4 +++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/to-rpz/dnsmasq_rpz_argv.py b/to-rpz/dnsmasq_rpz_argv.py index e4540b0..1d7f6bb 100644 --- a/to-rpz/dnsmasq_rpz_argv.py +++ b/to-rpz/dnsmasq_rpz_argv.py @@ -12,8 +12,10 @@ lst = [] with open(infile, 'r') as f: for line in f: for word in a: - if word in line: - line = line.replace(word,'') + if word in line and not line.startswith('#'): + line = line.replace(word,'') + else: + line = line.replace(line, line) lst.append(line) f.close() with open(infile, 'w') as f: diff --git a/to-rpz/host_rpz_argv.py b/to-rpz/host_rpz_argv.py index 1d12ae6..a689bf6 100644 --- a/to-rpz/host_rpz_argv.py +++ b/to-rpz/host_rpz_argv.py @@ -12,8 +12,10 @@ lst = [] with open(infile, 'r') as f: for line in f: for word in a: - if word in line: + if word in line and not line.startswith('#'): line = line.replace(word,'') + else: + line = line.replace(line, line) lst.append(line) f.close() with open(infile, 'w') as f: diff --git a/to-rpz/unbound_rpz_argv.py b/to-rpz/unbound_rpz_argv.py index 574ac34..bb2870c 100644 --- a/to-rpz/unbound_rpz_argv.py +++ b/to-rpz/unbound_rpz_argv.py @@ -13,8 +13,10 @@ lst = [] with open(infile, 'r') as f: for line in f: for word in a: - if word in line: + if word in line and not line.startswith('#'): line = line.replace(word,'') + else: + line = line.replace(line, line) lst.append(line) f.close() with open(infile, 'w') as f: