Skip to content

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
c29r3 committed Feb 25, 2021
1 parent dfe5aef commit 0415709
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 5 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down
8 changes: 4 additions & 4 deletions rpc-finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")

0 comments on commit 0415709

Please sign in to comment.