Skip to content

Instantly share code, notes, and snippets.

View b13bs's full-sized avatar

Étienne Ducharme b13bs

View GitHub Profile
@b13bs
b13bs / LuCI function error
Last active August 29, 2015 13:57
LuCI modifications
-- Dans le fichier /usr/lib/lua/luci/view/themes/commotion/header.htm, à la ligne 101
-- ==========
---- Le code suivant donne l'erreur: "Status: 500 Internal Server Error [...] 65: attempt to index local 'iface' (a nil value)"
function(s)
if s and s.mode and s.mode == "adhoc" and s.network then
local iface = conn:call("network.interface."..s.network, "status", {})
if s.proto == "babel" then
mesh_ip = sys.exec("ip addr show dev '"..iface["l3_device"].."' | sed -e's/^.*inet6 \\([^ ]*\\)\\/.*$/\\1/;t;d'")
else -- We keep the old behaviour before babel integration
from scapy.all import *
ip=IP(dst="www.google.com")
port=RandNum(1024,65535)
SYN=ip/TCP(sport=port, dport=80, flags="S", seq=42)
SYNACK=sr1(SYN)
ACK=ip/TCP(sport=SYNACK.dport, dport=80, flags="A", seq=SYNACK.ack, ack=SYNACK.seq + 1)
send(ACK)
@b13bs
b13bs / qbittorrent.service
Last active April 21, 2017 12:58
Running qBittorrent client as a service
[Unit]
Description=qBittorrent Daemon Service
After=network.target
[Service]
Type=forking
User=qbtuser
ExecStart=/usr/bin/qbittorrent-nox -d --webui-port=8113
[Install]
[Unit]
Description=OpenVPN connection
After=network.target
[Service]
Type=forking
ExecStart=/usr/sbin/openvpn --daemon vpn --status /run/openvpn/%i.status 10 --cd /etc/openvpn/vpn-files --config openvpn.ovpn
ExecReload=/bin/kill -HUP $MAINPID
WorkingDirectory=/etc/openvpn/vpn-files
#!/bin/bash
# https://raspberrypi.stackexchange.com/questions/11648/raspbmc-and-openvpn-block-traffic-except-vpn-with-iptables
read dnsserver1 dnsserver2 <<<$(egrep -o "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" /etc/resolv.conf | head -n 2)
vpnserver=$(egrep "^remote.*443" /etc/openvpn/vpn-files/openvpn.ovpn | cut -d " " -f2)
# Allow loopback
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
@b13bs
b13bs / nhl-bracket-scraping.py
Created April 26, 2017 22:37
NHL bracket challenge league leaderboard scraping with BeautifulSoup
#!/usr/bin/env python3
import sys
import bs4
import urllib.request
league_url = 'https://bracketchallenge.nhl.com/leagues/step'
response = urllib.request.urlopen(league_url)
html = response.read()
import logging
import os
def init_logging():
filename = os.path.splitext(os.path.abspath(__file__))[0]
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
handler = logging.FileHandler('%s.log' % filename)
formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
@b13bs
b13bs / Aircrack commands
Created May 19, 2017 15:33
cheatsheet for aircrack useful commands
airmon-ng start phy0
iwconfig wlan1mon channel $CHANNEL
iwconfig wlan1mon mode monitor
airodump-ng -c $CHANNEL --bssid $BSSID -w output wlan1mon
aireplay-ng -0 0 -a $BSSID -c $CLIENT wlan1mon

Keybase proof

I hereby claim:

  • I am b13bs on github.
  • I am b13bs (https://keybase.io/b13bs) on keybase.
  • I have a public key ASCr5LFbV2OpPjERq_uPQLr9_AaGp65d_eRGxyIxnBHfBQo

To claim this, I am signing this object:

#!/usr/bin/python2.7
import sys
import os
import threading
import time
import SocketServer
class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler):