Networking Laboratory - Lessons archive updated - Scripts published

I've uploaded on GitHub the latest version of the slides I made for the networking laboratory class which I've supported during the a.ys. 2015/2016 and 2016/2017.
The slides are available here.

Also I've published some scripts to solve the exercises proposed in the slides.
You can find them here.

Bye :)

[#snippet] How to reach and browse Windows paths rapidly using Bash on Windows (a.k.a. Windows Subsystem For Linux)


Here is a simple snippet I've put in my WSL .bashrc file to rapidly reach Windows paths when on Bash for Windows.

cdw() {
    local winpath="$1"
    winpath=$(echo $winpath | sed -e 's/\\$//g' -e 's/C\:/\/mnt\/c/g' -e 's/\\/\//g')
    cd "$winpath"

Place it in your .bashrc, then you can type cdw 'C:\What\Ever\Path' and you will reach /mnt/c/What/Ever/Path.

You can use the command echo $winpath | sed -e 's/\\$//g' -e 's/C\:/\/mnt\/c/g' -e 's/\\/\//g' alone to translate the Windows path into the corresponding WSL path in your scripts.

How to configure PiHole in QubesOS (ProxyVM)

Pi Hole is a framework that aims to block advertisements on your network using a sinkhole approach on known advertisements domains.

PiHole is based on Raspberry PI, a device that almost all computer enthusiasts have in their home, it is built on top of DNSMasq weaponized with community-maintained blacklist and can be backed with your favorite DNS servers.

But PiHole is not just and adblocker: it provides also a DHCP server and a dashboard for configuration, monitoring and tracking visited urls, allowing the PI owner to detect suspicious behaviors in the network.
Is very convenient to use it, because you have a central point in the network in which ads are conveyed avoiding the usage of addons that act browser-level, and preventing anti ad-blockers mechanisms.
Furthermore, it's open-source and available on GitHub
If you like to play with dedicated hardware, you can adopt a standard approach buying a cheap Raspberry Zero, installing PiHole on it, configuring it to be recognized as an USB ethernet adapter and play with NAT on your machine to give connectivity to him.

The annoying thing comes when you use to use a laptop: you don't have your Raspberry PI in your pocket and, if you

Google Apps Script to automatically tag emails with date-based labels

I use to automatically tag my e-mails with time based labels, on Gmail.
Can I simply use filters?
Maybe yes, but I didn't get to make them work when specifying only dates as criterias.
Maybe I'm idiot, but Gmail simply doesn't allow me to specify such filters.
So I tricked him with a small Google Apps Script, that tags emails with a current year and a current month nested labels.
Please note that it just works for 2017 and month names are in Italian.
I scheduled it to run once a minute.

function labelAllMessages() {
  var label2017 = GmailApp.getUserLabelByName("2017");
  var months = ["gennaio", "febbraio", "marzo", "aprile", "maggio", "giugno", "luglio", "agosto", "settembre", "ottobre", "novembre", "dicembre"];
  var getNumberOfDaysByMonth = function(i) {
    return (i==1) ? 28 : (  !(i>=7 ^ !(i&1)) ? 30:31  );
  var getDateRangeForMonth = function(ind) {
    var month = months[ind];
    var range = {
      start: new Date(2017, ind, 1).valueOf(),
      end: new Date(2017, ind, getNumberOfDaysByMonth(ind)).valueOf(),
      label: GmailApp.getUserLabelByName("2017/" + month)
    return range;
  var threads ='-label:2017 -label:"before 2017"

Kernel Linux, patch veloce ma adozione ritardataria

Via - Link all'articolo

Le maggiori distro GNU/Linux hanno da poco introdotto una patch rilasciata più di un anno fa per un pericoloso bug che consentirebbe l'esecuzione di codice arbitrario via UDP. Ma il rischio per i dispositivi Android ed embedded resta alto

Roma - Già nota dagli ultimi mesi del 2015, cui è seguita una patch silente ma immediata, la vulnerabilità CVE-2016-10229 di tipo arbitrary code execution, che riguarda le versioni del kernel Linux comprese tra la 2.6 e la 4.5, è stata catalogata nel Common Vulnerability Scoring System v3 con un punteggio pari a 9.8, ma la patch è stata inclusa solo di recente nelle maggiori distribuzioni GNU/Linux.

Il problema deriva dalla gestione del flag MSG_PEEK nella funzione recvmsg relativa al protocollo UDP, il cui ruolo è quello di permettere il prefetch di un messaggio in arrivo su un socket UDP senza consumare il buffer di lettura.
In particolare, quando l'utente fornisce una quantità di dati inferiore alla dimensione del socket buffer (SKB), il checksum del pacchetto UDP viene calcolato due volte; la seconda volta utilizzando una funzione insicura (skb_copy_and_csum_datagram_iovec) che potrebbe causare l'esecuzione di