From 337bf49eeb33375374fe0ceee4d7ee1c88cea92e Mon Sep 17 00:00:00 2001 From: emdee Date: Sun, 2 Oct 2022 22:40:43 +0000 Subject: [PATCH] Update editing --- README.md | 21 +++++++++++++-------- logging_tox_savefile.py | 12 ++++++------ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 3bd0348..1171ede 100644 --- a/README.md +++ b/README.md @@ -74,12 +74,12 @@ decryption). Takes a DHTnodes.json file as an argument. Choose one of ```{select_tcp,select_udp,select_version}``` -for ```--nodes``` to select TCP nodes, UDP nodes or nodes with the latest version. -Requires ```jq```. +for ```--nodes``` to select TCP nodes, UDP nodes, +or nodes with the latest version. Requires ```jq```. -Choose one of ```{nmap_tcp,nmap_udp}``` -to run tests using ```nmap``` for the ```tcp``` and ```udp``` -nodes. Reguires ```nmap``` and uses ```sudo```. +Choose one of ```{nmap_tcp,nmap_udp}``` to run tests using ```nmap``` +for the ```status_tcp==True``` and ```status_udp==True``` nodes. +Reguires ```nmap``` and uses ```sudo```. ### --command decrypt @@ -96,10 +96,15 @@ and it will save an copy of the edited file to the and Supported Quads (section,num,key,type) that can be edited. Currently it is: ``` -NAME,0,Nick_name,str -STATUSMESSAGE,0,Status_message,str -STATUS,0,Online_status,int +NAME,.,Nick_name,str +STATUSMESSAGE,.,Status_message,str +STATUS,.,Online_status,int ``` +The ```num``` field is to accomodate sections that have lists: +* ```.``` is a placeholder for sections that don't have lists. +* `````` is for the nth element of the list, zero-based. +* ```*``` is for all elements of the list. + ## Requirements diff --git a/logging_tox_savefile.py b/logging_tox_savefile.py index 6d24ed8..3a9733c 100644 --- a/logging_tox_savefile.py +++ b/logging_tox_savefile.py @@ -454,7 +454,7 @@ def process_chunk(index, state, oArgs=None): aIN = {"Nick_name": name} lOUT += [{label: aIN}]; aOUT.update({label: aIN}) if oArgs.command == 'edit' and section == label: - ## NAME,0,Nick_name,str + ## NAME,.,Nick_name,str if key == "Nick_name": result = bytes(val, sENC) length = len(result) @@ -466,7 +466,7 @@ def process_chunk(index, state, oArgs=None): aIN = {"Status_message": mess} lOUT += [{label: aIN}]; aOUT.update({label: aIN}) if oArgs.command == 'edit' and section == label: - ## STATUSMESSAGE,0,Status_message,str + ## STATUSMESSAGE,.,Status_message,str if key == "Status_message": result = bytes(val, sENC) length = len(result) @@ -481,7 +481,7 @@ def process_chunk(index, state, oArgs=None): aIN = {f"Online_status": status} lOUT += [{"STATUS": aIN}]; aOUT.update({"STATUS": aIN}) if oArgs.command == 'edit' and section == label: - ## STATUS,0,Online_status,int + ## STATUS,.,Online_status,int if key == "Online_status": result = struct.pack(">b", int(val)) length = len(result) @@ -696,9 +696,9 @@ def oMainArgparser(_=None): # grep '#''#' logging_tox_savefile.py|sed -e 's/.* //' sEDIT_HELP = """ -NAME,0,Nick_name,str -STATUSMESSAGE,0,Status_message,str -STATUS,0,Online_status,int +NAME,.,Nick_name,str +STATUSMESSAGE,.,Status_message,str +STATUS,.,Online_status,int """ global lOUT, bOUT, aOUT, sENC