From 4fcb56262b01cecf394a908584bc961101e1b260 Mon Sep 17 00:00:00 2001 From: corsaronero Date: Mon, 9 Jan 2023 23:20:24 +0000 Subject: [PATCH] added sed command to replace things in configs --- createNodeAService.php | 8 ++++++-- torrc | 26 +++++++++++++------------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/createNodeAService.php b/createNodeAService.php index 191c657..3b64c80 100644 --- a/createNodeAService.php +++ b/createNodeAService.php @@ -5,8 +5,12 @@ $hsname = $_POST["hsname"]; $nodename = $_POST["nodename"]; $newTorState = "node" -$configureHiddenService = "echo $rootPW | sudo -S "; -$confiureNode = "echo $rootPW | sudo -S "; +$configureHiddenService1 = "echo $rootPW | sudo -S sed -i 's/#HiddenServiceDir\ \/var\/lib\/tor\/hidden_service/HiddenServiceDir\ \/var\/lib\/tor\/$hsname/' torrc"; +$configureHiddenService1 = "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/}' torrc"; + + + +$confiureNode = "echo $rootPW | sudo -S sed -i "; $restartTor = "echo $rootPW | sudo -S "; $replaceTorState = "echo $newTorState > torstate.csv" diff --git a/torrc b/torrc index ac6ba61..857be30 100644 --- a/torrc +++ b/torrc @@ -1,5 +1,5 @@ ## Configuration file for a typical Tor user -## Last updated 9 October 2013 for Tor 0.2.5.2-alpha. +## Last updated 22 April 2012 for Tor 0.2.3.14-alpha. ## (may or may not work for much older or much newer versions of Tor.) ## ## Lines that begin with "## " try to explain what's going on. Lines @@ -16,7 +16,7 @@ ## configure one below. Set "SocksPort 0" if you plan to run Tor only ## as a relay, and not make any local application connections yourself. #SocksPort 9050 # Default: Bind to localhost:9050 for local connections. -#SocksPort 192.168.0.1:9100 # Bind to this address:port too. +#SocksPort 192.168.0.1:9100 # Bind to this adddress:port too. ## Entry policies to allow/deny SOCKS requests based on IP address. ## First entry that matches wins. If no SocksPolicy is set, we accept @@ -38,7 +38,7 @@ ## Send every possible message to /var/log/tor/debug.log #Log debug file /var/log/tor/debug.log ## Use the system log instead of Tor's logfiles -#Log notice syslog +Log notice syslog ## To send all messages to stderr: #Log debug stderr @@ -49,7 +49,7 @@ ## The directory for keeping all the keys/etc. By default, we store ## things in $HOME/.tor on Unix, and in Application Data\tor on Windows. -#DataDirectory /var/lib/tor +DataDirectory /var/lib/tor ## The port on which Tor will listen for local connections from Tor ## controller applications, as documented in control-spec.txt. @@ -71,9 +71,12 @@ #HiddenServiceDir /var/lib/tor/hidden_service/ #HiddenServicePort 80 127.0.0.1:80 -HiddenServiceDir /var/lib/tor/kaos/ -HiddenServicePort 80 127.0.0.1:80 -HiddenServicePort 22 127.0.0.1:22 +#HiddenServiceDir /var/lib/tor/other_hidden_service/ +#HiddenServicePort 80 127.0.0.1:80 +#HiddenServicePort 22 127.0.0.1:22 + +#HidServAuth tpxxw5d3mjbqdve2.onion J+jCSmEkGqRuyOsHGg5ghx + ################ This section is just for relays ##################### # @@ -120,12 +123,9 @@ HiddenServicePort 22 127.0.0.1:22 ## is per month) #AccountingStart month 3 15:00 -## Administrative contact information for this relay or bridge. This line -## can be used to contact you if your relay or bridge is misconfigured or -## something else goes wrong. Note that we archive and publish all -## descriptors containing these lines and that Google indexes them, so -## spammers might also collect them. You may want to obscure the fact that -## it's an email address and/or generate a new address for this purpose. +## Contact info to be published in the directory, so we can contact you +## if your relay is misconfigured or something else goes wrong. Google +## indexes this, so spammers might also collect it. #ContactInfo Random Person ## You might also include your PGP or GPG fingerprint if you have one: #ContactInfo 0xFFFFFFFF Random Person