forked from firerpa/lamda
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
110 additions
and
2 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
FROM debian:bullseye-slim | ||
|
||
ENV PYPIMIRROR=https://mirrors.ustc.edu.cn/pypi/web/simple | ||
ENV SS=https://github.com/shadowsocks/go-shadowsocks2/releases/download/v0.1.5/shadowsocks2-linux.gz | ||
ENV SOURCESMIRROR=mirrors.ustc.edu.cn | ||
|
||
RUN sed -i "s/deb.debian.org/${SOURCESMIRROR}/g" /etc/apt/sources.list | ||
RUN sed -i "s|security.debian.org/debian-security|${SOURCESMIRROR}/debian-security|g" /etc/apt/sources.list | ||
|
||
RUN apt-get update && apt-get -y upgrade | ||
RUN apt install -y git adb wget privoxy python3 python3-pip | ||
|
||
COPY entry /usr/bin/mitm | ||
RUN chmod 755 /usr/bin/mitm | ||
|
||
WORKDIR /tmp | ||
|
||
RUN git clone https://github.com/rev1si0n/lamda | ||
RUN pip3 install -i ${PYPIMIRROR} -r lamda/tools/requirements.txt | ||
RUN pip3 install -i ${PYPIMIRROR} packaging | ||
|
||
RUN cp lamda/tools/startmitm.py /usr/bin | ||
RUN chmod 755 /usr/bin/startmitm.py | ||
|
||
RUN wget ${SS} -O - | gzip -d> /usr/bin/go-shadowsocks2 | ||
RUN chmod 755 /usr/bin/go-shadowsocks2 | ||
|
||
RUN ( timeout 5 mitmdump; exit 0 ) && rm -rf lamda | ||
|
||
WORKDIR /root | ||
ENTRYPOINT [ "mitm" ] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/bash | ||
export GRPC_DNS_RESOLVER=native | ||
IP=${1:-} | ||
if [ -z "${IP}" ]; then | ||
exit 1 | ||
fi | ||
|
||
DNS=$(((RANDOM % 10000) + 10000)) | ||
SOCKS5=$(((RANDOM % 10000) + 10000)) | ||
HTTP=$(((RANDOM % 10000) + 10000)) | ||
WEB=${WEBPORT:-1234} | ||
|
||
if [ ! -z "${SS}" ]; then | ||
cat <<EOL >/etc/privoxy/config | ||
confdir /etc/privoxy | ||
logdir /tmp | ||
actionsfile user.action | ||
filterfile user.filter | ||
debug 1 | ||
hostname zeus | ||
listen-address 0.0.0.0:${HTTP} | ||
forward-socks5 / 127.0.0.1:${SOCKS5} . | ||
toggle 0 | ||
enable-remote-toggle 0 | ||
enable-remote-http-toggle 0 | ||
enable-edit-actions 0 | ||
enforce-blocks 0 | ||
EOL | ||
|
||
PIDS= | ||
go-shadowsocks2 -c ${SS} -verbose \ | ||
-socks 127.0.0.1:${SOCKS5} -u \ | ||
-udptun 127.0.0.1:${DNS}=8.8.8.8:53 \ | ||
-tcptun 127.0.0.1:${DNS}=8.8.8.8:53 & | ||
PIDS="$PIDS $!" | ||
privoxy --no-daemon /etc/privoxy/config & | ||
PIDS="$PIDS $!" | ||
|
||
trap "kill -9 ${PIDS} 2>/dev/null" SIGINT SIGTERM | ||
startmitm.py ${IP} --set dns_server=true \ | ||
--set dns_mode=reverse:127.0.0.1:${DNS} \ | ||
--mode upstream:http://127.0.0.1:${HTTP} \ | ||
--set block_global=false \ | ||
--web-host=0.0.0.0 \ | ||
--web-port=${WEB} \ | ||
${@: 2:999} | ||
else | ||
startmitm.py ${IP} --set block_global=false \ | ||
--web-host=0.0.0.0 \ | ||
--web-port=${WEB} \ | ||
${@: 2:999} | ||
fi | ||
exit 0 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
lamda>=3.0.0,<4.0.0 | ||
mitmproxy>6.0.0 | ||
mitmproxy>6.0.0 | ||
packaging |