Skip to content

Commit 39e8038

Browse files
committed
Add basic template
0 parents  commit 39e8038

File tree

6 files changed

+51
-0
lines changed

6 files changed

+51
-0
lines changed

Diff for: .gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bin/
2+
obj/

Diff for: Dockerfile

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM mcr.microsoft.com/dotnet/core/sdk:3.1
2+
3+
RUN apt-get update && apt-get install -y xinetd
4+
RUN mkdir -p /var/ctf /app
5+
COPY flag /var/ctf/
6+
COPY myservice /etc/xinetd.d/
7+
COPY Program.fs /app
8+
COPY *.fsproj /app
9+
10+
RUN echo "myservice 4000/tcp" >> /etc/services
11+
RUN service xinetd restart
12+
13+
WORKDIR /app
14+
CMD ["xinetd", "-dontfork"]

Diff for: Program.fs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
open System
2+
3+
[<EntryPoint>]
4+
let main _argv =
5+
Console.WriteLine "1 + 1 = ?"
6+
Console.ReadLine ()
7+
|> Convert.ToInt32
8+
|> fun n ->
9+
if n = 2 then IO.File.ReadAllText ("/var/ctf/flag") |> Console.WriteLine
10+
else Console.WriteLine ()
11+
0

Diff for: docker.fsproj

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<Compile Include="Program.fs" />
10+
</ItemGroup>
11+
12+
</Project>

Diff for: flag

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
this is my flag

Diff for: myservice

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
service myservice
2+
{
3+
flags = REUSE
4+
socket_type = stream
5+
wait = no
6+
user = root
7+
server = /usr/bin/dotnet
8+
server_args = run --project /app
9+
disable = no
10+
port = 4000
11+
}

0 commit comments

Comments
 (0)