13 Dec '12, 8am

[Ruby] IP주소 필터링 하기(White List) -

@ips = ['127.0.0.1', '192.168.1.0/24'] # 다수의 IP설정 가능 allowed = false # Remote IP를 Integer형으로 변경합니다. bremote_ip = request.remote_ip.split('.').map(&:to_i).pack('C*').unpack('N').first @ips.each do |ipstring| ip, mask = ipstring.split '/' # 비교할 IP도 Integer로 변경합니다. bip = ip.split('.').map(&:to_i).pack('C*').unpack('N').first # 넷마스크값을 정의합니다. 설정되어있지 않을경우 /32로 간주합니다. mask = mask ? mask.to_i : 32 bmask = ((1 << mask) - 1) << (32 - mask) if bip & bmask == bremote_ip & bmask allowed = true break end end if not allowed render :text => "You are unauthorized"

Full article: http://theeye.pe.kr/entry/how-to-filtering-ip-and-subnet-...

Tweets

Energy Solutions: A Christmas Shopping List

greenbuildingadvisor.com 13 Dec '12, 11am

I’m not a big shopper. I don’t even particularly like getting presents. Our society is just too much about consumption. No...

Ruby on Rails Request system by llwebsol #mysql...

freelancer.com 10 Dec '12, 7pm

Request System We are looking for a Ruby on Rails developer to build a module for a Rails App where users can make submit ...

We're excited to announce our latest book, Ruby...

robots.thoughtbot.com 13 Dec '12, 4pm

December 13, 2012 jferris ruby book refactoring rails She Blinded Me with Ruby Science We love Rails, object-oriented prog...

This week's Energy Solutions blog: a Christmas ...

buildinggreen.com 13 Dec '12, 2am

Alex Wilson is founder and executive editor of BuildingGreen, Inc., and coeditor of GreenSpec. For more than 30 years, Ale...

List your job openings for free on DI Jobs

List your job openings for free on DI Jobs

domainincite.com 12 Dec '12, 2pm

Ombudsman probing secretive Trademark Clearinghouse meetings New gTLD lottery tickets now on sale Van Gelder leaves NBT, g...

Nieuwe #job: Backend Ruby on Rails ontwikkelaar...

aplitrak.com 12 Dec '12, 1pm

Als Ruby on Rails (RoR) ontwikkelaar werk je aan applicaties die achter webpagina’s, webshops of webportalen hangen. Met d...

Ruby on Rails Developer #jquery #postgresql #jo...

findmjob.com 12 Dec '12, 8am

We're seeking a skilled Ruby on Rails developer to join our tight-knit team. You'll be building kick-ass tools to make the...