-
Notifications
You must be signed in to change notification settings - Fork 166
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
5 changed files
with
61 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
FROM alpine:latest | ||
MAINTAINER w8ay.w8ay@qq.com | ||
# install requirements | ||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories | ||
|
||
RUN set -x \ | ||
&& apk update \ | ||
&& apk add bash \ | ||
&& apk add python3 \ | ||
&& apk add redis \ | ||
&& apk add mongodb \ | ||
&& apk add mongodb-tools | ||
|
||
# install w11scan | ||
RUN mkdir -p /opt/w11scan | ||
COPY . /opt/w11scan | ||
|
||
RUN set -x \ | ||
&& pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple -r /opt/w11scan/requirements.txt | ||
|
||
RUN set -x \ | ||
&& chmod a+x /opt/w11scan/dockerconf/start.sh | ||
|
||
WORKDIR /opt/w11scan | ||
|
||
ENTRYPOINT ["/opt/w11scan/dockerconf/start.sh"] | ||
|
||
EXPOSE 8000 | ||
|
||
CMD ["/usr/bin/tail", "-f", "/dev/null"] |
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,36 +1,15 @@ | ||
|
||
from pymongo import MongoClient | ||
from config import mongodb_host,mongodb_password,mongodb_port,mongodb_username | ||
import json | ||
|
||
# db connect | ||
class MongDB(object): | ||
def __init__(self,host = 'localhost',port = 27017,database = 'w11scan',username = '',password = ''): | ||
self.host = host | ||
self.port = port | ||
def __init__(self,database = 'w11scan'): | ||
self.host = mongodb_host | ||
self.port = mongodb_port | ||
self.database = database | ||
self.conn = MongoClient(self.host,self.port) | ||
self.coll = self.conn[self.database] | ||
# self.coll.authenticate(username,password) | ||
|
||
# with open("cms.json") as f: | ||
# data = json.load(f) | ||
# | ||
# db = MongDB() | ||
# db.coll["cmsdna"].insert_many(data) | ||
# | ||
# # print(db.coll.collection_names()) | ||
# | ||
# collections = db.coll.collection_names() | ||
# for k,v in data.items(): | ||
# # db.coll[k].insert_many(v) | ||
# for i in v: | ||
# i["hit"] = 0 | ||
# if i["option"] == "regx": | ||
# i["option"] = "keyword" | ||
# db.coll[k].insert_many(v) | ||
# print(v) | ||
|
||
# for i in collections: | ||
# cursor = db.coll[i].find() | ||
# for f in cursor: | ||
# print(f) | ||
if mongodb_username != "" and mongodb_password != "": | ||
self.coll.authenticate(mongodb_username,mongodb_password) |
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,3 @@ | ||
use w11scan_config | ||
db.result.createIndex({"$**":"text"}) | ||
exit |
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,20 @@ | ||
#!/bin/bash | ||
|
||
XUNFENG_BASE=/opt/w11scan | ||
cd $XUNFENG_BASE | ||
XUNFENG_LOG=/var/log/xunfeng | ||
MONGODB_PATH=/data/db | ||
|
||
[ ! -d $XUNFENG_LOG ] && mkdir -p ${XUNFENG_LOG} | ||
[ ! -d $MONGODB_PATH ] && mkdir -p ${MONGODB_PATH} | ||
|
||
nohup redis-server > ${XUNFENG_LOG}/redis.log & | ||
nohup mongod --bind_ip 127.0.0.1 --port 65521 --dbpath=${MONGODB_PATH}> ${XUNFENG_LOG}/db.log & | ||
sleep 3s | ||
mongorestore -h 127.0.0.1 --port 65521 -d w11scan ${XUNFENG_BASE}/backup/w11scan | ||
mongo 127.0.0.1:65521 < ${XUNFENG_BASE}/dockerconf/mongoauth | ||
python3 ${XUNFENG_BASE}/manage.py migrate | ||
nohup python3 ${XUNFENG_BASE}/manage.py runserver 0.0.0.0:8000 > ${XUNFENG_LOG}/web.log & | ||
nohup celery -A whatcms worker -l info > ${XUNFENG_LOG}/celery.log & | ||
nohup celery -A whatcms worker -l info > ${XUNFENG_LOG}/celery2.log & | ||
/usr/bin/tail -f /dev/null |