g1billets sms auth

This commit is contained in:
qo-op 2020-05-10 22:11:47 +02:00
parent cc5962091b
commit c2cd235e25
14 changed files with 155 additions and 19 deletions

30
0.sms.command.sh Executable file
View File

@ -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 ./www/LOVELand/g1billet/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/g1sms/sms_AUTH.sh $line"
echo "RUN: $mycmd" > /tmp/sms.commmand.result
eval "$mycmd" >> /tmp/sms.commmand.result
fi
done

57
g1sms/sms_AUTH.sh Executable file
View File

@ -0,0 +1,57 @@
#!/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
cd ~/.zen/astroport/g1sms/
source ./init.sh
source ./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_balance $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 0

View File

@ -54,7 +54,7 @@
<P>Please contact the <!--WEBMASTER//-->webmaster<!--WEBMASTER//--> with any queries.</p> <P>Please contact the <!--WEBMASTER//-->webmaster<!--WEBMASTER//--> with any queries.</p>
</div> </div>
<div id="footer"> <div id="footer">
<p>Powered by <a href="http://www.ispconfig.org">ISPConfig</a></p> <p>Powered by <a href="https://astroport.com">Astroport</a></p>
</div> </div>
</div> </div>
</body> </body>

View File

@ -54,7 +54,7 @@
<P>Please contact the <!--WEBMASTER//-->webmaster<!--WEBMASTER//--> with any queries.</p> <P>Please contact the <!--WEBMASTER//-->webmaster<!--WEBMASTER//--> with any queries.</p>
</div> </div>
<div id="footer"> <div id="footer">
<p>Powered by <a href="http://www.ispconfig.org">ISPConfig</a></p> <p>Powered by <a href="https://astroport.com">Astroport</a></p>
</div> </div>
</div> </div>
</body> </body>

View File

@ -54,7 +54,7 @@
<P>Please contact the <!--WEBMASTER//-->webmaster<!--WEBMASTER//--> with any queries.</p> <P>Please contact the <!--WEBMASTER//-->webmaster<!--WEBMASTER//--> with any queries.</p>
</div> </div>
<div id="footer"> <div id="footer">
<p>Powered by <a href="http://www.ispconfig.org">ISPConfig</a></p> <p>Powered by <a href="https://astroport.com">Astroport</a></p>
</div> </div>
</div> </div>
</body> </body>

View File

@ -54,7 +54,7 @@
<P>Please check the URL or contact the <!--WEBMASTER//-->webmaster<!--WEBMASTER//-->.</p> <P>Please check the URL or contact the <!--WEBMASTER//-->webmaster<!--WEBMASTER//-->.</p>
</div> </div>
<div id="footer"> <div id="footer">
<p>Powered by <a href="http://www.ispconfig.org">ISPConfig</a></p> <p>Powered by <a href="https://astroport.com">Astroport</a></p>
</div> </div>
</div> </div>
</body> </body>

View File

@ -54,7 +54,7 @@
<P>Please contact the <!--WEBMASTER//-->webmaster<!--WEBMASTER//--> with any queries.</p> <P>Please contact the <!--WEBMASTER//-->webmaster<!--WEBMASTER//--> with any queries.</p>
</div> </div>
<div id="footer"> <div id="footer">
<p>Powered by <a href="http://www.ispconfig.org">ISPConfig</a></p> <p>Powered by <a href="https://astroport.com">Astroport</a></p>
</div> </div>
</div> </div>
</body> </body>

View File

@ -54,7 +54,7 @@
<P>If you get this message repeatedly please contact the <!--WEBMASTER//-->webmaster<!--WEBMASTER//-->.</p> <P>If you get this message repeatedly please contact the <!--WEBMASTER//-->webmaster<!--WEBMASTER//-->.</p>
</div> </div>
<div id="footer"> <div id="footer">
<p>Powered by <a href="http://www.ispconfig.org">ISPConfig</a></p> <p>Powered by <a href="https://astroport.com">Astroport</a></p>
</div> </div>
</div> </div>
</body> </body>

View File

@ -54,7 +54,7 @@
<P>If you get this message repeatedly please contact the <!--WEBMASTER//-->webmaster<!--WEBMASTER//-->.</p> <P>If you get this message repeatedly please contact the <!--WEBMASTER//-->webmaster<!--WEBMASTER//-->.</p>
</div> </div>
<div id="footer"> <div id="footer">
<p>Powered by <a href="http://www.ispconfig.org">ISPConfig</a></p> <p>Powered by <a href="https://astroport.com">Astroport</a></p>
</div> </div>
</div> </div>
</body> </body>

View File

@ -54,7 +54,7 @@
<P>Please contact the <!--WEBMASTER//-->webmaster<!--WEBMASTER//--> with any queries.</p> <P>Please contact the <!--WEBMASTER//-->webmaster<!--WEBMASTER//--> with any queries.</p>
</div> </div>
<div id="footer"> <div id="footer">
<p>Powered by <a href="http://www.ispconfig.org">ISPConfig</a></p> <p>Powered by <a href="https://astroport.com">Astroport</a></p>
</div> </div>
</div> </div>
</body> </body>

View File

@ -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;
}
?>

View File

@ -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
?>

View File

@ -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;
}
?>

View File

@ -59,6 +59,7 @@
<div class="container"> <div class="container">
<a class="btn btn-primary" href="./cesium/index.html" target="cesium">Cesium</a> <a class="btn btn-primary" href="./cesium/index.html" target="cesium">Cesium</a>
<a class="btn btn-primary" href="./gchange/index.html" target="gchange">Gchange</a> <a class="btn btn-primary" href="./gchange/index.html" target="gchange">Gchange</a>
<a class="btn btn-primary" href="./DUQR/index.html" target="g1billets">G1Billets</a>
</div> </div>
</nav> </nav>
@ -113,21 +114,24 @@
<div class="col-lg-6 order-lg-2 text-white showcase-img" style="background-image: url('img/bg-showcase-1.jpg');"></div> <div class="col-lg-6 order-lg-2 text-white showcase-img" style="background-image: url('img/bg-showcase-1.jpg');"></div>
<div class="col-lg-6 order-lg-1 my-auto showcase-text"> <div class="col-lg-6 order-lg-1 my-auto showcase-text">
<h2>Embarquez dans un nouvel Univers Numérique et Réel</h2> <h2>Un nouvel Univers Numérique et Réel</h2>
<p class="lead mb-0">Impossible à réaliser <b>jusqu'à aujourd'hui</b>! <p class="lead mb-0">Impossible à réaliser <b>jusqu'à aujourd'hui</b>!
Nous avons mis au point un système d'information totalement décentralisé. Créé par les Humains qui le compose. Nous avons mis au point un système d'information totalement décentralisé. Créé par les Humains qui le compose.
Chacun y est souverain. <b>Forgeron monétaire </b> dans l'Oasis formé par son réseau d'amis. Chacun y est souverain. <b>Forgeron monétaire </b> dans l'Oasis formé par son réseau d'amis.
Ici nul privilège autre que celui consciemment admis.<br><br> <br><br>Ici nul privilège autre que celui consciemment transmit.<br><br>
<h4>Il suffit de se saisir d'une clef pour y entrer !</h4></p> <h4>Commandez votre clef, évadons-nous ensemble !</h4></p>
</div> </div>
</div> </div>
<div class="row no-gutters"> <div class="row no-gutters">
<div class="col-lg-6 text-white showcase-img" style="background-image: url('img/bg-showcase-2.jpg');"></div> <div class="col-lg-6 text-white showcase-img" style="background-image: url('img/bg-showcase-2.jpg');"></div>
<div class="col-lg-6 my-auto showcase-text"> <div class="col-lg-6 my-auto showcase-text">
<h2>Bâtisseurs d'un Monde Libre</h2> <h2>Bâtissons un Monde Libre</h2>
<p class="lead mb-0">Astroport compose le Metavers qui connecte nos mini-mondes <p class="lead mb-0">Astroport fait émerger un Metavers composé des mini-mondes de chacun.
<a href="https://gchange.fr" target="gchange">Gchange organise nos échanges</a> gratuitement !!<br> Tous associés partageant besoins, compétences et connaissances.
<h4>Devenons maitre de son Economie! Entre amis et collaborateurs !</h4></p> <br><br>
<h3>Totalement gratuit!!</h3>
<h4>Maîtres de la valeur et de nos échanges!<br>Nous commerçons entre amis uniquement!</h4></p>
<p class="lead mb-0"><br><a href="./gchange/index.html" target="gchange">Annonces Gchange</a><br></p>
</div> </div>
</div> </div>
</div> </div>
@ -164,8 +168,8 @@
<div class="features-icons-icon d-flex"> <div class="features-icons-icon d-flex">
<i class="icon-basket-loaded m-auto text-primary"></i> <i class="icon-basket-loaded m-auto text-primary"></i>
</div> </div>
<h3>Marchés Artisanaux</h3> <h3>Marché Local Individual</h3>
<p class="lead mb-0">Vendez, achetez, échangez Librement entre amis avec <a href="https://gchange.fr">Gchange</a>.</p> <p class="lead mb-0">Vendez, achetez, échangez Librement entre amis avec <a href="./gchange/index.html">Gchange</a>.</p>
</div> </div>
</div> </div>
<div class="col-lg-5"> <div class="col-lg-5">
@ -173,8 +177,8 @@
<div class="features-icons-icon d-flex"> <div class="features-icons-icon d-flex">
<i class="icon-share m-auto text-primary"></i> <i class="icon-share m-auto text-primary"></i>
</div> </div>
<h3>Stockage Maillé</h3> <h3>Stockage Collectif</h3>
<p class="lead mb-0">Vos amis se chargeront de votre réputation... et de votre stockage <a href="https://git.p2p.legal/axiom-team/astroport#installation">IPFS</a></p> <p class="lead mb-0">Vos amis et vous-même hébergez vos données en essaim <a href="https://git.p2p.legal/axiom-team/astroport#installation">IPFS</a></p>
</div> </div>
</div> </div>
</div> </div>