Skip to content

Commit

Permalink
Merge pull request evilcos#1 from h00k4n1/master
Browse files Browse the repository at this point in the history
add Dockerfile - noNginx
  • Loading branch information
evilcos authored Jul 2, 2017
2 parents 1cc66c6 + c7f0423 commit a8bc5d1
Show file tree
Hide file tree
Showing 5 changed files with 145 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Dockerfile/noNginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM ubuntu:16.04

RUN sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
apt-get -y update && apt-get install -y supervisor git && \
mkdir -p /var/log/supervisor && \
mkdir -p /etc/supervisord.d/ && \
mkdir -p /var/run/supervisor/
COPY config/supervisord.conf /etc/supervisord.conf


#create user xssor
RUN useradd -d /home/xssor -s /usr/sbin/nologin xssor &&\
git clone https://github.com/evilcos/xssor2.git /home/xssor &&\
chown -R xssor:xssor /home/xssor/


#django
RUN apt-get install -y python-pip && \
mkdir ~/.pip

COPY config/pip.conf ~/.pip/pip.conf
#run
RUN cd /home/xssor/ && pip install -r requirement.txt
#config
COPY config/xssor.conf /etc/supervisord.d/xssor.conf


EXPOSE 8000
VOLUME ["/home/xssor/"]

CMD ["/usr/bin/supervisord","-c","/etc/supervisord.conf"]
81 changes: 81 additions & 0 deletions Dockerfile/noNginx/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Docker for XSSOR2

## 安装Docker

Docker 要求内核3.10以上并且要求64位操作系统。CentOS7.X的内核为3.10 CentOS6.X的2.6.32。

CentOS 安装Docker

```shell
sudo yum install docker
#开机自启动
sudo systemctl enable docker
#启动docker
sudo systemctl start docker
```

ubuntu 安装Docker(未经测试全靠记忆)

```shell
apt-get install docker.io docker
#开机自启动
update-rc.d docker default
#启动docker
services start
#注如果使用的ubuntu16.04以上的也可以使用systemd
sudo systemctl enable docker
sudo systemctl start docker
```

## 目录结构

```
Dockerfile/
└── noNginx
├── config
│   ├── pip.conf
│   ├── supervisord.conf
│   └── xssor.conf
└── Dockerfile
```

## 使用

根据需求切换到相应的Dockerfile文件下建立docker镜像

```
docker build -t xssor .
```

运行

```
docker run -d -p --name xssor 主机端口:8000 xssor
#eg
docker run -d --name xssor --restart=always -p 8004:8000 testxss
```

## 注意事项

modify xssor/payload/probe.js

有两种方式。

- 容器内修改

```shell
docker exec -i -t xssor /bin/bash
#正常修改然后执行
supervisorctl restart all
```

- 提前修改好挂载主机内的目录

```
#主机的shell下
mkdir /opt/xssor/
git clone https://github.com/evilcos/xssor2.git /opt/xssor/
#修改文件
docker run -d --name xssor --restart=always -v /opt/xssor/:/home/xssor/ -p 8004:8000 testxss
```

2 changes: 2 additions & 0 deletions Dockerfile/noNginx/config/pip.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[global]
index-url = https://pypi.mirrors.ustc.edu.cn/simple
21 changes: 21 additions & 0 deletions Dockerfile/noNginx/config/supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[unix_http_server]
file=/var/run/supervisor/supervisor.sock

[supervisord]
nodaemon=true
logfile=/var/log/supervisor/supervisord.log
logfile_maxbytes=50MB
logfile_backups=10
loglevel=info
pidfile=/var/run/supervisord.pid

[supervisorctl]
serverurl=unix:///var/run/supervisor/supervisor.sock

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[include]
files = supervisord.d/*.conf


10 changes: 10 additions & 0 deletions Dockerfile/noNginx/config/xssor.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[program:uwsgi]
user=xssor
directory=/home/xssor/
command=python manage.py runserver 0.0.0.0:8000
autostart = true
autorestart=true
redirect_stderr=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0

0 comments on commit a8bc5d1

Please sign in to comment.