moriarty 0.2.0 → 0.2.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.
- checksums.yaml +4 -4
- data/README.md +120 -51
- data/bin/moriarty +17 -9
- data/lib/moriarty/cli.rb +35 -8
- data/moriarty.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6561598fba3167762d21e7979989bc7d4b940a18b0d013d640ecf8aa7ad13d40
|
|
4
|
+
data.tar.gz: 20d9650e00de4c95531f3b447f20260c52e2fa06cc163d0e6ee0ef361a2fde93
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c119afe3b98a4d5ac724a142f17981d8cc6aea61e6a62d257b28feaa6f6b9c7fdcbfbe0a76cf0c84616922bc47ad270430e3a9d4bab7a0b4844fa4c145707db9
|
|
7
|
+
data.tar.gz: ff1cd49aaca53a39196f16ab7c67d243932803ab3b6cda766e74fdbfb61d3798c0155640e75b72f2ccd4dc91ef6b3e5b5dc2251ea8868ea1aa9a9f4e62f5c72d
|
data/README.md
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
|
+
- _GIF preview v-0.2.0 - without latest changes'_
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
Gem is still in alpha, many things will be added (like scrapping info from social networks).
|
|
6
|
+
Breaking changes are highly possible, so I do not suggest use of this gem except for development and test.
|
|
7
|
+
That means, do not use it in production services, otherwise feel free to play with it.
|
|
8
|
+
|
|
9
|
+
|
|
1
10
|
# Moriarty
|
|
2
11
|
|
|
3
12
|
Tool to check social networks for available username.
|
|
4
|
-
|
|
13
|
+
Idea from python tool - sherlock
|
|
5
14
|
|
|
6
|
-
---
|
|
7
15
|
|
|
8
16
|
# What it do
|
|
9
17
|
|
|
@@ -11,25 +19,33 @@ Search multiple social networks for free username.
|
|
|
11
19
|
It's reverse from Sherlock, so not-found username is success.
|
|
12
20
|
Argument `--hunt` will run search like _sherlock_ would, looking for valid users.
|
|
13
21
|
|
|
14
|
-
---
|
|
15
22
|
|
|
16
23
|
# How to install
|
|
17
24
|
|
|
18
|
-
Clone repo and
|
|
25
|
+
Clone repo and install dependencies:
|
|
19
26
|
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
|
|
27
|
+
```bash
|
|
28
|
+
# Moriarty use rest-client, nokogiri and colorize gems
|
|
29
|
+
git clone https://github.com/decentralizuj/moriarty.git && cd moriarty && bundle install
|
|
30
|
+
```
|
|
23
31
|
|
|
24
|
-
|
|
32
|
+
Or install from rubygems:
|
|
25
33
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
> DISCLAIMER:
|
|
35
|
+
GitHub repository is updated before Rubygems.
|
|
36
|
+
Before v-1.0.0 is released, recommended way is to clone repo, or install with bundler from git.
|
|
29
37
|
|
|
30
|
-
|
|
38
|
+
```ruby
|
|
39
|
+
# local
|
|
40
|
+
gem install moriarty
|
|
41
|
+
|
|
42
|
+
# bundler
|
|
43
|
+
gem 'moriarty', '~> 0.2.0'
|
|
44
|
+
|
|
45
|
+
# bundler from github
|
|
46
|
+
gem 'moriarty', git: 'https://github.com/decentralizuj/moriarty'
|
|
47
|
+
```
|
|
31
48
|
|
|
32
|
-
---
|
|
33
49
|
|
|
34
50
|
# How to use
|
|
35
51
|
|
|
@@ -38,62 +54,115 @@ To search for registered user, execute with `--hunt` as argument.
|
|
|
38
54
|
|
|
39
55
|
Read source-code, each method is explained with examples.
|
|
40
56
|
|
|
41
|
-
```
|
|
42
|
-
# if
|
|
57
|
+
```ruby
|
|
58
|
+
# if installed localy, you can run 'moriarty' without 'ruby bin/'
|
|
59
|
+
# > $ torify moriarty decentalizuj --hunt
|
|
43
60
|
|
|
44
|
-
ruby bin/moriarty
|
|
45
|
-
# => print usage instructions
|
|
61
|
+
ruby bin/moriarty
|
|
62
|
+
# => print usage instructions
|
|
46
63
|
|
|
47
|
-
ruby bin/moriarty USERNAME1 USERNAME2 USERNAME3
|
|
48
|
-
# => search for free usernames ... ... ...
|
|
64
|
+
ruby bin/moriarty USERNAME1 USERNAME2 USERNAME3
|
|
65
|
+
# => search for free usernames ... ... ...
|
|
49
66
|
|
|
50
|
-
ruby bin/moriarty --hunt USERNAME1 USERNAME2 USERNAME3
|
|
51
|
-
# => hunt registered usernames ... ... ...
|
|
67
|
+
ruby bin/moriarty --hunt USERNAME1 USERNAME2 USERNAME3
|
|
68
|
+
# => hunt registered usernames ... ... ...
|
|
52
69
|
```
|
|
53
70
|
|
|
54
|
-
To use *Moriarty* in your own project, available methods are:
|
|
71
|
+
To use *Moriarty* in your own project, available methods are:
|
|
55
72
|
|
|
56
73
|
```ruby
|
|
57
|
-
@jim = Moriarty.new( 'somename', 'facebook.com' )
|
|
58
|
-
# => prepare request for 'https://facebook.com/somename'
|
|
74
|
+
@jim = Moriarty.new( 'somename', 'facebook.com' )
|
|
75
|
+
# => prepare request for 'https://facebook.com/somename'
|
|
59
76
|
|
|
60
|
-
@jim.go
|
|
61
|
-
# => check facebook for username 'somename', return true/false
|
|
77
|
+
@jim.go
|
|
78
|
+
# => check facebook for username 'somename', return true/false
|
|
62
79
|
|
|
63
|
-
@jim.go site: 'github.com'
|
|
64
|
-
# => search github.com, but do not change default :url
|
|
80
|
+
@jim.go site: 'github.com'
|
|
81
|
+
# => search github.com, but do not change default :url
|
|
65
82
|
|
|
66
|
-
@jim.go site: 'github.com', user: 'decentralizuj'
|
|
67
|
-
# => search new user and site without changing defaults
|
|
83
|
+
@jim.go site: 'github.com', user: 'decentralizuj'
|
|
84
|
+
# => search new user and site without changing defaults
|
|
68
85
|
|
|
69
|
-
@jim.url
|
|
70
|
-
# => 'https://facebook.com/' -> get url
|
|
86
|
+
@jim.url
|
|
87
|
+
# => 'https://facebook.com/' -> get url
|
|
71
88
|
|
|
72
|
-
@jim.user
|
|
73
|
-
# => 'somename' -> get user
|
|
89
|
+
@jim.user
|
|
90
|
+
# => 'somename' -> get user
|
|
74
91
|
|
|
75
|
-
@jim.url = 'instagram.com'
|
|
76
|
-
# => 'https://instagram.com/' -> set url
|
|
92
|
+
@jim.url = 'instagram.com'
|
|
93
|
+
# => 'https://instagram.com/' -> set url
|
|
77
94
|
|
|
78
|
-
@jim.user = 'moriarty'
|
|
79
|
-
# => 'moriarti' -> set user
|
|
95
|
+
@jim.user = 'moriarty'
|
|
96
|
+
# => 'moriarti' -> set user
|
|
80
97
|
|
|
81
|
-
@jim.search
|
|
82
|
-
# => alias for #go
|
|
98
|
+
@jim.search
|
|
99
|
+
# => alias for #go
|
|
83
100
|
```
|
|
84
101
|
|
|
85
|
-
|
|
86
|
-
|
|
102
|
+
**CLI** is there to test main `class Moriarty` in terminal.
|
|
103
|
+
It's created from self methods: #find!, #hunt!, #print_url and #print_name
|
|
104
|
+
Methods with bang (#find!) run on self, while #find run on instance.
|
|
87
105
|
|
|
88
106
|
```ruby
|
|
89
|
-
Moriarty.find! 'somename', 'instagram.com'
|
|
90
|
-
# => execute search and print colorized output
|
|
107
|
+
Moriarty.find! 'somename', 'instagram.com'
|
|
108
|
+
# => execute search and print colorized output
|
|
91
109
|
|
|
92
|
-
Moriarty.find! 'somename', 'github.com', :hunt
|
|
93
|
-
or
|
|
94
|
-
Moriarty.hunt! 'somename', 'github.com'
|
|
95
|
-
# => execute hunt and print colorized output
|
|
96
|
-
|
|
97
|
-
Moriarty.print_url 'https://www.github.com/'
|
|
98
|
-
# => 'github'
|
|
110
|
+
Moriarty.find! 'somename', 'github.com', :hunt
|
|
111
|
+
or
|
|
112
|
+
Moriarty.hunt! 'somename', 'github.com'
|
|
113
|
+
# => execute hunt and print colorized output
|
|
99
114
|
```
|
|
115
|
+
|
|
116
|
+
Methods `#print_url` and `#print_name` are there to construct data for print.
|
|
117
|
+
We have url and name as instance variables, so this is self method.
|
|
118
|
+
|
|
119
|
+
```ruby
|
|
120
|
+
# remove all extensions, if there's any (http(s), .www, .com)
|
|
121
|
+
# first look for 'http(s)', then 'www.', remove if found
|
|
122
|
+
# if domain have more routes (rubygems.org/profiles), remove it
|
|
123
|
+
# this way subdomains are accepted and part of site-name
|
|
124
|
+
|
|
125
|
+
Moriarty.print_url 'https://www.github.com/'
|
|
126
|
+
# => 'github'
|
|
127
|
+
|
|
128
|
+
# Remove symbols from username ('@, #, /u/')
|
|
129
|
+
# this will be changed in future
|
|
130
|
+
|
|
131
|
+
Moriarty.print_name '/u/moriarty'
|
|
132
|
+
Moriarty.print_name '@moriarty'
|
|
133
|
+
Moriarty.print_name '#moriarty'
|
|
134
|
+
# => 'moriarty'
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Methods `#p1` and `#p2` are there to print colorized output
|
|
138
|
+
|
|
139
|
+
```ruby
|
|
140
|
+
# p1 wrap string with braces, bold by default
|
|
141
|
+
Moriarty.p1('mystring', :green, :white, :regular)
|
|
142
|
+
# => '[mystring]' -> string is green, bracelets are white
|
|
143
|
+
|
|
144
|
+
# p2 only print string colorized, and/or bold
|
|
145
|
+
Moriarty.p2('mystring', :red, :bold)
|
|
146
|
+
# => 'mystring' -> red and bold
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
# Latest Changes
|
|
151
|
+
|
|
152
|
+
Last push, will be compiled into gem V-0.3.0 when ready
|
|
153
|
+
- Add methods for smart printing
|
|
154
|
+
- changed colors in cli
|
|
155
|
+
- added youtube as source
|
|
156
|
+
- bold username and site in cli, site is capitalized
|
|
157
|
+
|
|
158
|
+
V-0.2.0
|
|
159
|
+
- Moriarty#print_name added to remove '@, #, /u/' from username when printing in cli.
|
|
160
|
+
- Added 'rubygems.org' as source to search
|
|
161
|
+
- Added '[+]' and '[-]' to cli output
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
# Contribution
|
|
165
|
+
|
|
166
|
+
At the moment I do not need any contribution on this project, but that will change after v1.
|
|
167
|
+
That will be in about 1 month, so you can watch repository to stay updated with latest changes.
|
|
168
|
+
Github is always updated before rubygems. And again, after v1, that will be automated.
|
data/bin/moriarty
CHANGED
|
@@ -6,15 +6,16 @@ require_relative '../lib/moriarty'
|
|
|
6
6
|
# accept '--hunt' as argument
|
|
7
7
|
|
|
8
8
|
hunt = ARGV.include?('--hunt') ? :hunt : :search
|
|
9
|
+
message = hunt == :hunt ? "Starting hunt on user -> " : "Starting search for free username -> "
|
|
9
10
|
|
|
10
11
|
# If no args, or include '-h' or '--help', print banner
|
|
11
12
|
# If use '--hunt', do not search for '--hunt' username
|
|
12
13
|
|
|
13
14
|
if ARGV.empty? or ARGV.include? '-h' or ARGV.include? '--help'
|
|
14
15
|
|
|
15
|
-
puts "\nSearch social networks for free username".
|
|
16
|
+
puts "\nSearch social networks for free username".cyan
|
|
16
17
|
puts " $ ".white + "ruby bin/moriarty sherlock watson".green
|
|
17
|
-
puts "\nRun with --hunt to search for registered users".
|
|
18
|
+
puts "\nRun with --hunt to search for registered users".cyan
|
|
18
19
|
puts " $ ".white + "ruby bin/moriarty sherlock watson --hunt\n".green
|
|
19
20
|
exit(1)
|
|
20
21
|
|
|
@@ -26,24 +27,31 @@ require_relative '../lib/moriarty'
|
|
|
26
27
|
ARGV.each do |user|
|
|
27
28
|
next if user == '--hunt'
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
puts
|
|
31
|
+
Moriarty.p2(message, :cyan, :bold)
|
|
32
|
+
Moriarty.p1(user)
|
|
33
|
+
puts; puts
|
|
31
34
|
|
|
32
35
|
Moriarty.find! user, 'github.com', hunt
|
|
33
36
|
Moriarty.find! user, 'rubygems.org/profiles', hunt
|
|
34
37
|
Moriarty.find! "@#{user}", 'dev.to', hunt
|
|
35
38
|
Moriarty.find! "@#{user}", 'medium.com', hunt
|
|
36
39
|
Moriarty.find! "/u/#{user}", 'reddit.com', hunt
|
|
40
|
+
Moriarty.find! user, 'youtube.com', hunt
|
|
37
41
|
Moriarty.find! user, 'facebook.com', hunt
|
|
38
42
|
Moriarty.find! user, 'instagram.com', hunt
|
|
39
43
|
Moriarty.find! "@#{user}", 'tiktok.com', hunt
|
|
40
44
|
end
|
|
41
45
|
|
|
42
46
|
end_time = Time.now.to_i
|
|
47
|
+
counter = end_time - start_time
|
|
43
48
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
puts
|
|
48
|
-
|
|
49
|
+
sec = ' second'
|
|
50
|
+
sec += 's' unless (counter.to_s.end_with?('1') or counter.to_s.end_with?('11'))
|
|
51
|
+
|
|
52
|
+
puts
|
|
53
|
+
Moriarty.p2('Finished in ->', :cyan, :bold)
|
|
54
|
+
Moriarty.p1(counter)
|
|
55
|
+
Moriarty.p2(sec, :cyan, :bold)
|
|
56
|
+
puts; puts
|
|
49
57
|
end
|
data/lib/moriarty/cli.rb
CHANGED
|
@@ -12,20 +12,35 @@ class Moriarty
|
|
|
12
12
|
# Moriarty.find! :stupiduser, 'facebook.com', :hunt
|
|
13
13
|
# => [FREE!] if user 'stupiduser' is registered on facebook
|
|
14
14
|
|
|
15
|
-
def self.find!(
|
|
15
|
+
def self.find!( username, web = 'github.com', type = :search )
|
|
16
16
|
|
|
17
|
-
@jim = Moriarty.new
|
|
17
|
+
@jim = Moriarty.new username.to_s, web.to_s
|
|
18
18
|
@jim.go
|
|
19
19
|
|
|
20
|
+
name = print_name(username).to_s
|
|
21
|
+
site = print_url(web).to_s
|
|
22
|
+
|
|
20
23
|
case
|
|
21
24
|
when type.to_sym == :hunt && @jim.success?
|
|
22
|
-
|
|
25
|
+
p1('+')
|
|
26
|
+
p1('FOUND!')
|
|
27
|
+
p2(" #{name}", :cyan, :bold)
|
|
28
|
+
p2(" found on >> ")
|
|
29
|
+
puts p2(site, :cyan, :bold)
|
|
23
30
|
when type.to_sym == :hunt && !@jim.success?
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
puts
|
|
31
|
+
p1('-', :red, :red)
|
|
32
|
+
p2(" #{name} fail on ", :red)
|
|
33
|
+
puts p2(site, :red)
|
|
34
|
+
when @jim.success?
|
|
35
|
+
p1('-', :red, :red)
|
|
36
|
+
p2(" #{name} is taken on ", :red)
|
|
37
|
+
puts p2(site, :red)
|
|
27
38
|
else
|
|
28
|
-
|
|
39
|
+
p1('+')
|
|
40
|
+
p1('FREE!')
|
|
41
|
+
p2(" #{name}", :cyan, :bold)
|
|
42
|
+
p2(" is free on >> ")
|
|
43
|
+
puts p2(site, :cyan, :bold)
|
|
29
44
|
end
|
|
30
45
|
end
|
|
31
46
|
|
|
@@ -50,7 +65,7 @@ class Moriarty
|
|
|
50
65
|
ext = site.to_s.split('.').last
|
|
51
66
|
name = site.gsub(".#{ext}", '')
|
|
52
67
|
name = name.split('/').first if ext.size < 5
|
|
53
|
-
return name
|
|
68
|
+
return name.capitalize
|
|
54
69
|
end
|
|
55
70
|
|
|
56
71
|
# Remove extensions from username
|
|
@@ -63,4 +78,16 @@ class Moriarty
|
|
|
63
78
|
name.gsub!('/u/','') if name.to_s.start_with?('/u/')
|
|
64
79
|
return name
|
|
65
80
|
end
|
|
81
|
+
|
|
82
|
+
def self.p1( title, color1 = :'light_green', color2 = :cyan, type = :bold )
|
|
83
|
+
str = ' ['.colorize(color2) + title.to_s.colorize(color1) + ']'.colorize(color2)
|
|
84
|
+
str = str.bold if type == :bold
|
|
85
|
+
print str
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def self.p2( title, color = :cyan, type = :regular)
|
|
89
|
+
str = title.colorize(color)
|
|
90
|
+
str = str.bold if type == :bold
|
|
91
|
+
print str
|
|
92
|
+
end
|
|
66
93
|
end
|
data/moriarty.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: moriarty
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- decentralizuj
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-04-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: colorize
|