Browse Source

SWARM contamination cleaning

master
qo-op 4 weeks ago
parent
commit
9c2bb72fff
3 changed files with 32 additions and 6 deletions
  1. +2
    -0
      www/FULLJS/README.md
  2. +29
    -5
      zen/gchange_IPFS_swarm.sh
  3. +1
    -1
      zen/ipfs_SWARM_refresh.sh

+ 2
- 0
www/FULLJS/README.md View File

@ -9,6 +9,8 @@ cp -Rf ~/.zen/astrXbian/www/FULLJS/gchange-web ~/.zen/ipfs/.$IPFSNODEID/WWW
cp ~/.zen/astrXbian/www/FULLJS/gchange.html ~/.zen/ipfs/index.html
sed -i "s/_IPFSNODEID_/$IPFSNODEID/g" ~/.zen/ipfs/index.html
~/.zen/astrXbian/zen/ipns_self_publish.sh
---
Tout plugin navigateur, site web JS devraient être compatible avec cette méthode !!


+ 29
- 5
zen/gchange_IPFS_swarm.sh View File

@ -12,8 +12,10 @@ G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) && [[ ! $G1PU
IPFSNODEID=$(ipfs id -f='<id>\n') && [[ "$IPFSNODEID" == "" ]] && echo 'ERROR missing IPFS Node id !! IPFS is not installed !?' && exit 1
# CLEAN "A_my_swarm.txt" and "A_swarm_map.txt"
rm -f ~/.zen/A_my_swarm.txt && touch ~/.zen/A_my_swarm.txt
rm -f ~/.zen/A_swarm_map.txt && touch ~/.zen/A_swarm_map.txt
if [[ $(cat ~/.zen/A_swarm_map.txt | wc -l) -gt 300 ]]; then
rm -f ~/.zen/A_my_swarm.txt && touch ~/.zen/A_my_swarm.txt
rm -f ~/.zen/A_swarm_map.txt && touch ~/.zen/A_swarm_map.txt
fi
########################################################################
# Force Strict #swarm0 !!?
@ -25,7 +27,9 @@ echo $(date)
# Let's look for Friends and "IPFS swarm connect" with them
########################################################################
# 1. Get Gchange "liking_me" people list
for liking_me in $(~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" stars | jq -r '.likes[].issuer');
~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" stars | jq -r '.likes[].issuer' > /tmp/liking_me
for liking_me in $(cat /tmp/liking_me);
do
[[ "$liking_me" == "" || "$liking_me" == "$G1PUB" ]] && continue
# DE TOUS CEUX QUI M'AIMENT JE VAIS LIRE LES MESSAGES pour collecter leurs ipfstryme vers ~/.zen/A_swarm_map.txt
@ -33,7 +37,10 @@ do
# Check if my like is reverse
liking_me_count=$((liking_me_count+1))
echo ">>>>>> CHECKING liking_me n° $liking_me_count : READING 'ipfstryme' message from $liking_me"
for peerline in $(~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" read -n300 -j | jq -r --arg friendKEY "$liking_me" '.[] | select(.pubkey == $friendKEY)' | jq 'select(.title == "ipfstryme")' | jq -r '.content');
~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" read -n300 -j | jq -r --arg friendKEY "$liking_me" '.[] | select(.pubkey == $friendKEY)' | jq 'select(.title == "ipfstryme")' | jq -r '.content' > /tmp/ipfstryme.$liking_me
[[ $(cat /tmp/ipfstryme.$liking_me | wc -l) -gt 300 ]] && echo "## THIS NODE IS CONTAMINATED !!" && continue ## ZOMBIE NODE
for peerline in $(cat /tmp/ipfstryme.$liking_me);
do
echo "======================================================"
# GET $ipfsnodeid FROM $peerline
@ -102,4 +109,21 @@ ipfs swarm peers
echo $(date)
# ipfs SWARM shaping
~/.zen/astrXbian/zen/ipfs_SWARM_refresh.sh
[[ $(cat ~/.zen/A_my_swarm.txt | wc -l) -gt 0 ]] && ~/.zen/astrXbian/zen/ipfs_SWARM_refresh.sh && exit 0 || echo "SWARM LOST !! "
########################################################################
## SWARM LOST !! EMERGENCY RECOVERY
########################################################################
ipfs bootstrap
## REBOOTSTRAP
[[ $(ipfs bootstrap | wc -l) -lt 2 ]] && ipfs bootstrap rm --all
for bootnode in $(cat ~/.zen/astrXbian/A_boostrap_nodes.txt | grep -Ev "#") # remove comments
do
ipfsnodeid=${bootnode##*/}
[[ "$ipfsnodeid" != "$IPFSNODEID" ]] && sleep 20 ## RALENTIR DEMARRAGE STATIONS NON BOOTSTRAP
## ADD $bootnode TO BOOTSTRAP
ipfs bootstrap add $bootnode
echo "/ipfs/$bootnode" >> ~/.zen/A_my_swarm.txt
echo "/ipfs/$bootnode" >> ~/.zen/A_swarm_map.txt
done

+ 1
- 1
zen/ipfs_SWARM_refresh.sh View File

@ -133,7 +133,7 @@ do
sudo fail2ban-client status recidive
## DEFCON 3
# Ban all known ipfsnodeid ip
# ACTIVATE PRIVATE SMARM !! BOOTSRAP OASIS creates and send a key to everyfriend he knows (PUB)
## DEFCON 2
# nmap NOT FRIEND


Loading…
Cancel
Save