forked from axiom-team/astroport
simple SMS send
This commit is contained in:
parent
59d6f745ca
commit
c9f9873642
|
@ -199,7 +199,10 @@ echo '
|
||||||
#
|
#
|
||||||
'
|
'
|
||||||
echo "StorageMax = $diskSize"
|
echo "StorageMax = $diskSize"
|
||||||
|
|
||||||
|
## RESET ipfs_SWARM_refresh.sh alert
|
||||||
|
rm -f /tmp/ssb-friends_ALERT.txt
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ fi
|
||||||
|
|
||||||
[[ $IPFSNODEID == "" ]] && echo "PROBLEM GETTING IPFSNODEID" && exit 1
|
[[ $IPFSNODEID == "" ]] && echo "PROBLEM GETTING IPFSNODEID" && exit 1
|
||||||
|
|
||||||
[[ ! $(which bc) ]] && sudo apt-get install bc -y ## TODO: migration need TO REMOVE
|
|
||||||
[[ ! -f /tmp/g1sms.log ]] && echo "ASTROPORT G1SMS ACTIVITY" > /tmp/g1sms.log && chmod 777 /tmp/g1sms.log
|
[[ ! -f /tmp/g1sms.log ]] && echo "ASTROPORT G1SMS ACTIVITY" > /tmp/g1sms.log && chmod 777 /tmp/g1sms.log
|
||||||
|
|
||||||
function log () {
|
function log () {
|
||||||
|
|
|
@ -9,6 +9,9 @@
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
|
|
||||||
|
export YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
|
||||||
|
export IPFSNODEID=$(ipfs id -f='<id>\n')
|
||||||
|
|
||||||
[[ $IPFSNODEID == "" ]] && echo "PROBLEM GETTING IPFSNODEID" && exit 1
|
[[ $IPFSNODEID == "" ]] && echo "PROBLEM GETTING IPFSNODEID" && exit 1
|
||||||
[[ $YOU == "" ]] && echo "PROBLEM GETTING YOU" && exit 1
|
[[ $YOU == "" ]] && echo "PROBLEM GETTING YOU" && exit 1
|
||||||
|
|
||||||
|
@ -44,6 +47,7 @@ I am $YOU on $IPFSNODEID
|
||||||
IPFSPrivKey=$(cat /home/$YOU/.ipfs/config | jq -r '.Identity.PrivKey') #"
|
IPFSPrivKey=$(cat /home/$YOU/.ipfs/config | jq -r '.Identity.PrivKey') #"
|
||||||
export IPFSPrivKey="${IPFSPrivKey:0:24}" #
|
export IPFSPrivKey="${IPFSPrivKey:0:24}" #
|
||||||
if [ ! $IPFSPrivKey ]; then echo "FATAL ERROR:: IPFS Node.Identity.PrivKey IPFSPrivKey EMPTY"; exit; fi
|
if [ ! $IPFSPrivKey ]; then echo "FATAL ERROR:: IPFS Node.Identity.PrivKey IPFSPrivKey EMPTY"; exit; fi
|
||||||
|
# TODO: FINISH to REMOVE THAT KEY (it makes system dependent on "ipfs id") and BETTER USE dunikey for cyphering
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
# G1sms+ Swarm KEYS
|
# G1sms+ Swarm KEYS
|
||||||
|
@ -117,7 +121,7 @@ fi
|
||||||
[[ -f /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna ]] && NODE_UIDNA=$(cat /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna)|| echo "Missing _uidna" || exit 1
|
[[ -f /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna ]] && NODE_UIDNA=$(cat /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna)|| echo "Missing _uidna" || exit 1
|
||||||
|
|
||||||
## INIT NODE G1 PUB & PRIV KEY
|
## INIT NODE G1 PUB & PRIV KEY
|
||||||
NODE_G1PUBKEY=$ZENG1
|
NODE_G1PUBKEY=$G1PUB
|
||||||
[[ ! $NODE_G1PUBKEY ]] && echo "Missing NODE_G1PUBKEY" && exit 1
|
[[ ! $NODE_G1PUBKEY ]] && echo "Missing NODE_G1PUBKEY" && exit 1
|
||||||
NODE_PUBSECFILE="/home/$YOU/.ssb/secret.dunikey"
|
NODE_PUBSECFILE="/home/$YOU/.ssb/secret.dunikey"
|
||||||
[[ ! $NODE_PUBSECFILE ]] && echo "Missing NODE_PUBSECFILE" && exit 1
|
[[ ! $NODE_PUBSECFILE ]] && echo "Missing NODE_PUBSECFILE" && exit 1
|
||||||
|
|
|
@ -11,9 +11,13 @@
|
||||||
########################################################################
|
########################################################################
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
|
|
||||||
|
[[ ! $(which gammu-smsd-inject) ]] && exit 0 ## TODO: ONLY SMS equiped NODE run that part of code !! DO BETTER
|
||||||
|
|
||||||
source $MY_PATH/init.sh
|
source $MY_PATH/init.sh
|
||||||
source $MY_PATH/functions.sh
|
source $MY_PATH/functions.sh
|
||||||
|
|
||||||
|
|
||||||
export YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) || er+=" ipfs daemon not running"
|
export YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) || er+=" ipfs daemon not running"
|
||||||
export IPFSNODEID=$(ipfs id -f='<id>\n') || er+=" ipfs id problem"
|
export IPFSNODEID=$(ipfs id -f='<id>\n') || er+=" ipfs id problem"
|
||||||
export WHOAMI=$(sbotc whoami | jq -r .id) || er+=" sbotc whoami problem"
|
export WHOAMI=$(sbotc whoami | jq -r .id) || er+=" sbotc whoami problem"
|
||||||
|
@ -34,7 +38,7 @@ Love Land ENTRANCE CHECKING
|
||||||
'
|
'
|
||||||
[[ ! $G1SMS == "yes" ]] && echo "I am NOT a G1SMS Node... Can't do nothing... EXIT" && exit 1
|
[[ ! $G1SMS == "yes" ]] && echo "I am NOT a G1SMS Node... Can't do nothing... EXIT" && exit 1
|
||||||
|
|
||||||
# /home/$YOU/.zen/astroport/zen/ipfs_SWARM_refresh.sh
|
# /home/$YOU/.zen/astroport/zen/ipfs_SWARM_refresh.sh
|
||||||
|
|
||||||
for hashfile in $(ls /tmp/loveland_entrance/); do
|
for hashfile in $(ls /tmp/loveland_entrance/); do
|
||||||
PP=$(cat $hashfile)
|
PP=$(cat $hashfile)
|
||||||
|
@ -49,12 +53,13 @@ for hashfile in $(ls /tmp/loveland_entrance/); do
|
||||||
|
|
||||||
if [[ ! -f /home/$YOU/.zen/g1sms/$PHONE/_pub ]]; then
|
if [[ ! -f /home/$YOU/.zen/g1sms/$PHONE/_pub ]]; then
|
||||||
# PHONE IS UNKNOWN !
|
# PHONE IS UNKNOWN !
|
||||||
|
sms_SEND "$PHONE" "COUCOU"
|
||||||
# CHECK for Associated PARRAIN. GET PubKey?
|
# CHECK for Associated PARRAIN. GET PubKey?
|
||||||
PARRAIN=$(echo "$PARRAIN" | grep -E "([A-Za-z0-9\-\_]+$)")
|
PARRAIN=$(echo "$PARRAIN" | grep -E "([A-Za-z0-9\-\_]+$)")
|
||||||
[[ $PARRAIN ]] && MEMRIB=$(sms_uid2key "$PARRAIN" "$PHONE" "$PIN") && echo "RIB PARRAIN: $MEMRIB"
|
# [[ $PARRAIN ]] && MEMRIB=$(sms_uid2key "$PARRAIN" "$PHONE" "$PIN") && echo "RIB PARRAIN: $MEMRIB"
|
||||||
|
|
||||||
# CREATE G1 WALLET
|
# CREATE G1 WALLET
|
||||||
echo " RUN $MY_PATH/sms_NEW.sh "$PHONE" "$PARRAIN" "
|
# $MY_PATH/sms_NEW.sh "$PHONE" "$PARRAIN"
|
||||||
|
|
||||||
else
|
else
|
||||||
# ACCOUNT ALREADY EXISTING
|
# ACCOUNT ALREADY EXISTING
|
||||||
|
@ -65,7 +70,7 @@ for hashfile in $(ls /tmp/loveland_entrance/); do
|
||||||
AMOUNTLOVE=$(bc -l <<< "scale=0; $AMOUNTG1 * 100 / $DUFACTOR")
|
AMOUNTLOVE=$(bc -l <<< "scale=0; $AMOUNTG1 * 100 / $DUFACTOR")
|
||||||
|
|
||||||
|
|
||||||
mess="Bonjour! Astroport Station"
|
mess="Bonjour! YOU HAVE $AMOUNTLOVE LOVE"
|
||||||
|
|
||||||
# Send response SMS
|
# Send response SMS
|
||||||
sms_SEND "$PHONE" "$mess"
|
sms_SEND "$PHONE" "$mess"
|
||||||
|
@ -73,7 +78,6 @@ for hashfile in $(ls /tmp/loveland_entrance/); do
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
[[ -d /home/$YOU/.zen/g1sms/$PHONE ]] && [[ $(whoami) == "root" ]] && chown -R $YOU /home/$YOU/.zen/g1sms/$PHONE
|
[[ -d /home/$YOU/.zen/g1sms/$PHONE ]] && [[ $(whoami) == "root" ]] && chown -R $YOU /home/$YOU/.zen/g1sms/$PHONE
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -35,9 +35,7 @@ AMOUNT=${countvalues[1]}
|
||||||
UNIT=${countvalues[2]}
|
UNIT=${countvalues[2]}
|
||||||
|
|
||||||
# ONLY USED BY sms_NEW.sh !!! To send back PIN
|
# ONLY USED BY sms_NEW.sh !!! To send back PIN
|
||||||
echo "${IPFSPrivKey}" | gpg -d -q --output "$PINFILE" --yes --pinentry-mode loopback --passphrase-fd 0 "$GPGPINFILE"
|
[[ -f "${PINFILE}.crypt" ]] && /home/$YOU/.zen/astroport/zen/tools/natools.py decrypt -f pubsec -k "$NODE_PUBSECFILE" -i "${PINFILE}.crypt" -o "$PINFILE" && PIN=$(cat "$PINFILE");
|
||||||
PIN=$(cat "$PINFILE" | xargs)
|
|
||||||
[[ "$PIN" == "" ]] && [[ -f "${PINFILE}.crypt" ]] && /home/$YOU/.zen/astroport/zen/tools/natools.py decrypt -f pubsec -k "$NODE_PUBSECFILE" -i "${PINFILE}.crypt" -o "$PINFILE" && PIN=$(cat "$PINFILE");
|
|
||||||
[[ "$PIN" != "" ]] && echo "" > "$PINFILE" || PIN="PIN EMPTY !!! Contacter $ADMINPHONE SVP"
|
[[ "$PIN" != "" ]] && echo "" > "$PINFILE" || PIN="PIN EMPTY !!! Contacter $ADMINPHONE SVP"
|
||||||
|
|
||||||
mess="[G1sms+]
|
mess="[G1sms+]
|
||||||
|
|
Loading…
Reference in New Issue