码迷,mamicode.com
首页 > 其他好文 > 详细

搭建内网安全漏洞扫描系统

时间:2020-08-13 11:58:49      阅读:51      评论:0      收藏:0      [点我收藏+]

标签:nec   reac   jpg   multicast   tcmalloc   cal   ase   netstat   size   

巡风是一个开源的安全漏洞扫描平台,支持自定义扩展插件,可以用来快速扫描被纳管的内网电脑和服务器。

我在 2017 年的时候为上海的老东家搭建过这个平台,那时候这个项目刚刚兴起,在公司业务中只用它来作为扫描引擎使用,后台的病毒库对比则是采购了某实验室的商业支持病毒对比库。最近整理自己的工作笔记,发现了当初研究这个平台的学习笔记,又特地访问了这个项目,发现项目已经停止开发1年多了。尽管它失去了技术支持热度,但作为内网扫描工具还是不错的。

现在要安装部署这个巡检平台,会遭遇到 Python 的支持问题。
由于这个巡检平台已经失去了技术支持,建议部署环境为 Windows 7、Windows 2008 R2、CentOS 7、Ubuntu 12/14/16、Debian 7/8、Python 2.7 、MongoDB 3.4 。

以下是今年的验证部署过程:

[root@localhost Downloads]# yum install -y gcc libffi-devel python-devel openssl-devel libpcap-devel
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
...............................................................................................................................
Installed:
libffi-devel.x86_64 0:3.0.13-19.el7 libpcap-devel.x86_64 14:1.5.3-12.el7 openssl-devel.x86_64 1:1.0.2k-19.el7 python-devel.x86_64 0:2.7.5-88.el7

Dependency Installed:
keyutils-libs-devel.x86_64 0:1.5.8-3.el7 krb5-devel.x86_64 0:1.15.1-46.el7 libcom_err-devel.x86_64 0:1.42.9-17.el7
libselinux-devel.x86_64 0:2.5-15.el7 libsepol-devel.x86_64 0:2.5-10.el7 libverto-devel.x86_64 0:0.2.5-4.el7
pcre-devel.x86_64 0:8.32-17.el7 python-rpm-macros.noarch 0:3-32.el7 python2-rpm-macros.noarch 0:3-32.el7
zlib-devel.x86_64 0:1.2.7-18.el7
Complete!
[root@localhost Downloads]#
[root@localhost Downloads]# wget https://sec.ly.com/mirror/get-pip.py --no-check-certificate
--2020-08-11 10:30:22-- https://sec.ly.com/mirror/get-pip.py
Resolving sec.ly.com (sec.ly.com)... 61.177.22.232
Connecting to sec.ly.com (sec.ly.com)|61.177.22.232|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1642328 (1.6M) [text/plain]
Saving to: ‘get-pip.py’

100%[===========================================================================================================>] 1,642,328 983KB/s in 1.6s

2020-08-11 10:30:23 (983 KB/s) - ‘get-pip.py’ saved [1642328/1642328]

[root@localhost Downloads]# python get-pip.py
Collecting pip
Using cached https://files.pythonhosted.org/packages/5a/4a/39400ff9b36e719bdf8f31c99fe1fa7842a42fa77432e584f707a5080063/pip-20.2.2-py2.py3-none-any.whl
rtslib-fb 2.1.69 has requirement pyudev>=0.16.1, but you‘ll have pyudev 0.15 which is incompatible.
ipapython 4.6.6 has requirement dnspython>=1.15, but you‘ll have dnspython 1.12.0 which is incompatible.
ipapython 4.6.6 has requirement python-ldap>=3.0.0b1, but you‘ll have python-ldap 2.4.15 which is incompatible.
Installing collected packages: pip
Found existing installation: pip 20.2.2
Uninstalling pip-20.2.2:
Successfully uninstalled pip-20.2.2
Successfully installed pip-20.2.2
[root@localhost Downloads]#
[root@localhost Downloads]# pip install pyudev==0.16.1
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting pyudev==0.16.1
Downloading pyudev-0.16.1.tar.gz (74 kB)
|████████████████████████████████| 74 kB 23 kB/s
Building wheels for collected packages: pyudev
Building wheel for pyudev (setup.py) ... done
Created wheel for pyudev: filename=pyudev-0.16.1-py2-none-any.whl size=45659 sha256=8d464de67c44ca3397c5e60b3a8d5039721e4ba417f2f965fa8fc99ce10a2893
Stored in directory: /root/.cache/pip/wheels/14/8d/19/1e74514e9e8b2c8b229c7e671fcb7e4f83a733ef6b64d7cd5c
Successfully built pyudev
Installing collected packages: pyudev
Attempting uninstall: pyudev
Found existing installation: pyudev 0.15
Uninstalling pyudev-0.15:
Successfully uninstalled pyudev-0.15
Successfully installed pyudev-0.16.1
[root@localhost Downloads]#
[root@localhost Downloads]# ls -F
epel-release-latest-7.noarch.rpm google-chrome-stable_current_x86_64.rpm VMwareTools-10.3.10-13959562.tar.gz xunfeng/
get-pip.py initCentOS7aliYUM.sh* vmware-tools-distrib/ xunfeng.tar.gz
[root@localhost Downloads]# cd xunfeng/
[root@localhost xunfeng]# ls -F
aider/ db/ Dockerfile install/ masscan/ README.md run.bat views/ web.py
config.py dockerconf/ docs/ LICENSE nascan/ requirements.txt run.sh vulscan/
[root@localhost xunfeng]#
[root@localhost xunfeng]# pip install -r requirements.txt -i https://pypi.doubanio.com/simple/
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Looking in indexes: https://pypi.doubanio.com/simple/
Requirement already satisfied: six>=1.6.0 in /usr/lib/python2.7/site-packages (from -r requirements.txt (line 1)) (1.9.0)
Collecting Flask
Downloading https://pypi.doubanio.com/packages/f2/28/2a03252dfb9ebf377f40fba6a7841b47083260bf8bd8e737b0c6952df83f/Flask-1.1.2-py2.py3-none-any.whl (94 kB)
|████████████████████████████████| 94 kB 1.6 MB/s
Collecting Flask-WTF
Downloading https://pypi.doubanio.com/packages/36/a9/8c01171066bd7a524ee005d81bb4a8aa446ab178043a1ad6cb5dc8f0bd83/Flask_WTF-0.14.3-py2.py3-none-any.whl (13 kB)
Collecting pymongo
Downloading https://pypi.doubanio.com/packages/41/4a/85d17508826b128e9d742127783810caa994c58857e3bc6e59185dd16454/pymongo-3.11.0-cp27-cp27mu-manylinux1_x86_64.whl (487 kB)
|████████████████████████████████| 487 kB 2.4 MB/s
Collecting xlwt
Downloading https://pypi.doubanio.com/packages/44/48/def306413b25c3d01753603b1a222a011b8621aed27cd7f89cbc27e6b0f4/xlwt-1.3.0-py2.py3-none-any.whl (99 kB)
|████████████████████████████████| 99 kB 1.9 MB/s
Collecting packaging
Downloading https://pypi.doubanio.com/packages/46/19/c5ab91b1b05cfe63cccd5cfc971db9214c6dd6ced54e33c30d5af1d2bc43/packaging-20.4-py2.py3-none-any.whl (37 kB)
Collecting appdirs
Downloading https://pypi.doubanio.com/packages/3b/00/2344469e2084fb287c2e0b57b72910309874c3245463acd6cf5e3db69324/appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Collecting gunicorn==19.9.0
Downloading https://pypi.doubanio.com/packages/8c/da/b8dd8deb741bff556db53902d4706774c8e1e67265f69528c14c003644e6/gunicorn-19.9.0-py2.py3-none-any.whl (112 kB)
|████████████████████████████████| 112 kB 831 kB/s
Collecting pycparser==2.18
Downloading https://pypi.doubanio.com/packages/8c/2d/aad7f16146f4197a11f8e91fb81df177adcc2073d36a17b1491fd09df6ed/pycparser-2.18.tar.gz (245 kB)
|████████████████████████████████| 245 kB 807 kB/s
Requirement already satisfied: cryptography in /usr/lib64/python2.7/site-packages (from -r requirements.txt (line 10)) (1.7.2)
Collecting itsdangerous>=0.24
Downloading https://pypi.doubanio.com/packages/76/ae/44b03b253d6fade317f32c24d100b3b35c2239807046a4c953c7b89fa49e/itsdangerous-1.1.0-py2.py3-none-any.whl (16 kB)
Collecting click>=5.1
Downloading https://pypi.doubanio.com/packages/d2/3d/fa76db83bf75c4f8d338c2fd15c8d33fdd7ad23a9b5e57eb6c5de26b430e/click-7.1.2-py2.py3-none-any.whl (82 kB)
|████████████████████████████████| 82 kB 873 kB/s
Collecting Werkzeug>=0.15
Downloading https://pypi.doubanio.com/packages/cc/94/5f7079a0e00bd6863ef8f1da638721e9da21e5bacee597595b318f71d62e/Werkzeug-1.0.1-py2.py3-none-any.whl (298 kB)
|████████████████████████████████| 298 kB 694 kB/s
Collecting Jinja2>=2.10.1
Downloading https://pypi.doubanio.com/packages/30/9e/f663a2aa66a09d838042ae1a2c5659828bb9b41ea3a6efa20a20fd92b121/Jinja2-2.11.2-py2.py3-none-any.whl (125 kB)
|████████████████████████████████| 125 kB 863 kB/s
Collecting WTForms
Downloading https://pypi.doubanio.com/packages/e0/31/614fc7dc7d76005b0acb8c0c8920d962b83d7422b4ba912886dfb63f86ff/WTForms-2.3.3-py2.py3-none-any.whl (169 kB)
|████████████████████████████████| 169 kB 771 kB/s
Collecting pyparsing>=2.0.2
Downloading https://pypi.doubanio.com/packages/8a/bb/488841f56197b13700afd5658fc279a2025a39e22449b7cf29864669b15d/pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
|████████████████████████████████| 67 kB 698 kB/s
Requirement already satisfied: idna>=2.0 in /usr/lib/python2.7/site-packages (from cryptography->-r requirements.txt (line 10)) (2.4)
Requirement already satisfied: pyasn1>=0.1.8 in /usr/lib/python2.7/site-packages (from cryptography->-r requirements.txt (line 10)) (0.4.8)
Requirement already satisfied: setuptools in /usr/lib/python2.7/site-packages (from cryptography->-r requirements.txt (line 10)) (0.9.8)
Requirement already satisfied: enum34 in /usr/lib/python2.7/site-packages (from cryptography->-r requirements.txt (line 10)) (1.0.4)
Requirement already satisfied: ipaddress in /usr/lib/python2.7/site-packages (from cryptography->-r requirements.txt (line 10)) (1.0.16)
Requirement already satisfied: cffi>=1.4.1 in /usr/lib64/python2.7/site-packages (from cryptography->-r requirements.txt (line 10)) (1.6.0)
Collecting MarkupSafe>=0.23
Downloading https://pypi.doubanio.com/packages/fb/40/f3adb7cf24a8012813c5edb20329eb22d5d8e2a0ecf73d21d6b85865da11/MarkupSafe-1.1.1-cp27-cp27mu-manylinux1_x86_64.whl (24 kB)
Building wheels for collected packages: pycparser
Building wheel for pycparser (setup.py) ... done
Created wheel for pycparser: filename=pycparser-2.18-py2.py3-none-any.whl size=206953 sha256=af643147c34bf328aa8e9de0706f8fe6201d07133ac0638d55b277643cf7c923
Stored in directory: /root/.cache/pip/wheels/4a/b7/9b/ccb0c7db88ced7ba106f9c69dad2399b3e3be5df7ac72495de
Successfully built pycparser
Installing collected packages: itsdangerous, click, Werkzeug, MarkupSafe, Jinja2, Flask, WTForms, Flask-WTF, pymongo, xlwt, pyparsing, packaging, appdirs, gunicorn, pycparser
Attempting uninstall: pyparsing
Found existing installation: pyparsing 1.5.6
ERROR: Cannot uninstall ‘pyparsing‘. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
[root@localhost xunfeng]#
[root@localhost xunfeng]# pip install -I pyparsing==2.2.0
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting pyparsing==2.2.0
Downloading pyparsing-2.2.0-py2.py3-none-any.whl (56 kB)
|████████████████████████████████| 56 kB 17 kB/s
Installing collected packages: pyparsing
Successfully installed pyparsing-2.2.0
[root@localhost xunfeng]# cd ..
[root@localhost Downloads]#
[root@localhost Downloads]# wget https://sec.ly.com/mirror/mongodb-linux-x86_64-3.4.0.tgz
--2020-08-11 10:54:56-- https://sec.ly.com/mirror/mongodb-linux-x86_64-3.4.0.tgz
Resolving sec.ly.com (sec.ly.com)... 61.177.22.232
Connecting to sec.ly.com (sec.ly.com)|61.177.22.232|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 86429824 (82M) [application/x-compressed]
Saving to: ‘mongodb-linux-x86_64-3.4.0.tgz’

100%[===========================================================================================================>] 86,429,824 1.15MB/s in 1m 52s

2020-08-11 10:56:48 (753 KB/s) - ‘mongodb-linux-x86_64-3.4.0.tgz’ saved [86429824/86429824]

[root@localhost Downloads]# mkdir -pv /opt/xunfengscan
mkdir: created directory ‘/opt/xunfengscan’
[root@localhost Downloads]# ls -F
epel-release-latest-7.noarch.rpm initCentOS7aliYUM.sh* vmware-tools-distrib/
get-pip.py mongodb-linux-x86_64-3.4.0.tgz xunfeng/
google-chrome-stable_current_x86_64.rpm VMwareTools-10.3.10-13959562.tar.gz xunfeng.tar.gz
[root@localhost Downloads]# cp -r xunfeng /opt/xunfengscan
[root@localhost Downloads]# tree -L 2 /opt/xunfengscan/
/opt/xunfengscan/
└── xunfeng
├── aider
├── config.py
├── db
├── dockerconf
├── Dockerfile
├── docs
├── install
├── LICENSE
├── masscan
├── nascan
├── README.md
├── requirements.txt
├── run.bat
├── run.sh
├── views
├── vulscan
└── web.py

10 directories, 8 files
[root@localhost Downloads]#
[root@localhost Downloads]# tar -xzvf mongodb-linux-x86_64-3.4.0.tgz -C /opt/xunfengscan
mongodb-linux-x86_64-3.4.0/README
mongodb-linux-x86_64-3.4.0/THIRD-PARTY-NOTICES
mongodb-linux-x86_64-3.4.0/MPL-2
mongodb-linux-x86_64-3.4.0/GNU-AGPL-3.0
mongodb-linux-x86_64-3.4.0/bin/mongodump
mongodb-linux-x86_64-3.4.0/bin/mongorestore
mongodb-linux-x86_64-3.4.0/bin/mongoexport
mongodb-linux-x86_64-3.4.0/bin/mongoimport
mongodb-linux-x86_64-3.4.0/bin/mongostat
mongodb-linux-x86_64-3.4.0/bin/mongotop
mongodb-linux-x86_64-3.4.0/bin/bsondump
mongodb-linux-x86_64-3.4.0/bin/mongofiles
mongodb-linux-x86_64-3.4.0/bin/mongooplog
mongodb-linux-x86_64-3.4.0/bin/mongoreplay
mongodb-linux-x86_64-3.4.0/bin/mongoperf
mongodb-linux-x86_64-3.4.0/bin/mongod
mongodb-linux-x86_64-3.4.0/bin/mongos
mongodb-linux-x86_64-3.4.0/bin/mongo
[root@localhost Downloads]# tree -L 2 /opt/xunfengscan/
/opt/xunfengscan/
├── mongodb-linux-x86_64-3.4.0
│?? ├── bin
│?? ├── GNU-AGPL-3.0
│?? ├── MPL-2
│?? ├── README
│?? └── THIRD-PARTY-NOTICES
└── xunfeng
├── aider
├── config.py
├── db
├── dockerconf
├── Dockerfile
├── docs
├── install
├── LICENSE
├── masscan
├── nascan
├── README.md
├── requirements.txt
├── run.bat
├── run.sh
├── views
├── vulscan
└── web.py

12 directories, 12 files
[root@localhost Downloads]# mv /opt/xunfengscan/mongodb-linux-x86_64-3.4.0/ /opt/xunfengscan/mongodb
[root@localhost Downloads]# tree -L 2 /opt/xunfengscan/
/opt/xunfengscan/
├── mongodb
│?? ├── bin
│?? ├── GNU-AGPL-3.0
│?? ├── MPL-2
│?? ├── README
│?? └── THIRD-PARTY-NOTICES
└── xunfeng
├── aider
├── config.py
├── db
├── dockerconf
├── Dockerfile
├── docs
├── install
├── LICENSE
├── masscan
├── nascan
├── README.md
├── requirements.txt
├── run.bat
├── run.sh
├── views
├── vulscan
└── web.py

12 directories, 12 files
[root@localhost Downloads]#
[root@localhost Downloads]# ls -F /opt/xunfengscan/mongodb/bin/
bsondump mongod mongoexport mongoimport mongoperf mongorestore mongostat
mongo
mongodump mongofiles mongooplog mongoreplay mongos mongotop
[root@localhost Downloads]# ln -s /opt/xunfengscan/mongodb/bin/* /usr/bin/
[root@localhost Downloads]# mkdir -pv /opt/xunfengscan/mongodb/bin/{logs,db}
mkdir: created directory ‘/opt/xunfengscan/mongodb/bin/logs’
mkdir: created directory ‘/opt/xunfengscan/mongodb/bin/db’
[root@localhost Downloads]# tree /opt/xunfengscan/mongodb/bin/
/opt/xunfengscan/mongodb/bin/
├── bsondump
├── db
├── logs
├── mongo
├── mongod
├── mongodump
├── mongoexport
├── mongofiles
├── mongoimport
├── mongooplog
├── mongoperf
├── mongoreplay
├── mongorestore
├── mongos
├── mongostat
└── mongotop

2 directories, 14 files
[root@localhost Downloads]#
[root@localhost Downloads]# tree /opt/xunfengscan/mongodb/bin/
/opt/xunfengscan/mongodb/bin/
├── bsondump
├── db
├── logs
├── mongo
├── mongod
├── mongodb.conf
├── mongodump
├── mongoexport
├── mongofiles
├── mongoimport
├── mongooplog
├── mongoperf
├── mongoreplay
├── mongorestore
├── mongos
├── mongostat
└── mongotop

2 directories, 15 files
[root@localhost Downloads]# /opt/xunfengscan/mongodb/bin/mongod --port 65521 --dbpath /opt/xunfengscan/mongodb/bin/db &
[1] 68704
2020-08-11T11:15:18.386-0400 I CONTROL [initandlisten] MongoDB starting : pid=68704 port=65521 dbpath=/opt/xunfengscan/mongodb/bin/db 64-bit host=localhost.localdomain
2020-08-11T11:15:18.386-0400 I CONTROL [initandlisten] db version v3.4.0
2020-08-11T11:15:18.386-0400 I CONTROL [initandlisten] git version: f4240c60f005be757399042dc12f6addbc3170c1
2020-08-11T11:15:18.386-0400 I CONTROL [initandlisten] allocator: tcmalloc
2020-08-11T11:15:18.386-0400 I CONTROL [initandlisten] modules: none
2020-08-11T11:15:18.386-0400 I CONTROL [initandlisten] build environment:
2020-08-11T11:15:18.386-0400 I CONTROL [initandlisten] distarch: x86_64
2020-08-11T11:15:18.386-0400 I CONTROL [initandlisten] target_arch: x86_64
2020-08-11T11:15:18.386-0400 I CONTROL [initandlisten] options: { net: { port: 65521 }, storage: { dbPath: "/opt/xunfengscan/mongodb/bin/db" } }
2020-08-11T11:15:18.396-0400 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=1373M,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
[root@localhost Downloads]# 2020-08-11T11:15:18.450-0400 I CONTROL [initandlisten]
2020-08-11T11:15:18.450-0400 I CONTROL [initandlisten] WARNING: Access control is not enabled for the database.
2020-08-11T11:15:18.450-0400 I CONTROL [initandlisten]
Read and write access to data and configuration is unrestricted.
2020-08-11T11:15:18.450-0400 I CONTROL [initandlisten] WARNING: You are running this process as the root user, which is not recommended.
2020-08-11T11:15:18.450-0400 I CONTROL [initandlisten]
2020-08-11T11:15:18.450-0400 I CONTROL [initandlisten]
2020-08-11T11:15:18.450-0400 I CONTROL [initandlisten]
WARNING: /sys/kernel/mm/transparent_hugepage/enabled is ‘always‘.
2020-08-11T11:15:18.450-0400 I CONTROL [initandlisten] We suggest setting it to ‘never‘
2020-08-11T11:15:18.450-0400 I CONTROL [initandlisten]
2020-08-11T11:15:18.450-0400 I CONTROL [initandlisten]
WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always‘.
2020-08-11T11:15:18.450-0400 I CONTROL [initandlisten] * We suggest setting it to ‘never‘
2020-08-11T11:15:18.451-0400 I CONTROL [initandlisten]
2020-08-11T11:15:18.461-0400 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory ‘/opt/xunfengscan/mongodb/bin/db/diagnostic.data‘
2020-08-11T11:15:18.467-0400 I INDEX [initandlisten] build index on: admin.system.version properties: { v: 2, key: { version: 1 }, name: "incompatible_with_version_32", ns: "admin.system.version" }
2020-08-11T11:15:18.467-0400 I INDEX [initandlisten] building index using bulk method; build may temporarily use up to 500 megabytes of RAM
2020-08-11T11:15:18.468-0400 I INDEX [initandlisten] build index done. scanned 0 total records. 0 secs
2020-08-11T11:15:18.468-0400 I COMMAND [initandlisten] setting featureCompatibilityVersion to 3.4
2020-08-11T11:15:18.468-0400 I NETWORK [thread1] waiting for connections on port 65521
^C
[root@localhost Downloads]# netstat -antlp | grep 65521
tcp 0 0 0.0.0.0:65521 0.0.0.0:
LISTEN 68704/mongod
[root@localhost Downloads]#
[root@localhost Downloads]# cat -n /opt/xunfengscan/xunfeng/run.sh
1 #!/bin/bash
2 CURRENT_PATH=dirname $0
3 cd $CURRENT_PATH
4
5 XUNFENG_LOG=/var/log/xunfeng
6 XUNFENG_DB=/var/lib/mongodb
7
8 [ ! -d $XUNFENG_LOG ] && mkdir -p ${XUNFENG_LOG}
9 [ ! -d $XUNFENG_DB ] && mkdir -p ${XUNFENG_DB}
10
11 nohup mongod --port 65521 --dbpath=${XUNFENG_DB} --auth > ${XUNFENG_LOG}/db.log &
12 nohup python web.py > ${XUNFENG_LOG}/web.log &
13 nohup python aider/aider.py > ${XUNFENG_LOG}/aider.log &
14 nohup python nascan/nascan.py > ${XUNFENG_LOG}/scan.log &
15 nohup python vulscan/vulscan.py > ${XUNFENG_LOG}/vul.log &
[root@localhost Downloads]# cp /opt/xunfengscan/xunfeng/run.sh{,.original}
[root@localhost Downloads]#
[root@localhost Downloads]# gedit /opt/xunfengscan/xunfeng/run.sh
[root@localhost Downloads]# cat -n /opt/xunfengscan/xunfeng/run.sh
1 #!/bin/bash
2 CURRENT_PATH=dirname $0
3 cd $CURRENT_PATH
4
5 XUNFENG_LOG=/opt/xunfengscan/mongodb/bin/logs
6 XUNFENG_DB=/opt/xunfengscan/mongodb/bin/db
7
8 [ ! -d $XUNFENG_LOG ] && mkdir -p ${XUNFENG_LOG}
9 [ ! -d $XUNFENG_DB ] && mkdir -p ${XUNFENG_DB}
10
11 nohup mongod --port 65521 --dbpath=${XUNFENG_DB} --auth > ${XUNFENG_LOG}/db.log &
12 nohup python web.py > ${XUNFENG_LOG}/web.log &
13 nohup python aider/aider.py > ${XUNFENG_LOG}/aider.log &
14 nohup python nascan/nascan.py > ${XUNFENG_LOG}/scan.log &
15 nohup python vulscan/vulscan.py > ${XUNFENG_LOG}/vul.log &
[root@localhost Downloads]#
[root@localhost Downloads]# chmod -R 777 /opt/xunfengscan/xunfeng
[root@localhost Downloads]# ll /opt/xunfengscan/xunfeng/
total 76
drwxrwxrwx 2 root root 22 Aug 11 10:58 aider
-rwxrwxrwx 1 root root 220 Aug 11 10:58 config.py
drwxrwxrwx 2 root root 4096 Aug 11 10:58 db
drwxrwxrwx 2 root root 39 Aug 11 10:58 dockerconf
-rwxrwxrwx 1 root root 1445 Aug 11 10:58 Dockerfile
drwxrwxrwx 3 root root 21 Aug 11 10:58 docs
drwxrwxrwx 3 root root 74 Aug 11 10:58 install
-rwxrwxrwx 1 root root 35141 Aug 11 10:58 LICENSE
drwxrwxrwx 4 root root 40 Aug 11 10:58 masscan
drwxrwxrwx 4 root root 48 Aug 11 10:58 nascan
-rwxrwxrwx 1 root root 7822 Aug 11 10:58 README.md
-rwxrwxrwx 1 root root 104 Aug 11 10:58 requirements.txt
-rwxrwxrwx 1 root root 164 Aug 11 10:58 run.bat
-rwxrwxrwx 1 root root 548 Aug 11 11:23 run.sh
-rwxrwxrwx 1 root root 516 Aug 11 11:19 run.sh.original
drwxrwxrwx 5 root root 82 Aug 11 10:58 views
drwxrwxrwx 3 root root 119 Aug 11 10:58 vulscan
-rwxrwxrwx 1 root root 129 Aug 11 10:58 web.py
[root@localhost Downloads]#
[root@localhost Downloads]# kill -9 $(pidof mongod)
[1]+ Killed /opt/xunfengscan/mongodb/bin/mongod --port 65521 --dbpath /opt/xunfengscan/mongodb/bin/db
[root@localhost Downloads]#
[root@localhost Downloads]# /opt/xunfengscan/mongodb/bin/mongod --port 65521 --dbpath /opt/xunfengscan/mongodb/bin/db &
[root@localhost Downloads]# netstat -antlp | grep 65521
tcp 0 0 0.0.0.0:65521 0.0.0.0:* LISTEN 70999/mongod
[root@localhost Downloads]#
[root@localhost Downloads]# /opt/xunfengscan/mongodb/bin/mongorestore -h 127.0.0.1 --port 65521 -d xunfeng /opt/xunfengscan/xunfeng/db/
2020-08-11T11:41:33.213-0400 the --db and --collection args should only be used when restoring from a BSON file. Other uses are deprecated and will not exist in the future; use --nsInclude instead
2020-08-11T11:41:33.213-0400 building a list of collections to restore from /opt/xunfengscan/xunfeng/db dir
2020-08-11T11:41:33.214-0400 reading metadata for xunfeng.Config from /opt/xunfengscan/xunfeng/db/Config.metadata.json
2020-08-11T11:41:33.214-0400 reading metadata for xunfeng.Heartbeat from /opt/xunfengscan/xunfeng/db/Heartbeat.metadata.json
2020-08-11T11:41:33.220-0400 restoring xunfeng.Config from /opt/xunfengscan/xunfeng/db/Config.bson
2020-08-11T11:41:33.256-0400 reading metadata for xunfeng.History from /opt/xunfengscan/xunfeng/db/History.metadata.json
2020-08-11T11:41:33.322-0400 reading metadata for xunfeng.Info from /opt/xunfengscan/xunfeng/db/Info.metadata.json
2020-08-11T11:41:33.324-0400 restoring indexes for collection xunfeng.Config from metadata
2020-08-11T11:41:33.324-0400 restoring xunfeng.Heartbeat from /opt/xunfengscan/xunfeng/db/Heartbeat.bson
2020-08-11T11:41:33.329-0400 finished restoring xunfeng.Config (2 documents)
2020-08-11T11:41:33.329-0400 reading metadata for xunfeng.Plugin from /opt/xunfengscan/xunfeng/db/Plugin.metadata.json
2020-08-11T11:41:33.329-0400 restoring xunfeng.History from /opt/xunfengscan/xunfeng/db/History.bson
2020-08-11T11:41:33.330-0400 restoring indexes for collection xunfeng.History from metadata
2020-08-11T11:41:33.334-0400 restoring xunfeng.Info from /opt/xunfengscan/xunfeng/db/Info.bson
2020-08-11T11:41:33.338-0400 restoring indexes for collection xunfeng.Info from metadata
2020-08-11T11:41:33.339-0400 restoring indexes for collection xunfeng.Heartbeat from metadata
2020-08-11T11:41:33.343-0400 restoring xunfeng.Plugin from /opt/xunfengscan/xunfeng/db/Plugin.bson
2020-08-11T11:41:33.344-0400 restoring indexes for collection xunfeng.Plugin from metadata
2020-08-11T11:41:33.349-0400 finished restoring xunfeng.History (0 documents)
2020-08-11T11:41:33.349-0400 reading metadata for xunfeng.Result from /opt/xunfengscan/xunfeng/db/Result.metadata.json
2020-08-11T11:41:33.368-0400 finished restoring xunfeng.Info (0 documents)
2020-08-11T11:41:33.368-0400 reading metadata for xunfeng.Statistics from /opt/xunfengscan/xunfeng/db/Statistics.metadata.json
2020-08-11T11:41:33.368-0400 finished restoring xunfeng.Heartbeat (2 documents)
2020-08-11T11:41:33.368-0400 reading metadata for xunfeng.Task from /opt/xunfengscan/xunfeng/db/Task.metadata.json
2020-08-11T11:41:33.368-0400 finished restoring xunfeng.Plugin (0 documents)
2020-08-11T11:41:33.368-0400 reading metadata for xunfeng.Update from /opt/xunfengscan/xunfeng/db/Update.metadata.json
2020-08-11T11:41:33.375-0400 restoring xunfeng.Result from /opt/xunfengscan/xunfeng/db/Result.bson
2020-08-11T11:41:33.376-0400 restoring indexes for collection xunfeng.Result from metadata
2020-08-11T11:41:33.379-0400 restoring xunfeng.Task from /opt/xunfengscan/xunfeng/db/Task.bson
2020-08-11T11:41:33.382-0400 restoring indexes for collection xunfeng.Task from metadata
2020-08-11T11:41:33.383-0400 restoring xunfeng.Update from /opt/xunfengscan/xunfeng/db/Update.bson
2020-08-11T11:41:33.387-0400 restoring indexes for collection xunfeng.Update from metadata
2020-08-11T11:41:33.396-0400 restoring xunfeng.Statistics from /opt/xunfengscan/xunfeng/db/Statistics.bson
2020-08-11T11:41:33.400-0400 restoring indexes for collection xunfeng.Statistics from metadata
2020-08-11T11:41:33.412-0400 finished restoring xunfeng.Result (0 documents)
2020-08-11T11:41:33.415-0400 finished restoring xunfeng.Update (0 documents)
2020-08-11T11:41:33.415-0400 finished restoring xunfeng.Task (0 documents)
2020-08-11T11:41:33.415-0400 finished restoring xunfeng.Statistics (0 documents)
2020-08-11T11:41:33.415-0400 done
[root@localhost Downloads]#
[root@localhost Downloads]# /opt/xunfengscan/mongodb/bin/mongo --port 65521
MongoDB shell version v3.4.0
connecting to: mongodb://127.0.0.1:65521/
MongoDB server version: 3.4.0
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
Server has startup warnings:
2020-08-11T11:35:30.514-0400 I CONTROL [initandlisten]
2020-08-11T11:35:30.514-0400 I CONTROL [initandlisten] WARNING: Access control is not enabled for the database.
2020-08-11T11:35:30.514-0400 I CONTROL [initandlisten]
Read and write access to data and configuration is unrestricted.
2020-08-11T11:35:30.514-0400 I CONTROL [initandlisten] WARNING: You are running this process as the root user, which is not recommended.
2020-08-11T11:35:30.514-0400 I CONTROL [initandlisten]
2020-08-11T11:35:30.514-0400 I CONTROL [initandlisten]
2020-08-11T11:35:30.514-0400 I CONTROL [initandlisten]
WARNING: /sys/kernel/mm/transparent_hugepage/enabled is ‘always‘.
2020-08-11T11:35:30.514-0400 I CONTROL [initandlisten] We suggest setting it to ‘never‘
2020-08-11T11:35:30.514-0400 I CONTROL [initandlisten]
2020-08-11T11:35:30.514-0400 I CONTROL [initandlisten]
WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always‘.
2020-08-11T11:35:30.514-0400 I CONTROL [initandlisten] ** We suggest setting it to ‘never‘
2020-08-11T11:35:30.514-0400 I CONTROL [initandlisten]

use xunfeng
switched to db xunfeng
db.createUser({user:‘scan‘,pwd:‘scanlol66‘,roles:[{role:‘dbOwner‘,db:‘xunfeng‘}]})
Successfully added user: {
"user" : "scan",
"roles" : [
{
"role" : "dbOwner",
"db" : "xunfeng"
}
]
}
exit
bye
[root@localhost Downloads]#
[root@localhost Downloads]# sh /opt/xunfengscan/xunfeng/run.sh
nohup: redirecting stderr to stdout
nohup: redirecting stderr to stdout
nohup: redirecting stderr to stdout
nohup: redirecting stderr to stdout
nohup: redirecting stderr to stdout
[root@localhost Downloads]#
[root@localhost Downloads]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.207.173 netmask 255.255.255.0 broadcast 192.168.207.255
inet6 fe80::af9b:7b7:e6e0:867e prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:f0:61:86 txqueuelen 1000 (Ethernet)
RX packets 97912 bytes 141036857 (134.5 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 49261 bytes 3033208 (2.8 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 928 bytes 217847 (212.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 928 bytes 217847 (212.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:5f:c7:73 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

[root@localhost Downloads]#

技术图片

技术图片

搭建内网安全漏洞扫描系统

标签:nec   reac   jpg   multicast   tcmalloc   cal   ase   netstat   size   

原文地址:https://blog.51cto.com/6286393/2519306

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!