Examination tasks to test backend knowledge (for junior level)

Overview

Task 1

The website of one of our old clients was hacked. After hacking, a strange red bar appeared on the site at the bottom of the page (https://imgur.com/gYWYQ0r). We don't have any sources left in the git, I can only give you an archive from the production (exam.tgz).

Task: to find and remove malicious code. In the response, specify the necessary actions to get rid of it.

Unpack the archive:

tar zxvf exam.tgz exam

Task 2

There are two services: app/Services/Loggers/{Foo,Bar}.php. Each of them wants to log something, and each of them wants to log to their own file (storage/logs/foo.log for the Foo service, storage/logs/bar.log – for Bar). It is necessary to solve this problem without changing the services themselves, i.e. without changing the code in app/Services/Loggers/{Foo,Bar}.php.

There is a test prepared for a quick check of what was happening tests/Unit/LoggingTest.php, which can be run with the following command: ./vendor/bin/phpunit tests/Unit/LoggingTest.php . He has to work out.

Task 3

There is a controller app/Http/Controllers/ActionController.php which dispatches the event.

You need to write the line action fired from ip: $ip to the logs, instead of $ip, your ip from the request should be added. The code cannot be changed in the controller.

To check, we use the command

php artisan serve # server will be accessible by url http://localhost:8000

The controller is registered in the routes api.php

Task 4

Expanding task 3.

Now you need to write a line to the logs once a minute, when there is an access from the same ip address. If the method is called more often, then we write the duplicate action from ip line in the logs: $ip

The database cannot be used. It is still impossible to change the controller code.

Task 5

There is a controller app/Http/Controllers/ResponseController.php

The controller returns the object app/Services/ResponseClass/ResponseClass.php

If you look http://localhost:8000/api/response then you will see the line. It is necessary, without changing the code of the service and controller, to give the json format:

{
  "name": "Foo",
  "description": "Bar"
}

You can change the code only in the Convert trait and the Response interface.

You might also like...
A simple, beautiful, mobile-first instant messaging web application backend build with ThinkPHP6 and Swoole.

OnChat A simple, beautiful, mobile-first instant messaging progressive web application build with ThinkPHP6 and Swoole. You can click here to view the

Backend of the Articly wiki/cms project
Backend of the Articly wiki/cms project

Documentation | Changelog | Roadmap Currently under heavy development & testing. Fast, easy and reliable wiki software running in the web. What is Art

Official backend for VideoStream Android app.

About VideoStream Backend Official backend for VideoStream Android app, which is the CMS for VideoStream Android app. This backend is public for testi

Backend for honkCDN.

ServerGoose - the backend for honkCDN Written in PHP. Some parts of the code were not included for security reasons. Some parts of the code were locat

Blog dengan framework laravel 8 sebagai backend dan tailwind sebagai frontend

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Backend to apuntate in globalEmergency.online

APÚNTATE - Global Emergency Resumen Apúntate es una aplicación enfocada en la gestión de los diferentes servicios disponibles dentro de una agrupación

Esta es la plicacion de digital-solutions backend de laravel

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

DBase - An easy-to-use backend for mobile and web applications
DBase - An easy-to-use backend for mobile and web applications

DBase DBase is an easy-to-use backend for your mobile and web applications, host the files in an Ubuntu server and use the SDKs to perform CRUD operat

Sistema web para la administracion de una clinica veterinaria, Frontend y Backend

Clinica-Veterinaria-Web Se desea desarrollar un sistema Web para la administración de una clínica veterinaria. Se desea recolectar información sobre l

Owner
dev.family
We develop complex services and solutions for startups
dev.family
Online-examination-System in PHP and Mysql using XAMPP server

online-examination-systen-in-php Online Examination System Today Online Examination System has become a fast growing examination method because of its

Web_Warriors 1 Nov 28, 2021
Personal Knowledge Management. Use branch "minimal change" to deploy as laravel package.

Knowfox Knowfox is my Personal Knowledge Management system. Having been an keen Evernote user since 2012, I finally got around to taking my precious n

null 180 Dec 28, 2022
Open source knowledge base application for Teams

Opensource knowledge base application for Teams. Introduction Opus is a place for your team to document who you are, what you do and how you do it. It

Zeeshan Ahmad 1.2k Jan 6, 2023
Simple and lightweight OOP wrapper for PHP's low-level sockets extension (ext-sockets)

clue/socket-raw Simple and lightweight OOP wrapper for PHP's low-level sockets extension (ext-sockets). PHP offers two networking APIs, the newer stre

Christian Lück 321 Dec 15, 2022
This is a Task Manager system for managing your task. You can categorize your tasks and upload music to the project And a whole host of other features

taskManager Login and register Each user can have their own task Categorize tasks by creating folders Edit and Delete Folders Search for Tasks Show nu

masoudharooni 11 May 22, 2022
Instagram automation represents the use of third-party software to manage your account, carry out tasks and/or interact with users without a human present. Bulit in Laravel Framework

How to Deploy laravel project to heroku Video Link : https://youtu.be/7Nq_a2QiaHo Home Page Login Page Dashboard Page About Laravel Laravel is a web a

null 1 Dec 3, 2021
This is mini project for online test with Face Camera detection and Anti Cheating

Online Test Script With Face Detection + Anti Cheating This is mini project that you can use this to make your own online test. This project include F

Ferry Ariawan 3 Jun 5, 2022
A component-centric backend communication layer for Alpine.js

A component-centric backend communication layer for Alpine.js. Installation Install using the following command: composer require radio/radio Install

Radio.js 75 Dec 20, 2021
PHP backend Scripts to add and Manage Live tv Streaming android app

PHP Backend to Manage Live TV Streaming Android app Follow Given Steps to Setup Local Environment to run this php Script Setting Up Local Environment

Bikash Thapa 11 May 10, 2022
Workout application with fully functional Frontend and Backend.

Fit_Me_Application About Application: This FIT-ME management system is an easy way to use gym and health membership system. It can help to keep the re

Talha 3 Feb 20, 2022