Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems running the ghosts.client.linux #380

Open
yamaking2 opened this issue Jul 29, 2024 · 1 comment
Open

Problems running the ghosts.client.linux #380

yamaking2 opened this issue Jul 29, 2024 · 1 comment

Comments

@yamaking2
Copy link

yamaking2 commented Jul 29, 2024

Hello,

I've been trying to get a few Linux NPCs running recently just to have a few users generating bash commands, and I can't get the Linux client to work (neither with docker compose nor with the executable in the release).

Docker compose

First off, here is my docker-compose.yaml:

     1  version: "3"
     2
     3  services:
     4    staypuft-011:
     5      image: ghosts.client.alpine
     6      container_name: aaa
     7      build:
     8        context: ..
     9        dockerfile: ghosts.client.linux/dockerfile-alpine
    10      volumes:
    11        - ./config:/app/config
    12      networks:
    13        - custom_network
    14    staypuft-1:
    15      image: ghosts.client.alpine
    16      container_name: staypuft-2
    17      volumes:
    18        - ./config:/app/config
    19      networks:
    20        - custom_network
    21    staypuft-2:
    22      image: ghosts.client.alpine
    23      container_name: staypuft-1
    24      volumes:
    25        - ./config:/app/config
    26      networks:
    27        - custom_network
    28    staypuft-3:
    29      image: ghosts.client.alpine
    30      container_name: staypuft-3
    31      volumes:
    32        - ./config:/app/config
    33      networks:
    34        - custom_network
    35  networks:
    36    custom_network:
    37      external:
    38        name: ghostsapi_ghosts-network

And my Dockerfile:

     1  FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS dev
     2
     3  # copy csproj and restore as distinct layers
     4  COPY ghosts.linux.sln ./app/
     5  COPY ghosts.client.linux/*csproj ./app/ghosts.client.linux/
     6  COPY Ghosts.Domain/*csproj ./app/Ghosts.Domain/
     7  COPY Ghosts.Domain/*.config ./app/Ghosts.Domain/
     8
     9  WORKDIR /app
    10  RUN dotnet restore
    11
    12  # copy everything else and build app
    13  COPY ghosts.client.linux/     ./ghosts.client.linux/
    14  COPY Ghosts.Domain/     ./Ghosts.Domain/
    15  WORKDIR /app/ghosts.client.linux/
    16  RUN dotnet publish -c Release -o out
    17
    18  FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS prod
    19
    20  RUN apk add curl && \
    21      apk add nmap && \
    22      apk add bash && \
    23      apk add busybox-extras && \
    24      apk add nikto && \
    25      apk add openssh-client && \
    26      apk add python3 && \
    27      apk add openssh-keygen && \
    28      wget 'https://github.com/sqlmapproject/sqlmap/tarball/master' --output-document=sqlmap.tar.gz && \
    29      mkdir sqlmap && \
    30      tar -xvf sqlmap.tar.gz -C sqlmap && \
    31      cd sqlmap/
    32  # python sqlmap.py --version
    33
    34  COPY --from=dev /app/ghosts.client.linux/out ./app
    35  WORKDIR /app/
    36
    37  ENV ASPNETCORE_URLS=http://+:5000
    38  EXPOSE 5000/tcp
    39
    40  CMD ["dotnet", "./ghosts.client.linux.dll"]

I'll point out that I had to change the base dotnet image being used by the Docker file from 6.0 to 8.0 because otherwise I could not build the docker image (docker raised an issue saying that dotnet 8.0 had to be supported). Whenever I try to raise the containers, they exit with code 139 (which normally is segfault iirc):

image

And the logs from one of the dc containers are just an endless loop of this error:

image

Release executable

I also tried downloading the latest Linux client release and running it on a separate user in my local machine. There I could run the application, but the logs/app.log file just looks like this:

image

I suspect that the issue may be in the NullReferenceException shown here in the logs, but I'm not sure where that may be being thrown (somewhere in the timeline orchestrator and maybe after the stop watcher is being initialized).
And the API GUI does not recognize any NPCs running:

image

Application and timeline configurations

My application.json looks like this (exactly like the one in the docs):

1 {
2   "ApiRootUrl": "http://localhost:5000/api",  
3   "Sockets": {                                  
4     "IsEnabled": true,
5     "Heartbeat": 50000
6   },
7   "Id": {
8     "IsEnabled": true,
9     "Format": "guestlocal",
10    "FormatKey": "guestinfo.id",
11    "FormatValue": "$formatkeyvalue$-$machinename$",
12    "VMWareToolsLocation": "C:\\progra~1\\VMware\\VMware Tools\\vmtoolsd.exe"
13  },
14  "AllowMultipleInstances": false,
15  "EncodeHeaders": true,
16  "ClientResults": {
17    "IsEnabled": true,
18    "IsSecure": false,
19    "CycleSleep": 300000
20  },
21  "ClientUpdates": {
22    "IsEnabled": true,
23    "CycleSleep": 300000
24  },
25  "Survey": {
26    "IsEnabled": false,
27    "IsSecure": false,
28    "Frequency": "once",
29    "CycleSleepMinutes": 5,
30    "OutputFormat": "indent"
31  },
32  "Timeline": {
33    "Location": "config/timeline.json"
34  },
35  "Content": {
36    "EmailsMax": 20,
37    "EmailContent": "",
38    "EmailReply": "",
39    "EmailDomain": "",
40    "EmailOutside": "",
41    "BlogContent": "",
42    "BlogReply": "",
43    "FileNames": "",
44    "Dictionary": ""
45  },
46  "ResourceControl": {
47    "ManageProcesses": true
48  },
49  "HealthIsEnabled": false,
50  "HandlersIsEnabled": true,
51  "DisableStartup": false
52 }

and the timeline.json:

     1  {
     2          "Status": "Run",
     3          "TimeLineHandlers": [
     4                  {
     5                  "HandlerType": "Command",
     6                  "Initial": "",
     7                  "UtcTimeOn": "00:00:00",
     8                  "UtcTimeOff": "24:00:00",
     9                  "Loop": "True",
    10                  "TimeLineEvents": [
    11                          {
    12                          "Command": "/bin/bash",
    13                          "CommandArgs": ["netstat"],
    14                          "DelayAfter": 9,
    15                          "DelayBefore": 0
    16                          }
    17                  ]
    18          }
    19  }

I'm a newbie in this framework, so any help would be much appreciated!

@yamaking2 yamaking2 changed the title Problems running the ghosts.linux.client Problems running the ghosts.client.linux Jul 29, 2024
@sei-dupdyke
Copy link
Contributor

Sorry, two things here:

  • the containerized linux client is a work in progress, and definitely hasn't been updated to .NET 8.
  • the move to .NET 8 is also a WIP.

Either

  • use the non-containerized linux binary available here
  • downgrade your project file (ghosts.client.linux.csproj to NET 6 on this line:

net8.0

Sorry for the inconvenience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants