Skip to content

Instantly share code, notes, and snippets.

View luukverhoeven's full-sized avatar
🚀
To Infinity, And Beyond!

Luuk Verhoeven luukverhoeven

🚀
To Infinity, And Beyond!
View GitHub Profile
@luukverhoeven
luukverhoeven / config.class.php
Last active November 3, 2022 20:14
Moodle PHPstorm helper.php / used for auto-completion
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
@luukverhoeven
luukverhoeven / fix_snmpd_ia_addr.sh
Last active February 21, 2025 12:07
# Fix error on subcontainer 'ia_addr' insert (-1) - debian 9
#!/bin/bash
apt-get remove --purge snmpd
apt-get install snmpd
apt-get install snmp-mibs-downloader
sed -i "s|-Lsd|-LS4d|" /etc/default/snmpd
sed -i "s|-Lsd|-LS4d|" /lib/systemd/system/snmpd.service
systemctl daemon-reload
service snmpd restart
@luukverhoeven
luukverhoeven / moodle_update_user_webservices.php
Last active July 28, 2020 15:54
Moodle webservice client sample
<?php
/**
* Send a Post request
*
* @param string $moodleFunction
* @param array $data
*
* @return array
*/
@luukverhoeven
luukverhoeven / Marlin_configuration.h
Created March 6, 2021 10:53
Marlin_configuration.h - x1 _ Waggster + BMG Wind
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@luukverhoeven
luukverhoeven / bsqli_moodle.py
Last active February 7, 2024 20:31
Moodle blind sql inject PoC 2021 - CVE-2021-36392 (3.11, 3.10 to 3.10.4, 3.9 to 3.9.7 and earlier unsupported versions)
#!/usr/bin/env python3
# Version 1.0 - Python 2.7+ Author Luuk Verhoeven
# BugBounty program (https://www.intigriti.com/) - MOODLE-WWXPVFWL
# Example usage
# ╰─❯ python3.9 bsqli.py -host "somehost.nl" -key "0hGdVB3DCa" -ses "oga7d5b5kijiv67oriog0C0h0s" -q "(select lastname from mdl_user where id = 2 limit 1)"
import requests
from urllib3.exceptions import InsecureRequestWarning
@luukverhoeven
luukverhoeven / get_moodle_blocks.php
Created September 21, 2021 09:44
Get Moodle blocks in a course
<?php
$page = new moodle_page();
$course = $DB->get_record('course', ['id' => 2]);
$page->set_course($course);
$page->set_context(context_course::instance($course->id));
$page->set_pagetype('course-view-' . $course->format);
$page->set_url(new moodle_url('/course/view.php', ['id' => $course->id]));
@luukverhoeven
luukverhoeven / moodle_course_customfields.php
Created October 4, 2021 09:26
Moodle course customfields
<?php
// Get customfields on course context.
// Can be used for the plugin settings page (dropdown).
$handler = \core_course\customfield\course_handler::create();
$fields = $handler->get_fields();
// Get customfields with data for a course.
$courseid = 16;
@luukverhoeven
luukverhoeven / get_all_moodle_versions.php
Created February 14, 2022 23:09
Simple way to get all Moodle versions
<?php
$htmlinput = file_get_contents('https://docs.moodle.org/dev/Releases');
$doc = new \DOMDocument();
libxml_use_internal_errors(true);
$doc->loadHTML($htmlinput);
$xpath = new \DOMXpath($doc);
$ths = $xpath->query('//tr/th[position()=1]');
$versions = [];
`.:;+o***ooi;.`
`,;o*%%&##########&*:`
'+&%%%***%%%%&$$$$$$$##&i`
`+$$%********%&$$$$$$$$$$$#&,
,&&%*********&$$$$$$$$$$$$$$$$:
,#$%********&$$$$$$$$$$$$$$$$$$o:
.$$$$&*****%%$$$########$$$$$$$$*i:
%$$##$&%**%$%.'..,::;i+*$$$$$$$$*i+.
'$#&o;,&$&&$$$+;ooi;:;i*%&$$$$$$$*iii
.$+::,;$$$$$$$$#$*%;`',,+#$$$$$$$oiii`
if [[ $(crontab -l | grep -q '/public_html/admin/cli/cron.php'; echo $?) == 1 ]]
then
crontab -l >/tmp/crontab.tmp
echo -e '\n* * * * * /usr/bin/php7.4 ~/public_html/admin/cli/cron.php > /dev/null 2>&1' >>/tmp/crontab.tmp
crontab /tmp/crontab.tmp
rm /tmp/crontab.tmp
echo 'Installed the crontab'
else
echo 'Skip the crontab installation, already there'
fi