Skip to content

Instantly share code, notes, and snippets.

@rebrec
rebrec / New-JEALab.ps1
Last active September 11, 2023 08:44
Configuration de Just Enough Administration (JEA) sur une machine membre d'un domaine Active Directory
# Testé avec Powershell 5.1
# Documentation disponible : # https://learn.microsoft.com/en-us/powershell/scripting/learn/remoting/jea/overview?view=powershell-7.3
# Réalise les opérations suivantes
# - crée sur une machine membre d'un domaine AD un endpoint JEA, une session avec un role affecté à celle-ci
# - autorise un utilisateur du domaine à accéder à ce rôle (au travers de cette session)
# - l'autorisation se fait via la création d'un groupe local auquel on pourra ajouter d'autres membres
# - les cmdlets autorisés sont ceux par défaut, il faudra étider le fichier de configuration (voir commentaires plus bas)
######## Elements à paramétrer
$AllowedUsername = "<DOMAIN>\<Utilisateur>"
@rebrec
rebrec / phpdangerousfuncs.md
Created November 16, 2022 12:03 — forked from snoopysecurity/phpdangerousfuncs.md
Dangerous PHP Functions

Command Execution

exec           - Returns last line of commands output
passthru       - Passes commands output directly to the browser
system         - Passes commands output directly to the browser and returns last line
shell_exec     - Returns commands output
\`\` (backticks) - Same as shell_exec()
popen          - Opens read or write pipe to process of a command
proc_open      - Similar to popen() but greater degree of control
pcntl_exec - Executes a program
# This example script will output information about the video driver on remote computers
# It allows to quickly compare 2 or more computer against their driver version to potentialy
# identify driver differences between a buggy computer and a working one
$computers = @("computer1","computer2")
Get-WmiObject -query "Select Caption,DriverVersion,DriverDate,InfSection,InstalledDisplayDrivers,SystemName From Win32_VideoController" `
-ComputerName $computers `
| Select SystemName,Caption,DriverVersion,DriverDate,InfSection,InstalledDisplayDrivers `
| Out-GridView
##################################################################################################################
# Description:
# This script helps Extensions creators to quickly create a new extension that can add some contextual menu
# to their desired location (Collection, Software Update group, whatever the Administrator UI Allows...)
# When creating an extension in SCCM, you need to define with which component of the UI it will interact.
# this guid is a bit difficult to find (you need to search through XML files).
# For this purpose, this script will create an extension action per UI component so that everywhere you
# can right click in the SCCM Administrator User Interface, a contextual menu will appear with it's GUID displayed
# clicking on this GUID will copy it to the clibpard.
##################################################################################################################
@rebrec
rebrec / hurry-admin-action
Created October 29, 2020 21:39
another one
{some:"text"}
// TLDR: I am trying to convert (new Buffer([86,97,108,130,114,105,101])).toString('utf8') to "Valérie" (and not "Val�rie""
/*
I am using a node module which permit me to interact with a powershell console.
During the execution of a command, i encounter encoding problems
Here is an example of what i receive from the module
*/
var iconv = require('iconv-lite');
// The below variable is the kind of data that the module process. This data is received from the child process's stdout
const net = require('net');
// common proxy ports
var honeyPort = [ 8080, 3128, 3129, 80 ];
function FakeSrv(port){
this.port = port;
this.server = net.createServer((socket) => {
socket.end('Bye\n');
const StringDecoder = require('string_decoder').StringDecoder;
const decoder = new StringDecoder('utf8');
var x = [49, // opcode
10,0,0,0, // cnt
0,0,0,0, // Highlight 1
77,69, 32,70, 85,67, 75,32, 73,83, 76,65, 77,0, // NAME 1 (length=14)
0,0,0,0, // HL 2
0, // NAME 2 (length=0)
rebrec@rebrec-cin:/tmp/build9052822487515109858.tmp$ cat Blink.cpp.hex
:100000000C945C000C9479000C9479000C947900A9
:100010000C9479000C9479000C9479000C9479007C
:100020000C9479000C9479000C9479000C9479006C
:100030000C9479000C9479000C9479000C9479005C
:100040000C949A000C9479000C9479000C9479002B
:100050000C9479000C9479000C9479000C9479003C
:100060000C9479000C947900000000070002010054
:100070000003040600000000000000000102040864
:100080001020408001020408102001020408102002
# -*- codding:utf-8 -*-
from xml.dom import minidom
import os.path
# The top argument for walk. The
# Python27/Lib/site-packages folder in my case
topdir="C:\\Users\\frlam\\Desktop\\Conf BIRDY WP"