FreedomCoder-esearchy 0.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +2 -1
- data/bin/esearchy +17 -2
- data/lib/esearchy/OtherEngines/googlegroups.rb +1 -1
- data/lib/esearchy/SearchEngines/altavista.rb +1 -1
- data/lib/esearchy/SearchEngines/bing.rb +1 -1
- data/lib/esearchy/SearchEngines/google.rb +1 -1
- data/lib/esearchy/SearchEngines/yahoo.rb +1 -1
- data/lib/esearchy/SocialNetworks/googleprofiles.rb +1 -1
- data/lib/esearchy/SocialNetworks/linkedin.rb +2 -2
- data/lib/esearchy/SocialNetworks/naymz.rb +1 -1
- data/lib/esearchy/bugmenot.rb +10 -6
- data/lib/esearchy/searchy.rb +5 -5
- data/lib/esearchy.rb +7 -2
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -10,7 +10,7 @@ Esearchy is a small library capable of searching the internet for email addresse
|
|
10
10
|
* AltaVista
|
11
11
|
* Social Networks:
|
12
12
|
* LinkedIn
|
13
|
-
* Google Profiles ( Based on DigiNinja's idea http://www.digininja.org/
|
13
|
+
* Google Profiles ( Based on DigiNinja's idea http://www.digininja.org/projects/gpscan.php)
|
14
14
|
* Naymz
|
15
15
|
* PGP servers
|
16
16
|
* Usenets
|
@@ -122,6 +122,7 @@ Not short of that now, we also have the possibility of choosing between a Librar
|
|
122
122
|
|
123
123
|
* http://www.penetrationtests.com/ [Penetration Testing Directory]
|
124
124
|
* http://www.mundoruby.com.ar/ [Ruby's News Aggregator]
|
125
|
+
* http://www.digininja.org/ [DigiNinja's Website]
|
125
126
|
|
126
127
|
== LICENSE:
|
127
128
|
|
data/bin/esearchy
CHANGED
@@ -9,10 +9,12 @@ require 'esearchy'
|
|
9
9
|
@maxhits = nil
|
10
10
|
@domains = []
|
11
11
|
@output = nil
|
12
|
+
@company = []
|
12
13
|
|
13
14
|
opts = GetoptLong.new(
|
14
15
|
[ '--help', '-h', GetoptLong::NO_ARGUMENT ],
|
15
16
|
['--domain','-d', GetoptLong::REQUIRED_ARGUMENT ],
|
17
|
+
['--company','-c', GetoptLong::REQUIRED_ARGUMENT ],
|
16
18
|
['--file','-f', GetoptLong::REQUIRED_ARGUMENT ],
|
17
19
|
['--filter','-p', GetoptLong::REQUIRED_ARGUMENT ],
|
18
20
|
['--output','-o', GetoptLong::REQUIRED_ARGUMENT ],
|
@@ -41,10 +43,14 @@ opts.each do |opt, arg|
|
|
41
43
|
exit(0)
|
42
44
|
when '--domain':
|
43
45
|
@domains << arg
|
46
|
+
when '--company':
|
47
|
+
@company << arg
|
44
48
|
when '--file':
|
45
49
|
if File.exists?(arg)
|
46
50
|
open(arg,'r').each_line do |line|
|
47
|
-
|
51
|
+
d,c = line.split(',')
|
52
|
+
@domains << d
|
53
|
+
@company << c
|
48
54
|
end
|
49
55
|
else
|
50
56
|
ESearchy::LOG.puts "File not found"
|
@@ -57,6 +63,8 @@ opts.each do |opt, arg|
|
|
57
63
|
@pattern = arg
|
58
64
|
when '--output':
|
59
65
|
@output = arg
|
66
|
+
when '--licredentials':
|
67
|
+
@li_username, @li_password = arg.split(":")
|
60
68
|
when '--maxhits':
|
61
69
|
@maxhits = arg
|
62
70
|
else
|
@@ -66,12 +74,19 @@ opts.each do |opt, arg|
|
|
66
74
|
end
|
67
75
|
|
68
76
|
require 'esearchy'
|
77
|
+
puts "This is just an example tool ESearchy is more and more a piece of code intended to work as a Library and you should create your own little.rb file :)"
|
69
78
|
|
70
|
-
@domains.
|
79
|
+
@domains.each_with_index do |domain, idx|
|
71
80
|
ESearchy.create domain do |d|
|
72
81
|
d.yahoo_key = @yahoo_key if @yahoo_key
|
73
82
|
d.bing_key = @bing_key if @bing_key
|
74
83
|
d.maxhits = @maxhits if @maxhits
|
84
|
+
if @li_username and @li_password
|
85
|
+
d.linkedin_credentials = (@li_username, @li_password)
|
86
|
+
else
|
87
|
+
d.linkedin_credentials = ESearchy.bugmenot
|
88
|
+
end
|
89
|
+
d.company_name = @company[idx] unless @company.empty?
|
75
90
|
d.search
|
76
91
|
d.save_to_file @output if @output
|
77
92
|
end
|
@@ -36,7 +36,7 @@ class GoogleGroups
|
|
36
36
|
if @totalhits > @start
|
37
37
|
ESearchy::LOG.puts "Searching #{self.class} from #{@start-100} to #{@start}"
|
38
38
|
search_emails(response.body)
|
39
|
-
sleep(
|
39
|
+
sleep(ESearchy::DELAY)
|
40
40
|
search(query)
|
41
41
|
else
|
42
42
|
ESearchy::LOG.puts "Searching #{self.class} from #{@start-100} to #{@start}"
|
@@ -36,7 +36,7 @@ class Altavista
|
|
36
36
|
if @totalhits > @start
|
37
37
|
ESearchy::LOG.puts "Searching #{self.class} from #{@start-50} to #{@start}"
|
38
38
|
search_emails(response.body.gsub(/<b>|<\/b>/,""))
|
39
|
-
sleep(
|
39
|
+
sleep(ESearchy::DELAY)
|
40
40
|
search(query)
|
41
41
|
else
|
42
42
|
ESearchy::LOG.puts "Searching #{self.class} from #{@start-50} to #{@start}"
|
@@ -37,7 +37,7 @@ class Bing
|
|
37
37
|
if @totalhits > @start
|
38
38
|
ESearchy::LOG.puts "Searching #{self.class} from #{@start-50} to #{@start}"
|
39
39
|
search_emails(response.body)
|
40
|
-
sleep(
|
40
|
+
sleep(ESearchy::DELAY)
|
41
41
|
search(query)
|
42
42
|
else
|
43
43
|
ESearchy::LOG.puts "Searching #{self.class} from #{@start-50} to #{@start}"
|
@@ -36,7 +36,7 @@ class Google
|
|
36
36
|
if @totalhits > @start
|
37
37
|
ESearchy::LOG.puts "Searching #{self.class} from #{@start-100} to #{@start}"
|
38
38
|
search_emails(response.body.gsub(/<em>|<\/em>/,""))
|
39
|
-
sleep(
|
39
|
+
sleep(ESearchy::DELAY)
|
40
40
|
search(query)
|
41
41
|
else
|
42
42
|
ESearchy::LOG.puts "Searching #{self.class} from #{@start-100} to #{@start}"
|
@@ -37,7 +37,7 @@ class Yahoo
|
|
37
37
|
if @totalhits > @start
|
38
38
|
ESearchy::LOG.puts "Searching #{self.class} from #{@start-50} to #{@start}"
|
39
39
|
search_emails(response.body)
|
40
|
-
sleep(
|
40
|
+
sleep(ESearchy::DELAY)
|
41
41
|
search(@query)
|
42
42
|
else
|
43
43
|
ESearchy::LOG.puts "Searching #{self.class} from #{@start-50} to #{@start}"
|
@@ -44,7 +44,7 @@ class GoogleProfiles
|
|
44
44
|
ESearchy::LOG.puts "Searching #{self.class} from #{@start-100} to #{@start}"
|
45
45
|
parse(response.body)
|
46
46
|
search_emails(response.body.gsub(/<em>|<\/em>/,""))
|
47
|
-
sleep(
|
47
|
+
sleep(ESearchy::DELAY)
|
48
48
|
search(query)
|
49
49
|
else
|
50
50
|
ESearchy::LOG.puts "Searching #{self.class} from #{@start-100} to #{@start}"
|
@@ -18,7 +18,7 @@ class LinkedIn
|
|
18
18
|
@company_name = nil
|
19
19
|
@cookie = nil
|
20
20
|
end
|
21
|
-
attr_accessor :emails, :username, :password, :company_name
|
21
|
+
attr_accessor :emails, :username, :password, :company_name, :people
|
22
22
|
|
23
23
|
def login
|
24
24
|
begin
|
@@ -76,7 +76,7 @@ class LinkedIn
|
|
76
76
|
ESearchy::LOG.puts "Searching in: #{self.class} up to point #{@start}"
|
77
77
|
search_people(response.body)
|
78
78
|
create_emails
|
79
|
-
sleep(
|
79
|
+
sleep(ESearchy::DELAY)
|
80
80
|
search(@query)
|
81
81
|
else
|
82
82
|
ESearchy::LOG.puts "Searching in: #{self.class} up to point #{@start}"
|
@@ -41,7 +41,7 @@ class Naymz
|
|
41
41
|
ESearchy::LOG.puts "Searching #{self.class} from #{@start-100} to #{@start}"
|
42
42
|
parse(response.body)
|
43
43
|
search_emails(response.body.gsub(/<em>|<\/em>/,""))
|
44
|
-
sleep(
|
44
|
+
sleep(ESearchy::DELAY)
|
45
45
|
search(query)
|
46
46
|
else
|
47
47
|
ESearchy::LOG.puts "Searching #{self.class} from #{@start-100} to #{@start}"
|
data/lib/esearchy/bugmenot.rb
CHANGED
@@ -7,13 +7,17 @@ class BMN
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def self.fetch_user(domain)
|
10
|
-
|
11
|
-
|
10
|
+
begin
|
11
|
+
url = Net::HTTP.get URI.parse("http://www.bugmenot.com/view/#{domain}")
|
12
|
+
key = ( url.scan(/var key =(.*);/)[0][0].to_i + 112 ) / 12
|
12
13
|
|
13
|
-
|
14
|
+
user, pass = url.scan(/tr><th>Username <\/th><td><script>d\('(.*)'\);<\/script><\/td><\/tr>
|
14
15
|
[\n\s]+<tr><th>Password <\/th><td><script>d\('(.*)'\);<\/script><\/td><\/tr>/)[0]
|
15
|
-
|
16
|
-
|
17
|
-
|
16
|
+
user = decode(user,key)
|
17
|
+
pass = decode(pass,key)
|
18
|
+
return user, pass
|
19
|
+
rescue
|
20
|
+
return nil,nil
|
21
|
+
end
|
18
22
|
end
|
19
23
|
end
|
data/lib/esearchy/searchy.rb
CHANGED
@@ -19,7 +19,7 @@ module Searchy
|
|
19
19
|
(?:\.[a-z0-9!#$&'*+=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z](?:[a-z-]*[a-z])?|\
|
20
20
|
[a-z0-9!#$&'*+=?^_`{|}~-]+(?:\.[a-z0-9!#$&'*+=?^_`{|}~-]+)*\s@\s(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+\
|
21
21
|
[a-z](?:[a-z-]*[a-z])?|[a-z0-9!#$&'*+=?^_`{|}~-]+(?:\sdot\s[a-z0-9!#$&'*+=?^_`\
|
22
|
-
{|}~-]+)*\sat\s(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\sdot\s)+[a-z](?:[a-z-]*[a-z])??/)
|
22
|
+
{|}~-]+)*\sat\s(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\sdot\s)+[a-z](?:[a-z-]*[a-z])??/i)
|
23
23
|
@lock.synchronize do
|
24
24
|
print_emails(list)
|
25
25
|
@emails.concat(fix(list)).uniq!
|
@@ -29,7 +29,7 @@ module Searchy
|
|
29
29
|
def search_pdfs(urls)
|
30
30
|
while urls.size >= 1
|
31
31
|
@threads << Thread.new do
|
32
|
-
web = URI.parse(urls.pop)
|
32
|
+
web = URI.parse(urls.pop.gsub(' ','+'))
|
33
33
|
ESearchy::LOG.puts "Searching in PDF: #{web.to_s}\n"
|
34
34
|
begin
|
35
35
|
http = Net::HTTP.new(web.host,80)
|
@@ -71,7 +71,7 @@ module Searchy
|
|
71
71
|
def search_docs(urls)
|
72
72
|
while urls.size >= 1
|
73
73
|
@threads << Thread.new do
|
74
|
-
web = URI.parse(urls.pop)
|
74
|
+
web = URI.parse(urls.pop.gsub(' ','+'))
|
75
75
|
ESearchy::LOG.puts "Searching in DOC: #{web.to_s}\n"
|
76
76
|
begin
|
77
77
|
http = Net::HTTP.new(web.host,80)
|
@@ -140,7 +140,7 @@ module Searchy
|
|
140
140
|
def search_office_xml(urls)
|
141
141
|
while urls.size >= 1
|
142
142
|
@threads << Thread.new do
|
143
|
-
web = URI.parse(urls.pop)
|
143
|
+
web = URI.parse(urls.pop.gsub(' ','+'))
|
144
144
|
#format = web.scan(/docx|xlsx|pptx/i)[0]
|
145
145
|
format = web.scan(/docx|xlsx|pptx|odt|odp|ods|odb/i)[0]
|
146
146
|
ESearchy::LOG.puts "Searching in #{format.upcase}: #{web.to_s}\n"
|
@@ -183,7 +183,7 @@ module Searchy
|
|
183
183
|
def search_txts(urls)
|
184
184
|
while urls.size >= 1
|
185
185
|
@threads << Thread.new do
|
186
|
-
web = URI.parse(urls.pop)
|
186
|
+
web = URI.parse(urls.pop.gsub(' ','+'))
|
187
187
|
ESearchy::LOG.puts "Searching in #{web.to_s.scan(/txt|rtf|ans/i)[0].upcase}: #{web.to_s}\n"
|
188
188
|
begin
|
189
189
|
http = Net::HTTP.new(web.host,80)
|
data/lib/esearchy.rb
CHANGED
@@ -10,6 +10,7 @@ class ESearchy
|
|
10
10
|
#Constants
|
11
11
|
LIBRARY = 1
|
12
12
|
APP = 2
|
13
|
+
DELAY = 4
|
13
14
|
LOG = Logger.new(1, $stdout)
|
14
15
|
BUGMENOT = BMN::fetch_user("linkedin.com")
|
15
16
|
DEFAULT_ENGINES = [:Google, :Bing, :Yahoo, :PGP, :LinkedIn,
|
@@ -30,6 +31,10 @@ class ESearchy
|
|
30
31
|
ESearchy::LOG.file = value
|
31
32
|
end
|
32
33
|
|
34
|
+
def delay=(value)
|
35
|
+
ESearch.DELAY = value
|
36
|
+
end
|
37
|
+
|
33
38
|
def initialize(options={}, &block)
|
34
39
|
@query = options[:query]
|
35
40
|
@depth_search = options[:depth] || true
|
@@ -79,7 +84,7 @@ class ESearchy
|
|
79
84
|
|
80
85
|
def people
|
81
86
|
people = []
|
82
|
-
[:LinkedIn, :GoogleProfiles].each do |e|
|
87
|
+
[:LinkedIn, :GoogleProfiles, :Naymz].each do |e|
|
83
88
|
people.concat(@engines[e].people) if @engines[e]
|
84
89
|
end
|
85
90
|
people.uniq!
|
@@ -147,7 +152,7 @@ class ESearchy
|
|
147
152
|
|
148
153
|
def search_engine(key, value)
|
149
154
|
if [:Google, :Bing, :Yahoo, :PGP, :LinkedIn,
|
150
|
-
:GoogleGroups, :
|
155
|
+
:GoogleGroups, :Altavista, :Usenet, :GoogleProfiles, :Naymz].include?(key)
|
151
156
|
if value == true
|
152
157
|
unless @engines[key]
|
153
158
|
@engines[key] = instance_eval "#{key}.new(@maxhits)"
|