Codebase list poshc2 / 98c26d1 debian / patches / change-posh-dir.patch
98c26d1

Tree @98c26d1 (Download .tar.gz)

change-posh-dir.patch @98c26d1raw · history · blame

From: Sophie Brun <[email protected]>
Date: Tue, 19 May 2020 15:10:35 +0200
Subject: Change POSH_DIR

Last-Update: 2020-10-28
---
 README.md                               | 4 ++--
 poshc2/server/Config.py                 | 2 +-
 resources/config-template.yml           | 2 +-
 resources/scripts/PoshC2.psm1           | 6 +++---
 resources/scripts/_posh-common          | 6 +++---
 resources/scripts/fpc                   | 2 +-
 resources/scripts/fpc.py                | 2 +-
 resources/scripts/posh                  | 2 +-
 resources/scripts/posh-config           | 2 +-
 resources/scripts/posh-cookie-decrypter | 4 ++--
 resources/scripts/posh-docker-server    | 2 +-
 resources/scripts/posh-log              | 2 +-
 resources/scripts/posh-project          | 2 +-
 resources/scripts/posh-server           | 2 +-
 resources/scripts/posh-service          | 4 ++--
 resources/scripts/posh-service-ansible  | 2 +-
 resources/scripts/poshc2.service        | 4 ++--
 resources/scripts/sharpsocks            | 2 +-
 18 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/README.md b/README.md
index 23ec4a2..9877a98 100644
--- a/README.md
+++ b/README.md
@@ -86,7 +86,7 @@ You can also run PoshC2 using Docker, this allows more stable and running and en
 
 The Docker install does not clone PoshC2 as the PoshC2 images on Docker Hub are used, so only a minimal install of some dependencies and scripts are performed.
 
-To start with, install Docker on the host and then add the PoshC2 projects directory to Docker as a shared directory if required for your OS. By default this is **/var/poshc2** on *nix and **/private/var/poshc2** on Mac.
+To start with, install Docker on the host and then add the PoshC2 projects directory to Docker as a shared directory if required for your OS. By default this is **/var/lib/poshc2** on *nix and **/private/var/poshc2** on Mac.
 
 ### Kali based hosts
 
@@ -213,4 +213,4 @@ However note that this will overwrite any local changes to files, such as change
 
 This software should only be used for **authorised** testing activity and not for malicious use.
 
-By downloading this software you are accepting the terms of use and the licensing agreement.
\ No newline at end of file
+By downloading this software you are accepting the terms of use and the licensing agreement.
diff --git a/poshc2/server/Config.py b/poshc2/server/Config.py
index 0e70581..e54f6fa 100644
--- a/poshc2/server/Config.py
+++ b/poshc2/server/Config.py
@@ -3,7 +3,7 @@ from poshc2.server.UrlConfig import UrlConfig
 from poshc2.Utils import string_to_array
 from poshc2.server.database.DBType import DBType
 
-POSH_PROJECTS_DIR = "/var/poshc2/"
+POSH_PROJECTS_DIR = "/var/lib/poshc2/"
 
 if not os.path.exists(f"{POSH_PROJECTS_DIR}CURRENT_PROJECT"):
     print("PoshC2 current project file does not exist, please run posh-project")
diff --git a/resources/config-template.yml b/resources/config-template.yml
index cc383c4..cabd76c 100644
--- a/resources/config-template.yml
+++ b/resources/config-template.yml
@@ -38,4 +38,4 @@ SocksHost: "http://127.0.0.1:49031"
 
 # PBind Options
 PBindPipeName: "jaccdpqnvbrrxlaf"
-PBindSecret: "mtkn4"
\ No newline at end of file
+PBindSecret: "mtkn4"
diff --git a/resources/scripts/PoshC2.psm1 b/resources/scripts/PoshC2.psm1
index 3884ee2..5601c43 100644
--- a/resources/scripts/PoshC2.psm1
+++ b/resources/scripts/PoshC2.psm1
@@ -140,7 +140,7 @@ Function Start-PoshC2Server {
 
     )
 
-    docker run --rm -p $("$PoshC2Port:$PoshC2Port") -v $("$LocalPoshC2ProjectDir:/var/poshc2") $PoshC2DockerImage:$DockerTag /usr/local/bin/posh-server
+    docker run --rm -p $("$PoshC2Port:$PoshC2Port") -v $("$LocalPoshC2ProjectDir:/var/lib/poshc2") $PoshC2DockerImage:$DockerTag /usr/bin/posh-server
 }
 
 Function Start-PoshC2DockerHandler {
@@ -188,10 +188,10 @@ Function Start-PoshC2DockerHandler {
         [string]$DockerTag = "latest"
     )
 
-    docker run -ti --rm -v $("$LocalPoshC2ProjectDir:/var/poshc2") $PoshC2DockerImage:$DockerTag /usr/local/bin/posh -u "$User"
+    docker run -ti --rm -v $("$LocalPoshC2ProjectDir:/var/lib/poshc2") $PoshC2DockerImage:$DockerTag /usr/bin/posh -u "$User"
 }
 
 Export-ModuleMember -Function Build-PoshC2DockerImage -Alias posh-docker-build
 Export-ModuleMember -Function Clean-PoshC2DockerState -Alias posh-docker-clean
 Export-ModuleMember -Function Start-PoshC2DockerServer -Alias posh-server
-Export-ModuleMember -Function Start-PoshC2DockerHandler -Alias posh
\ No newline at end of file
+Export-ModuleMember -Function Start-PoshC2DockerHandler -Alias posh
diff --git a/resources/scripts/_posh-common b/resources/scripts/_posh-common
index bf30fbe..4694483 100644
--- a/resources/scripts/_posh-common
+++ b/resources/scripts/_posh-common
@@ -4,12 +4,12 @@ get_posh_projects_dir(){
     if [ "$(uname)" == "Darwin" ]; then
         POSH_PROJECTS_DIR="/private/var/poshc2"
     else
-        POSH_PROJECTS_DIR="/var/poshc2"
+        POSH_PROJECTS_DIR="/var/lib/poshc2"
     fi
 }
 
 get_docker_posh_projects_dir(){
-    DOCKER_POSH_PROJECTS_DIR="/var/poshc2"
+    DOCKER_POSH_PROJECTS_DIR="/var/lib/poshc2"
 }
 
 get_posh_dir() {
@@ -38,4 +38,4 @@ get_posh_project_dir(){
 
 get_docker_image_name(){
     DOCKER_IMAGE_NAME="m0rv4i/poshc2"
-}
\ No newline at end of file
+}
diff --git a/resources/scripts/fpc b/resources/scripts/fpc
index 83fb5f0..8125fe2 100755
--- a/resources/scripts/fpc
+++ b/resources/scripts/fpc
@@ -8,7 +8,7 @@ function ctrl_c() {
     exit
 }
 
-source /usr/local/bin/_posh-common
+source /usr/bin/_posh-common
 get_posh_dir
 get_posh_project_dir
 
diff --git a/resources/scripts/fpc.py b/resources/scripts/fpc.py
index a0d40da..81bd708 100644
--- a/resources/scripts/fpc.py
+++ b/resources/scripts/fpc.py
@@ -13,7 +13,7 @@ class Colours:
 
 def create_arg_parser():
     parser = argparse.ArgumentParser(description='Find Posh Command - Search for a PoshC2 Command Output')
-    parser.add_argument("-p", "--project", help='The PoshC2 project dir', default = '/opt/PoshC2_Project')
+    parser.add_argument("-p", "--project", help='The PoshC2 project dir', default = '/var/lib/PoshC2_Project')
     parser.add_argument("-d", "--database_type", help="The database type (SQLite/Postgres)", default = 'SQLite')
     parser.add_argument("-pg", "--postgres_string", help="The postgres connection string (if using postgres)", default = '')
     parser.add_argument("-c", "--command", help='The command to search for', default = '%')
diff --git a/resources/scripts/posh b/resources/scripts/posh
index 9601dfa..d46c85f 100755
--- a/resources/scripts/posh
+++ b/resources/scripts/posh
@@ -8,7 +8,7 @@ function ctrl_c() {
     exit
 }
 
-source /usr/local/bin/_posh-common
+source /usr/bin/_posh-common
 get_posh_dir
 
 pushd "$POSH_DIR" >/dev/null
diff --git a/resources/scripts/posh-config b/resources/scripts/posh-config
index 50f73de..27160ac 100755
--- a/resources/scripts/posh-config
+++ b/resources/scripts/posh-config
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-source /usr/local/bin/_posh-common
+source /usr/bin/_posh-common
 get_posh_project_dir
 
 if [[ "$EDITOR" != "" ]]; then
diff --git a/resources/scripts/posh-cookie-decrypter b/resources/scripts/posh-cookie-decrypter
index 0cbddc2..5ae2a44 100755
--- a/resources/scripts/posh-cookie-decrypter
+++ b/resources/scripts/posh-cookie-decrypter
@@ -8,9 +8,9 @@ function ctrl_c() {
     exit
 }
 
-source /usr/local/bin/_posh-common
+source /usr/bin/_posh-common
 get_posh_dir
-
+    
 pushd $POSH_DIR  >/dev/null
 if [ "$?" -eq "0" ]; then
 
diff --git a/resources/scripts/posh-docker-server b/resources/scripts/posh-docker-server
index 6cf8c0e..be967d7 100755
--- a/resources/scripts/posh-docker-server
+++ b/resources/scripts/posh-docker-server
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-source /usr/local/bin/_posh-common
+source /usr/bin/_posh-common
 get_posh_project_dir
 get_posh_projects_dir
 get_docker_posh_projects_dir
diff --git a/resources/scripts/posh-log b/resources/scripts/posh-log
index 9245938..508092e 100755
--- a/resources/scripts/posh-log
+++ b/resources/scripts/posh-log
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-source /usr/local/bin/_posh-common
+source /usr/bin/_posh-common
 get_posh_project_dir
 
 tail -n 5000 -f "$POSH_PROJECT_DIR/poshc2_server.log" 2>/dev/null\
diff --git a/resources/scripts/posh-project b/resources/scripts/posh-project
index 23369d5..f091ca1 100755
--- a/resources/scripts/posh-project
+++ b/resources/scripts/posh-project
@@ -8,7 +8,7 @@ function ctrl_c() {
     exit
 }
 
-source /usr/local/bin/_posh-common
+source /usr/bin/_posh-common
 get_posh_projects_dir
 
 if [ "$1" == "-n" ]; then
diff --git a/resources/scripts/posh-server b/resources/scripts/posh-server
index ee9a6c3..bbd5e74 100755
--- a/resources/scripts/posh-server
+++ b/resources/scripts/posh-server
@@ -8,7 +8,7 @@ function ctrl_c() {
     exit
 }
 
-source /usr/local/bin/_posh-common
+source /usr/bin/_posh-common
 get_posh_dir
 get_posh_project_dir
 
diff --git a/resources/scripts/posh-service b/resources/scripts/posh-service
index 0bbaf64..6ca06d1 100755
--- a/resources/scripts/posh-service
+++ b/resources/scripts/posh-service
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-source /usr/local/bin/_posh-common
+source /usr/bin/_posh-common
 get_posh_project_dir
 
 sudo systemctl enable poshc2.service >/dev/null
@@ -12,5 +12,5 @@ while [[ $x -le 10 ]]; do
     sleep 1s
     x=$(( $x + 1 ))
 done
-/usr/local/bin/posh-log
+/usr/bin/posh-log
 
diff --git a/resources/scripts/posh-service-ansible b/resources/scripts/posh-service-ansible
index 7b7b658..e5d976b 100755
--- a/resources/scripts/posh-service-ansible
+++ b/resources/scripts/posh-service-ansible
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-source /usr/local/bin/_posh-common
+source /usr/bin/_posh-common
 get_posh_project_dir
 
 sudo systemctl enable poshc2.service >/dev/null
diff --git a/resources/scripts/poshc2.service b/resources/scripts/poshc2.service
index b389bf8..4834180 100644
--- a/resources/scripts/poshc2.service
+++ b/resources/scripts/poshc2.service
@@ -4,7 +4,7 @@ Description=PoshC2 Server
 [Service]
 Type=simple
 User=root
-ExecStart=/usr/local/bin/posh-server
+ExecStart=/usr/bin/posh-server
 
 [Install]
-WantedBy=default.target
\ No newline at end of file
+WantedBy=default.target
diff --git a/resources/scripts/sharpsocks b/resources/scripts/sharpsocks
index 4a4cc95..d569ae8 100755
--- a/resources/scripts/sharpsocks
+++ b/resources/scripts/sharpsocks
@@ -8,7 +8,7 @@ function ctrl_c() {
     exit
 }
 
-source /usr/local/bin/_posh-common
+source /usr/bin/_posh-common
 get_posh_dir
 
 pushd "$POSH_DIR" >/dev/null