10
2
Fork 0

wheres-the-sat

This commit is contained in:
Erin Moon 2020-06-03 17:59:52 -05:00
parent 71583185a7
commit 754f31758b
5 changed files with 100 additions and 2 deletions

View File

@ -17,3 +17,4 @@
- [satellite-bus/magic-bus](satellite-bus/magic-bus)
- [space/1201-alarm](space/1201-alarm)
- [space/good-plan-great-plan](space/good-plan-great-plan)
- [space/wheres-the-sat](space/wheres-the-sat)

View File

@ -102,7 +102,7 @@ Which produced the flag:
» python decode.py
found packets: [600, 1904, 3208]
0 0 0 0x66 11 1919 94
flag{delta98823mike:GAFbfoYquKzWaSFdWeYHGMDosGaBTnMbwD_kqwuj
flag{delta98823mike:GAFbfoYquKzWaSFdWeYHGMDosGaBTnMbwD_kqwuj
MhhNPaA9t7Iay8GY6CdGUwrYVa_AetBJEqJ6XO1XHl0kbHA}OP`P<
```

View File

@ -8,7 +8,6 @@
**Given files**: `rbs_m2-juliet20230hotel.tar.bz2`, `examples.zip`
## Write-up
by [erin (`barzamin`)](https://imer.in).

View File

@ -0,0 +1,64 @@
# Where's the Sat?
**Category**: Space and Things
**Points (final)**: 43
**Solves**: 107
> Let's start with an easy one, I tell you where I'm looking at a satellite, you tell me where to look for it later.
**Given files**: `stations.zip`
## Write-up
by [erin (`barzamin`)](https://imer.in).
Like all 106 other teams probably did, we used Python and [Skyfield](https://rhodesmill.org/skyfield/), an astronomical computation library.
The challenge gives us questions like
```
Please use the following time to find the correct satellite:(2020, 3, 18, 11, 43, 3.0)
Please use the following Earth Centered Inertial reference frame coordinates to find the satellite:
[-305.58833718148855, 5030.717506174544, 4485.770450701875]
Current attempt:1
What is the X coordinate at the time of:(2020, 3, 18, 4, 24, 46.0)?
```
We can easily grab the time and ECI coordinates (which turned out to be International Terrestrial Reference Frame coordinates) with some expect-style goodness:
```{.python}
r.readuntil('find the correct satellite:')
t = ts.utc(*[float(x) for x in r.readuntil('\n').decode().strip()[1:-1].split(', ')])
r.readuntil('coordinates to find the satellite:')
eci_coords = np.array([float(x) for x in r.readuntil('\n').decode().strip()[1:-1].split(', ')])
```
We're given a list of candidate satellites (or space stations, rather) in two-line element form; find the closest one at the given time:
```{.python}
satellites = load.tle_file('./stations.txt')
match = satellites[np.argmin([np.linalg.norm(s.at(t).position.km-eci_coords) for s in satellites])]
```
The challenge then wants us to project ITRF coordinates for three times it gives us. Read the challenge timestamps and tell it where the satellite is:
```{.python}
for _ in range(3):
r.readuntil('X coordinate at the time of:')
new_t = ts.utc(*[float(x)
for x in r.readuntil('?\n', drop=True).decode().strip()[1:-1].split(', ')])
print(new_t.utc_jpl())
x,y,z = match.at(new_t).position.km
r.send(f'{x}\n')
r.send(f'{y}\n')
r.send(f'{z}\n')
r.interactive()
```
The key can easily be grabbed from the output.
### Full code
```{.python include=wheres.py}
```
## Resources and other writeups
- <https://rhodesmill.org/skyfield/>
- <https://en.wikipedia.org/wiki/Earth-centered_inertial>
- <https://en.wikipedia.org/wiki/International_Terrestrial_Reference_System_and_Frame>

View File

@ -0,0 +1,34 @@
from pwn import *
import numpy as np
from skyfield.api import load
import astropy.units
satellites = load.tle_file('./stations.txt')
ts = load.timescale()
r = tubes.remote.remote('where.satellitesabove.me', 5021)
r.clean()
r.send('ticket{golf75315sierra:GD1mOBPBARyBwvCRkzVu1nM1zvy5McsNlVVo0lhamqDsYRQutQXgnbzUhioLbtz2zg}\n')
r.readuntil('find the correct satellite:')
t = ts.utc(*[float(x) for x in r.readuntil('\n').decode().strip()[1:-1].split(', ')])
r.readuntil('coordinates to find the satellite:')
eci_coords = np.array([float(x) for x in r.readuntil('\n').decode().strip()[1:-1].split(', ')])
match = satellites[np.argmin([np.linalg.norm(s.at(t).position.km-eci_coords) for s in satellites])]
for _ in range(3):
r.readuntil('X coordinate at the time of:')
new_t = ts.utc(*[float(x)
for x in r.readuntil('?\n', drop=True).decode().strip()[1:-1].split(', ')])
print(new_t.utc_jpl())
x,y,z = match.at(new_t).position.km
r.send(f'{x}\n')
r.send(f'{y}\n')
r.send(f'{z}\n')
r.interactive()