読者です 読者をやめる 読者になる 読者になる

gem install eventmachine時に「'openssl/ssl.h' file not found」とエラー

ruby

環境

  • Mac El Capitan

Gemfileに

症状

gem install eventmachine ができない

gem "eventmachine"

でbundle instrallすると

Using ref 1.0.5
Using sass 3.2.14
Using simple_oauth 0.3.0
Using elasticsearch-api 1.0.1
Using thread_safe 0.2.0
Using airbrake 4.0.0
Using rack-test 0.6.2
Using treetop 1.4.15
Using rspec-core 3.1.7
Using rspec-mocks 3.1.3
Using rspec-expectations 3.1.2
Using better_errors 2.0.0
Using net-scp 1.2.1
Using whenever 0.9.4
Using coffee-script 2.2.0
Using unf 0.1.4
Using faraday 0.9.0
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/thr3a/.rbenv/versions/2.2.4/bin/ruby -r ./siteconf20170322-53700-z08h1b.rb extconf.rb 
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... no
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
checking for writev() in sys/uio.h... yes
checking for rb_thread_fd_select()... yes
checking for rb_fdset_t in ruby/intern.h... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_enable_interrupt()... no
checking for rb_time_new()... yes
checking for sys/event.h... yes
checking for sys/queue.h... yes
checking for clock_gettime()... no
checking for gethrtime()... no
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling binder.cpp
In file included from binder.cpp:20:
./project.h:116:10: fatal error: 'openssl/ssl.h' file not found
#include <openssl/ssl.h>
         ^
1 error generated.
make: *** [binder.o] Error 1

make failed, exit code 2

と怒られる

対処法

 gem install eventmachine -- --with-cppflags=-I/usr/local/opt/openssl/include  

Gemfile.lockのバージョンに合わせてインストールするには

gem install eventmachine -v "1.0.7" -- --with-cppflags=-I/usr/local/opt/openssl/include

でいける

wpscanでWordPressの脆弱性診断を行う

環境

  • Ruby(2.4指定されたけど2017年3月6日現在

インストール

Githubが最新版 普通にgit clone

github.com

rubyなのでbundle install

コマンド

# 念のためアプデ
bundle exec ruby wpscan.rb --update

# 診断開始
bundle exec ruby wpscan.rb --url www.example.com

# ユーザー名の特定
bundle exec ruby wpscan.rb --url www.example.com --enumerate u

# プロキシを挟む場合
bundle exec ruby wpscan.rb --url www.example.com --proxy http://8.8.8.8:8080 --proxy-auth user:password

実行例

thr3a:wpscan thr3a$ bundle exec wpscan.rb --url http://www.************************.net/
_______________________________________________________________
        __          _______   _____                  
        \ \        / /  __ \ / ____|                 
         \ \  /\  / /| |__) | (___   ___  __ _ _ __ ®
          \ \/  \/ / |  ___/ \___ \ / __|/ _` | '_ \ 
           \  /\  /  | |     ____) | (__| (_| | | | |
            \/  \/   |_|    |_____/ \___|\__,_|_| |_|

        WordPress Security Scanner by the WPScan Team 
                       Version 2.9.2
          Sponsored by Sucuri - https://sucuri.net
   @_WPScan_, @ethicalhack3r, @erwan_lr, pvdl, @_FireFart_
_______________________________________________________________

[i] It seems like you have not updated the database for some time.
[?] Do you want to update now? [Y]es [N]o [A]bort, default: [N]Y
[i] Updating the Database ...
[i] Update completed.
[+] URL: http://www.************************.net/
[+] Started: Sat Mar 11 09:28:41 2017

[+] robots.txt available under: 'http://www.************************.net/robots.txt'
[!] The WordPress 'http://www.************************.net/readme.html' file exists exposing a version number
[+] Interesting header: SERVER: Apache
[+] XML-RPC Interface available under: http://www.************************.net/xmlrpc.php

[+] WordPress version 4.1.16 (Released on 2017-03-06) identified from meta generator, rss generator, rdf generator, atom generator, readme, links opml

[+] WordPress theme in use: xeory_base_20150528 - v0.1.3

[+] Name: xeory_base_20150528 - v0.1.3
 |  Location: http://www.************************.net/wp-content/themes/xeory_base_20150528/
 |  Style URL: http://www.************************.net/wp-content/themes/xeory_base_20150528/style.css
 |  Theme Name: XeoryBase_TREND
 |  Theme URI: http://xeory.jp/
 |  Description: Xeoryベーステーマ
 |  Author: バズ部
 |  Author URI: http://bazubu.com/

[+] Enumerating plugins from passive detection ...
 | 1 plugin found:

[+] Name: contact-form-7 - v4.1.2
 |  Last updated: 2017-03-03T19:29:00.000Z
 |  Location: http://www.************************.net/wp-content/plugins/contact-form-7/
 |  Readme: http://www.************************.net/wp-content/plugins/contact-form-7/readme.txt
[!] The version is out of date, the latest version is 4.7

[+] Finished: Sat Mar 11 09:28:54 2017
[+] Requests Done: 89
[+] Memory used: 55.051 MB
[+] Elapsed time: 00:00:12

物理的にLANケーブルが刺さっているか確認するLinuxコマンド

linux

ethtoolコマンドの Link detected: の欄を見るとそもそもネットに繋がる環境かどうかがわかる

つながるとき Link detected: yesになっている

# ethtool eth0
Settings for eth0:
    Supported ports: [ TP ]
    Supported link modes:   10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Half 1000baseT/Full 
    Supported pause frame use: No
    Supports auto-negotiation: Yes
    Advertised link modes:  10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Half 1000baseT/Full 
    Advertised pause frame use: Symmetric
    Advertised auto-negotiation: Yes
    Link partner advertised link modes:  10baseT/Half 10baseT/Full 
                                         100baseT/Half 100baseT/Full 
                                         1000baseT/Full 
    Link partner advertised pause frame use: No
    Link partner advertised auto-negotiation: Yes
    Speed: 1000Mb/s
    Duplex: Full
    Port: Twisted Pair
    PHYAD: 1
    Transceiver: internal
    Auto-negotiation: on
    MDI-X: off
    Supports Wake-on: g
    Wake-on: g
    Current message level: 0x000000ff (255)
                   drv probe link timer ifdown ifup rx_err tx_err
    Link detected: yes

つながらないとき Link detected: noになってる

# ethtool eth1
Settings for eth1:
    Supported ports: [ TP ]
    Supported link modes:   10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Half 1000baseT/Full 
    Supported pause frame use: No
    Supports auto-negotiation: Yes
    Advertised link modes:  10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Half 1000baseT/Full 
    Advertised pause frame use: Symmetric
    Advertised auto-negotiation: Yes
    Speed: Unknown!
    Duplex: Unknown! (255)
    Port: Twisted Pair
    PHYAD: 2
    Transceiver: internal
    Auto-negotiation: on
    MDI-X: Unknown
    Supports Wake-on: g
    Wake-on: g
    Current message level: 0x000000ff (255)
                   drv probe link timer ifdown ifup rx_err tx_err
    Link detected: no

参考リンク

@IT:ネットワークインターフェイスの状況を調べるには

Rubyのmerge()は順番によって挙動が変わる

当然といえば当然だが

# Here your code !
a = {
  hoge: {
    piyo: 111
  }
}

b = {
  hoge: {
    piyo: 222,
    fuga: {
      foo: 333
    }
  }
}

p a.merge(b)
p b.merge(a)

結果

{:hoge=>{:piyo=>222, :fuga=>{:foo=>333}}}
{:hoge=>{:piyo=>111}}

Dead or Alive 5 I'm a Fighterの歌詞

Dead or Aliveとかやったことすらないけど、偶然聴いて気に入ったのでメモ


Dead or Alive 5 OST - Showdown

※
I just want a true love and true loving you,
even if it brings me pain, gives me what I want.
I just want a real love and real loving you,
loving you I just want to keep loving you. Dead or Alive.


Here comes the heat, cold blooded.
never show you weakness can be something that you may have uttered.
you know you can't outsmart us.
you like to press a button.
still struggling for a touch want to get out a club.
It's Dead or Alive, what would you do?
would you let the other ones crew you like the ones that use to crew?
I won't bow down. no one can stop me.

I'm suppose to it's a battle against my own shadow I kept steppin' up my game to get the hell out of sin curren.
endurance and we just weren't on the same page your arguments became way too occurrence. 

Love is power, however let alone it's re-sour cuz we can't be seen eyeing cuz it gets shallow every hour we won't wait til it just won't be.
we will not fade, we will not lose to a someone and it will not get in my path

※繰り返し

won't let it en-fear me, this feat will preserve.
I won't let any fears get my nerves and try to steer.
correctly for fill tax. collectively.
basically peel the skin of fruits effectively and excessively.
destiny a little bit of pain in my life ecstatically cut in the years of my life and go dig distressingly
Hey, i'm living in the way that i try to live it the way i live it gotta be killing it
if i don't i'll be dead. 

sometimes it's not just forces born,
just determination just go for the opprotunity from next door.
pain is the war my thoughts my actions like nor.
 my faith is way to strong for then my steel's tensed off.

The day I lose to myself is the death of me which means that i stop is the day that I die deliberately. 

Still won't bow down, to you, or to me.

※繰り返し

what i want is best for you, best for me. best for me is the worst gonna get to me get to the full disgust of villain.
I wanna call somebody for help. I have to I wouldn't hesitate. battlefield, ooh baby.

You must lowblow wick if you do a dance 'cept the math you know I mean.
we can both rise up, best believe in me.
best believe I Punch you flat to be you and me.

※繰り返し

なお歌詞ソースはYoutube