Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
import http.server
port = 80
addr = '192.168.150.1'
addrport = (addr, port)
try:
serv = http.server.HTTPServer(
#!/usr/bin/env python3
import http.server
from http.server import CGIHTTPRequestHandler
port = 80
addr = '192.168.150.1'
addrport = (addr, port)
class myHandler(CGIHTTPRequestHandler):
$ sudo ./server.py
192.168.43.220 - - [30/Jul/2014 20:23:57] "GET / HTTP/1.1" 200 -
192.168.43.220 - - [30/Jul/2014 20:24:02] "POST /cgi-bin/server.py HTTP/1.1" 200 -
Traceback (most recent call last):
File "/tmp/www/cgi-bin/server.py", line 19, in <module>
http.server.CGIHTTPRequestHandler
File "/usr/lib/python3.4/socketserver.py", line 429, in __init__
self.server_bind()
File "/usr/lib/python3.4/http/server.py", line 133, in server_bind
socketserver.TCPServer.server_bind(self)
# Script (no es mio) que redirige todas las peticiones del DNS a la puerta de enlace (nuestro PC)
echo "import socket
class DNSQuery:
def __init__(self, data):
self.data=data
self.dominio=''
tipo = (ord(data[2]) >> 3) & 15 # 4bits de tipo de consulta
if tipo == 0: # Standard query
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>Interactive Page</title>
</head>
<body>
<form method=POST action="/cgi-bin/server.py">
<P><B>Enter your name:</B>
<P><input type=text name=user>
<P><input type=submit>
# ./server.py
127.0.0.1 - - [30/Jul/2014 16:43:19] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [30/Jul/2014 16:43:19] code 404, message File not found
127.0.0.1 - - [30/Jul/2014 16:43:19] "GET /favicon.ico HTTP/1.1" 404 -
127.0.0.1 - - [30/Jul/2014 16:43:22] "POST /cgi-bin/server.py HTTP/1.1" 200 -
Traceback (most recent call last):
File "/tmp/www/cgi-bin/server.py", line 19, in <module>
http.server.CGIHTTPRequestHandler
File "/usr/lib/python3.4/socketserver.py", line 429, in __init__
self.server_bind()
#!/usr/bin/env python3
import cgi
import time
import http.server
from os import getuid, devnull
from subprocess import call, check_output
from sys import argv, stdout, stdin
from re import findall
port = 8080
addrport = ('', port)
#!/bin/bash
HOSTAPD_CONF="/etc/hostapd_ap.conf"
DNSMASQ_CONF="/etc/dnsmasq.d/ap-hotspot.rules"
GW_IP="192.168.150.1"
HOSTAPD_LOG="/tmp/hostapd.log"
WLAN="wlan0"
start() {
#!/usr/bin/python3
# Alfa AWUS036 power increase up-to 30dbm
from os import getuid, devnull
import argparse
from sys import argv
from subprocess import call
from sys import stdout, stdin
# Console colors
W = '\033[0m' # white (normal)
#!/usr/bin/env python2.7
# Copyright 2013 Setkeh Mkfr
#
# 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 (at your option) any later
# version. See COPYING for more details.
#Short Python Example for connecting to The Cgminer API