1
0
Fork 0

simple SMS send

This commit is contained in:
qo-op 2020-05-27 17:44:38 +02:00
parent 59d6f745ca
commit c9f9873642
5 changed files with 20 additions and 11 deletions

View File

@ -199,7 +199,10 @@ echo '
#
'
echo "StorageMax = $diskSize"
## RESET ipfs_SWARM_refresh.sh alert
rm -f /tmp/ssb-friends_ALERT.txt
fi

View File

@ -17,7 +17,7 @@ fi
[[ $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
function log () {

View File

@ -9,6 +9,9 @@
MY_PATH="`dirname \"$0\"`" # relative
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
[[ $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') #"
export IPFSPrivKey="${IPFSPrivKey:0:24}" #
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
@ -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
## INIT NODE G1 PUB & PRIV KEY
NODE_G1PUBKEY=$ZENG1
NODE_G1PUBKEY=$G1PUB
[[ ! $NODE_G1PUBKEY ]] && echo "Missing NODE_G1PUBKEY" && exit 1
NODE_PUBSECFILE="/home/$YOU/.ssb/secret.dunikey"
[[ ! $NODE_PUBSECFILE ]] && echo "Missing NODE_PUBSECFILE" && exit 1

View File

@ -11,9 +11,13 @@
########################################################################
MY_PATH="`dirname \"$0\"`" # relative
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/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 IPFSNODEID=$(ipfs id -f='<id>\n') || er+=" ipfs id 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
# /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
PP=$(cat $hashfile)
@ -49,12 +53,13 @@ for hashfile in $(ls /tmp/loveland_entrance/); do
if [[ ! -f /home/$YOU/.zen/g1sms/$PHONE/_pub ]]; then
# PHONE IS UNKNOWN !
sms_SEND "$PHONE" "COUCOU"
# CHECK for Associated PARRAIN. GET PubKey?
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
echo " RUN $MY_PATH/sms_NEW.sh "$PHONE" "$PARRAIN" "
# $MY_PATH/sms_NEW.sh "$PHONE" "$PARRAIN"
else
# ACCOUNT ALREADY EXISTING
@ -65,7 +70,7 @@ for hashfile in $(ls /tmp/loveland_entrance/); do
AMOUNTLOVE=$(bc -l <<< "scale=0; $AMOUNTG1 * 100 / $DUFACTOR")
mess="Bonjour! Astroport Station"
mess="Bonjour! YOU HAVE $AMOUNTLOVE LOVE"
# Send response SMS
sms_SEND "$PHONE" "$mess"
@ -73,7 +78,6 @@ for hashfile in $(ls /tmp/loveland_entrance/); do
done
[[ -d /home/$YOU/.zen/g1sms/$PHONE ]] && [[ $(whoami) == "root" ]] && chown -R $YOU /home/$YOU/.zen/g1sms/$PHONE
exit 0

View File

@ -35,9 +35,7 @@ AMOUNT=${countvalues[1]}
UNIT=${countvalues[2]}
# 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"
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");
[[ -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"
mess="[G1sms+]