Online battleships game on python and JS

Overview

Battleships

Online battleships game

Using websockets to connect to the client.

SQLite database for storing account data and game logs (for players top)

And JS for the client-side

Installation

  1. Use the pip to install libs from requirements.txt.
pip install -r requirements.txt
  1. Fill server/config.py file (if needed)
  2. Change IP and PORT in client/script.js file (if needed)

Usage

Server

Launch server:

python server/main.py

Client

  1. Open index.html from the client folder
  2. Create an account and play (you will need a friend)

Debug

You can find all errors in log/errors.log file

Contributing

Pull requests and an issues are welcome!

Comments
  • SQL Injection

    SQL Injection

    You are putting user input strait into SQL queries without any validation. For example here:

    sql.execute(F"""SELECT * FROM tokens WHERE ip = '{ip}' AND token = '{token}'
                        AND state = 1 AND time > {time.time()-86400}""")
    

    (token - user-controlled variable). I can open devtools console in my browser and paste:

    socket.send(
      JSON.stringify({
        type: 'authorization',
        method: 'token',
        token: "' [some malicious code]"
      })
    );
    
    

    This is major security vulnerability. It allows attackers it insert malicious code to your SQL query.

    To avoid this you should use SQL parameters as explained here (the last code block).

    opened by ronanru 9
  • Clientside improvements

    Clientside improvements

    CSS improvements

    ui ui

    JS improvements

    • I improved code style and readability
    • Replaced deprecated function to copy text to the clipboard
    • Fixed some JS bugs
    opened by ronanru 1
  • Bad token generation

    Bad token generation

    opened by Trard 1
  • Fixed Readme.md

    Fixed Readme.md

    Поправил Readme.md, чтобы текст был большой.

    Также советую написать в ReadMe о том как запустить сервер и все такое, чтобы я мог поискать другие ошибочки.

    opened by ronanru 1
  • The project has no license.

    The project has no license.

    Before I contribute more code to this project I want to know its license and be sure it's truly open-source. You can choose a license here. I recommend GPL v3, but you can choose any other open-source license.

    opened by ronanru 0
Owner
null
A python-based multi-player online educational game for students to play in a class or club setting.

Kurono (codename: aimmo) Code for Life has been developed by Ocado Technology as a free, open-source project to inspire the next generation of compute

Ocado Technology 108 Nov 7, 2022
Python game engine for 2D multiplayer online games.

LAN-Caster The goal of LAN-Caster is to provide an easy-to-use code base (game engine) for developing 2D multiplayer online games. LAN-Caster original

Douglas Bakewell 1 Feb 11, 2022
A program to read, edit, and write save files for the game Railroads! Online

RROSE - v0.3.6 This program is intended to be used as an external tool to Railroads Online server hosts. It will read save files, allow to modify entr

null 17 Dec 9, 2022
Mandaw 2 Mar 1, 2022
Game-of-life - A simple python program to simulate and visualise the Conway's Game of life

Conway's game of life A simple python program to simulate and visualise the Conw

Dhravya Shah 3 Feb 20, 2022
Average Clicker Game (AVG) is a Python made game using tkinter

Average-Clicker-Game Average Clicker Game (AVG) is a Python clicker game not made with pygame but with tkinter, it has worker, worker upgrades, times

Zacky2613 1 Dec 21, 2021
Ice-Walker-Game - This repository is about the Ice Walker game made in Python.

Ice-Walker-Game Ce dépot contient le jeu Ice Walker programmé en Python. Les différentes grilles du jeu sont contenues dans le sous-dossier datas. Vou

Mohamed Amine SABIL 1 Jan 2, 2022
Adventure-Game - Adventure Game which is created using Python

Adventure Game ?? This is a Adventure Game which is created using Python. Featur

ArinjoyTheDev 1 Mar 19, 2022
A near-exact clone of google chrome's no internet game, or the "google dinosaur game", with some additions and extras.

dinoGame A near-exact clone of google chrome's no internet game, or the "google dinosaur game", with some additions and extras. Installation Download

null 1 Oct 26, 2021
Mastermind-Game - A game to test programming and logical skills

Bem vindo ao jogo Mastermind! O jogo consiste em adivinhar uma senha que será ge

Marcelo Daros 0 Jan 27, 2022
Snake game mixed with Conway's Game of Life

SnakeOfLife Snake game mixed with Conway's Game of Life The rules are the same than a normal snake game but you have to avoid cells created by Conway'

Aidan 5 May 26, 2022
Lint game data metafiles against GTA5.xsd for Rockstar's game engine (RAGE)

rage-lint Lint RAGE (only GTA5 at the moment) meta/XML files for validity based off of the GTA5.xsd generated from game code. This script accepts a se

GoatGeek 11 Sep 18, 2022
HTTP API for FGO game data. Transform the raw game data into something a bit more manageable.

FGO game data API HTTP API for FGO game data. Transform the raw game data into something a bit more manageable. View the API documentation here: https

Atlas Academy 51 Dec 26, 2022
Quantum version of the classical Nim game. An automatic opponent allows to game to not be as easy as it seems.

Nim game Running the game To run the program just launch : python3 game.py Rules This game is inspiring from the Nim game. You are 2 players face to f

Michaël 1 Jan 8, 2022
Deal Or No Deal was a very popular game show. Even now, for a family party, it's a fun game to pass time

Deal Or No Deal was a very popular game show. Even now, for a family party, it's a fun game to pass time. I made a code to play the game right in your terminal/console. This isn't made to be a game which can be installed by everyone and played, I just made it as a fun project as I just started out with python. So if you have python installed and wanna have some fun, or just curious to see how I did this, feel free to check the code out!

null 1 Feb 15, 2022
Quiz Game: answering questions naturally with a friendly UI to enjoy the game

About Quiz Game : The Game is about answering questions naturally with a friendl

null 4 Jan 19, 2022
This is a simple telegram bot for the game Pyal, a word guessing game inspired by Wordle

Pyal Telegram Bot This is a simple telegram bot for the game Pyal, a word guessing game inspired by Wordle. How does it work? Differently from the ori

Rafael Omiya 4 Oct 6, 2022
3D online shooter written on Panda3D 1.10.10 and Python 3.10.1

на русском itch.io page Droid Game 3D This is a fresh game that was developed using the Panda3D game engine and Python language in the PyCharm IDE (I

Marcus Kemaul 5 Jun 4, 2022
Python fitting assistant, cross-platform fitting tool for EVE Online

pyfa What is it? Pyfa, short for python fitting assistant, allows you to create, experiment with, and save ship fittings without being in game. Open s

null 1.4k Dec 22, 2022