最新消息:

乌云查询系统wyquery安装使用记录

工具 admin 1508浏览 0评论

wxquery是由ruby编写的,要想运行需要搭建ruby on rails环境。由于没学过ruby on rails,所以搭建时只能靠搜索引擎搜索来一步步完成。现记录一下安装过程,以备后续查询。

一、搭建ruby on rails环境

(1)安装rvm

执行命令:curl -sSL https://get.rvm.io | bash -s stable  来进行安装。如果报错说明是证书的问题,根据错误提示来执行命令。

QQ截图20150912205904

即如果执行上面命令报错,就按照错误提示执行命令gpg2命令后,再执行原先的命令安装rvm即可。

QQ截图20150912211107

ps:如果执行rvm命令时,提示找不到该命令,那么执行source /etc/profile.d/rvm.sh后就可以使用rvm命令了。

(2)安装ruby

通过安装好的rvm来直接安装ruby,命令:rvm install ruby

ps:Rvm命令简单使用介绍:

rvm install ruby    默认安装最新版本

rvm reinstall ruby  重新安装

rvm remove ruby  删除ruby的安装

若需安装、重装、删除ruby都可指定版本,即在ruby后面写上相应参数。

注:安装过程可能出现异常,这可能是由于网络原因,需多尝试几次。

ps:可以通过执行ruby -v来查看安装的ruby版本,执行 ruby -e ‘p “hello ruby”‘ 来测试安装的ruby是否能够正常使用。

ps:注:rvm 全称Ruby Version Manager,是一个非常好ruby版本管理和安装工具。

(3)安装rails

使用命令:gem install rails安装rails,默认安装最新版本rails。

若执行上述命令出现错误:gem install 出现Errno::ECONNRESET: Connection reset by peer – SSL_connect (https://api.rubygems.org),则是由于GFW的原因,将gem的源换成淘宝的即可。

执行如下命令添加:

gem sources --remove https://rubygems.org/
gem sources -a https://ruby.taobao.org/

添加完成后,可以执行命令gem -l 来查看是否添加成功。

添加淘宝源后,重新执行gem install rails来安装rails即可。

二、运行wxquery

wyquery上下载源码后,进入到源码目录,然后执行bundle install 命令等命令启动。命令如下:

cd wyquery-master
bundle install
rake db:migrate
rails s

执行完上面的命令后,访问本机的3000端口即可看到搭建好的网站。

但是此时只能本机访问,如果修改端口或让其他人访问,则修改最后的rails s命令即可。

ps:不过在重新执行rails s命令之前,需要kill掉已经启动的网站:

先执行netstat -nltp | grep 3000找到启动的进程的pid,然后执行kill -9即可

QQ截图20150913150457

rails命令-b表示监听的IP,-p表示启动的端口,因此如果想要使用8080端口并让任何人访问的话,使用命令:

 rails s -b 0.0.0.0 -p 8080
 或
 nohup rails s -b 0.0.0.0 -p 8080 -d  &

三、获取数据

要想获取wooyun数据,需要运行./tools/import_bugs.rb,并建立定时任务来定时执行并获取新的wooyun数据。

crontab -e,然后添加定时任务/root/wyquery-master/tools/import_bugs.rb

QQ截图20150915104823

ps:如果直接如上添加定时任务执行会失败,即使在bash shell下可以执行成功。因为cron使用的环境变量不是系统的环境变量,而是自己的环境变量,说白了,就是crontab不能读取到/etc/profile下的信息。解决办法可以参考Linux执行Cron Job失败,在Shell sh下执行却能成功 – 环境变量?。

即可以通过sh文件,在sh文件中source  /etc/profile来获取变量。即编写如下sh脚本,然后将这段脚本设为定时任务即可。

QQ截图20150915175311

 

ps:如果定时任务不能执行成功,可以通过/var/spool/mail/root(user name)查看crontab具体执行信息,如vim /var/spool/mail/root

QQ截图20150915105256

安装并同步完数据就可以查看到乌云已经公布了的所有漏洞了。

QQ截图20150915105648

参考资料:

1、wooyun查询系统开源代码:wyquery

2、如何在CentOS上搭建ruby on rails环境

3、CentOS安装Ruby,Rails运行环境

4、搭建环境篇——遇到的问题以及解决方案

5、Crontab的格式

6、Linux执行Cron Job失败,在Shell sh下执行却能成功 – 环境变量?

转载请注明:jinglingshu的博客 » 乌云查询系统wyquery安装使用记录

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

网友最新评论 (2)

  1. D:\wyquery>ruby ./tools/import_bugs.rb 'ps' 不是内部或外部命令,也不是可运行的程序 或批处理文件。 DL is deprecated, please use Fiddle ----> Process page 1... D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/mysql2-0.3.20-x86-mingw32/l ib/mysql2/client.rb:33: warning: D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.5/lib/acti ve_record/connection_adapters/abstract_mysql_adapter.rb:305:in `query': Mysql2:: Error: Incorrect string value: '\xE7\x99\xBE\xE5\xBA\xA6...' for column 'title' at row 1: INSERT INTO `bugs` (`wid`, `wmid`, `title`, `created_at`, `updated_at` ) VALUES ('wooyun-2015-0150876', 150876, '鐧惧害閭绯荤粺鍛樺伐璐︽埛閫氱敤鍙 d护娑夊強鍛樺伐鍙婂唴閮ㄤ俊鎭?, '2015-12-16 04:50:54', '2015-12-16 04:50:54' (A ctiveRecord::StatementInvalid) from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:305:in `blo ck in execute' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/connection_adapters/abstract_adapter.rb:472:in `block in log' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport- 4.2.5/lib/active_support/notifications/instrumenter.rb:20:in `instrument' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/connection_adapters/abstract_adapter.rb:466:in `log' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:305:in `exe cute' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/connection_adapters/mysql2_adapter.rb:231:in `execute' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/connection_adapters/mysql2_adapter.rb:248:in `exec_insert ' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:108:i n `insert' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/connection_adapters/abstract/query_cache.rb:14:in `insert ' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/relation.rb:64:in `insert' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/persistence.rb:524:in `_create_record' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/counter_cache.rb:139:in `_create_record' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/locking/optimistic.rb:75:in `_create_record' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/attribute_methods/dirty.rb:132:in `_create_record' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/callbacks.rb:306:in `block in _create_record' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport- 4.2.5/lib/active_support/callbacks.rb:88:in `__run_callbacks__' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport- 4.2.5/lib/active_support/callbacks.rb:778:in `_run_create_callbacks' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/callbacks.rb:306:in `_create_record' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/timestamp.rb:57:in `_create_record' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/persistence.rb:504:in `create_or_update' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/callbacks.rb:302:in `block in create_or_update' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport- 4.2.5/lib/active_support/callbacks.rb:88:in `__run_callbacks__' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport- 4.2.5/lib/active_support/callbacks.rb:778:in `_run_save_callbacks' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/callbacks.rb:302:in `create_or_update' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/persistence.rb:120:in `save' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/validations.rb:37:in `save' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/attribute_methods/dirty.rb:21:in `save' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/transactions.rb:286:in `block (2 levels) in save' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/transactions.rb:351:in `block in with_transaction_returni ng_status' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:i n `block in transaction' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `withi n_new_transaction' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:i n `transaction' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/transactions.rb:220:in `transaction' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/transactions.rb:348:in `with_transaction_returning_status ' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/transactions.rb:286:in `block in save' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/transactions.rb:301:in `rollback_active_record_state!' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4 .2.5/lib/active_record/transactions.rb:285:in `save' from ./tools/import_bugs.rb:214:in `block in process_page' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/nokogiri-1.6.7 -x86-mingw32/lib/nokogiri/xml/node_set.rb:187:in `block in each' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/nokogiri-1.6.7 -x86-mingw32/lib/nokogiri/xml/node_set.rb:186:in `upto' from D:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/nokogiri-1.6.7 -x86-mingw32/lib/nokogiri/xml/node_set.rb:186:in `each' from ./tools/import_bugs.rb:199:in `process_page' from ./tools/import_bugs.rb:90:in `sync' from ./tools/import_bugs.rb:399:in `' ---------------------------------------------------------------------------------- 为什么我同步不了数据?
    Magi2015-12-16 13:07 回复
    • 删除数据库,然后重建数据库,重建的时候设定好类型就好var
      啪啪啪2016-07-14 23:31 回复