Skip to content

Instantly share code, notes, and snippets.

@nick3499
Created August 12, 2021 05:01
Show Gist options
  • Save nick3499/8762f1eef7d7d249ae57257cf5efa050 to your computer and use it in GitHub Desktop.
Save nick3499/8762f1eef7d7d249ae57257cf5efa050 to your computer and use it in GitHub Desktop.
#!/bin/python3
'''Use netcat to get list of ports numbers.'''
def get_ports():
from os import system
system("nc mercury.picoctf.net 22902 > ports.txt &")
if __name__ == '__main__':
get_ports()
#!/bin/python3
'''Convert port numbers to characters in picoCTF key.'''
def convert_port_numbers():
key = []
with open('ports.txt') as txt_file:
for line in txt_file:
key.append(chr(int(line[:-2])))
print(''.join(key))
if __name__ == '__main__':
convert_port_numbers()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment