Update editing

This commit is contained in:
emdee 2022-10-02 22:40:43 +00:00
parent c1303a1a66
commit 337bf49eeb
2 changed files with 19 additions and 14 deletions

View File

@ -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.
* ```<int>``` is for the nth element of the list, zero-based.
* ```*``` is for all elements of the list.
## Requirements

View File

@ -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