From 041570917542eae613381e1714d5f948db618e4a Mon Sep 17 00:00:00 2001 From: c29r3 Date: Thu, 25 Feb 2021 22:12:55 +0300 Subject: [PATCH] upd --- Readme.md | 8 +++++--- rpc-finder.py | 8 ++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Readme.md b/Readme.md index 06aa4cf..f62bd93 100644 --- a/Readme.md +++ b/Readme.md @@ -15,14 +15,16 @@ This tool can be useful for: 1. Download config file and change the parameters to suit you ``` curl -s https://raw.githubusercontent.com/c29r3/cosmos-rpc-finder/master/config.yml > config.yml; \ -curl -s https://raw.githubusercontent.com/c29r3/cosmos-rpc-finder/master/rpc_urls.txt > rpc_urls.txt +curl -s https://raw.githubusercontent.com/c29r3/cosmos-rpc-finder/master/rpc_urls.txt > rpc_urls.txt; \ +mkdir results && chmod 777 results ``` 2. Run docker container ``` docker run -it --rm \ ---volume $(pwd)/config.yml:/rpc-finder/config.yml \ ---volume $(pwd)/rpc_urls.txt:/rpc-finder/rpc_urls.txt \ +-v $(pwd)/config.yml:/rpc-finder/config.yml \ +-v $(pwd)/rpc_urls.txt:/rpc-finder/rpc_urls.txt \ +-v $(pwd)/results:/rpc-finder/results \ --name rpc-finder \ c29r3/cosmos-rpc-finder ``` diff --git a/rpc-finder.py b/rpc-finder.py index fbf9dbd..3353907 100644 --- a/rpc-finder.py +++ b/rpc-finder.py @@ -150,8 +150,8 @@ def get_vuln_validators(validator_url_: str): valid_rpc.discard('rpc_not_available') # WRITE CSV HEADERS -write_to_file('valid_rpc.csv', CSV_HEADER_STR + "\n", 'w') -write_to_file('vulnerable_validators.csv', CSV_HEADER_STR + "\n", 'w') +write_to_file('results/valid_rpc.csv', CSV_HEADER_STR + "\n", 'w') +write_to_file('results/vulnerable_validators.csv', CSV_HEADER_STR + "\n", 'w') # SEARCHING FOR VULN VALIDATORS AFFECTED_STAKE = 0 @@ -170,12 +170,12 @@ def get_vuln_validators(validator_url_: str): if len(VULN_VALIDATORS) > 0: print(tabulate(VULN_VALIDATORS, tablefmt="grid", headers=CSV_HEADER_STR.split(","))) VULN_VALIDATORS = [",".join(i) for i in VULN_VALIDATORS] - write_to_file('vulnerable_validators.csv', VULN_VALIDATORS, 'a') + write_to_file('results/vulnerable_validators.csv', VULN_VALIDATORS, 'a') print(f'TOTAL VULNERABLE VALIDATORS: {len(VULN_VALIDATORS)} | TOTAL AFFECTED STAKE: {AFFECTED_STAKE}\n' f'Check file: vulnerable_validators.csv') else: print("Vulnerable validators not found") -write_to_file('valid_rpc.csv', valid_rpc, 'a') +write_to_file('results/valid_rpc.csv', valid_rpc, 'a') print("DONE")