Codebase list poshc2 / 98c26d1
Refresh patches Sophie Brun 3 years ago
5 changed file(s) with 312 addition(s) and 178 deletion(s). Raw diff Collapse all Expand all
11 Date: Tue, 19 May 2020 15:10:35 +0200
22 Subject: Change POSH_DIR
33
4 Last-Update: 2020-05-19
4 Last-Update: 2020-10-28
55 ---
6 config.yml | 4 ++--
7 resources/scripts/PoshC2.psm1 | 7 ++++---
6 README.md | 4 ++--
7 poshc2/server/Config.py | 2 +-
8 resources/config-template.yml | 2 +-
9 resources/scripts/PoshC2.psm1 | 6 +++---
10 resources/scripts/_posh-common | 6 +++---
811 resources/scripts/fpc | 2 +-
912 resources/scripts/fpc.py | 2 +-
1013 resources/scripts/posh | 2 +-
1114 resources/scripts/posh-config | 2 +-
12 resources/scripts/posh-cookie-decrypter | 2 +-
15 resources/scripts/posh-cookie-decrypter | 4 ++--
1316 resources/scripts/posh-docker-server | 2 +-
1417 resources/scripts/posh-log | 2 +-
18 resources/scripts/posh-project | 2 +-
1519 resources/scripts/posh-server | 2 +-
16 resources/scripts/posh-service | 2 +-
17 11 files changed, 15 insertions(+), 14 deletions(-)
20 resources/scripts/posh-service | 4 ++--
21 resources/scripts/posh-service-ansible | 2 +-
22 resources/scripts/poshc2.service | 4 ++--
23 resources/scripts/sharpsocks | 2 +-
24 18 files changed, 26 insertions(+), 26 deletions(-)
1825
19 diff --git a/config.yml b/config.yml
20 index b44e224..b3719a3 100644
21 --- a/config.yml
22 +++ b/config.yml
23 @@ -5,8 +5,8 @@
24 # Server Config
25 BindIP: '0.0.0.0'
26 BindPort: 443
27 -PoshInstallDirectory: "/opt/PoshC2/"
28 -PoshProjectDirectory: "/opt/PoshC2_Project/"
29 +PoshInstallDirectory: "/usr/share/poshc2/"
30 +PoshProjectDirectory: "/var/lib/PoshC2_Project/"
31
32 # Database Config
33 DatabaseType: SQLite # or Postgres
26 diff --git a/README.md b/README.md
27 index 23ec4a2..9877a98 100644
28 --- a/README.md
29 +++ b/README.md
30 @@ -86,7 +86,7 @@ You can also run PoshC2 using Docker, this allows more stable and running and en
31
32 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.
33
34 -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.
35 +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.
36
37 ### Kali based hosts
38
39 @@ -213,4 +213,4 @@ However note that this will overwrite any local changes to files, such as change
40
41 This software should only be used for **authorised** testing activity and not for malicious use.
42
43 -By downloading this software you are accepting the terms of use and the licensing agreement.
44 \ No newline at end of file
45 +By downloading this software you are accepting the terms of use and the licensing agreement.
46 diff --git a/poshc2/server/Config.py b/poshc2/server/Config.py
47 index 0e70581..e54f6fa 100644
48 --- a/poshc2/server/Config.py
49 +++ b/poshc2/server/Config.py
50 @@ -3,7 +3,7 @@ from poshc2.server.UrlConfig import UrlConfig
51 from poshc2.Utils import string_to_array
52 from poshc2.server.database.DBType import DBType
53
54 -POSH_PROJECTS_DIR = "/var/poshc2/"
55 +POSH_PROJECTS_DIR = "/var/lib/poshc2/"
56
57 if not os.path.exists(f"{POSH_PROJECTS_DIR}CURRENT_PROJECT"):
58 print("PoshC2 current project file does not exist, please run posh-project")
59 diff --git a/resources/config-template.yml b/resources/config-template.yml
60 index cc383c4..cabd76c 100644
61 --- a/resources/config-template.yml
62 +++ b/resources/config-template.yml
63 @@ -38,4 +38,4 @@ SocksHost: "http://127.0.0.1:49031"
64
65 # PBind Options
66 PBindPipeName: "jaccdpqnvbrrxlaf"
67 -PBindSecret: "mtkn4"
68 \ No newline at end of file
69 +PBindSecret: "mtkn4"
3470 diff --git a/resources/scripts/PoshC2.psm1 b/resources/scripts/PoshC2.psm1
35 index 105db37..9c9f5d4 100644
71 index 3884ee2..5601c43 100644
3672 --- a/resources/scripts/PoshC2.psm1
3773 +++ b/resources/scripts/PoshC2.psm1
38 @@ -126,7 +126,8 @@ Function Invoke-PoshC2DockerServer {
39
40 .EXAMPLE
41
42 - Invoke-PoshC2DockerServer -PoshC2Dir "C:\PoshC2" -LocalPoshC2ProjectDir "C:\PoshC2_Project" -DockerPoshC2ProjectDir "/opt/PoshC2_Project"
43 + Invoke-PoshC2DockerServer -PoshC2Dir "C:\PoshC2"
44 + -LocalPoshC2ProjectDir "C:\PoshC2_Project" -DockerPoshC2ProjectDir "/var/lib/local/PoshC2_Project"
45 #>
46 [CmdletBinding()]
47 Param(
48 @@ -140,7 +141,7 @@ Function Invoke-PoshC2DockerServer {
49
74 @@ -140,7 +140,7 @@ Function Start-PoshC2Server {
75
5076 )
5177
52 - docker run -ti --rm -p $("$PoshC2Port" + ":" + "$PoshC2Port") -v $("$LocalPoshC2ProjectDir" + ":" + "$DockerPoshC2ProjectDir") -v $("$PoshC2Dir" + ":" + "/opt/PoshC2") nettitude/poshc2 /usr/bin/posh-server
53 + docker run -ti --rm -p $("$PoshC2Port" + ":" + "$PoshC2Port") -v $("$LocalPoshC2ProjectDir" + ":" + "$DockerPoshC2ProjectDir") -v $("$PoshC2Dir" + ":" + "/usr/share/poshc2") nettitude/poshc2 /usr/bin/posh-server
54 }
55
56 Function Invoke-PoshC2DockerHandler {
57 @@ -189,7 +190,7 @@ Function Invoke-PoshC2DockerHandler {
58 [string]$User = ""
78 - docker run --rm -p $("$PoshC2Port:$PoshC2Port") -v $("$LocalPoshC2ProjectDir:/var/poshc2") $PoshC2DockerImage:$DockerTag /usr/local/bin/posh-server
79 + docker run --rm -p $("$PoshC2Port:$PoshC2Port") -v $("$LocalPoshC2ProjectDir:/var/lib/poshc2") $PoshC2DockerImage:$DockerTag /usr/bin/posh-server
80 }
81
82 Function Start-PoshC2DockerHandler {
83 @@ -188,10 +188,10 @@ Function Start-PoshC2DockerHandler {
84 [string]$DockerTag = "latest"
5985 )
6086
61 - docker run -ti --rm -v $("$LocalPoshC2ProjectDir" + ":" + "$DockerPoshC2ProjectDir") -v $("$PoshC2Dir" + ":" + "/opt/PoshC2") nettitude/poshc2 /usr/bin/posh -u "$User"
62 + docker run -ti --rm -v $("$LocalPoshC2ProjectDir" + ":" + "$DockerPoshC2ProjectDir") -v $("$PoshC2Dir" + ":" + "/usr/share/poshc2") nettitude/poshc2 /usr/bin/posh -u "$User"
63 }
64
65 Function Update-PoshC2 {
87 - docker run -ti --rm -v $("$LocalPoshC2ProjectDir:/var/poshc2") $PoshC2DockerImage:$DockerTag /usr/local/bin/posh -u "$User"
88 + docker run -ti --rm -v $("$LocalPoshC2ProjectDir:/var/lib/poshc2") $PoshC2DockerImage:$DockerTag /usr/bin/posh -u "$User"
89 }
90
91 Export-ModuleMember -Function Build-PoshC2DockerImage -Alias posh-docker-build
92 Export-ModuleMember -Function Clean-PoshC2DockerState -Alias posh-docker-clean
93 Export-ModuleMember -Function Start-PoshC2DockerServer -Alias posh-server
94 -Export-ModuleMember -Function Start-PoshC2DockerHandler -Alias posh
95 \ No newline at end of file
96 +Export-ModuleMember -Function Start-PoshC2DockerHandler -Alias posh
97 diff --git a/resources/scripts/_posh-common b/resources/scripts/_posh-common
98 index bf30fbe..4694483 100644
99 --- a/resources/scripts/_posh-common
100 +++ b/resources/scripts/_posh-common
101 @@ -4,12 +4,12 @@ get_posh_projects_dir(){
102 if [ "$(uname)" == "Darwin" ]; then
103 POSH_PROJECTS_DIR="/private/var/poshc2"
104 else
105 - POSH_PROJECTS_DIR="/var/poshc2"
106 + POSH_PROJECTS_DIR="/var/lib/poshc2"
107 fi
108 }
109
110 get_docker_posh_projects_dir(){
111 - DOCKER_POSH_PROJECTS_DIR="/var/poshc2"
112 + DOCKER_POSH_PROJECTS_DIR="/var/lib/poshc2"
113 }
114
115 get_posh_dir() {
116 @@ -38,4 +38,4 @@ get_posh_project_dir(){
117
118 get_docker_image_name(){
119 DOCKER_IMAGE_NAME="m0rv4i/poshc2"
120 -}
121 \ No newline at end of file
122 +}
66123 diff --git a/resources/scripts/fpc b/resources/scripts/fpc
67 index 929a208..0312a9f 100644
124 index 83fb5f0..8125fe2 100755
68125 --- a/resources/scripts/fpc
69126 +++ b/resources/scripts/fpc
70 @@ -9,7 +9,7 @@ function ctrl_c() {
71 }
72
73 if [[ -z "${POSHC2_DIR}" ]]; then
74 - POSH_DIR="/opt/PoshC2"
75 + POSH_DIR="/usr/share/poshc2"
76 else
77 POSH_DIR=${POSHC2_DIR}
78 fi
127 @@ -8,7 +8,7 @@ function ctrl_c() {
128 exit
129 }
130
131 -source /usr/local/bin/_posh-common
132 +source /usr/bin/_posh-common
133 get_posh_dir
134 get_posh_project_dir
135
79136 diff --git a/resources/scripts/fpc.py b/resources/scripts/fpc.py
80 index b3e458e..05a295c 100644
137 index a0d40da..81bd708 100644
81138 --- a/resources/scripts/fpc.py
82139 +++ b/resources/scripts/fpc.py
83140 @@ -13,7 +13,7 @@ class Colours:
90147 parser.add_argument("-pg", "--postgres_string", help="The postgres connection string (if using postgres)", default = '')
91148 parser.add_argument("-c", "--command", help='The command to search for', default = '%')
92149 diff --git a/resources/scripts/posh b/resources/scripts/posh
93 index 87f1199..01eac13 100755
150 index 9601dfa..d46c85f 100755
94151 --- a/resources/scripts/posh
95152 +++ b/resources/scripts/posh
96 @@ -9,7 +9,7 @@ function ctrl_c() {
97 }
98
99 if [[ -z "${POSHC2_DIR}" ]]; then
100 - POSH_DIR="/opt/PoshC2"
101 + POSH_DIR="/usr/share/poshc2"
102 else
103 POSH_DIR=${POSHC2_DIR}
104 fi
153 @@ -8,7 +8,7 @@ function ctrl_c() {
154 exit
155 }
156
157 -source /usr/local/bin/_posh-common
158 +source /usr/bin/_posh-common
159 get_posh_dir
160
161 pushd "$POSH_DIR" >/dev/null
105162 diff --git a/resources/scripts/posh-config b/resources/scripts/posh-config
106 index c20c200..e197ba2 100755
163 index 50f73de..27160ac 100755
107164 --- a/resources/scripts/posh-config
108165 +++ b/resources/scripts/posh-config
109 @@ -1,7 +1,7 @@
110 #!/bin/bash
111
112 if [[ -z "${POSHC2_DIR}" ]]; then
113 - POSH_DIR="/opt/PoshC2"
114 + POSH_DIR="/usr/share/poshc2"
115 else
116 POSH_DIR=${POSHC2_DIR}
117 fi
166 @@ -1,6 +1,6 @@
167 #!/bin/bash
168
169 -source /usr/local/bin/_posh-common
170 +source /usr/bin/_posh-common
171 get_posh_project_dir
172
173 if [[ "$EDITOR" != "" ]]; then
118174 diff --git a/resources/scripts/posh-cookie-decrypter b/resources/scripts/posh-cookie-decrypter
119 index 50cad8f..8b77c68 100755
175 index 0cbddc2..5ae2a44 100755
120176 --- a/resources/scripts/posh-cookie-decrypter
121177 +++ b/resources/scripts/posh-cookie-decrypter
122 @@ -9,7 +9,7 @@ function ctrl_c() {
123 }
124
125 if [[ -z "${POSHC2_DIR}" ]]; then
126 - POSH_DIR="/opt/PoshC2"
127 + POSH_DIR="/usr/share/poshc2"
128 else
129 POSH_DIR=${POSHC2_DIR}
130 fi
178 @@ -8,9 +8,9 @@ function ctrl_c() {
179 exit
180 }
181
182 -source /usr/local/bin/_posh-common
183 +source /usr/bin/_posh-common
184 get_posh_dir
185 -
186 +
187 pushd $POSH_DIR >/dev/null
188 if [ "$?" -eq "0" ]; then
189
131190 diff --git a/resources/scripts/posh-docker-server b/resources/scripts/posh-docker-server
132 index 123ed9d..ec2d4bf 100755
191 index 6cf8c0e..be967d7 100755
133192 --- a/resources/scripts/posh-docker-server
134193 +++ b/resources/scripts/posh-docker-server
135 @@ -1,7 +1,7 @@
136 #!/bin/bash
137
138 if [[ -z "${POSHC2_DIR}" ]]; then
139 - POSH_DIR="/opt/PoshC2"
140 + POSH_DIR="/usr/share/poshc2"
141 else
142 POSH_DIR="${POSHC2_DIR}"
143 fi
194 @@ -1,6 +1,6 @@
195 #!/bin/bash
196
197 -source /usr/local/bin/_posh-common
198 +source /usr/bin/_posh-common
199 get_posh_project_dir
200 get_posh_projects_dir
201 get_docker_posh_projects_dir
144202 diff --git a/resources/scripts/posh-log b/resources/scripts/posh-log
145 index 230c247..5838a57 100755
203 index 9245938..508092e 100755
146204 --- a/resources/scripts/posh-log
147205 +++ b/resources/scripts/posh-log
148 @@ -1,7 +1,7 @@
149 #!/bin/bash
150
151 if [[ -z "${POSHC2_DIR}" ]]; then
152 - POSH_DIR="/opt/PoshC2"
153 + POSH_DIR="/usr/share/poshc2"
154 else
155 POSH_DIR=${POSHC2_DIR}
156 fi
206 @@ -1,6 +1,6 @@
207 #!/bin/bash
208
209 -source /usr/local/bin/_posh-common
210 +source /usr/bin/_posh-common
211 get_posh_project_dir
212
213 tail -n 5000 -f "$POSH_PROJECT_DIR/poshc2_server.log" 2>/dev/null\
214 diff --git a/resources/scripts/posh-project b/resources/scripts/posh-project
215 index 23369d5..f091ca1 100755
216 --- a/resources/scripts/posh-project
217 +++ b/resources/scripts/posh-project
218 @@ -8,7 +8,7 @@ function ctrl_c() {
219 exit
220 }
221
222 -source /usr/local/bin/_posh-common
223 +source /usr/bin/_posh-common
224 get_posh_projects_dir
225
226 if [ "$1" == "-n" ]; then
157227 diff --git a/resources/scripts/posh-server b/resources/scripts/posh-server
158 index bd87038..e354e16 100755
228 index ee9a6c3..bbd5e74 100755
159229 --- a/resources/scripts/posh-server
160230 +++ b/resources/scripts/posh-server
161 @@ -9,7 +9,7 @@ function ctrl_c() {
162 }
163
164 if [[ -z "${POSHC2_DIR}" ]]; then
165 - POSH_DIR="/opt/PoshC2"
166 + POSH_DIR="/usr/share/poshc2"
167 else
168 POSH_DIR=${POSHC2_DIR}
169 fi
231 @@ -8,7 +8,7 @@ function ctrl_c() {
232 exit
233 }
234
235 -source /usr/local/bin/_posh-common
236 +source /usr/bin/_posh-common
237 get_posh_dir
238 get_posh_project_dir
239
170240 diff --git a/resources/scripts/posh-service b/resources/scripts/posh-service
171 index 839c618..b265574 100755
241 index 0bbaf64..6ca06d1 100755
172242 --- a/resources/scripts/posh-service
173243 +++ b/resources/scripts/posh-service
174 @@ -9,7 +9,7 @@ function ctrl_c() {
175 }
176
177 if [[ -z "${POSHC2_DIR}" ]]; then
178 - POSH_DIR="/opt/PoshC2"
179 + POSH_DIR="/usr/share/poshc2"
180 else
181 POSH_DIR=${POSHC2_DIR}
182 fi
244 @@ -1,6 +1,6 @@
245 #!/bin/bash
246
247 -source /usr/local/bin/_posh-common
248 +source /usr/bin/_posh-common
249 get_posh_project_dir
250
251 sudo systemctl enable poshc2.service >/dev/null
252 @@ -12,5 +12,5 @@ while [[ $x -le 10 ]]; do
253 sleep 1s
254 x=$(( $x + 1 ))
255 done
256 -/usr/local/bin/posh-log
257 +/usr/bin/posh-log
258
259 diff --git a/resources/scripts/posh-service-ansible b/resources/scripts/posh-service-ansible
260 index 7b7b658..e5d976b 100755
261 --- a/resources/scripts/posh-service-ansible
262 +++ b/resources/scripts/posh-service-ansible
263 @@ -1,6 +1,6 @@
264 #!/bin/bash
265
266 -source /usr/local/bin/_posh-common
267 +source /usr/bin/_posh-common
268 get_posh_project_dir
269
270 sudo systemctl enable poshc2.service >/dev/null
271 diff --git a/resources/scripts/poshc2.service b/resources/scripts/poshc2.service
272 index b389bf8..4834180 100644
273 --- a/resources/scripts/poshc2.service
274 +++ b/resources/scripts/poshc2.service
275 @@ -4,7 +4,7 @@ Description=PoshC2 Server
276 [Service]
277 Type=simple
278 User=root
279 -ExecStart=/usr/local/bin/posh-server
280 +ExecStart=/usr/bin/posh-server
281
282 [Install]
283 -WantedBy=default.target
284 \ No newline at end of file
285 +WantedBy=default.target
286 diff --git a/resources/scripts/sharpsocks b/resources/scripts/sharpsocks
287 index 4a4cc95..d569ae8 100755
288 --- a/resources/scripts/sharpsocks
289 +++ b/resources/scripts/sharpsocks
290 @@ -8,7 +8,7 @@ function ctrl_c() {
291 exit
292 }
293
294 -source /usr/local/bin/_posh-common
295 +source /usr/bin/_posh-common
296 get_posh_dir
297
298 pushd "$POSH_DIR" >/dev/null
11 Date: Tue, 19 May 2020 15:33:59 +0200
22 Subject: Don't use pipenv
33
4 Last-Update: 2020-05-19
4 Last-Update: 2020-10-28
55 ---
66 resources/scripts/fpc | 2 +-
77 resources/scripts/posh | 2 +-
1010 4 files changed, 4 insertions(+), 4 deletions(-)
1111
1212 diff --git a/resources/scripts/fpc b/resources/scripts/fpc
13 index 0312a9f..1e82e87 100644
13 index 8125fe2..802a967 100755
1414 --- a/resources/scripts/fpc
1515 +++ b/resources/scripts/fpc
16 @@ -22,7 +22,7 @@ pushd "$POSH_DIR" >/dev/null
16 @@ -18,6 +18,6 @@ DATABASE_STRING=`cat $POSH_PROJECT_DIR/config.yml | grep "PostgresConnectionStri
17 pushd "$POSH_DIR" >/dev/null
1718
1819 if [ "$?" -eq "0" ]; then
19
2020 - python3 -m pipenv run python3 "resources/scripts/fpc.py" -p "$POSH_PROJECT_DIR" -d "$DATABASE_TYPE" -pg "$DATABASE_STRING" $@
2121 + python3 "resources/scripts/fpc.py" -p "$POSH_PROJECT_DIR" -d "$DATABASE_TYPE" -pg "$DATABASE_STRING" $@
2222 popd > /dev/null
23
24 fi
23 fi
2524 diff --git a/resources/scripts/posh b/resources/scripts/posh
26 index 01eac13..41ddf6c 100755
25 index d46c85f..7e55f13 100755
2726 --- a/resources/scripts/posh
2827 +++ b/resources/scripts/posh
29 @@ -17,6 +17,6 @@ fi
28 @@ -14,6 +14,6 @@ get_posh_dir
3029 pushd "$POSH_DIR" >/dev/null
3130
3231 if [ "$?" -eq "0" ]; then
33 - python3 -m pipenv run python3 start.py --client "$@"
32 - sudo python3 -m pipenv run python3 start.py --client "$@"
3433 + python3 start.py --client "$@"
3534 popd > /dev/null
3635 fi
3736 diff --git a/resources/scripts/posh-cookie-decrypter b/resources/scripts/posh-cookie-decrypter
38 index 8b77c68..8223f6a 100755
37 index 5ae2a44..206fecb 100755
3938 --- a/resources/scripts/posh-cookie-decrypter
4039 +++ b/resources/scripts/posh-cookie-decrypter
41 @@ -17,7 +17,7 @@ fi
40 @@ -14,7 +14,7 @@ get_posh_dir
4241 pushd $POSH_DIR >/dev/null
4342 if [ "$?" -eq "0" ]; then
4443
45 - python3 -m pipenv run python3 "$POSH_DIR/cookie_decrypter.py"
44 - sudo python3 -m pipenv run python3 "$POSH_DIR/cookie_decrypter.py"
4645 + python3 "$POSH_DIR/cookie_decrypter.py"
4746 popd > /dev/null
4847
49 fi
48 fi
5049 diff --git a/resources/scripts/posh-server b/resources/scripts/posh-server
51 index e354e16..8f20714 100755
50 index bbd5e74..0f6b8be 100755
5251 --- a/resources/scripts/posh-server
5352 +++ b/resources/scripts/posh-server
54 @@ -23,7 +23,7 @@ fi
53 @@ -15,7 +15,7 @@ get_posh_project_dir
5554 pushd $POSH_DIR >/dev/null
5655 if [ "$?" -eq "0" ]; then
5756
58 - python3 -m pipenv run python3 -u start.py --server 2>&1 | tee -a "$POSH_PROJECT_DIR/poshc2_server.log"
57 - sudo python3 -m pipenv run python3 -u start.py --server 2>&1 | tee -a "$POSH_PROJECT_DIR/poshc2_server.log"
5958 + python3 -u start.py --server 2>&1 | tee -a "$POSH_PROJECT_DIR/poshc2_server.log"
6059 popd > /dev/null
60 fi
6161
62 fi
99 1 file changed, 1 insertion(+), 6 deletions(-)
1010
1111 diff --git a/poshc2/client/Help.py b/poshc2/client/Help.py
12 index 6aae658..017938e 100644
12 index d1a5ac5..f342338 100644
1313 --- a/poshc2/client/Help.py
1414 +++ b/poshc2/client/Help.py
15 @@ -12,12 +12,7 @@ logopic = Colours.GREEN + r"""
15 @@ -13,12 +13,7 @@ logopic = Colours.GREEN + r"""
1616 \/ \/ \/ \/
1717 """
1818
11 Date: Tue, 19 May 2020 15:17:23 +0200
22 Subject: Remove posh-update script
33
4 Last-Update: 2020-05-19
4 Last-Update: 2020-10-28
55 ---
6 resources/scripts/posh-update | 64 -------------------------------------------
7 1 file changed, 64 deletions(-)
6 resources/scripts/posh-update | 83 -------------------------------------------
7 1 file changed, 83 deletions(-)
88 delete mode 100755 resources/scripts/posh-update
99
1010 diff --git a/resources/scripts/posh-update b/resources/scripts/posh-update
1111 deleted file mode 100755
12 index faac326..0000000
12 index 615d553..0000000
1313 --- a/resources/scripts/posh-update
1414 +++ /dev/null
15 @@ -1,64 +0,0 @@
15 @@ -1,83 +0,0 @@
1616 -#!/bin/bash
1717 -
1818 -# trap ctrl-c and call ctrl_c()
2222 - popd > /dev/null
2323 - exit
2424 -}
25 -
26 -if [[ -z "${POSHC2_DIR}" ]]; then
27 - POSH_DIR="/opt/PoshC2"
28 -else
29 - POSH_DIR=${POSHC2_DIR}
30 -fi
25 -
26 -# A POSIX variable
27 -OPTIND=1 # Reset in case getopts has been used previously in the shell.
28 -
29 -# Initialize our own variables:
30 -GIT_BRANCH="master"
31 -MANUAL_BRANCH_SET=false
32 -
33 -show_help(){
34 - echo "*** PoshC2 Update Script ***"
35 - echo "Usage:"
36 - echo "posh-update -b <git branch>"
37 - echo ""
38 - echo "Default is the master branch"
39 -}
40 -
41 -while getopts "h?b:" opt; do
42 - case "$opt" in
43 - h|\?)
44 - show_help
45 - exit 0
46 - ;;
47 - b) GIT_BRANCH="$OPTARG"
48 - MANUAL_BRANCH_SET=true
49 - ;;
50 - esac
51 -done
52 -
53 -
54 -
55 -source /usr/local/bin/_posh-common
56 -get_posh_dir
3157 -
3258 -pushd $POSH_DIR >/dev/null
3359 -
3460 -if [ "$?" -eq "0" ]; then
61 -
62 - if [ "$MANUAL_BRANCH_SET" == "false" ]; then
63 - GIT_BRANCH=`git rev-parse --abbrev-ref HEAD`
64 - fi
3565 -
3666 - echo ""
3767 - echo -e """\033[92m
4676 - echo "[+] Updating PoshC2"
4777 - echo ""
4878 -
49 - echo ""
50 - echo "[+] Saving changes to Config.py"
51 - echo ""
52 - git diff Config.py >> /tmp/PoshC2_Config_Diff.git
79 - if [[ $(id -u) -ne 0 ]]; then
80 - echo -e "You must run this installer as root.\nQuitting!";
81 - exit 1;
82 - fi
5383 -
5484 - echo ""
55 - echo "[+] Updating Posh Installation to latest master"
85 - echo "[+] Updating Posh Installation to latest $GIT_BRANCH"
5686 - git fetch
57 - git reset --hard origin/master
87 - git reset --hard origin/"$GIT_BRANCH"
5888 -
5989 - echo ""
6090 - echo "[+] Running Install script"
61 - ./Install.sh
62 -
63 - echo ""
64 - echo "[+] Re-applying Config file changes"
65 - git apply /tmp/PoshC2_Config_Diff.git
66 -
67 - if [ "$?" -eq "0" ]; then
68 - rm /tmp/PoshC2_Config_Diff.git
69 - else
70 - echo "[-] Re-applying Config file changes failed, please merge manually from /tmp/PoshC2_Config_Diff.git"
71 - fi
91 - ./Install.sh -b "$GIT_BRANCH" -p "$POSH_DIR"
7292 -
7393 - echo ""
7494 - echo "[+] Update complete"
7595 - echo ""
7696 -
7797 - popd > /dev/null
78 -
79 -fi
98 -fi
1010 1 file changed, 1 insertion(+), 1 deletion(-)
1111
1212 diff --git a/poshc2/server/Implant.py b/poshc2/server/Implant.py
13 index cfc12ad..6c57b38 100644
13 index abf3d3e..ca0ebe0 100644
1414 --- a/poshc2/server/Implant.py
1515 +++ b/poshc2/server/Implant.py
16 @@ -49,7 +49,7 @@ NEWKEY8839394%s4939388YEKWEN
16 @@ -46,7 +46,7 @@ NEWKEY8839394%s4939388YEKWEN
1717 IMGS19459394%s49395491SGMI""" % (self.RandomURI, self.AllBeaconURLs, self.KillDate, self.Sleep, self.Jitter, self.Key, self.AllBeaconImages)
1818 with open("%spy_dropper.sh" % (PayloadsDirectory), 'rb') as f:
1919 self.PythonImplant = base64.b64encode(f.read()).decode("utf-8")