Crysadm是powergx开发的一款检测迅雷赚钱宝的网页程序,之前一直有看到,但是没拿到邀请码,也没用过,看到有源码就拿空闲的VPS搭建一下,顺便做个记录,方便查看。

powergx 运行环境 python3.3+ , redis * crysadm 启动web服务 * config 配置redis server * crysadm_helper 启动后台服务 感谢 在此特别感谢powergx同学,感谢他的无私奉献精神.
网上也有一个教程是关于Crysadm搭建在Debian8,我转过来了,

debian8为例
1.安装python3
apt-get update
aptitude install python3.4 python3.4-dev
2.安装pip
apt-get install curl
curl -O https://bootstrap.pypa.io/get-pip.py
python3.4 get-pip.py
/usr/local/bin/pip3.4 install redis
/usr/local/bin/pip3.4 install requests
/usr/local/bin/pip3.4 install flask
3.安装redis
apt-get install redis-server
/etc/init.d/redis-server restart
4.解压源码上传 下载地址 https://git.airl.us/powergx/crysadm/tree/master
5。cd到源码目录,分别运行
python3.4 crysadm_helper.py&
python3.4 crysadm.py&
6。访问http://主机IP:5000/install 生成管理员账号 (注:5000是默认端口,如有修改config.py按修改过的打开)

但是我发现我这款空闲的VPS没有debian8,-.-~于是折腾了下,教程如下:

环境搭建

安装Python

我这边安装的是debian7.8_x64,首先更新下..

apt-get update
apt-get upgrade

因为debian7默认的python版本太低了 我们需要手动安装3.3+ 安装编译用的包

sudo apt-get install build-essential
sudo apt-get install libncurses5-dev libncursesw5-dev libreadline6-dev
sudo apt-get install libdb5.1-dev libgdbm-dev libsqlite3-dev libssl-dev
sudo apt-get install libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev

编译安装

mkdir download
cd download
wget -c https://www.python.org/ftp/python/3.4.1/Python-3.4.1.tgz
tar -zxf Python-3.4.1.tgz
cd Python-3.4.1
./configure --prefix=/opt/python-3.4.1
make
sudo make install
cd ../
sudo rm -rf Python-3.4.1 #删除解压目录
sudo rm -rf Python-3.4.1.tgz #删除安装包

安装好后把 python3 添加到PATH里,打开~/.bashrc 文件,在最后添加:

export PATH=$PATH:/opt/python-3.4.1/bin

保存后:

source ~/.bashrc #更新变量

在终端里输入 python3,可以看到现在的版本是3.4.1。 问题集锦,转自IBG

在make时出现这个提示:
# Substitution happens here, as the completely-expanded BINDIR
# is not available in configure
sed -e "s,@EXENAME@,/opt/python-3.4.2/bin/python3.4m," < ./Misc/python-config.in >python-config.py
# Replace makefile compat. variable references with shell script compat. ones; ->
sed -e 's,\$(\([A-Za-z0-9_]*\)),\$\{\1\},g' < Misc/python-config.sh >python-config
# On Darwin, always use the python version of the script, the shell
# version doesn't use the compiler customizations that are provided
# in python (_osx_support.py).
if test `uname -s` = Darwin; then \
cp python-config.py python-config; \
fi
按提示操作:
sed -e "s,@EXENAME@,/opt/python-3.4.2/bin/python3.4m," < ./Misc/python-config.in >python-config.py
sed -e 's,\$(\([A-Za-z0-9_]*\)),\$\{\1\},g' < Misc/python-config.sh >python-config
再make:
make
最后:
sudo make install
在编译安装python3.4.2时有这个提示:
INFO: Can't locate Tcl/Tk libs and/or headers
Python build finished successfully!
The necessary bits to build these optional modules were not found:
_tkinter                                                       
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
解决办法:
sudo apt-get install python-tk tcl tk tcl-dev tk-dev 

安装PIP

apt-get install curl
curl -O https://bootstrap.pypa.io/get-pip.py
python3.4 get-pip.py
/opt/python-3.4.1/bin/pip3.4 install redis
/opt/python-3.4.1/bin/pip3.4 install requests
/opt/python-3.4.1/bin/pip3.4 install flask

安装运行redis

apt-get install redis-server
/etc/init.d/redis-server start

输入:

ps -ef |grep redis

看到配置文件/etc/redis/redis.conf,下面

nano /etc/redis/redis.conf

文件里面的port是端口,这里可以自行修改,当然到时配置config.py的时候也需要对应修改。

修改时区

我之前安装运行了没发觉,因为我的机器是在国外的,所以存在时区差异,如果不修改的话,里面的记录也会错乱,不方便查看.可以使用date查看下时间,如果不一致的话,可以用下面的方法修改:

tzselect
选择上海后
nano /etc/profile
在文件最后添加以下内容
export TZ='Asia/Shanghai'
使变量生效.
source /etc/profile #更新系统变量

安装Cyrsadm

上传源码后,解压缩,然后自行修改config.py.example 改名为config.py,里面的访问端口和数据库端口如果需要修改,自行修改就可以,然后进入到源码目录,执行:

python3.4 crysadm_helper.py& 
python3.4 crysadm.py&

如果执行没问题就可以访问,

http://ip:port/install

生成管理员账号,这里页面只会出现一次,如果没保存也没关系,只要删除redis目录下的.db文件就可以恢复,后续我测试了下redis密码设置,简单说一下,

class RedisConfig():
    def __init__(self, host, port, db, password): #如果没有密码直接password=None
        self.host = host
        self.port = port
        self.db = db
        self.password = password


class Config(object):
    DEBUG = False
    TESTING = False
    DATABASE_URI = ''
    ALLOWED_EXTENSIONS = {'txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'}
    SESSION_TYPE = 'memcached'
    SECRET_KEY = '7e30485a-dd01-11e4-8abd-10ddb199c373'
    REDIS_CONF = RedisConfig(host='127.0.0.1', port=9527, db=0,password="password") #如果之前设置了不用redis密码,那么这里最后一个,password="password"不用添加。
    PASSWORD_PREFIX = "password" #此条为用户密码加密,如果你之前已经设置了,那么即使修改redis加密,你也不要改这个,不然之前的用户会登陆不了
    ENCRYPT_PWD_URL = None
    SERVER_IP = '0.0.0.0'
    SERVER_PORT = 80

补充一下,redis密码添加和测试,修改redis的配置文件,之前已经有说到配置文件怎么查找,然后添加一个requirepass,比如你添加密码为nyko,那么添加requirepass nyko,具体添加位置最放心就先查找一下配置文件里面有没有requirepass这个字段,放在对应位置就好,添加了密码,redis需要重启一下,然后测试连接,

redis-cli -h 127.0.0.1 -p 6379  #6379为redis端口,如果你之前修改了,请对应修改,端口不对是连接不上的,你可以测试下。-。-

当然你发现了,添加了密码依然可以连接,但是执行具体命令是提示操作不允许。

redis-cli -h 127.0.0.1 -p 6379  
redis 127.0.0.1:6379>  
redis 127.0.0.1:6379> keys *  
(error) ERR operation not permitted  
redis 127.0.0.1:6379> select 1  
(error) ERR operation not permitted  
redis 127.0.0.1:6379[1]>   

那么现在测试下,密码连接..

redis-cli -h 127.0.0.1 -p 6379 -a nyko #此处nyko为我的redis密码,你修改对应

此时你可以看到可以执行具体命令并成功

redis 127.0.0.1:6379> keys *  
1) "myset"  
2) "mysortset"  
redis 127.0.0.1:6379> select 1  
OK  
redis 127.0.0.1:6379[1]> config get requirepass  
1) "requirepass"  
2) "myRedis"