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);
if ($lokinetstatus[0] == 0) {
$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 {
$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>';
}
?>
<div class="row">
<div class="col-lg-12">
<div class="panel panel-primary">
<div class="panel-heading"><i class="fa fa-eye-slash fa-fw"></i> Configure Lokinet</div>
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>';
} ?>
<div class="row">
<div class="col-lg-12">
<div class="panel panel-primary">
<div class="panel-heading"><i class="fa fa-eye-slash fa-fw"></i> Configure Lokinet</div>
<!-- /.panel-heading -->
<div class="panel-body">
<!-- Nav tabs -->
<ul class="nav nav-tabs">
<li class="active"><a href="#basic" data-toggle="tab">Daemon Control</a>
<div class="panel-body">
<!-- Nav tabs -->
<ul class="nav nav-tabs">
<li class="active"><a href="#basic" data-toggle="tab">Exit Node Settings</a>
</li>
<li><a href="#daemon" data-toggle="tab">Advanced Console User</a>
<li><a href="#daemon" data-toggle="tab">Daemon Settings</a>
</li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<p><?php echo $status; ?></p>
<p><?php echo "Current Lokinet $lokiversion"; ?></p>
<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>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<p><?php echo $status; ?></p>
<p><?php echo "Current Lokinet $lokiversion"; ?></p>
<div class="tab-pane fade in active" id="basic">
<form role="form" action="?page=save_hostapd_conf" method="POST">
<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="usr">Bootstrap url:</label>
<input type="url" class="form-control" placeholder="https://seed.lokinet.org/lokinet.signed" id="lokinetbootstrap" name="lokinetbootstrap">
<li></li>
<?php
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>Enter Exit Node Data to activate:</h5>
<label for="exitaddress">Exit Address:</label>
<input type="url" class="form-control" placeholder="enter exit address here" id="exitaddress" name="exitaddress">
<label for="exitkey">Exit Key: (optional)</label>
<input type="url" class="form-control" placeholder="enter exit key here" id="exitkey" name="exitkey">
<br/>
<?php
if ($exitstatus[0] == 0) {
echo '<input type="submit" class="btn btn-success" name="StartExit" value="Start Exit" />' , PHP_EOL;
} else {
echo '<input type="submit" class="btn btn-danger" name="StopExit" value="Stop Exit" />' , 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';
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)) {
echo '<input type="submit" class="btn btn-danger" name="ReGenerateLokinet" value="Regenerate .ini" />' , PHP_EOL;
} else {
echo '<input type="submit" class="btn btn-success" name="GenerateLokinet" value="Generate .ini" />' , PHP_EOL;
}
?>
if (file_exists($filename)) {
echo '<input type="submit" class="btn btn-danger" name="ReGenerateLokinet" value="Regenerate .ini" />' , PHP_EOL;
} else {
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" />
<h5><?php echo _("Your development support is greatly appreciated | Loki Address:"); ?></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>
</div>
</div>
</div>
</div>
</div>
</div>
</div><!-- /.tab-content -->
</div><!-- /.panel-body -->
<div class="panel-footer">Contact Loki user groups for the latest bootstrap file location</div>
</div><!-- /.tab-content -->
</div><!-- /.panel-body -->
<div class="panel-footer">Contact Loki user groups on Session to obtain Exit Access</div>
</div><!-- /.panel-primary -->
</div><!-- /.col-lg-12 -->
</div><!-- /.row -->
<?php
}
/**
*
*
@ -599,43 +609,43 @@ function SaveTORAndVPNConfig()
foreach ($return as $line) {
echo htmlspecialchars($line, ENT_QUOTES).'<br />' , PHP_EOL;
}
/* Lokinet script commands start HERE
////
//// LOKINET
////
//*/
/* Lokinet script commands start HERE
////
//// LOKINET
////
//*/
//START
} elseif (isset($_POST['StartDaemon'])) {
exec('sudo /var/lib/lokinet/lokilaunch.sh start');
exec('sudo /var/lib/lokinet/lokilaunch.sh start');
//STOP
} elseif (isset($_POST['StopDaemon'])) {
exec('sudo /var/lib/lokinet/lokilaunch.sh stop');
exec('sudo /var/lib/lokinet/lokilaunch.sh stop');
//GENERATE LOKINET.INI
} elseif (isset($_POST['GenerateLokinet'])) {
?>
?>
<div class="alert alert-success">
Generating Lokinet Configuration
</div>
<?php
$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
} elseif (isset($_POST['ReGenerateLokinet'])) {
?>
?>
<div class="alert alert-success">
Regenerating Lokinet Configuration
</div>
<?php
$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
} elseif (isset($_POST['ApplyLokinetSettings'])) {
?>
?>
<div class="alert alert-danger">
Stopping Lokinet background daemon process.
</div>
@ -644,8 +654,8 @@ function SaveTORAndVPNConfig()
</div>
<?php
$bootstrap = $_POST['lokinetbootstrap'];
$bootstrap=str_replace("'", "", $bootstrap);
$output = shell_exec('sudo /var/lib/lokinet/lokilaunch.sh bootstrap '.$bootstrap.'');
$bootstrap=str_replace("'", "", $bootstrap);
$output = shell_exec('sudo /var/lib/lokinet/lokilaunch.sh bootstrap '.$bootstrap.'');
echo "<pre><strong>$output</strong></pre>";
}

Loading…
Cancel
Save