Fixup the "No Reassembly" profile.

Fix the pattern match in make-no-reassembly-profile.py. Have it only
write changed preferences.

Change-Id: I14f23a56f9ec598930591fae9eac2f14747c55bb
Reviewed-on: https://code.wireshark.org/review/30805
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
Gerald Combs 2018-11-27 10:04:31 -08:00
parent a8c93de0b0
commit 246b801f83
2 changed files with 103 additions and 5045 deletions

File diff suppressed because it is too large Load Diff

View File

@ -33,30 +33,31 @@ def main():
parser.print_usage()
sys.exit(1)
rd_pref_re = re.compile('^#\s*(.*(reassembl|desegment)):')
nr_prefs = []
prefs_changed = 0
rd_pref_re = re.compile('^#\s*(.*(reassembl|desegment)\S*):\s*TRUE')
out_prefs = [
'# Generated by ' + os.path.basename(__file__), '',
'####### Protocols ########', '',
]
cp = subprocess.run([tshark_path, '-G', 'defaultprefs'], stdout=subprocess.PIPE, check=True, encoding='utf-8')
for pref_line in cp.stdout.split('\n'):
nr_prefs.append(pref_line)
pref_lines = cp.stdout.splitlines()
for pref_line in pref_lines:
m = rd_pref_re.search(pref_line)
if m:
pref = m.group(1) + ': FALSE'
rd_pref = m.group(1) + ': FALSE'
if args.verbose is True:
print(pref_line + '\n' + pref)
nr_prefs.append(pref)
prefs_changed += 1
print(rd_pref)
out_prefs.append(rd_pref)
if len(nr_prefs) < 5000:
if len(pref_lines) < 5000:
print("Too few preference lines.")
sys.exit(1)
if len(nr_prefs) < 50:
if len(out_prefs) < 150:
print("Too few changed preferences.")
sys.exit(1)
with open(profile_path, 'w') as profile_f:
for pref_line in nr_prefs:
for pref_line in out_prefs:
profile_f.write(pref_line + '\n')
if __name__ == '__main__':