From b2f9ee35cf7816eea83ead2833c52a8252b70d3d Mon Sep 17 00:00:00 2001 From: shizhongpwn <522796871@qq.com> Date: Tue, 29 Jun 2021 11:26:12 +0800 Subject: [PATCH 01/17] docker update --- ancypwn-docker/16.04/Dockerfile | 109 ++++++++++++++++++-------------- ancypwn-docker/18.04/Dockerfile | 104 +++++++++++++++--------------- ancypwn-docker/18.10/Dockerfile | 98 ++++++++++++++-------------- ancypwn-docker/20.04/Dockerfile | 56 ++++++++++++++++ 4 files changed, 219 insertions(+), 148 deletions(-) create mode 100644 ancypwn-docker/20.04/Dockerfile diff --git a/ancypwn-docker/16.04/Dockerfile b/ancypwn-docker/16.04/Dockerfile index 5228725..5a40a21 100644 --- a/ancypwn-docker/16.04/Dockerfile +++ b/ancypwn-docker/16.04/Dockerfile @@ -1,49 +1,60 @@ -FROM ubuntu:16.04 - -MAINTAINER Anciety - -# Apt packages -RUN dpkg --add-architecture i386 && apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get install -qy \ - git nasm python \ - build-essential \ - python-dev python-pip python-setuptools \ - libc6-dbg \ - libc6-dbg:i386 \ - gcc-multilib \ - gdb-multiarch \ - gcc \ - wget \ - curl \ - glibc-source \ - cmake \ - python-capstone \ - socat \ - netcat \ - ruby \ - ruby-dev \ - lxterminal && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ - cd ~ && tar -xvf /usr/src/glibc/glibc-2.23.tar.xz - -# python/ruby packages & gdb-plugin -RUN pip install --no-cache-dir pwntools ropper ancypatch && \ - gem install one_gadget seccomp-tools && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -# git installaing package -RUN cd ~/ && \ - git clone https://github.com/pwndbg/pwndbg.git && \ - cd ~/pwndbg/ && ./setup.sh && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -ENV LANG C.UTF-8 - -COPY ./ancyterm.py /usr/local/bin/ancyterm -RUN chmod +x /usr/local/bin/ancyterm - -VOLUME ["/pwn"] -WORKDIR /pwn - -CMD ["/bin/bash"] +FROM ubuntu:16.04 + +MAINTAINER Anciety + +# Apt packages +RUN dpkg --add-architecture i386 && \ + apt-get update && \ + apt-get -y install python-software-properties \ + software-properties-common && \ + add-apt-repository ppa:brightbox/ruby-ng && \ + apt-get update && \ + apt-get purge --auto-remove ruby && \ + DEBIAN_FRONTEND=noninteractive apt-get install -qy \ + git nasm python3 \ + build-essential \ + python3-dev python3-pip python3-setuptools\ + libc6-dbg \ + libc6-dbg:i386 \ + gcc-multilib \ + gdb-multiarch \ + gcc \ + sudo \ + wget \ + curl \ + glibc-source \ + cmake \ + socat \ + netcat \ + ruby2.6 \ + ruby2.6-dev \ + lxterminal && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ + cd ~ && tar -xvf /usr/src/glibc/glibc-2.23.tar.xz + +# python/ruby packages & gdb-plugin +#RUN wget https://files.pythonhosted.org/packages/cd/82/04e9aaf603fdbaecb4323b9e723f13c92c245f6ab2902195c53987848c78/pip-21.1.2-py3-none-any.whl && \ +#RUN pip3 install pip-21.1.2-py3-none-any.whl && \ +RUN wget https://bootstrap.pypa.io/pip/3.5/get-pip.py && \ + python3 get-pip.py && \ +# pip3 install --upgrade pip && \ + pip3 install --no-cache-dir pwntools ropper ancypatch LibcSearcher&& \ + gem install one_gadget seccomp-tools && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# git installaing package +RUN cd ~/ && \ + git clone https://github.com/pwndbg/pwndbg.git && \ + cd ~/pwndbg/ && ./setup.sh && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +ENV LANG C.UTF-8 + +COPY ./ancyterm.py /usr/local/bin/ancyterm +RUN chmod +x /usr/local/bin/ancyterm + +VOLUME ["/pwn"] +WORKDIR /pwn + +CMD ["/bin/bash"] diff --git a/ancypwn-docker/18.04/Dockerfile b/ancypwn-docker/18.04/Dockerfile index 072c315..052f035 100644 --- a/ancypwn-docker/18.04/Dockerfile +++ b/ancypwn-docker/18.04/Dockerfile @@ -1,50 +1,54 @@ -FROM ubuntu:18.04 - -MAINTAINER Anciety - - -# Apt packages -RUN dpkg --add-architecture i386 && apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get install -qy \ - git nasm python \ - build-essential \ - python-dev python-pip python-setuptools \ - libc6-dbg \ - libc6-dbg:i386 \ - gcc-multilib \ - gdb-multiarch \ - gcc \ - wget \ - curl \ - glibc-source \ - cmake \ - python-capstone \ - socat \ - netcat \ - ruby \ - ruby-dev \ - lxterminal && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ - cd ~ && tar -xvf /usr/src/glibc/glib*.tar.xz - -# python/ruby packages & gdb-plugin -RUN pip install --no-cache-dir pwntools ropper ancypatch && \ - gem install one_gadget seccomp-tools && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -# git installaing package -RUN cd ~/ && \ - git clone https://github.com/pwndbg/pwndbg.git && \ - cd ~/pwndbg/ && ./setup.sh && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -ENV LANG C.UTF-8 - -COPY ./ancyterm.py /usr/local/bin/ancyterm -RUN chmod +x /usr/local/bin/ancyterm - -VOLUME ["/pwn"] -WORKDIR /pwn - -CMD ["/bin/bash"] +FROM ubuntu:18.04 + +MAINTAINER Anciety + + +# Apt packages +RUN dpkg --add-architecture i386 && \ + apt-get update && \ + apt-get -y install sudo wget cmake curl gcc socat\ + software-properties-common && \ + wget http://archive.ubuntu.com/ubuntu/pool/main/k/keyutils/libkeyutils1_1.5.9-9.2ubuntu2_amd64.deb && \ + dpkg -i libkeyutils1_1.5.9-9.2ubuntu2_amd64.deb && \ + add-apt-repository ppa:brightbox/ruby-ng && \ + apt-get update && \ + apt-get purge --auto-remove ruby && \ + DEBIAN_FRONTEND=noninteractive apt-get install -qy \ + git nasm python3 \ + build-essential \ + python3-dev python3-pip python3-setuptools \ + libc6-dbg \ + libc6-dbg:i386 \ + gcc-multilib \ + gdb-multiarch \ + glibc-source \ + netcat \ + ruby2.6 \ + ruby2.6-dev \ + lxterminal && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ + cd ~ && tar -xvf /usr/src/glibc/glib*.tar.xz + +# python/ruby packages & gdb-plugin +RUN wget https://bootstrap.pypa.io/pip/3.5/get-pip.py && \ + python3 get-pip.py && \ + pip install --no-cache-dir LibcSearcher pwntools ropper ancypatch && \ + gem install one_gadget seccomp-tools && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# git installaing package +RUN cd ~/ && \ + git clone https://github.com/pwndbg/pwndbg.git && \ + cd ~/pwndbg/ && ./setup.sh && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +ENV LANG C.UTF-8 + +COPY ./ancyterm.py /usr/local/bin/ancyterm +RUN chmod +x /usr/local/bin/ancyterm + +VOLUME ["/pwn"] +WORKDIR /pwn + +CMD ["/bin/bash"] diff --git a/ancypwn-docker/18.10/Dockerfile b/ancypwn-docker/18.10/Dockerfile index 6af97e6..1e5d3e9 100644 --- a/ancypwn-docker/18.10/Dockerfile +++ b/ancypwn-docker/18.10/Dockerfile @@ -1,49 +1,49 @@ -FROM ubuntu:18.10 - -MAINTAINER Anciety - -# Apt packages -RUN dpkg --add-architecture i386 && apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get install -qy \ - git nasm python \ - build-essential \ - python-dev python-pip python-setuptools \ - libc6-dbg \ - libc6-dbg:i386 \ - gcc-multilib \ - gdb-multiarch \ - gcc \ - wget \ - curl \ - glibc-source \ - cmake \ - python-capstone \ - socat \ - netcat \ - ruby \ - ruby-dev \ - lxterminal && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ - cd ~ && tar -xvf /usr/src/glibc/glibc-*.tar.xz - -# python/ruby packages & gdb-plugin -RUN pip install --no-cache-dir pwntools ropper ancypatch && \ - gem install one_gadget seccomp-tools && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -# git installaing package -RUN cd ~/ && \ - git clone https://github.com/pwndbg/pwndbg.git && \ - cd ~/pwndbg/ && ./setup.sh && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -ENV LANG C.UTF-8 - -COPY ./ancyterm.py /usr/local/bin/ancyterm -RUN chmod +x /usr/local/bin/ancyterm - -VOLUME ["/pwn"] -WORKDIR /pwn - -CMD ["/bin/bash"] +FROM ubuntu:18.10 + +MAINTAINER Anciety + +# Apt packages +RUN dpkg --add-architecture i386 && apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -qy \ + git nasm python \ + build-essential \ + python-dev python-pip python-setuptools \ + libc6-dbg \ + libc6-dbg:i386 \ + gcc-multilib \ + gdb-multiarch \ + gcc \ + wget \ + curl \ + glibc-source \ + cmake \ + python-capstone \ + socat \ + netcat \ + ruby \ + ruby-dev \ + lxterminal && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ + cd ~ && tar -xvf /usr/src/glibc/glibc-*.tar.xz + +# python/ruby packages & gdb-plugin +RUN pip install --no-cache-dir pwntools ropper ancypatch && \ + gem install one_gadget seccomp-tools && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# git installaing package +RUN cd ~/ && \ + git clone https://github.com/pwndbg/pwndbg.git && \ + cd ~/pwndbg/ && ./setup.sh && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +ENV LANG C.UTF-8 + +COPY ./ancyterm.py /usr/local/bin/ancyterm +RUN chmod +x /usr/local/bin/ancyterm + +VOLUME ["/pwn"] +WORKDIR /pwn + +CMD ["/bin/bash"] diff --git a/ancypwn-docker/20.04/Dockerfile b/ancypwn-docker/20.04/Dockerfile new file mode 100644 index 0000000..227859c --- /dev/null +++ b/ancypwn-docker/20.04/Dockerfile @@ -0,0 +1,56 @@ +FROM ubuntu:20.04 + +MAINTAINER Anciety + +# Apt packages +RUN dpkg --add-architecture i386 && apt-get update && \ + apt-get -y install software-properties-common && \ + add-apt-repository ppa:brightbox/ruby-ng && \ + add-apt-repository ppa:deadsnakes/ppa && \ + apt-get update && \ + apt-get purge --auto-remove ruby && \ + DEBIAN_FRONTEND=noninteractive apt-get install -qy \ + git nasm python3 \ + build-essential fakeroot dpkg-dev libcurl4-openssl-dev\ + python3-dev python3-pip python3-setuptools \ + libc6-dbg \ + libc6-dbg:i386 \ + gcc-multilib \ + gdb-multiarch \ + gcc \ + wget \ + curl \ + glibc-source \ + cmake \ + socat \ + sudo \ + netcat \ + ruby2.6 \ + ruby2.6-dev \ + lxterminal && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ + cd ~ && tar -xvf /usr/src/glibc/glib*.tar.xz + +# python/ruby packages & gdb-plugin +RUN wget https://bootstrap.pypa.io/pip/get-pip.py && \ + python3 get-pip.py && \ + pip3 install --no-cache-dir pwntools ropper ancypatch && \ + gem install one_gadget seccomp-tools && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# git installaing package +RUN cd ~/ && \ + git clone https://github.com/pwndbg/pwndbg.git && \ + cd ~/pwndbg/ && ./setup.sh && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +ENV LANG C.UTF-8 + +COPY ./ancyterm.py /usr/local/bin/ancyterm +RUN chmod +x /usr/local/bin/ancyterm + +VOLUME ["/pwn"] +WORKDIR /pwn + +CMD ["/bin/bash"] From 88f8b6e651f7f1c6eb0d6fe9524ff15cdd88ef91 Mon Sep 17 00:00:00 2001 From: shizhongpwn <522796871@qq.com> Date: Tue, 29 Jun 2021 11:26:38 +0800 Subject: [PATCH 02/17] ancypwn-terminal update --- ancypwn-terminal/ancyterm.py | 13 +++++-------- ancypwn-terminal/launch.json | 16 ++++++++++++++++ ancypwn-terminal/test.py | 5 +++++ 3 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 ancypwn-terminal/launch.json create mode 100644 ancypwn-terminal/test.py diff --git a/ancypwn-terminal/ancyterm.py b/ancypwn-terminal/ancyterm.py index 99b06e8..168e22d 100755 --- a/ancypwn-terminal/ancyterm.py +++ b/ancypwn-terminal/ancyterm.py @@ -1,4 +1,5 @@ #!/usr/bin/python +# -*- coding: UTF-8 -*- import argparse import json @@ -10,32 +11,28 @@ def pack(num): return struct.pack(' Date: Tue, 29 Jun 2021 11:27:13 +0800 Subject: [PATCH 03/17] src update to py3 --- src/ancypwn.py | 23 +++++++++++------------ src/server.py | 16 +++++++++------- src/util.py | 4 ++-- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/ancypwn.py b/src/ancypwn.py index f0f28bd..b313102 100644 --- a/src/ancypwn.py +++ b/src/ancypwn.py @@ -10,9 +10,8 @@ APPNAME = 'ancypwn' APPAUTHOR = 'Anciety' - -CONFIG_DIR = appdirs.user_data_dir(APPNAME, APPAUTHOR) -CONFIG_FILE_PATH = os.path.join(CONFIG_DIR, 'config.json') +CONFIG_DIR = appdirs.user_data_dir(APPNAME, APPAUTHOR) #获取当前目录 +CONFIG_FILE_PATH = os.path.join(CONFIG_DIR, 'config.json') #找到config.json文件 SUPPORTED_UBUNTU_VERSION = [ @@ -22,8 +21,8 @@ ] -system = platform.system().lower() -if 'linux' in system or 'darwin' in system: +system = platform.system().lower() +if 'linux' in system or 'darwin' in system: #根据不同的平台作出不同选择 BACKEND_DEFAULT_CONFIG = { 'name': 'unix' } @@ -40,7 +39,7 @@ install_plugin_name = 'windows' -DEFAULT_CONFIG = { +DEFAULT_CONFIG = { # 端口,环境,插件 'terminal_port': 15111, 'backend': BACKEND_DEFAULT_CONFIG, # install plugin name @@ -58,7 +57,7 @@ class PluginNotFoundError(Exception): def plugin_module_import(name): try: - return importlib.import_module(name) + return importlib.import_module(name) except ModuleNotFoundError as e: prompt = 'plugin {} not found, please install it first.\n'.format(name) prompt += 'try follwing:\n\tpip3 install {}'.format(name) @@ -70,17 +69,17 @@ def __init__(self, config): name = config['install_plugin'] realname = 'ancypwn_install_{}'.format(name) self.config = config - self.mod = plugin_module_import(realname) + self.mod = plugin_module_import(realname) #这里加载一个mod def install(self): - self.mod.install(self.config) + self.mod.install(self.config) #x向得到的模块里面install? class Backend: def __init__(self, config): - realname = 'ancypwn_backend_{}'.format(config['backend']['name']) + realname = 'ancypwn_backend_{}'.format(config['backend']['name']) #macos下 ancypwn_backend_unix self.config = config - self.mod = plugin_module_import(realname) + self.mod = plugin_module_import(realname) #这里导入的模块好似本机还没有 def run(self, directory=None, priv=None, image=None, tag=None, command=None): if directory is None or \ @@ -91,7 +90,7 @@ def run(self, directory=None, priv=None, image=None, tag=None, command=None): # this should never hapen raise Exception('backend run argument incorrect!') image_name = '{}:{}'.format(image, tag) - self.mod.run( + self.mod.run( # ancypwn_backend_unix 执行命令 config=self.config, priv=priv, image_name=image_name, diff --git a/src/server.py b/src/server.py index 907a5ed..edc5b64 100644 --- a/src/server.py +++ b/src/server.py @@ -5,6 +5,8 @@ import importlib from socketserver import TCPServer, StreamRequestHandler +class PluginNotFoundError(Exception): + pass def plugin_module_import(name): try: @@ -17,17 +19,17 @@ def plugin_module_import(name): class NotificationHandler(StreamRequestHandler): def handle(self): - length = struct.unpack(' Date: Tue, 29 Jun 2021 11:29:08 +0800 Subject: [PATCH 04/17] macos --- ancypwn-backend-unix | 1 + ancypwn-terminal-iterm2 | 1 + 2 files changed, 2 insertions(+) create mode 160000 ancypwn-backend-unix create mode 160000 ancypwn-terminal-iterm2 diff --git a/ancypwn-backend-unix b/ancypwn-backend-unix new file mode 160000 index 0000000..f0a7ad5 --- /dev/null +++ b/ancypwn-backend-unix @@ -0,0 +1 @@ +Subproject commit f0a7ad5f0c6af66500dbcbad2593a3028fa36382 diff --git a/ancypwn-terminal-iterm2 b/ancypwn-terminal-iterm2 new file mode 160000 index 0000000..7457ec9 --- /dev/null +++ b/ancypwn-terminal-iterm2 @@ -0,0 +1 @@ +Subproject commit 7457ec9f5da700d9ad3bd47e1a1ab03d6b37794e From e73e461a619cda79c9b88df30353eaf3f4be4030 Mon Sep 17 00:00:00 2001 From: shizhongpwn <522796871@qq.com> Date: Tue, 29 Jun 2021 11:40:19 +0800 Subject: [PATCH 05/17] README --- README.md | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 9efb702..bdc9585 100644 --- a/README.md +++ b/README.md @@ -36,17 +36,15 @@ Backends have the name pattern: `ancypwn-backend-*`, while terminal plugin has t So you need: ``` -# download images, and tag them properly -docker pull auxy233/ancypwn:16.04 -docker pull auxy233/ancypwn:18.04 -docker pull auxy233/ancypwn:18.10 -docker image tag auxy233/ancypwn:16.04 ancypwn:16.04 -docker image tag auxy233/ancypwn:18.04 ancypwn:18.04 -docker image tag auxy233/ancypwn:18.10 ancypwn:18.10 +# build images +docker build -t ancypwn:20.04 . +docker build -t ancypwn:18.04 . +docker build -t ancypwn:18.10 . +docker build -t ancypwn:16.04 . pip3 install ancypwn -# pip3 install ancypwn-backend-* (choose your backend, and install it) -# pip3 install ancypwn-terminal-* (choose your terminal, and install it) +# install ancypwn-backend-* (choose your backend, and install it) +# install ancypwn-terminal-* (choose your terminal, and install it) ``` ### Choose your backend @@ -61,7 +59,7 @@ Current official backends: Current official terminals: - [ancypwn-terminal-alacritty](https://github.com/Escapingbug/ancypwn-terminal-alacritty) -- [ancypwn-terminal-iterm2](https://github.com/Escapingbug/ancypwn-terminal-iterm2) +- [ancypwn-terminal-iterm2](https://github.com/shizhongpwn/ancypwn-terminal-iterm2.git) ## Usage @@ -156,3 +154,4 @@ Current supported ubuntu version: * 18.10 * 18.04 * 16.04 +* 20.04 From 8459c4b10a399aec14f107a5bef2e7a5eed0a982 Mon Sep 17 00:00:00 2001 From: shizhongpwn <522796871@qq.com> Date: Tue, 29 Jun 2021 11:40:44 +0800 Subject: [PATCH 06/17] ancypwn-terminal2 update --- ancypwn-terminal-iterm2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ancypwn-terminal-iterm2 b/ancypwn-terminal-iterm2 index 7457ec9..0b14058 160000 --- a/ancypwn-terminal-iterm2 +++ b/ancypwn-terminal-iterm2 @@ -1 +1 @@ -Subproject commit 7457ec9f5da700d9ad3bd47e1a1ab03d6b37794e +Subproject commit 0b14058199862705e850e71007eb7be0f59e9655 From 4a5db2736321e4408c89948120812642d584ea38 Mon Sep 17 00:00:00 2001 From: shizhongpwn <522796871@qq.com> Date: Tue, 29 Jun 2021 12:01:17 +0800 Subject: [PATCH 07/17] docker 20.04 --- ancypwn-docker/20.04/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ancypwn-docker/20.04/Dockerfile b/ancypwn-docker/20.04/Dockerfile index 227859c..04219f8 100644 --- a/ancypwn-docker/20.04/Dockerfile +++ b/ancypwn-docker/20.04/Dockerfile @@ -1,6 +1,6 @@ FROM ubuntu:20.04 -MAINTAINER Anciety +MAINTAINER xibai # Apt packages RUN dpkg --add-architecture i386 && apt-get update && \ From 8f83700d199f0c3e27aad0be614a5f3ac3a60b7d Mon Sep 17 00:00:00 2001 From: shizhongpwn <522796871@qq.com> Date: Tue, 29 Jun 2021 12:04:54 +0800 Subject: [PATCH 08/17] README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bdc9585..35e43bb 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,8 @@ Ancypwn is now plugin based, choose your own plugin or write a new plugin if you You will need at least 4 parts to have a working environment (apart from docker). -0. A ancypwn docker image, and is properly tagged as ancypwn:VERSION, VERSION is one of "16.04", "18.04" or "18.10", each represent a corresponding ubuntu version. -1. ancypwn launcher (`pip install ancypwn`) +0. A ancypwn docker image, and is properly tagged as ancypwn:VERSION, VERSION is one of "16.04", "18.04", "20.04" or "18.10", each represent a corresponding ubuntu version. +1. ancypwn launcher (`pip3 install ancypwn`) 2. a backend: backend provides ability to listen incoming request to pop up a terminal window, then asks terminal plugin to do it and does different docker container launching strategy (like remote support). 3. a terminal plugin: this one handles terminal poping up From 67b9d788bf943af88e4634f408ff508553340312 Mon Sep 17 00:00:00 2001 From: shizhongpwn <522796871@qq.com> Date: Wed, 8 Sep 2021 19:43:04 +0800 Subject: [PATCH 09/17] ancypwn-docker update --- ancypwn-docker/16.04/.gdb_history | 1 + ancypwn-docker/16.04/Dockerfile | 7 +++++++ ancypwn-docker/18.04/Dockerfile | 7 +++++++ ancypwn-docker/20.04/.gdb_history | 1 + ancypwn-docker/20.04/Dockerfile | 7 +++++++ 5 files changed, 23 insertions(+) create mode 100644 ancypwn-docker/16.04/.gdb_history create mode 100644 ancypwn-docker/20.04/.gdb_history diff --git a/ancypwn-docker/16.04/.gdb_history b/ancypwn-docker/16.04/.gdb_history new file mode 100644 index 0000000..79102ed --- /dev/null +++ b/ancypwn-docker/16.04/.gdb_history @@ -0,0 +1 @@ +parseheap diff --git a/ancypwn-docker/16.04/Dockerfile b/ancypwn-docker/16.04/Dockerfile index 5a40a21..700f4c0 100644 --- a/ancypwn-docker/16.04/Dockerfile +++ b/ancypwn-docker/16.04/Dockerfile @@ -49,6 +49,13 @@ RUN cd ~/ && \ cd ~/pwndbg/ && ./setup.sh && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +RUN cd ~/ && \ + git clone https://github.com/scwuaptx/Pwngdb.git && \ + cp ~/Pwngdb/.gdbinit ~/ && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ + sed -i '1d' ~/.gdbinit && \ + sed -i '1c source ~/pwndbg/gdbinit.py' ~/.gdbinit + ENV LANG C.UTF-8 COPY ./ancyterm.py /usr/local/bin/ancyterm diff --git a/ancypwn-docker/18.04/Dockerfile b/ancypwn-docker/18.04/Dockerfile index 052f035..1221cd0 100644 --- a/ancypwn-docker/18.04/Dockerfile +++ b/ancypwn-docker/18.04/Dockerfile @@ -43,6 +43,13 @@ RUN cd ~/ && \ cd ~/pwndbg/ && ./setup.sh && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +RUN cd ~/ && \ + git clone https://github.com/scwuaptx/Pwngdb.git && \ + cp ~/Pwngdb/.gdbinit ~/ && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ + sed -i '1d' ~/.gdbinit && \ + sed -i '1c source ~/pwndbg/gdbinit.py' ~/.gdbinit* + ENV LANG C.UTF-8 COPY ./ancyterm.py /usr/local/bin/ancyterm diff --git a/ancypwn-docker/20.04/.gdb_history b/ancypwn-docker/20.04/.gdb_history new file mode 100644 index 0000000..79102ed --- /dev/null +++ b/ancypwn-docker/20.04/.gdb_history @@ -0,0 +1 @@ +parseheap diff --git a/ancypwn-docker/20.04/Dockerfile b/ancypwn-docker/20.04/Dockerfile index 04219f8..05a613e 100644 --- a/ancypwn-docker/20.04/Dockerfile +++ b/ancypwn-docker/20.04/Dockerfile @@ -45,6 +45,13 @@ RUN cd ~/ && \ cd ~/pwndbg/ && ./setup.sh && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +RUN cd ~/ && \ + git clone https://github.com/scwuaptx/Pwngdb.git && \ + cp ~/Pwngdb/.gdbinit ~/ && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ + sed -i '1d' ~/.gdbinit && \ + sed -i '1c source ~/pwndbg/gdbinit.py' ~/.gdbinit + ENV LANG C.UTF-8 COPY ./ancyterm.py /usr/local/bin/ancyterm From 9954b74236e74beede9458d678a54250ff6f8324 Mon Sep 17 00:00:00 2001 From: shizhongpwn <522796871@qq.com> Date: Wed, 8 Sep 2021 19:45:03 +0800 Subject: [PATCH 10/17] ancypwn-terminal update --- ancypwn-terminal/test.py | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 ancypwn-terminal/test.py diff --git a/ancypwn-terminal/test.py b/ancypwn-terminal/test.py deleted file mode 100644 index 76cb8ce..0000000 --- a/ancypwn-terminal/test.py +++ /dev/null @@ -1,5 +0,0 @@ -import argparse -parser = argparse.ArgumentParser() -parser.add_argument("square", help="display a square of a given number") -args = parser.parse_args() -print(int(args.square)**2) \ No newline at end of file From f6f69e244395f6364d71b1a567b69283a4e3561f Mon Sep 17 00:00:00 2001 From: shizhongpwn <522796871@qq.com> Date: Wed, 8 Sep 2021 19:45:22 +0800 Subject: [PATCH 11/17] src update --- src/ancypwn.py | 21 +++++++++++---------- src/server.py | 14 +++++++------- src/util.py | 2 +- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/ancypwn.py b/src/ancypwn.py index b313102..d66f949 100644 --- a/src/ancypwn.py +++ b/src/ancypwn.py @@ -10,19 +10,20 @@ APPNAME = 'ancypwn' APPAUTHOR = 'Anciety' -CONFIG_DIR = appdirs.user_data_dir(APPNAME, APPAUTHOR) #获取当前目录 -CONFIG_FILE_PATH = os.path.join(CONFIG_DIR, 'config.json') #找到config.json文件 +CONFIG_DIR = appdirs.user_data_dir(APPNAME, APPAUTHOR) +CONFIG_FILE_PATH = os.path.join(CONFIG_DIR, 'config.json') SUPPORTED_UBUNTU_VERSION = [ '16.04', '18.04', - '18.10', + '18.10', # This is not well maintained because it is not commonly used + '20.04', ] system = platform.system().lower() -if 'linux' in system or 'darwin' in system: #根据不同的平台作出不同选择 +if 'linux' in system or 'darwin' in system: BACKEND_DEFAULT_CONFIG = { 'name': 'unix' } @@ -39,7 +40,7 @@ install_plugin_name = 'windows' -DEFAULT_CONFIG = { # 端口,环境,插件 +DEFAULT_CONFIG = { 'terminal_port': 15111, 'backend': BACKEND_DEFAULT_CONFIG, # install plugin name @@ -69,17 +70,17 @@ def __init__(self, config): name = config['install_plugin'] realname = 'ancypwn_install_{}'.format(name) self.config = config - self.mod = plugin_module_import(realname) #这里加载一个mod + self.mod = plugin_module_import(realname) def install(self): - self.mod.install(self.config) #x向得到的模块里面install? + self.mod.install(self.config) class Backend: def __init__(self, config): - realname = 'ancypwn_backend_{}'.format(config['backend']['name']) #macos下 ancypwn_backend_unix + realname = 'ancypwn_backend_{}'.format(config['backend']['name']) #macos ancypwn_backend_unix self.config = config - self.mod = plugin_module_import(realname) #这里导入的模块好似本机还没有 + self.mod = plugin_module_import(realname) def run(self, directory=None, priv=None, image=None, tag=None, command=None): if directory is None or \ @@ -90,7 +91,7 @@ def run(self, directory=None, priv=None, image=None, tag=None, command=None): # this should never hapen raise Exception('backend run argument incorrect!') image_name = '{}:{}'.format(image, tag) - self.mod.run( # ancypwn_backend_unix 执行命令 + self.mod.run( config=self.config, priv=priv, image_name=image_name, diff --git a/src/server.py b/src/server.py index edc5b64..95d3c80 100644 --- a/src/server.py +++ b/src/server.py @@ -19,17 +19,17 @@ def plugin_module_import(name): class NotificationHandler(StreamRequestHandler): def handle(self): - length = struct.unpack(' Date: Wed, 8 Sep 2021 20:07:12 +0800 Subject: [PATCH 12/17] ancypwn-docker update --- ancypwn-docker/16.04/.gdb_history | 1 - ancypwn-docker/20.04/.gdb_history | 1 - 2 files changed, 2 deletions(-) delete mode 100644 ancypwn-docker/16.04/.gdb_history delete mode 100644 ancypwn-docker/20.04/.gdb_history diff --git a/ancypwn-docker/16.04/.gdb_history b/ancypwn-docker/16.04/.gdb_history deleted file mode 100644 index 79102ed..0000000 --- a/ancypwn-docker/16.04/.gdb_history +++ /dev/null @@ -1 +0,0 @@ -parseheap diff --git a/ancypwn-docker/20.04/.gdb_history b/ancypwn-docker/20.04/.gdb_history deleted file mode 100644 index 79102ed..0000000 --- a/ancypwn-docker/20.04/.gdb_history +++ /dev/null @@ -1 +0,0 @@ -parseheap From a67ed26859d45c0c77ce0e6f7dc4e4222a7d0813 Mon Sep 17 00:00:00 2001 From: shizhongpwn <522796871@qq.com> Date: Wed, 8 Sep 2021 20:07:25 +0800 Subject: [PATCH 13/17] ancypwn-terminal update --- ancypwn-terminal/launch.json | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 ancypwn-terminal/launch.json diff --git a/ancypwn-terminal/launch.json b/ancypwn-terminal/launch.json deleted file mode 100644 index c25b4b6..0000000 --- a/ancypwn-terminal/launch.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Python: 当前文件", - "type": "python", - "request": "launch", - "program": "${file}", - "console": "integratedTerminal", - "args": ["2"] - } - ] -} \ No newline at end of file From 1b99c04a16b2d36f3a2dd64c4981b96342586174 Mon Sep 17 00:00:00 2001 From: shizhongpwn <522796871@qq.com> Date: Wed, 8 Sep 2021 20:07:40 +0800 Subject: [PATCH 14/17] src update --- src/ancypwn.py | 2 +- src/server.py | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/ancypwn.py b/src/ancypwn.py index d66f949..a12d8c7 100644 --- a/src/ancypwn.py +++ b/src/ancypwn.py @@ -22,7 +22,7 @@ ] -system = platform.system().lower() +system = platform.system().lower() if 'linux' in system or 'darwin' in system: BACKEND_DEFAULT_CONFIG = { 'name': 'unix' diff --git a/src/server.py b/src/server.py index 95d3c80..a145146 100644 --- a/src/server.py +++ b/src/server.py @@ -5,8 +5,6 @@ import importlib from socketserver import TCPServer, StreamRequestHandler -class PluginNotFoundError(Exception): - pass def plugin_module_import(name): try: From 653b0a4317e94981936158a32c5126a6960eb3d3 Mon Sep 17 00:00:00 2001 From: shizhongpwn <522796871@qq.com> Date: Wed, 8 Sep 2021 20:08:48 +0800 Subject: [PATCH 15/17] README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 35e43bb..6d5f1ae 100644 --- a/README.md +++ b/README.md @@ -43,8 +43,8 @@ docker build -t ancypwn:18.10 . docker build -t ancypwn:16.04 . pip3 install ancypwn -# install ancypwn-backend-* (choose your backend, and install it) -# install ancypwn-terminal-* (choose your terminal, and install it) +# pip3 install ancypwn-backend-* (choose your backend, and install it) +# pip3 install ancypwn-terminal-* (choose your terminal, and install it) ``` ### Choose your backend From c18ac4c40c13ca653c9164f08c52dd144268390a Mon Sep 17 00:00:00 2001 From: shizhongpwn <522796871@qq.com> Date: Wed, 8 Sep 2021 20:14:48 +0800 Subject: [PATCH 16/17] README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6d5f1ae..ef3e015 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ Current official backends: Current official terminals: - [ancypwn-terminal-alacritty](https://github.com/Escapingbug/ancypwn-terminal-alacritty) -- [ancypwn-terminal-iterm2](https://github.com/shizhongpwn/ancypwn-terminal-iterm2.git) +- [ancypwn-terminal-iterm2](https://github.com/Escapingbug/ancypwn-terminal-iterm2) ## Usage From 716146e4986c514754492c8503ab196eecb9466d Mon Sep 17 00:00:00 2001 From: shizhongpwn <522796871@qq.com> Date: Thu, 9 Sep 2021 15:30:50 +0800 Subject: [PATCH 17/17] delete the whitespace in server.py --- src/server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server.py b/src/server.py index a145146..07027ce 100644 --- a/src/server.py +++ b/src/server.py @@ -20,7 +20,7 @@ def handle(self): length = struct.unpack('