the interface of the KaosCube

28 lines
1.6 KiB

  1. <?php
  2. $rootPW = $_POST["rootPW"];
  3. $nodename = $_POST["nodename"];
  4. $newTorState = "node"
  5. $configureHiddenService1 = "echo $rootPW | sudo -S sed -i 's/#HiddenServiceDir\ \/var\/lib\/tor\/hidden_service/HiddenServiceDir\ \/var\/lib\/tor\/$hsname/' /etc/tor/torrc";
  6. $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";
  7. $configureMiddleRelay1 = "echo $rootPW | sudo -S sed '0,/#ORPort\ 443\ NoListen/{s/#ORPort\ 443\ NoListen/ORPort\ 443\nNickname\ $nodename\nExitRelay\ 0\nSocksPort\ 0/}' /etc/tor/torrc";
  8. $configureFromNode2BridgeRelay1 = "echo $rootPW | sudo -S sed '0,/ORPort\ 443\nNickname/{s/ORPort\ 443\nNickname\ $nodename\nExitRelay\ 0\nSocksPort\ 0/ORPort\ 443/}' /etc/tor/torrc";
  9. $configureFromNode2BridgeRelay2 = "echo $rootPW | sudo -S sed '0,/#BridgeRelay\ 1/{s/#BridgeRelay\ 1/BridgeRelay\ 1/}' /etc/tor/torrc";
  10. $configureFromBridge2MiddleRelay1 = "echo $rootPW | sudo -S sed '0,/ORPort\ 443/{s/ORPort\ 443/ORPort\ 443\nNickname\ $nodename\nExitRelay\ 0\nSocksPort\ 0/}' /etc/tor/torrc";
  11. $configureFromBridge2MiddleRelay2 = "echo $rootPW | sudo -S sed '0,/BridgeRelay\ 1/{s/BridgeRelay\ 1/#BridgeRelay\ 1/}' /etc/tor/torrc";
  12. $restartTor = "echo $rootPW | sudo -S systemctl restart tor";
  13. $replaceTorState = "echo $newTorState > torstate.csv"
  14. $output = exec($configureFromBridge2MiddleRelay1);
  15. $output2 = exec($configureFromBridge2MiddleRelay2);
  16. $output3 = exec($restartTor);
  17. $output4 = exec($replaceTorState);
  18. echo $output3;
  19. echo " oi oi oi ";
  20. ?>