Saubole VISITEURS GUILDE SMS
parent
0042a6158a
commit
579ac8f74c
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
clear
|
||||
echo "------------------------------------------------------------------------------"
|
||||
if [ "$1" == "" ]; then
|
||||
echo " Nothing to search for!"
|
||||
else
|
||||
echo " Searching for "$1" recursively. Please Wait..."
|
||||
echo "------------------------------------------------------------------------------"
|
||||
grep -h -r --exclude=B00 -H --colour=always "$1" ./
|
||||
fi
|
||||
echo "------------------------------------------------------------------------------"
|
||||
if [ "$2" != "" ]; then
|
||||
echo " To replace \"$1\" whith \"$2\", please run"
|
||||
echo " grep -rl '$1' ./ | xargs sed -i 's/$1/$2/g'"
|
||||
fi
|
|
@ -20,7 +20,7 @@ else:
|
|||
|
||||
# Check parameters
|
||||
if len(sys.argv) != 2:
|
||||
print("Usage: sendlongsms.py [configfile] RECIPIENT_NUMBER")
|
||||
print("Usage: sendmessage.py [configfile] RECIPIENT_NUMBER")
|
||||
sys.exit(1)
|
||||
|
||||
# Connect to the phone
|
||||
|
|
|
@ -0,0 +1,128 @@
|
|||
#!/bin/bash
|
||||
################################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 0.1
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
|
||||
ME="${0##*/}"
|
||||
echo "EXECUTE $ME ($1=phone, $2=uid)"
|
||||
phone="$1"
|
||||
groupe="$2"
|
||||
|
||||
avis="$(cat /tmp/${phone}_message)"
|
||||
|
||||
## LOG
|
||||
echo "${phone};${groupe};${avis}" >> /home/${YOU}/.zen/SMS/received.log
|
||||
|
||||
########################################################################
|
||||
echo "## GET STATION G1PUB"
|
||||
########################################################################
|
||||
[[ ! -f /home/${YOU}/.zen/secret.dunikey ]] && echo "Crypto is missing... please provide /home/${YOU}/.zen/secret.dunikey by installing 'astrXbian' TestNet" && exit 1
|
||||
G1PUB=$(cat /home/${YOU}/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
||||
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"
|
||||
|
||||
########################################################################
|
||||
echo "## sha256sum($phone)"
|
||||
########################################################################
|
||||
hash=$(echo $phone | sha256sum | cut -d ' ' -f1)
|
||||
########################################################################
|
||||
echo "=> ${hash}"
|
||||
########################################################################
|
||||
|
||||
htest=$(ls /home/${YOU}/.zen/SMS/PHONE/${hash} 2>dev/null)
|
||||
if [[ $htest ]]; then
|
||||
echo "$phone already registered in $htest"
|
||||
xzuid=$(cat "/home/${YOU}/.zen/SMS/PHONE/${hash}/xzuid" | rev | cut -d '/' -f 2 | rev)
|
||||
fi
|
||||
|
||||
mkdir -p /home/${YOU}/.zen/SMS/PHONE/${hash}/
|
||||
|
||||
if [[ ! -f /home/${YOU}/.zen/SMS/PHONE/${hash}/passwd.encrypt ]]; then
|
||||
########################################################################
|
||||
echo "## Encrypt ${phone} into /home/${YOU}/.zen/SMS/PHONE/${hash}/passwd.encrypt"
|
||||
########################################################################
|
||||
echo $phone > /tmp/${phone}_phone
|
||||
$MY_PATH/natools.py encrypt -p $G1PUB -i /tmp/${phone}_phone -o /home/${YOU}/.zen/SMS/PHONE/${hash}/passwd.encrypt
|
||||
[[ ! $? == 0 ]] && echo "FAILED" && exit 1
|
||||
fi
|
||||
|
||||
if [[ ! $xzuid ]]; then
|
||||
########################################################################
|
||||
echo "## GESTION IDENTITES: G1 + NEXTCLOUD + QRCODE"
|
||||
########################################################################
|
||||
|
||||
## MAKE UNIQ xzuid
|
||||
xzuid=$($MY_PATH/diceware.sh 1 | xargs)${RANDOM:0:5}
|
||||
while [[ "$(cat /home/${YOU}/.zen/SMS/PHONE/*/xzuid)" == "${xzuid}" ]]
|
||||
do
|
||||
xzuid=$($MY_PATH/diceware.sh 1 | xargs)${RANDOM:0:5}
|
||||
done
|
||||
echo "$xzuid" > /home/${YOU}/.zen/SMS/PHONE/${hash}/xzuid
|
||||
echo "=> $xzuid + NOUVEAU +"
|
||||
|
||||
########################################################################
|
||||
echo "## $xzuid / $phone => NEW DUNIKEY & QRCODE"
|
||||
########################################################################
|
||||
|
||||
########################################################################
|
||||
echo "## MAKE /tmp/secret.dunikey"
|
||||
########################################################################
|
||||
$MY_PATH/key_create_dunikey.py "$xzuid" "$phone"
|
||||
[[ ! $? == 0 ]] && echo "FAILED" && exit 1
|
||||
g1pub=$(cat /tmp/secret.dunikey | grep "pub" | cut -d ' ' -f 2)
|
||||
g1sec=$(cat /tmp/secret.dunikey | grep "sec" | cut -d ' ' -f 2)
|
||||
|
||||
########################################################################
|
||||
echo "## SAVING /home/${YOU}/.zen/SMS/PHONE/${hash}/secret.dunikey.encrypt"
|
||||
########################################################################
|
||||
$MY_PATH/natools.py encrypt -p $G1PUB -i /tmp/secret.dunikey -o /home/${YOU}/.zen/SMS/PHONE/${hash}/secret.dunikey.encrypt
|
||||
[[ ! $? == 0 ]] && echo "FAILED" && exit 1
|
||||
|
||||
########################################################################
|
||||
echo "GETTING AVATAR"
|
||||
########################################################################
|
||||
curl -s https://thispersondoesnotexist.com/image -o /home/${YOU}/.zen/SMS/PHONE/${hash}/avatar.jpg
|
||||
|
||||
########################################################################
|
||||
echo "CREATING GCHANGE+ PROFILE"
|
||||
########################################################################
|
||||
$MY_PATH/timeout.sh -t 10 $MY_PATH/jaklis/jaklis.py -k /tmp/secret.dunikey -n "https://data.gchange.fr" set --name "${xzuid}" --avatar "/home/${YOU}/.zen/SMS/PHONE/${hash}/avatar.jpg" #GCHANGE+
|
||||
|
||||
########################################################################
|
||||
echo "CREATING CESIUM+ PROFILE"
|
||||
########################################################################
|
||||
$MY_PATH/timeout.sh -t 10 $MY_PATH/jaklis/jaklis.py -k /tmp/secret.dunikey -n "https://g1.data.e-is.pro" set --name "${xzuid}" --avatar "/home/${YOU}/.zen/SMS/PHONE/${hash}/avatar.jpg" #CESIUM+
|
||||
|
||||
if [[ -f /var/www/nextcloud/occ ]]; then
|
||||
########################################################################
|
||||
echo "## REGISTER Nextcloud : ${xzuid} / $phone "
|
||||
########################################################################
|
||||
sudo su -s /bin/sh www-data -c "export OC_PASS=\"$phone\" && php /var/www/nextcloud/occ user:add --password-from-env --group=\"astroport\" --display-name=\"${xzuid}\" ${xzuid}"
|
||||
fi
|
||||
|
||||
########################################################################
|
||||
echo "## MAKING QRCODE"
|
||||
########################################################################
|
||||
qrencode -s 6 -o "/home/${YOU}/.zen/SMS/PHONE/${hash}/qrcode.png" "$g1pub"
|
||||
|
||||
else
|
||||
|
||||
echo "=> $xzuid"
|
||||
|
||||
fi
|
||||
|
||||
########################################################################
|
||||
echo "## GESTION ${groupe} = GROUPES / GUILDES"
|
||||
########################################################################
|
||||
if [[ ! -d /home/${YOU}/.zen/SMS/GUILDES/${groupe} ]];
|
||||
then
|
||||
mkdir -p /home/${YOU}/.zen/SMS/GUILDES/${groupe}
|
||||
gammu-smsd-inject TEXT "$phone" -text "Enregistrement ${groupe}"
|
||||
fi
|
||||
## WRITE AVIS FOR GROUPE
|
||||
echo "${phone};${avis}" >> /home/${YOU}/.zen/SMS/GUILDES/${groupe}/AVIS
|
||||
|
||||
exit 0
|
26
sms/NEW.sh
26
sms/NEW.sh
|
@ -22,7 +22,7 @@ echo $G1PUB
|
|||
echo "## CREATE UNIQUE XZUID"
|
||||
########################################################################
|
||||
XZUID=$($MY_PATH/diceware.sh 1 | xargs)${RANDOM:0:5}
|
||||
while [[ -d /home/pi/.zen/sms/$XZUID ]]
|
||||
while [[ -d /home/pi/.zen/SMS/$XZUID ]]
|
||||
do
|
||||
XZUID=$($MY_PATH/diceware.sh 1 | xargs)${RANDOM:0:5}
|
||||
done
|
||||
|
@ -105,36 +105,32 @@ echo "## REGISTER Nextcloud : $XZUID / $phone "
|
|||
fi
|
||||
|
||||
## REPONSE SMS
|
||||
MESS="Néonaute,
|
||||
Votre Identité Interplanétaire est $XZUID.
|
||||
Vous avez rejoint MadeInZion et commencez le JEu de l'évasion...
|
||||
|
||||
MESS="Néonaute, bienvenue votre Identité Interplanétaire est $XZUID.
|
||||
Vous venez de rejoindre MadeInZion et commencez le JEu de l'évasion...
|
||||
Votre compte NextCloud se trouve sur https://taurus.copylaradio.com
|
||||
|
||||
Re-terraformez la TERRE? https://oasis.astroport.com
|
||||
Devenez %MAKER ? https://copylaradio.com
|
||||
Notre Mission, instaurer la paix et restaurer l'abondance.
|
||||
Réunir nos Oasis Jardins Forêt https://oasis.astroport.com
|
||||
Reprendre INTERNET https://copylaradio.com
|
||||
|
||||
Telegram : https://t.me/onenation_madeinzion_astroport
|
||||
|
||||
Monnaie Libre
|
||||
Vos passphrases pour expériement la
|
||||
$salt
|
||||
$pepper
|
||||
https://gchange.fr et https://cesium.app
|
||||
|
||||
Datacenter P2P :
|
||||
|
||||
MadeInZion
|
||||
Crypto Pays P2P LIBRE.
|
||||
MadeInZion - Crypto Pays P2P LIBRE et LEGAL -
|
||||
Canal Telegram : https://t.me/onenation_madeinzion_astroport
|
||||
"
|
||||
|
||||
# Send response SMS
|
||||
# Send response SMS (gammu-smsd-inject max 160 characters)
|
||||
gammu-smsd-inject TEXT "$phone" -text "$MESS"
|
||||
suite=$(echo $MESS | tail -c+160)
|
||||
[[ $suite ]] && sleep 3 && gammu-smsd-inject TEXT "$phone" -text "$(echo $MESS | tail -c+160)"
|
||||
suite=$(echo $MESS | tail -c+160 | tail -c+160)
|
||||
[[ $suite ]] && sleep 3 && gammu-smsd-inject TEXT "$phone" -text "$(echo $MESS | tail -c+160 | tail -c+160)"
|
||||
|
||||
|
||||
## SEND BIODYNAMIE.ORG SMS
|
||||
if [[ -f /tmp/sms ]]; then
|
||||
gammu-smsd-inject TEXT "$phone" -text "$(cat /tmp/sms)"
|
||||
final=$(cat /tmp/sms | tail -c+160)
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# The Bash shell script executes a command with a time-out.
|
||||
# Upon time-out expiration SIGTERM (15) is sent to the process. If the signal
|
||||
# is blocked, then the subsequent SIGKILL (9) terminates it.
|
||||
#
|
||||
# Based on the Bash documentation example.
|
||||
|
||||
# Hello Chet,
|
||||
# please find attached a "little easier" :-) to comprehend
|
||||
# time-out example. If you find it suitable, feel free to include
|
||||
# anywhere: the very same logic as in the original examples/scripts, a
|
||||
# little more transparent implementation to my taste.
|
||||
#
|
||||
# Dmitry V Golovashkin <Dmitry.Golovashkin@sas.com>
|
||||
|
||||
scriptName="${0##*/}"
|
||||
|
||||
declare -i DEFAULT_TIMEOUT=9
|
||||
declare -i DEFAULT_INTERVAL=1
|
||||
declare -i DEFAULT_DELAY=1
|
||||
|
||||
# Timeout.
|
||||
declare -i timeout=DEFAULT_TIMEOUT
|
||||
# Interval between checks if the process is still alive.
|
||||
declare -i interval=DEFAULT_INTERVAL
|
||||
# Delay between posting the SIGTERM signal and destroying the process by SIGKILL.
|
||||
declare -i delay=DEFAULT_DELAY
|
||||
|
||||
function printUsage() {
|
||||
cat <<EOF
|
||||
|
||||
Synopsis
|
||||
$scriptName [-t timeout] [-i interval] [-d delay] command
|
||||
Execute a command with a time-out.
|
||||
Upon time-out expiration SIGTERM (15) is sent to the process. If SIGTERM
|
||||
signal is blocked, then the subsequent SIGKILL (9) terminates it.
|
||||
|
||||
-t timeout
|
||||
Number of seconds to wait for command completion.
|
||||
Default value: $DEFAULT_TIMEOUT seconds.
|
||||
|
||||
-i interval
|
||||
Interval between checks if the process is still alive.
|
||||
Positive integer, default value: $DEFAULT_INTERVAL seconds.
|
||||
|
||||
-d delay
|
||||
Delay between posting the SIGTERM signal and destroying the
|
||||
process by SIGKILL. Default value: $DEFAULT_DELAY seconds.
|
||||
|
||||
As of today, Bash does not support floating point arithmetic (sleep does),
|
||||
therefore all delay/time values must be integers.
|
||||
EOF
|
||||
}
|
||||
|
||||
# Options.
|
||||
while getopts ":t:i:d:" option; do
|
||||
case "$option" in
|
||||
t) timeout=$OPTARG ;;
|
||||
i) interval=$OPTARG ;;
|
||||
d) delay=$OPTARG ;;
|
||||
*) printUsage; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
# $# should be at least 1 (the command to execute), however it may be strictly
|
||||
# greater than 1 if the command itself has options.
|
||||
if (($# == 0 || interval <= 0)); then
|
||||
printUsage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# kill -0 pid Exit code indicates if a signal may be sent to $pid process.
|
||||
(
|
||||
((t = timeout))
|
||||
|
||||
while ((t > 0)); do
|
||||
sleep $interval
|
||||
kill -0 $$ || exit 0
|
||||
((t -= interval))
|
||||
done
|
||||
|
||||
# Be nice, post SIGTERM first.
|
||||
# The 'exit 0' below will be executed if any preceeding command fails.
|
||||
kill -s SIGTERM $$ && kill -0 $$ || exit 0
|
||||
sleep $delay
|
||||
kill -s SIGKILL $$
|
||||
) 2> /dev/null &
|
||||
|
||||
exec "$@"
|
|
@ -23,12 +23,14 @@ SMSADMIN="$(cat /home/pi/.zen/SMSADMIN)" ## FRENCH NUMBER
|
|||
########################################################################
|
||||
########################################################################
|
||||
PHONE="$SMS_1_NUMBER" # gammu-smsd
|
||||
[[ ! ${PHONE} ]] && PHONE="$1" # CLI
|
||||
[[ ! ${PHONE} ]] && PHONE="$1" # CLI MODE
|
||||
|
||||
[[ "${#PHONE}" < 10 || "${#PHONE}" > 12 ]] && echo "${PHONE} NON RECONNU. EXIT" && exit 1
|
||||
[[ ${PHONE#"$prefix"} != "${PHONE}" ]] && phone=0${PHONE#"$prefix"} || phone="${PHONE}" ## 06
|
||||
## Remove prefix: phone contains local number
|
||||
[[ ${PHONE#"$prefix"} != "${PHONE}" ]] && phone=0${PHONE#"$prefix"} || phone="${PHONE}"
|
||||
|
||||
TEXT="$SMS_1_TEXT" # gammu-smsd
|
||||
[[ ! ${TEXT} ]] && TEXT="$2" # CLI
|
||||
[[ ! ${TEXT} ]] && TEXT="$2" # CLI MODE
|
||||
[[ "${TEXT}" == "" ]] && TEXT="TEST : ABC : 12345*" # TEST MESSAGE
|
||||
|
||||
########################################################################
|
||||
|
@ -51,25 +53,32 @@ case "$CMD" in
|
|||
A|AIDE)
|
||||
## ASK FOR HELP
|
||||
$MY_PATH/sms/AIDE.sh "$phone" &
|
||||
;;
|
||||
OK|OPEN|OASIS)
|
||||
## CREATE ACCOUNT
|
||||
EXTRA=$(echo "$TEXT" | awk '{print $2}' | grep -E "([A-Za-z0-9\-\_]+$)")
|
||||
$MY_PATH/sms/NEW.sh "$phone" "$EXTRA" &
|
||||
exit 0
|
||||
;;
|
||||
TEST)
|
||||
echo "TEST: sending ___ $TEXT _to_ $phone"
|
||||
gammu-smsd-inject TEXT "$phone" -text "$TEXT"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "EXIT. COMMANDE INCONNUE : $CMD"
|
||||
exit 1
|
||||
echo "TEST: sending ___ $TEXT _to_ $phone"
|
||||
gammu-smsd-inject TEXT "$phone" -text "$TEXT"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "MESSAGE DE $phone POUR GUILDE/GROUPE $CMD"
|
||||
MESSAGE=$(echo "$TEXT" | cut -d ' ' -f2-)
|
||||
if [[ $MESSAGE ]]; then
|
||||
echo "${MESSAGE}" > /tmp/${phone}_message
|
||||
echo "${MESSAGE}"
|
||||
else
|
||||
gammu-smsd-inject TEXT "$phone" -text "Votre message pour $CMD est vide."
|
||||
exit 1
|
||||
fi
|
||||
## OK CMD=GROUPE suivi de message
|
||||
$MY_PATH/sms/GUILDE.sh "$phone" "$CMD" &
|
||||
gammu-smsd-inject TEXT "$phone" -text "Votre message pour $CMD est enregistré. MERCI."
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
## SEND A COPY OF INCOMING MESSAGE TO SMSADMIN
|
||||
[[ "$phone" != "$smsadmin" ]] && gammu-smsd-inject TEXT "$smsadmin" -text "$phone : $TEXT"
|
||||
# [[ "$phone" != "$smsadmin" ]] && gammu-smsd-inject TEXT "$smsadmin" -text "$phone : $TEXT"
|
||||
|
||||
## FILESYSTEM RIGHTS CORRECTION
|
||||
chown -R pi:pi /home/pi/.zen
|
||||
|
|
Loading…
Reference in New Issue