Permalink
Browse files

first commit

  • Loading branch information...
1 parent 61e8a12 commit 419032f06cdbf2659edf2c3317fb21c9e167d8e3 @brunogh committed Jun 10, 2012
Showing with 95 additions and 7 deletions.
  1. +18 −0 .project
  2. +6 −1 Gemfile
  3. +39 −0 Gemfile.lock
  4. +7 −1 README.rdoc
  5. +3 −3 Rakefile
  6. +19 −0 lib/tor_requests.rb
  7. +3 −2 spec/tor_requests_spec.rb
View
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>tor_requests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.aptana.ide.core.unifiedBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.aptana.ruby.core.rubynature</nature>
+ <nature>com.aptana.projects.webnature</nature>
+ </natures>
+</projectDescription>
View
@@ -10,5 +10,10 @@ group :development do
gem "rdoc", "~> 3.12"
gem "bundler", "~> 1.0.0"
gem "jeweler", "~> 1.8.3"
- gem "rcov", ">= 0"
+ # gem "rcov", ">= 0"
+ gem "simplecov"
+ gem "socksify"
+
+# require 'net/http'
+# require 'socksify/http'
end
View
@@ -0,0 +1,39 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ diff-lcs (1.1.3)
+ git (1.2.5)
+ jeweler (1.8.3)
+ bundler (~> 1.0)
+ git (>= 1.2.5)
+ rake
+ rdoc
+ json (1.7.3)
+ multi_json (1.3.6)
+ rake (0.9.2.2)
+ rdoc (3.12)
+ json (~> 1.4)
+ rspec (2.8.0)
+ rspec-core (~> 2.8.0)
+ rspec-expectations (~> 2.8.0)
+ rspec-mocks (~> 2.8.0)
+ rspec-core (2.8.0)
+ rspec-expectations (2.8.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.8.0)
+ simplecov (0.6.4)
+ multi_json (~> 1.0)
+ simplecov-html (~> 0.5.3)
+ simplecov-html (0.5.3)
+ socksify (1.4.1)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ bundler (~> 1.0.0)
+ jeweler (~> 1.8.3)
+ rdoc (~> 3.12)
+ rspec (~> 2.8.0)
+ simplecov
+ socksify
View
@@ -1,6 +1,12 @@
= tor_requests
-Description goes here.
+1 - Install Tor
+https://www.torproject.org
+On Settings -> Advanced -> Fix the port to 9051
+
+2 - Ruby code
+res = Request.new.http("google.com", 80, "/")
+res.code.should eq("301")
== Contributing to tor_requests
View
@@ -17,9 +17,9 @@ Jeweler::Tasks.new do |gem|
gem.name = "tor_requests"
gem.homepage = "http://github.com/brunogh/tor_requests"
gem.license = "MIT"
- gem.summary = %Q{TODO: one-line summary of your gem}
- gem.description = %Q{TODO: longer description of your gem}
- gem.email = "bruno.ghisi@resultadosdigitais.com.br"
+ gem.summary = "Create anonymously requests through Tor network"
+ gem.description = "Create anonymously requests through Tor network"
+ gem.email = "brunogh@gmail.com"
gem.authors = ["Bruno Ghisi"]
# dependencies defined in Gemfile
end
View
@@ -0,0 +1,19 @@
+require 'net/http'
+require 'socksify/http'
+
+class Request
+
+ class << self
+
+ def http(host, port = 80, path = "/")
+ res = ""
+ Net::HTTP.SOCKSProxy('127.0.0.1', 9050).start(host, port) do |http|
+ res = http.get(path)
+ end
+ res
+ end
+
+ end
+
+end
+
@@ -1,7 +1,8 @@
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "TorRequests" do
- it "fails" do
- fail "hey buddy, you should probably rename this file and start specing for real"
+ it "makes a HTTP request to Google" do
+ res = Request.new.http("google.com", 80, "/")
+ res.code.should eq("301")
end
end

0 comments on commit 419032f

Please sign in to comment.