kc-interface/switchFromNode2Bridge.php
2023-01-13 17:18:05 +00:00

23 lines
735 B
PHP

<?php
$rootPW = $_POST["rootPW"];
$nickname = $_POST["nickname"];
$newTorState = "bridge"
$configureFromNode2BridgeRelay1 = "echo $rootPW | sudo -S sed '0,/ORPort\ 443\nNickname/{s/ORPort\ 443\nNickname\ $nickname\nExitRelay\ 0\nSocksPort\ 0/ORPort\ 443/}' /etc/tor/torrc";
$configureFromNode2BridgeRelay2 = "echo $rootPW | sudo -S sed '0,/#BridgeRelay\ 1/{s/#BridgeRelay\ 1/BridgeRelay\ 1/}' /etc/tor/torrc";
$restartTor = "echo $rootPW | sudo -S systemctl restart tor";
$replaceTorState = "echo $newTorState > torstate.csv"
$output = exec($configureFromNode2BridgeRelay1);
$output2 = exec($configureFromNode2BridgeRelay2);
$output3 = exec($restartTor);
$output4 = exec($replaceTorState);
echo $output3;
echo " oi oi oi ";
?>