This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mitmproxy.options import Options | |
from mitmproxy.proxy.config import ProxyConfig | |
from mitmproxy.proxy.server import ProxyServer | |
from mitmproxy.tools.dump import DumpMaster | |
import threading | |
import asyncio | |
import time | |
class Addon(object): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## set up the raspberry pi 3B+ as a wifi AP ( a wireless router ) | |
## suppose etho is your wan interface name, and wlan0 is your lan interface name | |
# https://www.raspberrypi.org/documentation/configuration/wireless/access-point-routed.md | |
# https://thepi.io/how-to-use-your-raspberry-pi-as-a-wireless-access-point/ | |
# https://www.shellvoide.com/wifi/setup-wireless-access-point-hostapd-dnsmasq-linux/ | |
## install softwares | |
apt install -y hostapd | |
apt install -y dnsmasq | |
DEBIAN_FRONTEND=noninteractive apt install -y netfilter-persistent iptables-persistent | |
# testing ps -ef | grep hostapd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Usage: | |
* let cookies = await asyncfy(chrome.cookies.getAll)({ url }) | |
* let tabs = await asyncfy(chrome.tabs.query)({active: true, currentWindow: true}) | |
* | |
* @param fn A function that takes one or more parameters, and the last parameter is a callback which has one or more parameter. The simplest one is chrome.management.getSelf | |
* @returns {function(...[*]): Promise<any>} Return one value if the results array has only one element, else return the whole results array | |
*/ | |
let asyncfy = fn => (...args) => { | |
return new Promise((resolve, reject) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server: | |
logfile: "" | |
# verbosity: 2 | |
username: "nobody" | |
interface: 0.0.0.0 | |
access-control: 0.0.0.0/0 allow | |
prefetch: yes | |
# include: "/opt/unbound/local.conf" | |
# include: "/opt/unbound/customize.conf" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. set the ip and port of http and https proxy manually for the first time, which can be accomplished in command line though. | |
networksetup -setwebproxy "Wi-fi" 127.0.0.1 8080 | |
networksetup -setsecurewebproxy "Wi-fi" 127.0.0.1 8080 | |
2. add the following shell function to your ~/.profile | |
toggleProxy() { | |
e=$(networksetup -getwebproxy wi-fi | grep "No") | |
ns=wi-fi | |
status='' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function printf(s,...) print(s:format(...)) end | |
function fastExportImage() | |
-- whether the pohtoshop is in focus | |
local window = hs.window.focusedWindow() | |
local app = window:application() | |
local title = app:title() | |
local isPhotoshop = title:find("Photoshop CC") | |
if( not isPhotoshop ) then |
NewerOlder