kc-interface/initTorAndHS.php

31 lines
929 B
PHP
Raw Permalink Normal View History

<?php
$rootPW = $_POST["rootPW"];
$hsname = $_POST["hsname"];
$newTorState = "hs"
$configureHiddenService1 = "echo $rootPW | sudo -S sed -i 's/#HiddenServiceDir\ \/var\/lib\/tor\/hidden_service/HiddenServiceDir\ \/var\/lib\/tor\/$hsname/' /etc/tor/torrc";
$configureHiddenService2 = "echo $rootPW | sudo -S sed '0,/#HiddenServiceP/{s/#HiddenServicePort\ 80 127.0.0.1:80/HiddenServicePort 80 127.0.0.1:80\nHiddenServicePort 22 127.0.0.1:22/}' /etc/tor/torrc";
$restartTor = "echo $rootPW | sudo -S systemctl restart tor";
$replaceTorState = "echo $newTorState > torstate.csv"
$writeTheNewGeneratedAddress = "echo $rootPW | sudo -S cat /var/lib/tor/$hsname/hostname > hshostname.txt"
$output = exec($configureHiddenService1);
$output1 = exec($configureHiddenService2);
$output2 = exec($restartTor);
$output3 = exec($replaceTorState);
$output4 = exec($writeTheNewGeneratedAddress);
echo $output3;
echo " oi oi oi ";
?>