diff --git a/debian/patches/change-posh-dir.patch b/debian/patches/change-posh-dir.patch index 80d9455..ef59505 100644 --- a/debian/patches/change-posh-dir.patch +++ b/debian/patches/change-posh-dir.patch @@ -2,83 +2,140 @@ Date: Tue, 19 May 2020 15:10:35 +0200 Subject: Change POSH_DIR -Last-Update: 2020-05-19 +Last-Update: 2020-10-28 --- - config.yml | 4 ++-- - resources/scripts/PoshC2.psm1 | 7 ++++--- + 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 | 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 | 2 +- - 11 files changed, 15 insertions(+), 14 deletions(-) + 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/config.yml b/config.yml -index b44e224..b3719a3 100644 ---- a/config.yml -+++ b/config.yml -@@ -5,8 +5,8 @@ - # Server Config - BindIP: '0.0.0.0' - BindPort: 443 --PoshInstallDirectory: "/opt/PoshC2/" --PoshProjectDirectory: "/opt/PoshC2_Project/" -+PoshInstallDirectory: "/usr/share/poshc2/" -+PoshProjectDirectory: "/var/lib/PoshC2_Project/" - - # Database Config - DatabaseType: SQLite # or Postgres +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 105db37..9c9f5d4 100644 +index 3884ee2..5601c43 100644 --- a/resources/scripts/PoshC2.psm1 +++ b/resources/scripts/PoshC2.psm1 -@@ -126,7 +126,8 @@ Function Invoke-PoshC2DockerServer { - - .EXAMPLE - -- Invoke-PoshC2DockerServer -PoshC2Dir "C:\PoshC2" -LocalPoshC2ProjectDir "C:\PoshC2_Project" -DockerPoshC2ProjectDir "/opt/PoshC2_Project" -+ Invoke-PoshC2DockerServer -PoshC2Dir "C:\PoshC2" -+ -LocalPoshC2ProjectDir "C:\PoshC2_Project" -DockerPoshC2ProjectDir "/var/lib/local/PoshC2_Project" - #> - [CmdletBinding()] - Param( -@@ -140,7 +141,7 @@ Function Invoke-PoshC2DockerServer { - +@@ -140,7 +140,7 @@ Function Start-PoshC2Server { + ) -- docker run -ti --rm -p $("$PoshC2Port" + ":" + "$PoshC2Port") -v $("$LocalPoshC2ProjectDir" + ":" + "$DockerPoshC2ProjectDir") -v $("$PoshC2Dir" + ":" + "/opt/PoshC2") nettitude/poshc2 /usr/bin/posh-server -+ docker run -ti --rm -p $("$PoshC2Port" + ":" + "$PoshC2Port") -v $("$LocalPoshC2ProjectDir" + ":" + "$DockerPoshC2ProjectDir") -v $("$PoshC2Dir" + ":" + "/usr/share/poshc2") nettitude/poshc2 /usr/bin/posh-server - } - - Function Invoke-PoshC2DockerHandler { -@@ -189,7 +190,7 @@ Function Invoke-PoshC2DockerHandler { - [string]$User = "" +- 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" + ":" + "$DockerPoshC2ProjectDir") -v $("$PoshC2Dir" + ":" + "/opt/PoshC2") nettitude/poshc2 /usr/bin/posh -u "$User" -+ docker run -ti --rm -v $("$LocalPoshC2ProjectDir" + ":" + "$DockerPoshC2ProjectDir") -v $("$PoshC2Dir" + ":" + "/usr/share/poshc2") nettitude/poshc2 /usr/bin/posh -u "$User" - } - - Function Update-PoshC2 { +- 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 929a208..0312a9f 100644 +index 83fb5f0..8125fe2 100755 --- a/resources/scripts/fpc +++ b/resources/scripts/fpc -@@ -9,7 +9,7 @@ function ctrl_c() { - } - - if [[ -z "${POSHC2_DIR}" ]]; then -- POSH_DIR="/opt/PoshC2" -+ POSH_DIR="/usr/share/poshc2" - else - POSH_DIR=${POSHC2_DIR} - fi +@@ -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 b3e458e..05a295c 100644 +index a0d40da..81bd708 100644 --- a/resources/scripts/fpc.py +++ b/resources/scripts/fpc.py @@ -13,7 +13,7 @@ class Colours: @@ -91,93 +148,152 @@ 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 87f1199..01eac13 100755 +index 9601dfa..d46c85f 100755 --- a/resources/scripts/posh +++ b/resources/scripts/posh -@@ -9,7 +9,7 @@ function ctrl_c() { - } - - if [[ -z "${POSHC2_DIR}" ]]; then -- POSH_DIR="/opt/PoshC2" -+ POSH_DIR="/usr/share/poshc2" - else - POSH_DIR=${POSHC2_DIR} - fi +@@ -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 c20c200..e197ba2 100755 +index 50f73de..27160ac 100755 --- a/resources/scripts/posh-config +++ b/resources/scripts/posh-config -@@ -1,7 +1,7 @@ - #!/bin/bash - - if [[ -z "${POSHC2_DIR}" ]]; then -- POSH_DIR="/opt/PoshC2" -+ POSH_DIR="/usr/share/poshc2" - else - POSH_DIR=${POSHC2_DIR} - fi +@@ -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 50cad8f..8b77c68 100755 +index 0cbddc2..5ae2a44 100755 --- a/resources/scripts/posh-cookie-decrypter +++ b/resources/scripts/posh-cookie-decrypter -@@ -9,7 +9,7 @@ function ctrl_c() { - } - - if [[ -z "${POSHC2_DIR}" ]]; then -- POSH_DIR="/opt/PoshC2" -+ POSH_DIR="/usr/share/poshc2" - else - POSH_DIR=${POSHC2_DIR} - fi +@@ -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 123ed9d..ec2d4bf 100755 +index 6cf8c0e..be967d7 100755 --- a/resources/scripts/posh-docker-server +++ b/resources/scripts/posh-docker-server -@@ -1,7 +1,7 @@ - #!/bin/bash - - if [[ -z "${POSHC2_DIR}" ]]; then -- POSH_DIR="/opt/PoshC2" -+ POSH_DIR="/usr/share/poshc2" - else - POSH_DIR="${POSHC2_DIR}" - fi +@@ -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 230c247..5838a57 100755 +index 9245938..508092e 100755 --- a/resources/scripts/posh-log +++ b/resources/scripts/posh-log -@@ -1,7 +1,7 @@ - #!/bin/bash - - if [[ -z "${POSHC2_DIR}" ]]; then -- POSH_DIR="/opt/PoshC2" -+ POSH_DIR="/usr/share/poshc2" - else - POSH_DIR=${POSHC2_DIR} - fi +@@ -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 bd87038..e354e16 100755 +index ee9a6c3..bbd5e74 100755 --- a/resources/scripts/posh-server +++ b/resources/scripts/posh-server -@@ -9,7 +9,7 @@ function ctrl_c() { - } - - if [[ -z "${POSHC2_DIR}" ]]; then -- POSH_DIR="/opt/PoshC2" -+ POSH_DIR="/usr/share/poshc2" - else - POSH_DIR=${POSHC2_DIR} - fi +@@ -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 839c618..b265574 100755 +index 0bbaf64..6ca06d1 100755 --- a/resources/scripts/posh-service +++ b/resources/scripts/posh-service -@@ -9,7 +9,7 @@ function ctrl_c() { - } - - if [[ -z "${POSHC2_DIR}" ]]; then -- POSH_DIR="/opt/PoshC2" -+ POSH_DIR="/usr/share/poshc2" - else - POSH_DIR=${POSHC2_DIR} - fi +@@ -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 diff --git a/debian/patches/dont-use-pipenv.patch b/debian/patches/dont-use-pipenv.patch index cc1b919..786a9bf 100644 --- a/debian/patches/dont-use-pipenv.patch +++ b/debian/patches/dont-use-pipenv.patch @@ -2,7 +2,7 @@ Date: Tue, 19 May 2020 15:33:59 +0200 Subject: Don't use pipenv -Last-Update: 2020-05-19 +Last-Update: 2020-10-28 --- resources/scripts/fpc | 2 +- resources/scripts/posh | 2 +- @@ -11,53 +11,52 @@ 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/scripts/fpc b/resources/scripts/fpc -index 0312a9f..1e82e87 100644 +index 8125fe2..802a967 100755 --- a/resources/scripts/fpc +++ b/resources/scripts/fpc -@@ -22,7 +22,7 @@ pushd "$POSH_DIR" >/dev/null +@@ -18,6 +18,6 @@ DATABASE_STRING=`cat $POSH_PROJECT_DIR/config.yml | grep "PostgresConnectionStri + pushd "$POSH_DIR" >/dev/null if [ "$?" -eq "0" ]; then - - python3 -m pipenv run python3 "resources/scripts/fpc.py" -p "$POSH_PROJECT_DIR" -d "$DATABASE_TYPE" -pg "$DATABASE_STRING" $@ + python3 "resources/scripts/fpc.py" -p "$POSH_PROJECT_DIR" -d "$DATABASE_TYPE" -pg "$DATABASE_STRING" $@ popd > /dev/null - - fi + fi diff --git a/resources/scripts/posh b/resources/scripts/posh -index 01eac13..41ddf6c 100755 +index d46c85f..7e55f13 100755 --- a/resources/scripts/posh +++ b/resources/scripts/posh -@@ -17,6 +17,6 @@ fi +@@ -14,6 +14,6 @@ get_posh_dir pushd "$POSH_DIR" >/dev/null if [ "$?" -eq "0" ]; then -- python3 -m pipenv run python3 start.py --client "$@" +- sudo python3 -m pipenv run python3 start.py --client "$@" + python3 start.py --client "$@" popd > /dev/null fi diff --git a/resources/scripts/posh-cookie-decrypter b/resources/scripts/posh-cookie-decrypter -index 8b77c68..8223f6a 100755 +index 5ae2a44..206fecb 100755 --- a/resources/scripts/posh-cookie-decrypter +++ b/resources/scripts/posh-cookie-decrypter -@@ -17,7 +17,7 @@ fi +@@ -14,7 +14,7 @@ get_posh_dir pushd $POSH_DIR >/dev/null if [ "$?" -eq "0" ]; then -- python3 -m pipenv run python3 "$POSH_DIR/cookie_decrypter.py" +- sudo python3 -m pipenv run python3 "$POSH_DIR/cookie_decrypter.py" + python3 "$POSH_DIR/cookie_decrypter.py" popd > /dev/null - fi + fi diff --git a/resources/scripts/posh-server b/resources/scripts/posh-server -index e354e16..8f20714 100755 +index bbd5e74..0f6b8be 100755 --- a/resources/scripts/posh-server +++ b/resources/scripts/posh-server -@@ -23,7 +23,7 @@ fi +@@ -15,7 +15,7 @@ get_posh_project_dir pushd $POSH_DIR >/dev/null if [ "$?" -eq "0" ]; then -- python3 -m pipenv run python3 -u start.py --server 2>&1 | tee -a "$POSH_PROJECT_DIR/poshc2_server.log" +- sudo python3 -m pipenv run python3 -u start.py --server 2>&1 | tee -a "$POSH_PROJECT_DIR/poshc2_server.log" + python3 -u start.py --server 2>&1 | tee -a "$POSH_PROJECT_DIR/poshc2_server.log" popd > /dev/null + fi - fi diff --git a/debian/patches/remove-git-usage.patch b/debian/patches/remove-git-usage.patch index 4330d04..4b204f6 100644 --- a/debian/patches/remove-git-usage.patch +++ b/debian/patches/remove-git-usage.patch @@ -10,10 +10,10 @@ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/poshc2/client/Help.py b/poshc2/client/Help.py -index 6aae658..017938e 100644 +index d1a5ac5..f342338 100644 --- a/poshc2/client/Help.py +++ b/poshc2/client/Help.py -@@ -12,12 +12,7 @@ logopic = Colours.GREEN + r""" +@@ -13,12 +13,7 @@ logopic = Colours.GREEN + r""" \/ \/ \/ \/ """ diff --git a/debian/patches/remove-posh-update.patch b/debian/patches/remove-posh-update.patch index d5192cb..6698acf 100644 --- a/debian/patches/remove-posh-update.patch +++ b/debian/patches/remove-posh-update.patch @@ -2,18 +2,18 @@ Date: Tue, 19 May 2020 15:17:23 +0200 Subject: Remove posh-update script -Last-Update: 2020-05-19 +Last-Update: 2020-10-28 --- - resources/scripts/posh-update | 64 ------------------------------------------- - 1 file changed, 64 deletions(-) + resources/scripts/posh-update | 83 ------------------------------------------- + 1 file changed, 83 deletions(-) delete mode 100755 resources/scripts/posh-update diff --git a/resources/scripts/posh-update b/resources/scripts/posh-update deleted file mode 100755 -index faac326..0000000 +index 615d553..0000000 --- a/resources/scripts/posh-update +++ /dev/null -@@ -1,64 +0,0 @@ +@@ -1,83 +0,0 @@ -#!/bin/bash - -# trap ctrl-c and call ctrl_c() @@ -23,16 +23,46 @@ - popd > /dev/null - exit -} -- --if [[ -z "${POSHC2_DIR}" ]]; then -- POSH_DIR="/opt/PoshC2" --else -- POSH_DIR=${POSHC2_DIR} --fi +- +-# A POSIX variable +-OPTIND=1 # Reset in case getopts has been used previously in the shell. +- +-# Initialize our own variables: +-GIT_BRANCH="master" +-MANUAL_BRANCH_SET=false +- +-show_help(){ +- echo "*** PoshC2 Update Script ***" +- echo "Usage:" +- echo "posh-update -b " +- echo "" +- echo "Default is the master branch" +-} +- +-while getopts "h?b:" opt; do +- case "$opt" in +- h|\?) +- show_help +- exit 0 +- ;; +- b) GIT_BRANCH="$OPTARG" +- MANUAL_BRANCH_SET=true +- ;; +- esac +-done +- +- +- +-source /usr/local/bin/_posh-common +-get_posh_dir - -pushd $POSH_DIR >/dev/null - -if [ "$?" -eq "0" ]; then +- +- if [ "$MANUAL_BRANCH_SET" == "false" ]; then +- GIT_BRANCH=`git rev-parse --abbrev-ref HEAD` +- fi - - echo "" - echo -e """\033[92m @@ -47,34 +77,23 @@ - echo "[+] Updating PoshC2" - echo "" - -- echo "" -- echo "[+] Saving changes to Config.py" -- echo "" -- git diff Config.py >> /tmp/PoshC2_Config_Diff.git +- if [[ $(id -u) -ne 0 ]]; then +- echo -e "You must run this installer as root.\nQuitting!"; +- exit 1; +- fi - - echo "" -- echo "[+] Updating Posh Installation to latest master" +- echo "[+] Updating Posh Installation to latest $GIT_BRANCH" - git fetch -- git reset --hard origin/master +- git reset --hard origin/"$GIT_BRANCH" - - echo "" - echo "[+] Running Install script" -- ./Install.sh -- -- echo "" -- echo "[+] Re-applying Config file changes" -- git apply /tmp/PoshC2_Config_Diff.git -- -- if [ "$?" -eq "0" ]; then -- rm /tmp/PoshC2_Config_Diff.git -- else -- echo "[-] Re-applying Config file changes failed, please merge manually from /tmp/PoshC2_Config_Diff.git" -- fi +- ./Install.sh -b "$GIT_BRANCH" -p "$POSH_DIR" - - echo "" - echo "[+] Update complete" - echo "" - - popd > /dev/null -- --fi +-fi diff --git a/debian/patches/rename-Implant-Core.py.patch b/debian/patches/rename-Implant-Core.py.patch index 3ea62f6..01b9987 100644 --- a/debian/patches/rename-Implant-Core.py.patch +++ b/debian/patches/rename-Implant-Core.py.patch @@ -11,10 +11,10 @@ 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/poshc2/server/Implant.py b/poshc2/server/Implant.py -index cfc12ad..6c57b38 100644 +index abf3d3e..ca0ebe0 100644 --- a/poshc2/server/Implant.py +++ b/poshc2/server/Implant.py -@@ -49,7 +49,7 @@ NEWKEY8839394%s4939388YEKWEN +@@ -46,7 +46,7 @@ NEWKEY8839394%s4939388YEKWEN IMGS19459394%s49395491SGMI""" % (self.RandomURI, self.AllBeaconURLs, self.KillDate, self.Sleep, self.Jitter, self.Key, self.AllBeaconImages) with open("%spy_dropper.sh" % (PayloadsDirectory), 'rb') as f: self.PythonImplant = base64.b64encode(f.read()).decode("utf-8")