2023 linux world cup writeup

Taipei - normal port knocking#
nmap -p- --min-rate=1000 -T4 localhost
Unimak - json parsing#
jq '.data.stations[] | select(.has_kiosk==false and .capacity>30) | .station_id' station_information.json > ~/mysolution
Ivujivik - csv parsing#
find out the row first run without try - error - and catch it
import csv
max_rejected = 0
max_district = ""
with open("table_tableau11.csv") as f:
reader = csv.reader(f)
next(reader) # skip header
for row in reader:
name = row[1]
try:
rejected = int(row[8])
except ValueError:
print(f"Could not convert rejected ballots to int for district {name}")
rejected = 0
population = int(row[3])
if population < 100000 and rejected > max_rejected:
max_rejected = rejected
max_district = name
print(max_district)
Monaco#
# - get the POST field
curl localhost:5000
# format with
curl -X POST -F 'password=PASSWORD' http://localhost:5000/
git restore ./
cat webserver.py
#locate the password location
ps aux | grep python
# find the pid
cat /proc/1234/environ | grep SUPERSECRETPASSWORD
get the env
format and post it
pretty cool about /proc tricks. you can even see a background progress stderr/stdout with
cat /proc/1444/fd/{1,2}
Chennai#
pretty rough. read the repo read .env docker-compose not present, convert the docker-compose to docker commands
# Create rabbitmq1 container
docker run -d --network my-network --hostname rabbitmq1 --env RABBITMQ_DEFAULT_USER=guest --env RABBITMQ_DEFAULT_PASS=guest --env RABBITMQ_DEFAULT_VHOST=/ --volume ./.erlang.cookie:/var/lib/rabbitmq/.erlang.cookie --volume ./cluster-entrypoint.sh:/usr/local/bin/cluster-entrypoint.sh --entrypoint /usr/local/bin/cluster-entrypoint.sh rabbitmq:3-management
# Create rabbitmq2 container
docker run -d --network my-network --hostname rabbitmq2 --env JOIN_CLUSTER_HOST=rabbitmq1 --volume ./.erlang.cookie:/var/lib/rabbitmq/.erlang.cookie --volume ./cluster-entrypoint.sh:/usr/local/bin/cluster-entrypoint.sh --entrypoint /usr/local/bin/cluster-entrypoint.sh rabbitmq:3-management
# Create rabbitmq3 container
docker run -d --network my-network --hostname rabbitmq3 --env JOIN_CLUSTER_HOST=rabbitmq1 --volume ./.erlang.cookie:/var/lib/rabbitmq/.erlang.cookie --volume ./cluster-entrypoint.sh:/usr/local/bin/cluster-entrypoint.sh --entrypoint /usr/local/bin/cluster-entrypoint.sh rabbitmq:3-management
# Create haproxy container
docker run -d --network my-network --volume ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro -p 15672:15672 -p 5672:5672 haproxy:1.7
it doesnt really run, investigate(docker logs -f) and find out entrance.sh error
give it something random to loop (how to make it easier)
haproxy not finding the mq1 mq2 mq3
- docker create network.
docker network create my-network - adding
--network my-networkto the docker command - the producer doesnt run
pika.exceptions.IncompatibleProtocolError: StreamLostError: (‘Transport indicated EOF’,)
because the channel is empty - reading - it takes the channel from ENV
RMQ_QUEUE="hello" python3 producer.py
# works
export RMQ_QUEUE="hello"
the consumer doesnt run - error auth
pika.exceptions.ProbableAuthenticationError: ConnectionClosedByBroker: (403) ‘ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.’
adding a user for it
docker exec -it 6414fa8a1402 rabbitmqctl add_user username password
#and set up proper vhost perm for it
docker exec -it 6414fa8a1402 rabbitmqctl set_permissions -p "/" username ".*" ".*" ".*"