Merge pull request #37 from necro-nemesis/exit

Add exit data entry into php gui
pull/38/head
necro-nemesis 4 years ago committed by GitHub
commit eb4d935d67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -348,84 +348,94 @@ function DisplayLokinetConfig()
$lokiversion = exec("dpkg -s lokinet | grep '^Version:'", $output); $lokiversion = exec("dpkg -s lokinet | grep '^Version:'", $output);
if ($lokinetstatus[0] == 0) { if ($lokinetstatus[0] == 0) {
$status = '<div class="alert alert-danger alert-dismissable">Lokinet daemon is not running $status = '<div class="alert alert-danger alert-dismissable">Lokinet daemon is not running
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>'; <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>';
} else { } else {
$status = '<div class="alert alert-success alert-dismissable">Lokinet daemon is running $status = '<div class="alert alert-success alert-dismissable">Lokinet daemon is running
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>'; <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>';
} } ?>
<div class="row">
?> <div class="col-lg-12">
<div class="row"> <div class="panel panel-primary">
<div class="col-lg-12"> <div class="panel-heading"><i class="fa fa-eye-slash fa-fw"></i> Configure Lokinet</div>
<div class="panel panel-primary">
<div class="panel-heading"><i class="fa fa-eye-slash fa-fw"></i> Configure Lokinet</div>
<!-- /.panel-heading --> <!-- /.panel-heading -->
<div class="panel-body"> <div class="panel-body">
<!-- Nav tabs --> <!-- Nav tabs -->
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li class="active"><a href="#basic" data-toggle="tab">Daemon Control</a> <li class="active"><a href="#basic" data-toggle="tab">Exit Node Settings</a>
</li> </li>
<li><a href="#daemon" data-toggle="tab">Advanced Console User</a> <li><a href="#daemon" data-toggle="tab">Daemon Settings</a>
</li> </li>
</ul> </ul>
<!-- Tab panes --> <!-- Tab panes -->
<div class="tab-content"> <div class="tab-content">
<p><?php echo $status; ?></p> <p><?php echo $status; ?></p>
<p><?php echo "Current Lokinet $lokiversion"; ?></p> <p><?php echo "Current Lokinet $lokiversion"; ?></p>
<div class="tab-pane fade in active" id="basic"> <div class="tab-pane fade in active" id="basic">
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#instruct">Instructions</button>
<div id="instruct" class="collapse">The 3 buttons below must be armed (red) to connect to Lokinet. If there isn't a current lokinet.ini file found on the system the "Generate.ini" button will be green. The .ini file must be generated prior to connecting to Lokinet by pressing the button which will automatically write the required .ini file. Similarly the absense of a valid bootstrap will be indicated by a green "Bootstrap" button. Applying a bootstrap by pressing the apply button without submitting a valid URL in the textbox area will apply the original default bootstrap in place of one being provided. Stopping the daemon also exits Lokinet. To summarize, if necessary generate the .ini and bootstrap Lokinet then you are able to connect to Lokinet by starting the daemon and letting the network establish itself.
</div>
<form role="form" action="?page=save_hostapd_conf" method="POST"> <form role="form" action="?page=save_hostapd_conf" method="POST">
<div class="row"> <h5>Enter Exit Node Data to activate:</h5>
<div class="form-group col-lg-12"> <label for="exitaddress">Exit Address:</label>
<h5>Enter a valid bootstrap url below and apply to overwrite the current bootstrap:</h5> <input type="url" class="form-control" placeholder="enter exit address here" id="exitaddress" name="exitaddress">
<label for="usr">Bootstrap url:</label> <label for="exitkey">Exit Key: (optional)</label>
<input type="url" class="form-control" placeholder="https://seed.lokinet.org/lokinet.signed" id="lokinetbootstrap" name="lokinetbootstrap"> <input type="url" class="form-control" placeholder="enter exit key here" id="exitkey" name="exitkey">
<li></li> <br/>
<?php <?php
if ($exitstatus[0] == 0) {
if ($lokinetstatus[0] == 0) { echo '<input type="submit" class="btn btn-success" name="StartExit" value="Start Exit" />' , PHP_EOL;
echo '<input type="submit" class="btn btn-success" name="StartDaemon" value="Start Daemon" />' , PHP_EOL; } else {
} else { echo '<input type="submit" class="btn btn-danger" name="StopExit" value="Stop Exit" />' , PHP_EOL;
echo '<input type="submit" class="btn btn-danger" name="StopDaemon" value="Stop Daemon" />' , PHP_EOL; }
} if ($lokinetstatus[0] == 0) {
echo '<input type="submit" class="btn btn-success" name="StartDaemon" value="Start Daemon" />' , PHP_EOL;
} else {
echo '<input type="submit" class="btn btn-danger" name="StopDaemon" value="Stop Daemon" />' , PHP_EOL;
} ?><h5><?php echo _("Your development support is greatly appreciated | Loki Address:"); ?></h5>
<h5><pre><?php echo _("LA8VDcoJgiv2bSiVqyaT6hJ67LXbnQGpf9Uk3zh9ikUKPJUWeYbgsd9gxQ5ptM2hQNSsCaRETQ3GM9FLDe7BGqcm4ve69bh"); ?></pre></h5>
</div>
<div class="tab-pane fade" id="daemon">
<h4>Lokient Daemon</h4>
<div class="row">
<div class="col-lg-12">The 3 buttons below must be armed (red) to connect to Lokinet. If there isn't a current lokinet.ini file found on the system the "Generate.ini" button will be green. The .ini file must be generated prior to connecting to Lokinet by pressing the button which will automatically write the required .ini file. Similarly the absense of a valid bootstrap will be indicated by a green "Bootstrap" button. Applying a bootstrap by pressing the apply button without submitting a valid URL in the textbox area will apply the original default bootstrap in place of one being provided. Stopping the daemon also exits Lokinet. To summarize, if necessary generate the .ini and bootstrap Lokinet then you are able to connect to Lokinet by starting the daemon and letting the network establish itself.
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#instruct">Instructions</button>
<div id="instruct" class="collapse">
</div>
<div class="row">
<div class="form-group col-lg-12">
<h5>Enter a valid bootstrap url below and apply to overwrite the current bootstrap:</h5>
<label for="lokinetbootstrap">Bootstrap url:</label>
<input type="url" class="form-control" placeholder="https://seed.lokinet.org/lokinet.signed" id="lokinetbootstrap" name="lokinetbootstrap">
<br/>
<?php
$filename = '/var/lib/lokinet/lokinet.ini'; $filename = '/var/lib/lokinet/lokinet.ini';
if ($lokinetstatus[0] == 0) {
echo '<input type="submit" class="btn btn-success" name="StartDaemon" value="Start Daemon" />' , PHP_EOL;
} else {
echo '<input type="submit" class="btn btn-danger" name="StopDaemon" value="Stop Daemon" />' , PHP_EOL;
}
if (file_exists($filename)) { if (file_exists($filename)) {
echo '<input type="submit" class="btn btn-danger" name="ReGenerateLokinet" value="Regenerate .ini" />' , PHP_EOL; echo '<input type="submit" class="btn btn-danger" name="ReGenerateLokinet" value="Regenerate .ini" />' , PHP_EOL;
} else { } else {
echo '<input type="submit" class="btn btn-success" name="GenerateLokinet" value="Generate .ini" />' , PHP_EOL; echo '<input type="submit" class="btn btn-success" name="GenerateLokinet" value="Generate .ini" />' , PHP_EOL;
} } ?>
?>
<input type="submit" class="btn btn-danger" name="ApplyLokinetSettings" value="Re-Bootstrap" /> <input type="submit" class="btn btn-danger" name="ApplyLokinetSettings" value="Re-Bootstrap" />
<h5><?php echo _("Your development support is greatly appreciated | Loki Address:"); ?></h5> <h5><?php echo _("Your development support is greatly appreciated | Loki Address:"); ?></h5>
<h5><pre><?php echo _("LA8VDcoJgiv2bSiVqyaT6hJ67LXbnQGpf9Uk3zh9ikUKPJUWeYbgsd9gxQ5ptM2hQNSsCaRETQ3GM9FLDe7BGqcm4ve69bh"); ?></pre></h5> <h5><pre><?php echo _("LA8VDcoJgiv2bSiVqyaT6hJ67LXbnQGpf9Uk3zh9ikUKPJUWeYbgsd9gxQ5ptM2hQNSsCaRETQ3GM9FLDe7BGqcm4ve69bh"); ?></pre></h5>
</div>
</div>
</div>
<div class="tab-pane fade" id="daemon">
<h4>Lokient Daemon</h4>
<div class="row">
<div class="col-lg-12">
<iframe src="includes/webconsole.php" class="webconsole"></iframe>
</div>
</form> </form>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div><!-- /.tab-content -->
</div><!-- /.tab-content --> </div><!-- /.panel-body -->
</div><!-- /.panel-body --> <div class="panel-footer">Contact Loki user groups on Session to obtain Exit Access</div>
<div class="panel-footer">Contact Loki user groups for the latest bootstrap file location</div>
</div><!-- /.panel-primary --> </div><!-- /.panel-primary -->
</div><!-- /.col-lg-12 --> </div><!-- /.col-lg-12 -->
</div><!-- /.row --> </div><!-- /.row -->
<?php <?php
} }
/** /**
* *
* *
@ -599,43 +609,43 @@ function SaveTORAndVPNConfig()
foreach ($return as $line) { foreach ($return as $line) {
echo htmlspecialchars($line, ENT_QUOTES).'<br />' , PHP_EOL; echo htmlspecialchars($line, ENT_QUOTES).'<br />' , PHP_EOL;
} }
/* Lokinet script commands start HERE /* Lokinet script commands start HERE
//// ////
//// LOKINET //// LOKINET
//// ////
//*/ //*/
//START //START
} elseif (isset($_POST['StartDaemon'])) { } elseif (isset($_POST['StartDaemon'])) {
exec('sudo /var/lib/lokinet/lokilaunch.sh start'); exec('sudo /var/lib/lokinet/lokilaunch.sh start');
//STOP //STOP
} elseif (isset($_POST['StopDaemon'])) { } elseif (isset($_POST['StopDaemon'])) {
exec('sudo /var/lib/lokinet/lokilaunch.sh stop'); exec('sudo /var/lib/lokinet/lokilaunch.sh stop');
//GENERATE LOKINET.INI //GENERATE LOKINET.INI
} elseif (isset($_POST['GenerateLokinet'])) { } elseif (isset($_POST['GenerateLokinet'])) {
?> ?>
<div class="alert alert-success"> <div class="alert alert-success">
Generating Lokinet Configuration Generating Lokinet Configuration
</div> </div>
<?php <?php
$output = shell_exec('sudo /var/lib/lokinet/lokilaunch.sh gen'); $output = shell_exec('sudo /var/lib/lokinet/lokilaunch.sh gen');
echo "<pre><strong>$output</strong></pre>"; echo "<pre><strong>$output</strong></pre>";
//REGENERATE LOKINET.INI //REGENERATE LOKINET.INI
} elseif (isset($_POST['ReGenerateLokinet'])) { } elseif (isset($_POST['ReGenerateLokinet'])) {
?> ?>
<div class="alert alert-success"> <div class="alert alert-success">
Regenerating Lokinet Configuration Regenerating Lokinet Configuration
</div> </div>
<?php <?php
$output = shell_exec('sudo /var/lib/lokinet/lokilaunch.sh gen'); $output = shell_exec('sudo /var/lib/lokinet/lokilaunch.sh gen');
echo "<pre><strong>$output</strong></pre>"; echo "<pre><strong>$output</strong></pre>";
//APPLY LOKINET-BOOTSTRAP //APPLY LOKINET-BOOTSTRAP
} elseif (isset($_POST['ApplyLokinetSettings'])) { } elseif (isset($_POST['ApplyLokinetSettings'])) {
?> ?>
<div class="alert alert-danger"> <div class="alert alert-danger">
Stopping Lokinet background daemon process. Stopping Lokinet background daemon process.
</div> </div>
@ -644,8 +654,8 @@ function SaveTORAndVPNConfig()
</div> </div>
<?php <?php
$bootstrap = $_POST['lokinetbootstrap']; $bootstrap = $_POST['lokinetbootstrap'];
$bootstrap=str_replace("'", "", $bootstrap); $bootstrap=str_replace("'", "", $bootstrap);
$output = shell_exec('sudo /var/lib/lokinet/lokilaunch.sh bootstrap '.$bootstrap.''); $output = shell_exec('sudo /var/lib/lokinet/lokilaunch.sh bootstrap '.$bootstrap.'');
echo "<pre><strong>$output</strong></pre>"; echo "<pre><strong>$output</strong></pre>";
} }

Loading…
Cancel
Save