Skip to content

Instantly share code, notes, and snippets.

View guillaumerose's full-sized avatar

Guillaume Rose guillaumerose

  • Apple
  • Paris
View GitHub Profile
module Backend
class DHCP < Sinatra::Base
get '/options' do
content_type "application/json"
ordinateur = Ordinateur.where(:mac => params["mac"].try(:gsub, ":", "-")).limit(1).first
return '{}' if ordinateur.nil? || ordinateur.desactive?
ordinateur.vu!
@guillaumerose
guillaumerose / gist:1133955
Created August 9, 2011 12:48
dhcp.feature
# language: fr
Fonctionnalité: DHCP
Afin de distribuer des IPs
En tant qu'API appelée par le serveur DHCP
Je souhaite pouvoir répondre à celui-ci
Scénario: Répondre correctement
Soit un adhérent ayant la chambre 1005
Et une date de départ dans 1 an
Et un ordinateur avec pour mac 00-11-22-33-44-55
@guillaumerose
guillaumerose / filtre.c
Created April 7, 2011 10:23
Deuxieme exercice
#include <linux/module.h> //these are for every module
#include <linux/kernel.h>
#include <linux/types.h> //u_int && co
#include <linux/skbuff.h> //struct sk_buff
#include <linux/in.h> //basic internet shiat
#include <linux/ip.h> //protocol headers
#include <linux/tcp.h>
#include <linux/netfilter.h> //need this for register_
#include <linux/netfilter_ipv4.h> //..
@guillaumerose
guillaumerose / netfilter.c
Created April 7, 2011 09:17
Premier exercice
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <netinet/in.h>
#include <linux/types.h>
#include <linux/netfilter.h> /* for NF_ACCEPT */
#include <linux/ip.h>
#include <linux/tcp.h>
@guillaumerose
guillaumerose / netfilter-queue
Created April 7, 2011 09:00
Working with netfilter and libnetfilter-queue
TP 3: Working with netfilter and libnetfilter-queue
The objective of this TP is to work with netfilter kernel module creation and user-space processing of queued packets using libnetfilter-queue.
Important: The result of this TP should be sent to: [email protected] or [email protected] with TP3-yourname as a subject.
If you don't finish on time, consider it as a homework and send it before Friday April 15 at 8:00PM.
Context:
--------
Whenever the host receives an incomming ssh connection (on port 22), the module drops the packet.
require "rubygems"
require "mechanize"
agent = Mechanize.new
page = agent.get "https://cas.it-sudparis.eu/cas/login?service=http://si-etudiants.it-sudparis.eu/opdotnet/noyau/SSO/cas.aspx"
session = page.body.match(/jsessionid\=(.*?)\?service/)[1]
lt = page.body.match(/name\=\"lt\" value=\"(.*?)\"/)[1]