GithubHelp home page GithubHelp logo

ndum / laravel-seb Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 20 KB

Laravel Package for generating encrypted SEB (Safe Exam Browser) exam configurations

License: MIT License

PHP 100.00%
laravel php80 seb exams safeexambrowser pbkdf2 encryption

laravel-seb's Introduction

laravel-seb

This Laravel-Package provides the possibility to generate encrypted SEB (Safe Exam Browser) configurations. its mainly used to generate automatic seb-exams configurations with secure defaults options.

Requirements

Laravel 8, 9 or 10 with php8 and enabled ext-openssl, ext-zlib

Limititations

Its can only be used for password-encrypted exams (client-configurations currently are not supported)

Installation

Install via Composer.

$ composer require ndum/laravel-seb

Examples

NOTE: For production - Please use secure passwords and a secure seb-config!

Parameters

$sebConfig = seb-config as json-array (show examples/example_seb_config.json)
$startPassword = encryption-password as string
$quitPassword = close-password as string
$adminPassword = admin-password as string
Traditionally:
use Ndum\Laravel\SebConfigGenerator;
use Storage;

$config = Storage::disk('local')->get('/examples/example_seb_config.json'); // just as example...
$startPassword = 'test';
$quitPassword = 'test';
$adminPassword = 'test';

$sebConfig = json_decode($config, true);

$generator = new SebConfigGenerator();
$encryptedSebConfig = $generator->createSebConfig($sebConfig, $startPassword, $quitPassword, $adminPassword);
dd($encryptedSebConfig);
Facade:
use Ndum\Laravel\Facades\SebConfigGenerator;
use Storage;

$config = Storage::disk('local')->get('/examples/example_seb_config.json'); // just as example...
$startPassword = 'test';
$quitPassword = 'test';
$adminPassword = 'test';

$sebConfig = json_decode($config, true);

$encryptedSebConfig = SebConfigGenerator::createSebConfig($sebConfig, $startPassword, $quitPassword, $adminPassword);
dd($encryptedSebConfig);

Issues / Contributions

Directly via GitHub

License

This project is licensed under the MIT License - see the LICENSE-File for details

laravel-seb's People

Contributors

ndum avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

e-emad

laravel-seb's Issues

Best practice for .seb routes

Thank you for this package, I am curious how you implement the .seb files. The examples provided dd( the encryptedSebConfig. Any recommendations on how to generate the .seb file? Any specific header (e.g. X-SafeExamBrowser-RequestHash) used?

Value for key examKeySalt is NULL or doesn't have the correct class!

I've the following code in a controller, but when invoking the URL and SEB opens, it throws an error:

I've managed to store SEB logs and the error I've found in the los is the following:

2023/11/10 13:45:52:174 -[SEBConfigFileManager checkClassOfSettings:error:] Value for key examKeySalt is NULL or doesn't have the correct class!

public function sebConfig(Request $request, $attempt_id)
    {
        
        $path = storage_path('app/seb_config.json');
        $attempt = Attempt::findOrFail($attempt_id);
        $config = Storage::disk('local')->get('/seb_config.json'); // just as example...
        $startPassword = 'test';
        $quitPassword = 'test';
        $adminPassword = 'test';

        $sebConfig = json_decode($config, true);
        $sebConfig['startURL'] = url('/attempt/'.$attempt_id);
        
        //dd($sebConfig);
        $encryptedSebConfig = SebConfigGenerator::createSebConfig($sebConfig, $startPassword, $quitPassword, $adminPassword);
        //dd($encryptedSebConfig);
        // Enviar la configuración como respuesta 
        return response($encryptedSebConfig)->withHeaders([
            'Content-Type' => 'application/octet-stream',
            'Content-disposition' => 'attachment; filename=seb_config.seb'
          ]);
           
    }

The json template content is the same from the repo:
https://github.com/ndum/laravel-seb/blob/master/examples/example_seb_config.json

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.