Flaga ze Szturmu na AWS.

Overview

Witaj

Jesteś na GitHub'ie i czytasz właśnie plik README.md który znajduje się wewnątrz repozytorium Flaga z 7 i 8 etapu Szturmu na AWS.

W tym etapie w 6 krokach:

  • wejdziesz na serwer
  • przygotujesz go
  • pobierzesz repozytorium z flagą,
  • utworzysz nowe środowisko programistyczne
  • w którym uruchomisz i udostępnisz w sieci stronę www napisaną w pythonie
  • i jeżeli wszystko zadziała, przejdziesz do etapu 8 i powiesisz flagę. Zaczynajmy!

1. Start. Wejdź na serwer.

Aby zacżąć włącz terminal (lub powershell) i połącz się ze swoim serwerem. Jeżeli nie wiesz jak to powróć do etapu 5:

Resetowanie serwera

Od teraz, gdyby coś poszło nie tak, zawsze możesz zrestartować serwer i zacząć od nowa:

Krok jedynie dla serwerów na AWS:

Dla serwerów postawionych na AWS najpierw dodatkowo ustawiamy uprawnienia root ("administratora"). Skopiuj poniższe komendy i wklej do terminala.

sudo passwd   # <----- To dla AWS tylkooo! Podaj hasło i zapisz. Wpisz jeszcze poniższe i podaj hasło.
su -          # <----- Od teraz będziesz jako 'root'.

Poza tym na AWS trzeba stworzyć folder, gdzie będziemy trzymać Twoją stronę z flagą: mkdir i nazwa folderu: /var/www

mkdir /var/www     # <---- Czyli stwórz katalog var wewnątrz którego znajduje się pusty katalog www. Stwórz: /var/www

2. Uaktualniamy paczki (packages).

apt update
apt upgrade

W trakcie instalacji gdy proces się zatrzymuje z zapytaniem "Do you want to continue? [Y/n]" na końcu, napisz "Y" aby przejść dalej.

PS: w plikach README.md kod umieszcza się w takiej ramce jak poniżej.

pwd

Nie musisz ręcznie go przepisywać. Możesz łatwo skopiować, najedź myszką na tę ramkę wyżej i w prawym rogu a pokaże się przycisk - kliknij i masz skopiowany tekst. Teraz możesz wkleić kod, w zależności czy jesteś w powershellu czy w terminalu:

  • terminal: (linux, mac) klikając jednocześnie ctrl+shift+v
  • powershell: (windows) klikając prawym przyciskiem myszy.

3. Git.

Instalujemy git'a, pobieramy repozytorium i rozkładamy manatki.

apt install git
cd /var/www
git clone https://github.com/ZPXD/flaga.git # <--- wklej dokładnie tą linię do terminala
cd flaga
python3 xD.py # <---- z dużej litery xD.py a nie xd.py z małej litery.

PS: Tak jak się domyślasz, terminal nie czyta niczego po znaku "#" zobacz samemu, wpisz:

ls # sdfgsdfgsdgsgjpodgksg

4. Wewnątrz środowiska (env).

Wszystkie polecenia wykonywane w tym kroku są wykonywane w folderze /var/www/flaga .

Upewnij się w jakim folderze jesteś, napisz:

pwd

Teraz, zobacz ale jeszcze nie wpisuj poniższych 3 komend:

python3 -m venv flagaenv      # Stwórz środowisko flagenv używając venv.
source flagaenv/bin/activate  # Aktywuj środowisko flagaenv
export FLASK_APP=app.py       # I zapisz zmienną FLASK_APP równą app.py (nazwie programu strony www) 

Teraz skopiuj wszystkie 3 linie i spróbuj je wkleić w terminalu. Po ostatniej komendzie naciśnij enter.

Instalacja wymaganych bibliotek.

Użyjemy do tego pip3 - to narzędzie którym pobieramy w pythonie potrzebne biblioteki. We fladze używamy dodatkowo pliku requirements.txt, który jest niczym innym jak listą nazw i wersji bibliotek które będą.

pip3 install -r requirements.txt

Następnie podaj swoją domenę.

Napisz:

nano settings.ini

po spacji wpisz nazwę swojej domeny np (bez "www") wg wzoru:

domena = nazwa_domeny.pl

Aby zapisać wciśnij ctrl+s Aby zamknąć wciśnij ctrl+x

Uruchom skrypt przygotowujący hosting na serwerze (1 raz).

python3 xd.py

Restart nginxa i serwisów.

systemctl daemon-reload
systemctl restart nginx
systemctl restart flaga.service

Zobacz czy strona działa. Działa? Wyślij komuś, pochwal się i powróć do:

Etap 8: Flaga.

Ostatnie co zostało, to edycja flagi. Twoja flaga aby przejść dalej musi spełniać 3 kryteria

  • być widoczna w sieci, czyli działać - to mamy
  • jest na niej "xD" - to też już mamy
  • oraz jest coś napisane poza "xDDD" - to mamy do zrobienia. Będąc dalej na serwerze, w folderze /var/www/flaga edytuj zawartość pliku xd.txt. Można dodać tam coś od siebie. Jak skończysz, zrestartuj odrazu nginxa.
cd /var/www/flaga
nano xd.txt

systemctl daemon-reload
systemctl restart nginx
systemctl restart flaga.service

Gotowe?

Możesz opuścić Terminal pisząć

exit

A strona nadal będzie stała w internecie.

Jeżeli postawiłeś stronę www, flagę i edytowałeś ją to przeszedłeś ten etap i idź dalej:

Flagi:

Zawisło już ponad 650 flag. Zobacz je na: https://zajecia-programowania-xd.pl/flagi

Adds a new git subcommand named "ranch".

Git Ranch This script adds ranch, a new subcommand for git that makes it easier to order 1 Gallon of Kraft Ranch Salad Dressing from Amazon. Installat

Austin T Schaffer 8 Jul 06, 2022
A Telegram Music Bot written in Python using Pyrogram and Py-Tgcalls

A Telegram Music Bot written in Python using Pyrogram and Py-Tgcalls. This is Also The Source Code of The UserBot Which is Playing Music in @S1-BOTS Support Group ❤️

SAF ONE 224 Dec 28, 2022
Schedule Twitter updates with easy

coo: schedule Twitter updates with easy Coo is an easy to use Python library for scheduling Twitter updates. To use it, you need to first apply for a

wilfredinni 46 Nov 03, 2022
This python cheat utilizes PyMeow, PyMem, and others to enhance your CS:GO experience ;).

CSGO-Python-Cheat This python cheat utilizes PyMeow, PyMem, and others to enhance your CS:GO experience ;). Features Esp Tracers Chams (More to come)

Addi 1 Nov 30, 2021
A simple language translator with python and google translate api

Language translator with python A simple language translator with python and google translate api Install pip and python 3.9. All the required depende

0 Nov 11, 2021
Zero2 Discord bot is written with Discord.py using Python.

Zero2 Discord bot is written with Discord.py using Python.

Siva Avanish 4 Nov 08, 2021
Asca - Antiscam Discord Bot With Python

asca Antiscam Discord Bot Asca moderates scammers and deletes scam messages Opti

11 Nov 01, 2022
Based Telegram Bot and Userbot To Play Music in Your Telegram Groups With Some Cool Extra Features! 🥰

CallMusicPlus69 This Repo base on! 🤗️ A CallsMusic Based Telegram Bot and Userbot To Play Music in Your Telegram Groups With Some Cool Extra Features

brut✘⁶⁹ // ユスフ 6 Jun 26, 2022
Singer Tap for dbt Artifacts built with the Meltano SDK

tap-dbt-artifacts tap-dbt-artifacts is a Singer tap for dbtArtifacts. Built with the Meltano SDK for Singer Taps.

Prratek Ramchandani 9 Nov 25, 2022
Discord bot code to stop users that are scamming with fake messages of free discord nitro on servers in order to steal users accounts.

AntiScam Discord bot code to stop users that are scamming with fake messages of free discord nitro on servers in order to steal users accounts. How to

H3cJP 94 Dec 15, 2022
A wordwolf bot with python

ワードウルフBot requirements.txtから依存ライブラリをインストールしてください discordのトークン/Google spread sheetのキー/Sheetの名前を.envに書き込んでください DISCORD_TOKEN SHEET_KEY SHEET_NAME また、.sh

Kato 2 Dec 11, 2022
A very simple Salesforce.com REST API client for Python

Simple Salesforce Simple Salesforce is a basic Salesforce.com REST API client built for Python 3.5, 3.6, 3.7 and 3.8. The goal is to provide a very lo

simple salesforce 1.4k Dec 29, 2022
Mixcloud API wrapper for Python and Async IO

aiomixcloud Mixcloud API wrapper for Python and Async IO aiomixcloud is a wrapper library for the HTTP API of Mixcloud. It supports asynchronous opera

Aristotelis Mikropoulos 26 Dec 31, 2022
This checks that your credit card is valid or not

Credit_card_Validator This checks that your credit card is valid or not. Where is the app ? main.exe is the application to run and main.py is the file

Ritik Ranjan 1 Dec 21, 2021
An unofficial client library for Google Music.

gmusicapi: an unofficial API for Google Play Music gmusicapi allows control of Google Music with Python. from gmusicapi import Mobileclient api = Mob

Simon Weber 2.5k Dec 15, 2022
Python Telegram Bot Template

Python Telegram Bot Template Concepts Customizable python-telegram-bot template implementing code refactoring to streamline development process: handl

Jansen A. Simanullang 1 Jan 25, 2022
An async-ready Python wrapper around FerrisChat's API.

FerrisWheel An async-ready Python wrapper around FerrisChat's API. Installation Instructions Linux: $ python3.9 -m pip install -U ferriswheel Python 3

FerrisChat 8 Feb 08, 2022
A Telegram bot that scrapes websites for available vaccination appointments to notify users. (German)

@dachau_impf_bot 🇬🇧 A Telegram bot to check the contents of https://termin.dachau-med.de for available slots and inform users of the available dates

1 Nov 21, 2021
Yes, it's true :revolving_hearts: This repository has 301 stars.

Yes, it's true! Inspired by a similar repository from @RealPeha, but implemented using a webhook on AWS Lambda and API Gateway, so it's serv

511 Dec 30, 2022
The official Pushy SDK for Python apps.

pushy-python The official Pushy SDK for Python apps. Pushy is the most reliable push notification gateway, perfect for real-time, mission-critical app

Pushy 1 Dec 21, 2021