Compare commits
10 Commits
Author | SHA1 | Date |
---|---|---|
qo-op | 01d3acdfad | |
qo-op | 644268b607 | |
qo-op | fc0b00e570 | |
qo-op | 0b9c94a408 | |
qo-op | 537c68ec98 | |
qo-op | 3d61960eab | |
qo-op | 850413e229 | |
qo-op | 164bf129d8 | |
qo-op | 43963548ea | |
qo-op | 73eca2426c |
|
@ -0,0 +1,10 @@
|
||||||
|
import RPi.GPIO as GPIO
|
||||||
|
import time
|
||||||
|
GPIO.setmode(GPIO.BOARD)
|
||||||
|
GPIO.setup(7, GPIO.OUT)
|
||||||
|
while True:
|
||||||
|
GPIO.output(7, GPIO.LOW)
|
||||||
|
time.sleep(4)
|
||||||
|
GPIO.output(7, GPIO.HIGH)
|
||||||
|
break
|
||||||
|
GPIO.cleanup()
|
|
@ -1,4 +1,4 @@
|
||||||
From: support@qo-op.com
|
From: support@qo-op.com
|
||||||
To: EMAIL
|
To: _EMAIL
|
||||||
Subject: SUBJECT
|
Subject: _SUBJECT
|
||||||
MESSAGE
|
_MESSAGE
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
# Author: Fred (support@qo-op.com)
|
||||||
|
# Version: 0.2
|
||||||
|
# License: GPL (http://www.google.com/search?q=GPL)
|
||||||
|
################################################################################
|
||||||
|
# READ /tmp/sms.commands and RUN it.. TODO, add keys for security ;)
|
||||||
|
#################################################################################
|
||||||
|
# RECEIVE COMMAND FROM zen_sms.php
|
||||||
|
#<?php
|
||||||
|
#header("Access-Control-Allow-Origin: *");
|
||||||
|
#if (strlen($_REQUEST['num']) == 10 ) {
|
||||||
|
# $newNumber = preg_replace('/^0?/', '+33', $_REQUEST['num']);
|
||||||
|
# $data = '"'.$newNumber.'" "'.$_REQUEST['val'].'"'.PHP_EOL;
|
||||||
|
# $fp = fopen('/tmp/sms.commands', 'a');
|
||||||
|
# fwrite($fp, $data);
|
||||||
|
#} else {
|
||||||
|
# return false;
|
||||||
|
#}
|
||||||
|
#?>
|
||||||
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
|
|
||||||
|
[[ -f /tmp/sms.commands ]] && echo "" > /tmp/sms.commands
|
||||||
|
tail -fn 1 /tmp/sms.commands | while read -r line
|
||||||
|
do
|
||||||
|
if [[ $line != "" ]]; then
|
||||||
|
mycmd="$MY_PATH/sms_AUTH.sh $line"
|
||||||
|
echo "RUN: $mycmd" > /tmp/sms.commmand.result
|
||||||
|
eval "$mycmd" >> /tmp/sms.commmand.result
|
||||||
|
fi
|
||||||
|
done
|
|
@ -4,6 +4,12 @@
|
||||||
# Version: 0.1
|
# Version: 0.1
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
# 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
|
||||||
|
########################################################################
|
||||||
|
# \\///
|
||||||
|
# qo-op
|
||||||
|
#############
|
||||||
# cron_G1TAG_REFRESH.sh
|
# cron_G1TAG_REFRESH.sh
|
||||||
# Scan all TAG created by current $IPFSNODEID
|
# Scan all TAG created by current $IPFSNODEID
|
||||||
# Update local and Publish it
|
# Update local and Publish it
|
||||||
|
|
|
@ -14,7 +14,7 @@ if [[ -f $MY_PATH/.install/.GPATH ]]; then source $MY_PATH/.install/.GPATH; fi
|
||||||
if [[ -f $MY_PATH/../.install/.GPATH ]]; then source $MY_PATH/../.install/.GPATH; fi
|
if [[ -f $MY_PATH/../.install/.GPATH ]]; then source $MY_PATH/../.install/.GPATH; fi
|
||||||
|
|
||||||
YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
|
YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
|
||||||
if [[ "$USER" != "root" ]]; then echo "Hey, $USER you must at least be admin of your system (sudo $0)"; exit; fi
|
#if [[ "$USER" != "root" ]]; then echo "Hey, $USER you must at least be admin of your system (sudo $0)"; exit; fi # BUG because cron USER=""
|
||||||
if [[ "$YOU" == "" || "$YOU" == "root" ]]; then echo "BAD IPFS. Aucune installation IPFS satisfaisante ici... Ciao $YOU !"; exit; fi
|
if [[ "$YOU" == "" || "$YOU" == "root" ]]; then echo "BAD IPFS. Aucune installation IPFS satisfaisante ici... Ciao $YOU !"; exit; fi
|
||||||
IPFSNODEID=$(su $YOU -c "ipfs id -f='<id>\n'")
|
IPFSNODEID=$(su $YOU -c "ipfs id -f='<id>\n'")
|
||||||
cd $GPATH
|
cd $GPATH
|
||||||
|
@ -22,13 +22,75 @@ source ./shell/init.sh
|
||||||
source ./shell/functions.sh
|
source ./shell/functions.sh
|
||||||
|
|
||||||
timebar=$(date +%H:%M)
|
timebar=$(date +%H:%M)
|
||||||
|
minut=$(date +%M | sed 's/^0*//')
|
||||||
|
[[ $minut == "" ]] && minut=0
|
||||||
|
# log "__CRON:cron_MINUTE.sh - $minut - It is $timebar ... $1"
|
||||||
|
##################################################################
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
if [[ "$1" == "" ]]; then
|
|
||||||
##################################################################
|
##################################################################
|
||||||
echo "It is $timebar in the morning, or in the night? It depends on your day..."
|
##################################################################
|
||||||
exit
|
# EVERY EVERY MINUTES
|
||||||
fi
|
# START CHECK FOR EMAIL CMD
|
||||||
|
# START CHECK FOR TX CMD
|
||||||
|
EVERY=1
|
||||||
|
##################################################################
|
||||||
|
if [[ $(($minut%$EVERY)) == 0 ]]; then
|
||||||
|
##################################################################
|
||||||
|
# CHECK FOR TX COMMAND
|
||||||
|
TIMEBEFORE=$(date --date="-$EVERY minutes" +"%s")
|
||||||
|
[[ $NODE_G1PUBKEY == "" ]] && NODE_G1PUBKEY="5sdcypPRDrzEirtTqXwzvNnMwGpjXK6EhNdti8qsdS4h"
|
||||||
|
TIMESTAMP=$(date +"%s")
|
||||||
|
#log "GETTING last $EVERY mn TX : https://duniter-g1.p2p.legal/tx/history/$NODE_G1PUBKEY/times/$TIMEBEFORE/$TIMESTAMP"
|
||||||
|
curl -s https://duniter-g1.p2p.legal/tx/history/$NODE_G1PUBKEY/times/$TIMEBEFORE/$TIMESTAMP | jq '.history.pending' | jq '.[].comment' > /tmp/zenfontain.g1tx.txt
|
||||||
|
while read SMS_1_TEXT
|
||||||
|
do
|
||||||
|
export $SMS_1_TEXT
|
||||||
|
log "$NODE_G1PUBKEY TX PENDING $timebar !! COMMENT = " $SMS_1_TEXT
|
||||||
|
# TODO: VERIFY SOURCE PUBKEY IS RELATED TO A WALLET
|
||||||
|
# PUBKEY=
|
||||||
|
# WALLET=$(grep -Rwl "$PUBKEY" ./wallets/*/*.pub | head -n 1)
|
||||||
|
# export SMS_1_NUMBER=$(echo $WALLET | cut -d '/' -f 3) #TODO CHANGE ON NEXT SHA RELEASE
|
||||||
|
# TODO: GET PHONE G1SMS (OPTION: SEND SMS FOR AUTH CHALENGE?)
|
||||||
|
# TODO: EXTRACT CMD FROM TX AND RELAY TO SMS_RECEIVED API
|
||||||
|
# TODO: MEMORIZE CMD TO MAKE IT ONLY ONE TIME!!!!!!!
|
||||||
|
|
||||||
|
done < /tmp/zenfontain.g1tx.txt
|
||||||
|
|
||||||
|
# CHECK FOR EMAIL COMMAND
|
||||||
|
FROM="None"
|
||||||
|
SUBJECT="None"
|
||||||
|
# LOOP ON EVERY mn received emails
|
||||||
|
while [[ $FROM != "" && $SUBJECT != "" ]]; do
|
||||||
|
# GET POP3 From Address (TODO: CREATE != EMAILs FOR EACH NODE = UIDNA@g1sms.fr )
|
||||||
|
FROM=$(curl -s --insecure --url "pop3://pop.bookmyname.com/1" --user "vir@g1sms.fr:Z1cG1V1r!" | grep From | head -n 1 | grep -i -o '[A-Z0-9._%+-]\+@[A-Z0-9.-]\+\.[A-Z]\{2,4\}' | tr -d '\r')
|
||||||
|
# GET POP3 Email Subject (remove carriage return | tr -d '\r' )
|
||||||
|
export SMS_1_TEXT=$(curl -s --insecure --url "pop3://pop.bookmyname.com/1" --user "vir@g1sms.fr:Z1cG1V1r!" | grep Subject | head -n 1 | cut -d ':' -f 2 | sed -e 's/^[[:space:]]*//' | tr -d '\r')
|
||||||
|
# SHA256(FROM) as Search ./wallets
|
||||||
|
[[ $FROM != "" ]] && HMAIL=$(echo -n $FROM | sha256sum | cut -d ' ' -f 1)
|
||||||
|
# SEARCH for FROM corresponding WALLET
|
||||||
|
[[ $HMAIL != "" ]] && WALLET=$(grep -Rwl "$HMAIL" ./wallets/*/_email.sha | head -n 1)
|
||||||
|
# HAVE WALLET SOURCE + CMD: OK
|
||||||
|
if [[ $WALLET ]]; then
|
||||||
|
# DELETE EMAIL 1
|
||||||
|
curl -s --user "vir@g1sms.fr:Z1cG1V1r!" pop3://pop.bookmyname.com/1 --request dele --list-only
|
||||||
|
# GET G1SMS PHONE NUMBER
|
||||||
|
export SMS_1_NUMBER=$(echo -n $WALLET | cut -d '/' -f 3) #TODO CHANGE ON NEXT SHA RELEASE
|
||||||
|
# $SMS_1_NUMBER && $SMS_1_TEXT => RUN ./sms_received.sh
|
||||||
|
[[ $SMS_1_TEXT != "" && $SMS_1_NUMBER ]] && log "EMAIL CMD = $SMS_1_NUMBER $SMS_1_TEXT" && ./sms_received.sh
|
||||||
|
cat ./email.txt | sed s/_EMAIL/"${FROM}"/g | sed s/_SUBJECT/"G1sms+ EMAIL ACK"/g | sed s/_MESSAGE/"$SMS_1_TEXT OK"/g | ssmtp ${FROM}
|
||||||
|
else
|
||||||
|
if [[ $FROM != "" ]]; then
|
||||||
|
log "MAIL RECEIVED! NO GOOD SENDER: $FROM"
|
||||||
|
curl -s --user "vir@g1sms.fr:Z1cG1V1r!" pop3://pop.bookmyname.com/1 --request dele --list-only
|
||||||
|
cat ./email.txt | sed s/_EMAIL/"${FROM}"/g | sed s/_SUBJECT/"G1sms+ INCONNU"/g | sed s/_MESSAGE/"Portefeuille G1sms inconnu"/g | ssmtp ${FROM}
|
||||||
|
fi
|
||||||
|
#log "NO MAIL"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
fi # END CHECK FOR EMAIL CMD
|
||||||
##################################################################
|
##################################################################
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
|
@ -92,8 +154,12 @@ if [[ "$1" == "KALKUN" ]]; then
|
||||||
member=""
|
member=""
|
||||||
phone=$(echo $number | cut -d '/' -f 3);
|
phone=$(echo $number | cut -d '/' -f 3);
|
||||||
if [[ -f $number/$phone.uidname ]]; then member=$(cat $number/$phone.uidname); fi
|
if [[ -f $number/$phone.uidname ]]; then member=$(cat $number/$phone.uidname); fi
|
||||||
if [[ ! $member ]]; then member=$phone; fi
|
if [[ $phone && $member ]]; then
|
||||||
if [[ $phone && $member ]]; then add_contact $phone $member; log "__SUB:cron_MINUTE.sh: KALKUN add_contact $phone $member"; fi
|
rm_contact $phone $member;
|
||||||
|
sleep 2
|
||||||
|
add_contact $phone $member;
|
||||||
|
log "__SUB:cron_MINUTE.sh: KALKUN refresh contact $phone $member";
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
##################################################################
|
##################################################################
|
||||||
|
|
|
@ -124,14 +124,14 @@ su $YOU -c "ipfs get --output=./wallets_swarm/ /ipns/$IPFSNODEID"
|
||||||
count=1
|
count=1
|
||||||
# Search for All peers Nodes. TODO: To be changed when Swarm is too bug or not expendanding
|
# Search for All peers Nodes. TODO: To be changed when Swarm is too bug or not expendanding
|
||||||
#for id in ./wallets/.Qm*/;
|
#for id in ./wallets/.Qm*/;
|
||||||
for id in $(su $YOU -c "ipfs swarm peers" | awk -F '/' '{print $7}');
|
#for id in $(su $YOU -c "ipfs swarm peers" | awk -F '/' '{print $7}');
|
||||||
do
|
#do
|
||||||
count=$((count+1))
|
# count=$((count+1))
|
||||||
id=$(echo $id | cut -d '.' -f 3 | cut -d '/' -f 1)
|
# id=$(echo $id | cut -d '.' -f 3 | cut -d '/' -f 1)
|
||||||
log "__SUB:ipfs_swarm_wallets_refresh: IPFS: ipfs get --output=./wallets_swarm/ /ipns/$id"
|
# log "__SUB:ipfs_swarm_wallets_refresh: IPFS: ipfs get --output=./wallets_swarm/ /ipns/$id"
|
||||||
rm -Rf ./wallets_swarm/.$id
|
# rm -Rf ./wallets_swarm/.$id
|
||||||
./shell/timeout.sh -t 20 su $YOU -c "ipfs get --output=./wallets_swarm/ /ipns/$id"
|
# ./shell/timeout.sh -t 20 su $YOU -c "ipfs get --output=./wallets_swarm/ /ipns/$id"
|
||||||
done
|
#done
|
||||||
log "__SUB:ipfs_swarm_wallets_refresh: ./wallets_swarm/ RENEW from $count peers .........OK!!!"
|
log "__SUB:ipfs_swarm_wallets_refresh: ./wallets_swarm/ RENEW from $count peers .........OK!!!"
|
||||||
|
|
||||||
|
|
||||||
|
@ -320,6 +320,7 @@ log "__SUB:sms_INIT_ACCOUNT: ($1=phone, $2=NOSMS)"
|
||||||
RIBFILE="./wallets/$PHONE/$PHONE.uidrib" # Contains phone wallet related UID Pubkey
|
RIBFILE="./wallets/$PHONE/$PHONE.uidrib" # Contains phone wallet related UID Pubkey
|
||||||
NAMEFILE="./wallets/$PHONE/$PHONE.uidname" # Contains the member UID related to wallet
|
NAMEFILE="./wallets/$PHONE/$PHONE.uidname" # Contains the member UID related to wallet
|
||||||
MAILFILE="./wallets/$PHONE/$PHONE.email" # Contains the member EMAIL (Send BILLET)
|
MAILFILE="./wallets/$PHONE/$PHONE.email" # Contains the member EMAIL (Send BILLET)
|
||||||
|
HMAILFILE="./wallets/$PHONE/_email.sha" # Contains sha256 EMAIL (Email CMD wallet owner search)
|
||||||
GPGMAILFILE="./wallets/$PHONE/$PHONE.email.gpg" # Contains the member EMAIL (Send BILLET)
|
GPGMAILFILE="./wallets/$PHONE/$PHONE.email.gpg" # Contains the member EMAIL (Send BILLET)
|
||||||
UIDNAFILE="./wallets/$PHONE/$PHONE.uidna" # Contains the G1sms+ UID Name for recursive VIR
|
UIDNAFILE="./wallets/$PHONE/$PHONE.uidna" # Contains the G1sms+ UID Name for recursive VIR
|
||||||
GEOFILE="./wallets/$PHONE/$PHONE.uidgeo.json" # Contains the member GeoPoint from member Cesium+ related to wallet
|
GEOFILE="./wallets/$PHONE/$PHONE.uidgeo.json" # Contains the member GeoPoint from member Cesium+ related to wallet
|
||||||
|
@ -429,8 +430,8 @@ log "__SUB:sms_INIT_ACCOUNT: ($1=phone, $2=NOSMS)"
|
||||||
# CYPHER EMAIL FILE
|
# CYPHER EMAIL FILE
|
||||||
if [[ ! -f "$GPGMAILFILE" ]]; then
|
if [[ ! -f "$GPGMAILFILE" ]]; then
|
||||||
# ------------8<------------------
|
# ------------8<------------------
|
||||||
log "__SUB:sms_INIT_ACCOUNT: NO EMAIL .gpg file, CREATING it"
|
|
||||||
if [ -f "$MAILFILE" ]; then
|
if [ -f "$MAILFILE" ]; then
|
||||||
|
log "__SUB:sms_INIT_ACCOUNT: NO EMAIL .gpg file, CREATING it"
|
||||||
MAIL=$(cat "$MAILFILE");
|
MAIL=$(cat "$MAILFILE");
|
||||||
echo "${GPGPASS}" | gpg -q --output "$GPGMAILFILE" --yes --pinentry-mode loopback --symmetric --passphrase-fd 0 "$MAILFILE";
|
echo "${GPGPASS}" | gpg -q --output "$GPGMAILFILE" --yes --pinentry-mode loopback --symmetric --passphrase-fd 0 "$MAILFILE";
|
||||||
else
|
else
|
||||||
|
@ -441,9 +442,12 @@ log "__SUB:sms_INIT_ACCOUNT: ($1=phone, $2=NOSMS)"
|
||||||
log "__SUB:sms_INIT_ACCOUNT: DECODING EMAIL .gpg... "
|
log "__SUB:sms_INIT_ACCOUNT: DECODING EMAIL .gpg... "
|
||||||
echo "${GPGPASS}" | gpg -d -q --output "$MAILFILE" --yes --pinentry-mode loopback --passphrase-fd 0 "$GPGMAILFILE"
|
echo "${GPGPASS}" | gpg -d -q --output "$MAILFILE" --yes --pinentry-mode loopback --passphrase-fd 0 "$GPGMAILFILE"
|
||||||
MAIL=$(cat "$MAILFILE");
|
MAIL=$(cat "$MAILFILE");
|
||||||
|
# Double decypher (TODO: stop PGP for email)
|
||||||
[[ $MAIL == "" && -f "$MAILFILE.node.crypt" ]] && ./shell/natools.py decrypt -k "$NODE_G1AUTHFILE" -i "$MAILFILE.node.crypt" -o "$MAILFILE" && MAIL=$(cat "$MAILFILE");
|
[[ $MAIL == "" && -f "$MAILFILE.node.crypt" ]] && ./shell/natools.py decrypt -k "$NODE_G1AUTHFILE" -i "$MAILFILE.node.crypt" -o "$MAILFILE" && MAIL=$(cat "$MAILFILE");
|
||||||
# EMPTY CLEAR EMAIL FILE
|
# EMPTY CLEAR EMAIL FILE
|
||||||
[[ $MAIL != "" ]] && echo "" > "$MAILFILE" || log "SYSTEM ERROR :: MAIL EMPTY !!! GPG???"
|
[[ $MAIL != "" ]] && echo "" > "$MAILFILE" || log "SYSTEM ERROR :: MAIL EMPTY !!! GPG PROBLEM???"
|
||||||
|
# Create _email.sha
|
||||||
|
[[ $MAIL != "" && ! -f $HMAILFILE ]] && echo -n $MAIL | sha256sum | cut -d ' ' -f 1 > $HMAILFILE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ------------8<------------------
|
# ------------8<------------------
|
||||||
|
@ -647,6 +651,7 @@ function add_contact(){
|
||||||
$sql "INSERT INTO user_group (id_group, id_pbk, id_pbk_groups, id_user) VALUES ('$id_user', '$id_user', '1', '1')" || exit 1
|
$sql "INSERT INTO user_group (id_group, id_pbk, id_pbk_groups, id_user) VALUES ('$id_user', '$id_user', '1', '1')" || exit 1
|
||||||
else
|
else
|
||||||
log "${red}Contact already exist$c_"
|
log "${red}Contact already exist$c_"
|
||||||
|
#TODO: UPDATE Kalkun Contact database
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
duniter.moul.re:443
|
|
||||||
g1.duniter.fr:443
|
|
||||||
g1.duniter.org:443
|
|
||||||
g1.le-sou.org:443
|
|
||||||
g1.monnaielibreoccitanie.org:443
|
|
||||||
g1.presles.fr:443
|
|
|
@ -23,7 +23,7 @@ export GPGPASS=$(cat "/home/$YOU/.ipfs/config" | jq '.Identity.PrivKey' | sed s/
|
||||||
if [ ! $GPGPASS ]; then echo "FATAL ERROR:: IPFS Node.Identity.PrivKey GPGPASS EMPTY"; exit; fi
|
if [ ! $GPGPASS ]; then echo "FATAL ERROR:: IPFS Node.Identity.PrivKey GPGPASS EMPTY"; exit; fi
|
||||||
|
|
||||||
# GET SWARM KEY G1sms+ .ipfs/swarm.key
|
# GET SWARM KEY G1sms+ .ipfs/swarm.key
|
||||||
export SWARMKEY=$(cat "/home/$YOU/.ipfs/swarm.key" | tail -n 1)
|
export SWARMKEY=$(cat "/home/$YOU/.ipfs/swarm.key.old" | tail -n 1)
|
||||||
if [ ! $SWARMKEY ]; then echo "FATAL ERROR:: .ipfs/swarm.key EMPTY"; exit; fi
|
if [ ! $SWARMKEY ]; then echo "FATAL ERROR:: .ipfs/swarm.key EMPTY"; exit; fi
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
# This Python script gets Duniter creddentials as arguments, and writes a PubSec file that should be compatible with Cesium and Silkaj(DuniterPy) clients.
|
||||||
|
# launch with :
|
||||||
|
# python3 key_create_dnuikey.py <id> <mdp>
|
||||||
|
|
||||||
|
# depends on duniterpy 0.56
|
||||||
|
|
||||||
|
### Licence - WTFPL
|
||||||
|
# This script was written my Matograine, in the hope that it will be helpful.
|
||||||
|
# Do What The Fuck you like with it. There is :
|
||||||
|
# * no guarantee that this will work
|
||||||
|
# * no support of any kind
|
||||||
|
#
|
||||||
|
# If this is helpful, please consider making a donation to the developper's pubkey : 78ZwwgpgdH5uLZLbThUQH7LKwPgjMunYfLiCfUCySkM8
|
||||||
|
# Have fun
|
||||||
|
|
||||||
|
from sys import argv
|
||||||
|
from duniterpy.key import SigningKey
|
||||||
|
|
||||||
|
# path to save to
|
||||||
|
path = "/tmp/secret.dunikey"
|
||||||
|
|
||||||
|
key = SigningKey.from_credentials(argv[1], argv[2], None)
|
||||||
|
key.save_pubsec_file(path)
|
||||||
|
print(
|
||||||
|
"G1 Wallet: ",
|
||||||
|
key.pubkey,
|
||||||
|
)
|
|
@ -45,7 +45,7 @@ for result in $(find billets/ -daystart -mtime +$vieux -type d -name "*"); do
|
||||||
if [[ "$virement" == "0.0" ]]; then
|
if [[ "$virement" == "0.0" ]]; then
|
||||||
echo "G1Billet déjà vide, suppression de $result"; rm -Rf $result;
|
echo "G1Billet déjà vide, suppression de $result"; rm -Rf $result;
|
||||||
else
|
else
|
||||||
PAY=$(/usr/local/bin/silkaj -p duniter-g1.p2p.legal:443 tx --amount="$virement" --output="$dest" --comment="[G1Billet] $numero" -y)
|
PAY=$(/usr/local/bin/silkaj -p g1.presles.fr:443 tx --amount="$virement" --output="$dest" --comment="[G1Billet] $numero" -y)
|
||||||
if [[ ! $(echo $PAY | grep "successfully sent") ]]; then
|
if [[ ! $(echo $PAY | grep "successfully sent") ]]; then
|
||||||
echo "!!!! ERREUR: $virement Something Wrong happened with $result. Moving to /tmp/ERROR_BILL_$billetname (please check or remove)"
|
echo "!!!! ERREUR: $virement Something Wrong happened with $result. Moving to /tmp/ERROR_BILL_$billetname (please check or remove)"
|
||||||
mkdir -p /tmp/ERROR_BILL_$billetname
|
mkdir -p /tmp/ERROR_BILL_$billetname
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
#!/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
|
||||||
|
if [[ -f $MY_PATH/.install/.GPATH ]]; then source $MY_PATH/.install/.GPATH; fi
|
||||||
|
if [[ -f $MY_PATH/../.install/.GPATH ]]; then source $MY_PATH/../.install/.GPATH; fi
|
||||||
|
cd $GPATH
|
||||||
|
source ./shell/init.sh
|
||||||
|
source ./shell/functions.sh
|
||||||
|
|
||||||
|
PHONE=$1
|
||||||
|
VALEUR=$2
|
||||||
|
TODAY=$(date '+%Y%m%d')
|
||||||
|
log "__SUB:sms_AUTH.sh ($PHONE, $VALEUR)"
|
||||||
|
|
||||||
|
## INITIALIZE RESULT FILE
|
||||||
|
[[ $VALEUR == "" ]] && echo "Indiquez la valeur des G1Billets" && exit 1
|
||||||
|
[[ $PHONE != "" ]] && sms_INIT_ACCOUNT "$PHONE" "NOSMS" || exit 1
|
||||||
|
[[ $UNKNOWN == "unknown" ]] && echo "G1sms Wallet $PHONE inconnu! Envoyer N au $MASTERPHONE" && exit 1
|
||||||
|
|
||||||
|
# Get AMOUNTG1, AMOUNTLOVE, AMOUNTDU
|
||||||
|
AMOUNTG1=$(./silkaj/silkaj amount "$PUBKEY")
|
||||||
|
AMOUNTDU=$(bc -l <<< "scale=2; $AMOUNTG1 / $DUFACTOR")
|
||||||
|
AMOUNTLOVE=$(bc -l <<< "scale=0; $AMOUNTG1 * 100 / $DUFACTOR")
|
||||||
|
|
||||||
|
# Convert amount to G1 unit
|
||||||
|
VIR=$(bc -l <<< "scale=2; $VALEUR * $DUFACTOR / 100")
|
||||||
|
|
||||||
|
# Need at least $MIN G1 available!
|
||||||
|
MIN=$(bc -l <<< "$AMOUNTG1 - $LIMIT")
|
||||||
|
testmin=$( echo "${VIR} < ${MIN}" | bc -l )
|
||||||
|
SMSPIN=$((1000 + RANDOM % 9999))
|
||||||
|
|
||||||
|
log "__SUB:sms_AUTH.sh: CODE $SMSPIN : $VIR < $MIN ? $testmin"
|
||||||
|
if [[ "$testmin" -eq "1" ]]
|
||||||
|
then
|
||||||
|
mess="CODE: $SMSPIN
|
||||||
|
A saisir pour vous authentifier...
|
||||||
|
[G1] Zen Astroport Satellite #$(cat /etc/hostname)"
|
||||||
|
# Send response SMS
|
||||||
|
sms_SEND "$PHONE" "$mess"
|
||||||
|
echo $SMSPIN > /tmp/$PHONE.PIN.auth
|
||||||
|
echo $SMSPIN
|
||||||
|
else
|
||||||
|
text="Solde: $AMOUNTLOVE LOVE ($AMOUNTG1 G1 = $AMOUNTDU DU)
|
||||||
|
Insuffisant (minimum $VIR G1 + $LIMIT G1)"
|
||||||
|
sms_ERROR "$PHONE" "$text"
|
||||||
|
echo "Minimum $VIR G1 + $LIMIT G1"
|
||||||
|
fi
|
||||||
|
log "__SUB:sms_AUTH.sh: END sms_AUTH.sh "
|
||||||
|
log "~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
||||||
|
exit
|
|
@ -96,7 +96,7 @@ then
|
||||||
rm -f "./authfile"
|
rm -f "./authfile"
|
||||||
|
|
||||||
log_history $PHONE "G1BILLET, $TRANSAC, $BILLETPUBKEY"
|
log_history $PHONE "G1BILLET, $TRANSAC, $BILLETPUBKEY"
|
||||||
sleep 3
|
sleep 5
|
||||||
# Fill BILLET with TRANSAC amount
|
# Fill BILLET with TRANSAC amount
|
||||||
PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$TRANSAC" --output="$BILLETPUBKEY" --comment="G1Billet $NUMBER" -y)
|
PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$TRANSAC" --output="$BILLETPUBKEY" --comment="G1Billet $NUMBER" -y)
|
||||||
if [[ "$(echo $PAY | cut -d '|' -f 1)" != "KO" ]]; then
|
if [[ "$(echo $PAY | cut -d '|' -f 1)" != "KO" ]]; then
|
||||||
|
@ -131,7 +131,7 @@ then
|
||||||
done
|
done
|
||||||
|
|
||||||
# + G1SMS Commission
|
# + G1SMS Commission
|
||||||
sleep 2
|
sleep 10
|
||||||
COM=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$BILLCOM" --output="$NODE_G1PUBKEY" --comment="[G1sms+] Achat G1Billets" -y)
|
COM=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$BILLCOM" --output="$NODE_G1PUBKEY" --comment="[G1sms+] Achat G1Billets" -y)
|
||||||
|
|
||||||
# POUR IMPRIMER LES BILLETS! Brancher votre imprimante, configurer cups, activer code lp ;)
|
# POUR IMPRIMER LES BILLETS! Brancher votre imprimante, configurer cups, activer code lp ;)
|
||||||
|
@ -160,7 +160,7 @@ Support: $ADMINPSEUDO ($ADMINPHONE)
|
||||||
sms_SEND "$phone" "$mess"
|
sms_SEND "$phone" "$mess"
|
||||||
# ADMIN ALERT SMS + TODO Add ADMINEMAIL parameter in "install.sh"
|
# ADMIN ALERT SMS + TODO Add ADMINEMAIL parameter in "install.sh"
|
||||||
sms_SEND "$ADMINPHONE" "$MEMBER vient de créer $NBbillets G1Billets de $VALbillet $UNIT ($TRANSAC G1): $MAIL"
|
sms_SEND "$ADMINPHONE" "$MEMBER vient de créer $NBbillets G1Billets de $VALbillet $UNIT ($TRANSAC G1): $MAIL"
|
||||||
cat ./email.txt | sed s/EMAIL/frenault@linkeo.com/g | sed s/SUBJECT/Creation_G1Billets/g | sed s/MESSAGE/"$MEMBER ($PHONE) vient de creer $NBbillets G1Billets de $VALbillet $UNIT ($TRANSAC G1) vers $MAIL"/g | ssmtp "frenault@linkeo.com"
|
cat ./email.txt | sed s/_EMAIL/frenault@linkeo.com/g | sed s/_SUBJECT/Creation_G1Billets/g | sed s/_MESSAGE/"$MEMBER ($PHONE) vient de creer $NBbillets G1Billets de $VALbillet $UNIT ($TRANSAC G1) vers $MAIL"/g | ssmtp "frenault@linkeo.com"
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
# Amount too High, solde insuffisant
|
# Amount too High, solde insuffisant
|
||||||
|
|
|
@ -7,21 +7,22 @@ source ./shell/functions.sh
|
||||||
log "X sms_BILLETCHK.sh $0"
|
log "X sms_BILLETCHK.sh $0"
|
||||||
|
|
||||||
PHONE="$1"
|
PHONE="$1"
|
||||||
CODE="$2 $3"
|
CODE=""
|
||||||
SEC="$4 $5 $6 $7"
|
|
||||||
|
|
||||||
# Construct billet path
|
# Construct billet path
|
||||||
bpath=$(echo "$CODE" | sed 's/ /_/g')
|
bpath=$(echo "$2 $3" | sed 's/ /_/g')
|
||||||
|
[[ -d "./billets/$bpath" ]] && CODE="$2 $3" && SEC="$4 $5 $6 $7" && zpath=$bpath
|
||||||
|
|
||||||
if [ -d "./billets/$bpath" ]
|
oldpath=$(echo "$2 $3 $4 $5" | sed 's/ /_/g')
|
||||||
then
|
[[ -d "./billets/$oldpath" ]] && CODE="$2 $3 $4 $5" && SEC="$6 $7 $8" && zpath=$oldpath
|
||||||
SECRET=$(cat "./billets/$bpath/note.secret")
|
|
||||||
SALT=$(cat "./billets/$bpath/note.salt")
|
|
||||||
VALbillet=$(cat "./billets/$bpath/note.value")
|
|
||||||
UNIT=$(cat "./billets/$bpath/note.unit")
|
|
||||||
BILLETPUBKEY=$(cat "./billets/$bpath/note.pubkey")
|
|
||||||
|
|
||||||
AMOUNTG1=$(./silkaj/silkaj amount "$BILLETPUBKEY")
|
if [[ $CODE != "" ]]; then
|
||||||
|
SECRET=$(cat "./billets/$zpath/note.secret")
|
||||||
|
SALT=$(cat "./billets/$zpath/note.salt")
|
||||||
|
VALbillet=$(cat "./billets/$zpath/note.love")
|
||||||
|
UNIT="LOVE"
|
||||||
|
BILLETPUBKEY=$(cat "./billets/$zpath/note.pubkey")
|
||||||
|
|
||||||
|
G1=$(./silkaj/silkaj amount "$BILLETPUBKEY")
|
||||||
log "Billet: $AMOUNTG1 ($VALbillet $UNIT): $BILLETPUBKEY"
|
log "Billet: $AMOUNTG1 ($VALbillet $UNIT): $BILLETPUBKEY"
|
||||||
|
|
||||||
# NO GOOD SECRET
|
# NO GOOD SECRET
|
||||||
|
@ -29,11 +30,11 @@ then
|
||||||
# SEND ACTUAL BILLET VALUE
|
# SEND ACTUAL BILLET VALUE
|
||||||
mess="[G1SMS]
|
mess="[G1SMS]
|
||||||
Billet de $VALbillet $UNIT Valide!
|
Billet de $VALbillet $UNIT Valide!
|
||||||
Valeur: $AMOUNTG1 G1
|
Valeur: $G1 G1
|
||||||
https://www.g1sms.fr/contact"
|
https://www.g1sms.fr/contact"
|
||||||
sms_SEND "$PHONE" "$mess"
|
sms_SEND "$PHONE" "$mess"
|
||||||
log "BILLETCHK: $VALbillet $UNIT ($AMOUNTG1 G1)"
|
log "BILLETCHK: $VALbillet $UNIT ($G1 G1)"
|
||||||
log_history $PHONE "BILLET_CHK, $AMOUNTG1, $bpath"
|
log_history $PHONE "BILLET_CHK, $G1, $zpath"
|
||||||
else
|
else
|
||||||
# TRANSFER & DESTROY
|
# TRANSFER & DESTROY
|
||||||
sms_INIT_ACCOUNT "$PHONE" "NOSMS"
|
sms_INIT_ACCOUNT "$PHONE" "NOSMS"
|
||||||
|
@ -41,35 +42,43 @@ https://www.g1sms.fr/contact"
|
||||||
# Account creation
|
# Account creation
|
||||||
sms_INIT_ACCOUNT "$PHONE"
|
sms_INIT_ACCOUNT "$PHONE"
|
||||||
fi
|
fi
|
||||||
log "./silkaj/silkaj transaction --auth-scrypt -salt=\"$CODE\" -password=\"$SEC$SALT\" --amount=\"$AMOUNTG1\" --output=\"$PUBKEY\" --comment=\"THIRD_PARTY_MANAGER:$NODE_G1PUBKEY:G1SMS:ENCAISSEMENT:$CODE\" -y"
|
################ BUG SILKAJ TX
|
||||||
PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$CODE" -password="$SEC$SALT" --amount="$AMOUNTG1" --output="$PUBKEY" --comment="THIRD_PARTY_MANAGER:$NODE_G1PUBKEY:ENCAISSEMENT:$CODE" -y)
|
log "python3 ./shell/key_create_dunikey.py $CODE / $SEC $SALT"
|
||||||
|
# [[ $SALT != "" ]] && PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$CODE" -password="$SEC $SALT" --amount="$G1" --output="$PUBKEY" --comment="THIRD_PARTY_MANAGER:$NODE_G1PUBKEY:ENCAISSEMENT:$CODE" -y) \
|
||||||
|
# || PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$CODE" -password="$SEC" --amount="$G1" --output="$PUBKEY" --comment="THIRD_PARTY_MANAGER:$NODE_G1PUBKEY:ENCAISSEMENT:$CODE" -y)
|
||||||
|
# MAKE .dunikey file and use latest silkaj
|
||||||
|
[[ $SALT != "" ]] && python3 ./shell/key_create_dunikey.py "$CODE" "$SEC $SALT" \
|
||||||
|
|| python3 ./shell/key_create_dunikey.py "$CODE" "$SEC"
|
||||||
|
log "silkaj -p duniter-g1.p2p.legal:443 -af --file /tmp/secret.dunikey tx --output $PUBKEY --amount $G1"
|
||||||
|
PAY=$(silkaj -p duniter-g1.p2p.legal:443 -af --file /tmp/secret.dunikey tx --output $PUBKEY --amount $G1 -y)
|
||||||
|
log "$PAY"
|
||||||
|
### TODO AMELIORER ANALYSE DU RETOUR SILKAJ
|
||||||
if [[ "$(echo $PAY | cut -d '|' -f 1)" != "KO" ]]; then
|
if [[ "$(echo $PAY | cut -d '|' -f 1)" != "KO" ]]; then
|
||||||
# DESTROY BILLET
|
# DESTROY BILLET
|
||||||
rm -Rf ./billets/$bpath
|
rm -Rf ./billets/$zpath
|
||||||
# DESTROY PUBLIC CACHE in /tmp
|
# DESTROY PUBLIC CACHE in /tmp
|
||||||
if [ -d "/tmp/billets_valides/$bpath" ]; then
|
if [ -d "/tmp/billets_valides/$zpath" ]; then
|
||||||
rm -Rf /tmp/billets_valides/$bpath
|
rm -Rf /tmp/billets_valides/$zpath
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SOLDE=$(./silkaj/silkaj amount "$PUBKEY")
|
SOLDE=$(./silkaj/silkaj amount "$PUBKEY")
|
||||||
|
|
||||||
mess="[G1SMS]
|
mess="[G1SMS]
|
||||||
ENCAISSEMENT de $VALbillet $UNIT ($AMOUNTG1 G1)
|
ENCAISSEMENT de $VALbillet $UNIT ($G1 G1)
|
||||||
dans portefeuille $UIDNA ($PHONE)
|
dans portefeuille $UIDNA ($PHONE)
|
||||||
OK!
|
OK!
|
||||||
Solde: $SOLDE G1"
|
Solde: $SOLDE G1"
|
||||||
sms_SEND "$PHONE" "$mess"
|
sms_SEND "$PHONE" "$mess"
|
||||||
log "BILLETCHK DESTROY: $VALbillet $UNIT ($AMOUNTG1 G1)"
|
log "BILLETCHK DESTROY: $VALbillet $UNIT ($G1 G1)"
|
||||||
log "=> $PUBKEY"
|
log "=> $PUBKEY"
|
||||||
log_history $PHONE "BILLET_CHK, $AMOUNTG1, $bpath, $PUBKEY"
|
log_history $PHONE "BILLET_CHK, $G1, $zpath, $PUBKEY"
|
||||||
else
|
else
|
||||||
sms_ERROR "$PHONE" "Erreur! Transaction Impossible! Valeur du G1Billet $AMOUNTG1 G1. Contactez $ADMINPSEUDO : $ADMINPHONE"
|
sms_ERROR "$PHONE" "Erreur! Transaction Impossible! Valeur du G1Billet $G1 G1. Contactez $ADMINPSEUDO : $ADMINPHONE"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
sms_SEND "$PHONE" "BILLET \"$CODE\" INCONNU !!"
|
sms_SEND "$PHONE" "BILLET \"$CODE\" inconnu !!"
|
||||||
log_history $PHONE "BILLET_CHK, ERROR, $bpath"
|
log_history $PHONE "BILLET_CHK, ERROR, $zpath"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log "END sms_BILLETCHK.sh"
|
log "END sms_BILLETCHK.sh"
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
source ./shell/init.sh
|
source ./shell/init.sh
|
||||||
source ./shell/functions.sh
|
source ./shell/functions.sh
|
||||||
|
|
||||||
log "__SUB:sms_EMAIL.sh.sh: START ($1=phone, $2=mail)"
|
log "__SUB:sms_EMAIL.sh: START ($1=phone, $2=mail)"
|
||||||
|
|
||||||
phone="$1"
|
phone="$1"
|
||||||
mail="$2"
|
mail="$2"
|
||||||
|
@ -30,7 +30,7 @@ if [[ "$mail" != "" ]]; then
|
||||||
echo "$mail" > "$MAILFILE"
|
echo "$mail" > "$MAILFILE"
|
||||||
./shell/natools.py encrypt -p $NODE_G1PUBKEY -i "$MAILFILE" -o "$MAILFILE.node.crypt"
|
./shell/natools.py encrypt -p $NODE_G1PUBKEY -i "$MAILFILE" -o "$MAILFILE.node.crypt"
|
||||||
echo "" > "$MAILFILE"
|
echo "" > "$MAILFILE"
|
||||||
log "__SUB:sms_EMAIL.sh.sh: EMAIL $MEMBER ($PHONE) NOUVEAU: $mail... Publishing to IPFS"
|
log "__SUB:sms_EMAIL.sh: EMAIL $MEMBER ($PHONE) NOUVEAU: $mail... Publishing to IPFS"
|
||||||
ipfs_node_wallets_add
|
ipfs_node_wallets_add
|
||||||
else
|
else
|
||||||
mail=$MAIL
|
mail=$MAIL
|
||||||
|
@ -39,10 +39,10 @@ fi
|
||||||
# SEND EMAIL WITH ssmtp
|
# SEND EMAIL WITH ssmtp
|
||||||
SUBJECT="[G1sms+] $MEMBER, Message de votre portefeuille monnaie libre $UIDNA ($PHONE)"
|
SUBJECT="[G1sms+] $MEMBER, Message de votre portefeuille monnaie libre $UIDNA ($PHONE)"
|
||||||
MESSAGE="Bonjour $MEMBER\n\nVotre porte-monnaie G1sms $UIDNA ($PHONE) a choisi votre email comme contact.\nPour commander vos G1Billets, envoyez par SMS à $MASTERPHONE :\nBILL 10/20/50/100/200/500/1000\n\n\nA bientot <3\n$ADMINPSEUDO ($ADMINPHONE)"
|
MESSAGE="Bonjour $MEMBER\n\nVotre porte-monnaie G1sms $UIDNA ($PHONE) a choisi votre email comme contact.\nPour commander vos G1Billets, envoyez par SMS à $MASTERPHONE :\nBILL 10/20/50/100/200/500/1000\n\n\nA bientot <3\n$ADMINPSEUDO ($ADMINPHONE)"
|
||||||
cat ./email.txt | sed s/EMAIL/"${mail}"/g | sed s/SUBJECT/"${SUBJECT}"/g | sed s/MESSAGE/"${MESSAGE}"/g | ssmtp ${mail}
|
cat ./email.txt | sed s/_EMAIL/"${mail}"/g | sed s/_SUBJECT/"${SUBJECT}"/g | sed s/_MESSAGE/"${MESSAGE}"/g | ssmtp ${mail}
|
||||||
mpack -s "[G1sms+] $PHONE, $UIDNA :: Envoyer 'BILL nnn' à $MASTERPHONE pour fabriquer des G1Billets (ci-joint exemple de verso)" ./Dos_G1Billets.odt ${mail}
|
mpack -s "[G1sms+] $PHONE, $UIDNA :: Envoyer 'BILL nnn' à $MASTERPHONE pour fabriquer des G1Billets (ci-joint exemple de verso)" ./Dos_G1Billets.odt ${mail}
|
||||||
|
|
||||||
log "__SUB:sms_EMAIL.sh.sh: Send welcome EMAIL to $mail via ssmtp"
|
log "__SUB:sms_EMAIL.sh: Send welcome EMAIL to $mail via ssmtp"
|
||||||
log_history $PHONE "EMAIL, $mail"
|
log_history $PHONE "EMAIL, $mail"
|
||||||
|
|
||||||
mess="[G1sms+]
|
mess="[G1sms+]
|
||||||
|
|
|
@ -14,8 +14,10 @@ function log () {
|
||||||
echo "$line
|
echo "$line
|
||||||
$1" >> /tmp/tag_READ_XY.log
|
$1" >> /tmp/tag_READ_XY.log
|
||||||
}
|
}
|
||||||
source ./shell/init.sh
|
#############################################
|
||||||
source ./shell/functions.sh
|
# No external dependance !!!!
|
||||||
|
#source ./shell/init.sh
|
||||||
|
#source ./shell/functions.sh
|
||||||
##############################################
|
##############################################
|
||||||
# NODE ENVIRONEMENT DETECTION
|
# NODE ENVIRONEMENT DETECTION
|
||||||
##############################################
|
##############################################
|
||||||
|
|
|
@ -4,17 +4,19 @@
|
||||||
# PUBKEY G1 DU SWARMMASTER: 8qs69HriAdytcCLzvQGJ15XBwpjAVFx8JoVM2ahue1y7
|
# PUBKEY G1 DU SWARMMASTER: 8qs69HriAdytcCLzvQGJ15XBwpjAVFx8JoVM2ahue1y7
|
||||||
# ipfs ls /ipns/QmZHTne3bjtMgaXWRqSbdKchJbgq2NaAeVSzFUN7ceYpif
|
# ipfs ls /ipns/QmZHTne3bjtMgaXWRqSbdKchJbgq2NaAeVSzFUN7ceYpif
|
||||||
#
|
#
|
||||||
# G1sms+ est totalement décentralisé! Il peut être fait de multiples SWARM de Services dont les codes évoluent de façon décentralisé.
|
# G1sms+ est constitué de multiples essaims (SWARM) qui évoluent de façon décentralisé.
|
||||||
# Puis se mettent à jour autour des $ADMINPHONE par consensus d'utilisateurs ;)
|
# Ils se mettent à jour autour des $ADMINPHONE par consensus d'utilisateurs ;)
|
||||||
#
|
#
|
||||||
# Log => tail -f /tmp/g1sms.log -n 200
|
# Log => tail -f /tmp/g1sms.log -n 200
|
||||||
# gammu => tail -f /tmp/smsd.log -n 200
|
# gammu => tail -f /tmp/smsd.log -n 200
|
||||||
#
|
#
|
||||||
|
# PRODUCTION : RAM DISK / NO LOG
|
||||||
# 2 commands needed to make the ramdisk if planning to run from ramdisk to gain some speed
|
# 2 commands needed to make the ramdisk if planning to run from ramdisk to gain some speed
|
||||||
# sudo mkdir /mnt/ramdisk
|
# sudo mkdir /mnt/ramdisk
|
||||||
# sudo mount -t tmpfs -o size=50m tmpfs /mnt/ramdisk
|
# sudo mount -t tmpfs -o size=50m tmpfs /mnt/ramdisk
|
||||||
#
|
#
|
||||||
# Utiliser la commande ./search fournie pour fouiller dans le code, mais tout est ordonnancé d'ici, donc vous êtes au bon endroit pour commencer à farfouiller.
|
# Utiliser la commande ./search fournie pour fouiller dans le code,
|
||||||
|
# mais tout est ordonnancé à partir d'ici, vous êtes au bon endroit pour commencer à farfouiller.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# EN FAISANT PARTIE DU SWARM G1sms+ VOUS VOUS ENGAGEZ A ASSURER LA SECURITE
|
# EN FAISANT PARTIE DU SWARM G1sms+ VOUS VOUS ENGAGEZ A ASSURER LA SECURITE
|
||||||
# PHYSIQUE ET INFORMATIQUE DE VOTRE NOEUD ET NE PAS INTRODUIRE DE CODE MALVEILLANT
|
# PHYSIQUE ET INFORMATIQUE DE VOTRE NOEUD ET NE PAS INTRODUIRE DE CODE MALVEILLANT
|
||||||
|
@ -23,7 +25,7 @@
|
||||||
# ELLE EST PROVISION EN CAS DE FRAUDE ET SA REATRIBUTION POURRA EVOLUER...
|
# ELLE EST PROVISION EN CAS DE FRAUDE ET SA REATRIBUTION POURRA EVOLUER...
|
||||||
#
|
#
|
||||||
# Author: Fred (support@qo-op.com)
|
# Author: Fred (support@qo-op.com)
|
||||||
# Version: 0.1
|
# Version: 0.2
|
||||||
# License: GPL (http://www.google.com/search?q=GPL)
|
# License: GPL (http://www.google.com/search?q=GPL)
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
@ -63,7 +65,7 @@ security
|
||||||
##################################################################
|
##################################################################
|
||||||
# Refresh All peers SWARM Wallets.
|
# Refresh All peers SWARM Wallets.
|
||||||
##################################################################
|
##################################################################
|
||||||
ipfs_swarm_wallets_refresh
|
# ipfs_swarm_wallets_refresh
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
# Check if PHONE is already registred in G1sms+ SWARM
|
# Check if PHONE is already registred in G1sms+ SWARM
|
||||||
|
@ -109,7 +111,7 @@ case "$CMD" in
|
||||||
;;
|
;;
|
||||||
VIR)
|
VIR)
|
||||||
montant=$(echo "$TEXT" | awk '{print $2}' | grep -E "^\-?[0-9]+$")
|
montant=$(echo "$TEXT" | awk '{print $2}' | grep -E "^\-?[0-9]+$")
|
||||||
membre=$(echo "$TEXT" | awk '{print $3}' | grep -E "([A-Za-z0-9\-\_]+$)")
|
membre=$(echo "$TEXT" | awk '{print $3}' | grep -E "([A-Za-z0-9\-\_]+$)") #TODO: UTF8 Char compatible? zöoma case
|
||||||
if [[ "$montant" != "" && "$membre" != "" ]]; then
|
if [[ "$montant" != "" && "$membre" != "" ]]; then
|
||||||
./shell/sms_VIR.sh "$PHONE" "$montant" "$membre" &
|
./shell/sms_VIR.sh "$PHONE" "$montant" "$membre" &
|
||||||
else
|
else
|
||||||
|
@ -204,8 +206,7 @@ case "$CMD" in
|
||||||
*)
|
*)
|
||||||
#./shell/sms_ERROR.sh "$PHONE" "$TEXT" &
|
#./shell/sms_ERROR.sh "$PHONE" "$TEXT" &
|
||||||
log "SMS forward to $ADMINPHONE"
|
log "SMS forward to $ADMINPHONE"
|
||||||
sms_SEND "$ADMINPHONE" "ADMIN! BAD SMS FROM $PHONE
|
sms_SEND "$ADMINPHONE" "$PHONE !! BAD CMD: $TEXT"
|
||||||
$TEXT"
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
server {
|
||||||
|
listen 9980;
|
||||||
|
server_name rock64.p2p.legal g1sms.local localhost 127.0.0.1;
|
||||||
|
|
||||||
|
index index.php index.html;
|
||||||
|
root /var/www/g1billet;
|
||||||
|
|
||||||
|
# set expiration of assets to MAX for caching
|
||||||
|
location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
|
||||||
|
expires max;
|
||||||
|
log_not_found off;
|
||||||
|
}
|
||||||
|
|
||||||
|
# php parsing
|
||||||
|
location ~ \.php$ {
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
error_log /var/log/nginx/g1billet_error.log;
|
||||||
|
access_log /var/log/nginx/g1billet_access.log;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
header("Access-Control-Allow-Origin: *");
|
||||||
|
if ( strlen($_REQUEST['code']) == 4 && strlen($_REQUEST['num']) == 10 ) {
|
||||||
|
$newNumber = preg_replace('/^0?/', '+33', $_REQUEST['num']);
|
||||||
|
$pinfile = '/tmp/'.$newNumber.'.PIN.auth';
|
||||||
|
if (file_exists($pinfile)) {
|
||||||
|
$authpin = file_get_contents($pinfile);
|
||||||
|
if ( trim($authpin) === trim($_REQUEST['code']) ) {
|
||||||
|
echo "OK ".$authpin. " == ".$_REQUEST['code'];
|
||||||
|
} else { echo "KO ".$pinfile." != ".$_REQUEST['code']; }
|
||||||
|
} else { echo "KO FILE ".$pinfile; }
|
||||||
|
} else {
|
||||||
|
echo "KO";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
|
||||||
|
<form accept-charset="UTF-8" action="zen_sms.php" autocomplete="off" method="GET" target="_self">
|
||||||
|
<label for="num">G1sms Wallet Number</label><br />
|
||||||
|
<input name="num" type="text" value="0612345678" /> <br />
|
||||||
|
|
||||||
|
<label for="g1billets_value">G1Billets Value</label><br />
|
||||||
|
<input name="val" type="text" value="10" /> LOVE <br />
|
||||||
|
<input type="submit" value="OK" />
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?php
|
||||||
|
header("Access-Control-Allow-Origin: *");
|
||||||
|
if (strlen($_REQUEST['num']) == 10 ) {
|
||||||
|
$newNumber = preg_replace('/^0?/', '+33', $_REQUEST['num']);
|
||||||
|
$data = '"'.$newNumber.'" "'.$_REQUEST['val'].'"'.PHP_EOL;
|
||||||
|
$fp = fopen('/tmp/sms.commands', 'a');
|
||||||
|
fwrite($fp, $data);
|
||||||
|
sleep(1);
|
||||||
|
echo exec('cat /tmp/sms.commmand.result');
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
server {
|
||||||
|
|
||||||
|
listen 80 default_server;
|
||||||
|
listen [::]:80 default_server;
|
||||||
|
|
||||||
|
root /var/www/rompr;
|
||||||
|
index index.php index.html index.htm;
|
||||||
|
|
||||||
|
server_name copylaradio;
|
||||||
|
|
||||||
|
# This section can be copied into an existing default setup
|
||||||
|
location / {
|
||||||
|
allow all;
|
||||||
|
index index.php;
|
||||||
|
location ~ \.php {
|
||||||
|
try_files $uri index.php =404;
|
||||||
|
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||||
|
include /etc/nginx/fastcgi_params;
|
||||||
|
fastcgi_read_timeout 1800;
|
||||||
|
}
|
||||||
|
error_page 404 = /404.php;
|
||||||
|
try_files $uri $uri/ =404;
|
||||||
|
location ~ /albumart/* {
|
||||||
|
expires -1s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# IPFS GATEWAY PROXY
|
||||||
|
location /ipfs {
|
||||||
|
proxy_pass http://127.0.0.1:8080;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Forwarded-For $remote_addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue