- Enable IP forwarding & port redirection
sysctl -w net.ipv4.ip_forward=1
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080- Use
tmuxto run 2 instances ofarpspoof:
arpspoof -i $INTERFACE -t $VICTIM_IP $GATEWAY_IP| #!/usr/bin/env python2 | |
| import SimpleHTTPServer | |
| import SocketServer | |
| import logging | |
| PORT = 8000 | |
| class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): |
| #!/usr/bin/env python | |
| import socket | |
| import threading | |
| import select | |
| import sys | |
| terminateAll = False | |
| class ClientThread(threading.Thread): |
| ''' | |
| Establish a socket connection through an HTTP proxy. | |
| Author: Fredrik Østrem <frx.apps@gmail.com> | |
| License: | |
| Copyright 2013 Fredrik Østrem | |
| Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | |
| documentation files (the "Software"), to deal in the Software without restriction, including without |
| 糖份進入身體之後,會刺激大腦釋放「血清素」(serotonin)以及「多巴胺」(dopamine),這兩種神經傳導物質會讓人「感覺良好」。這能解釋為何很多人一旦壓力大,就想吃甜的;吃了甜食,就覺得心情好多了。 |
| #import section | |
| from matplotlib import pylab | |
| import pylab as plt | |
| import numpy as np | |
| #sigmoid = lambda x: 1 / (1 + np.exp(-x)) | |
| def sigmoid(x): | |
| return (1 / (1 + np.exp(-x))) | |
| mySamples = [] |
| ; A minimal Mach-o x64 executable for OS X (also see below Mountain Lion version) | |
| ; | |
| ; $ nasm -f bin -o tiny_hello tiny_hello.s | |
| ; $ chmod +x tiny_hello | |
| ; $ ./tiny_hello | |
| ; Hello World! | |
| ; $ | |
| ; c.f. | |
| ; http://osxbook.com/blog/2009/03/15/crafting-a-tiny-mach-o-executable/ ( the original tiny mach-o executable ) |
| // This script sets OSName variable as follows: | |
| // "Windows" for all versions of Windows | |
| // "MacOS" for all versions of Macintosh OS | |
| // "Linux" for all versions of Linux | |
| // "UNIX" for all other UNIX flavors | |
| // "Unknown OS" indicates failure to detect the OS | |
| var OSName="Unknown OS"; | |
| if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows"; | |
| if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS"; |
sysctl -w net.ipv4.ip_forward=1
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080tmux to run 2 instances of arpspoof:arpspoof -i $INTERFACE -t $VICTIM_IP $GATEWAY_IP| import urllib2 | |
| import json | |
| data = urllib2.urlopen("http://api.bitcoincharts.com/v1/weighted_prices.json") | |
| def convert_to_bitcoin(amount, currency): | |
| bitcoins = json.loads(data.read()) | |
| converted = float(bitcoins[currency]["24h"]) * amount | |
| print converted |
| """ base58 encoding / decoding functions """ | |
| import unittest | |
| alphabet = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ' | |
| base_count = len(alphabet) | |
| def encode(num): | |
| """ Returns num in a base58-encoded string """ | |
| encode = '' | |