girbot 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.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +67 -0
- data/Rakefile +6 -0
- data/bin/console +10 -0
- data/bin/setup +8 -0
- data/examples/brute_force.rb +29 -0
- data/examples/cookie_clicker.rb +34 -0
- data/examples/details.json.example +17 -0
- data/examples/emag_search.rb +11 -0
- data/examples/plata_electrica.rb +46 -0
- data/examples/plata_eon.rb +46 -0
- data/examples/test_run.rb +18 -0
- data/girbot.gemspec +34 -0
- data/lib/girbot.rb +14 -0
- data/lib/girbot/browser_holder.rb +37 -0
- data/lib/girbot/step_foundation.rb +90 -0
- data/lib/girbot/steps/brute_force.rb +35 -0
- data/lib/girbot/steps/step.rb +22 -0
- data/lib/girbot/string_generator.rb +34 -0
- data/lib/girbot/version.rb +3 -0
- data/lib/girbot/watir_shortcuts.rb +36 -0
- data/pass.txt +100 -0
- data/users.txt +11 -0
- metadata +200 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: da32d54d8b5bee072cd244a31ba756b4d7724e92
|
4
|
+
data.tar.gz: 7a3d56cde56d78b7d82e7b250eaccbcb265f4f80
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5c7b4330b81a3898af4c182ef38c32febac8c3b0365dae5b320263744d2479d86e024291195439dde89ac01b02c294f4aac6eb2a8883d021da06a9bdcb10b0b5
|
7
|
+
data.tar.gz: 377c7cd1c6f8abf9fc930d759d3e0745e14683f4451febdb6c0b924bd798043a885dea7f15199480c46a7bcbeca53d820c8227838a5bbbbcab92864eceaff404
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
girbot
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.4.3
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at mess110@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Cristian Mircea Messel
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# Girbot
|
2
|
+
|
3
|
+
> bleep-blop wreak havoc bleep mischief - Girbot
|
4
|
+
|
5
|
+
Girbot wants to help you automate boring tasks. You define steps which can be run
|
6
|
+
in different browsers.
|
7
|
+
|
8
|
+
```
|
9
|
+
Girbot::Step.run(
|
10
|
+
# different steps can share a BrowserHolder
|
11
|
+
browser: BrowserHolder.new,
|
12
|
+
|
13
|
+
# if the browser is hidden
|
14
|
+
headless: true,
|
15
|
+
|
16
|
+
# opens the browser in the BrowserHolder
|
17
|
+
openBrowser: true,
|
18
|
+
|
19
|
+
# closes the browser in the BrowserHolder
|
20
|
+
closeBrowser: true,
|
21
|
+
|
22
|
+
# each action in the step is executed in sequence one after the other
|
23
|
+
actions: [
|
24
|
+
|
25
|
+
# go to a specific webpage
|
26
|
+
{ goto: 'https://www.google.com' }
|
27
|
+
|
28
|
+
# set text in a textfield
|
29
|
+
{ text_in_textfield: [ 'text', id: 'id' ]}
|
30
|
+
|
31
|
+
# click an item
|
32
|
+
{ click: [ 'button', id: 'submit' ] }
|
33
|
+
]
|
34
|
+
)
|
35
|
+
```
|
36
|
+
|
37
|
+
See examples folder for more information.
|
38
|
+
|
39
|
+
## Installation
|
40
|
+
|
41
|
+
Add this line to your application's Gemfile:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
gem 'girbot'
|
45
|
+
```
|
46
|
+
|
47
|
+
And then execute:
|
48
|
+
|
49
|
+
$ bundle
|
50
|
+
|
51
|
+
Or install it yourself as:
|
52
|
+
|
53
|
+
$ gem install girbot
|
54
|
+
|
55
|
+
## Development
|
56
|
+
|
57
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
58
|
+
|
59
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
60
|
+
|
61
|
+
## Contributing
|
62
|
+
|
63
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/mess110/girbot. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
64
|
+
|
65
|
+
## License
|
66
|
+
|
67
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
data/bin/setup
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require "girbot"
|
3
|
+
|
4
|
+
# Attempt to brute force user/password from a dictionary
|
5
|
+
Girbot::BruteForce.run(
|
6
|
+
# useful for debugging
|
7
|
+
headless: false,
|
8
|
+
|
9
|
+
# base url
|
10
|
+
url: 'https://website_with_login/login',
|
11
|
+
|
12
|
+
# how to find the username field
|
13
|
+
username_field: { id: 'UserName' },
|
14
|
+
|
15
|
+
# how to find the password field
|
16
|
+
password_field: { id: 'Password' },
|
17
|
+
|
18
|
+
# the button to press
|
19
|
+
login_button: { class: 'btn-syn' },
|
20
|
+
|
21
|
+
# how to know when a successful login happened
|
22
|
+
break_condition: '!browser.url.start_with? "https://website_with_login/login"',
|
23
|
+
|
24
|
+
# path to users file; one username per line
|
25
|
+
users: 'users.txt',
|
26
|
+
|
27
|
+
# path to passwords file; one password per line
|
28
|
+
passwords: 'pass.txt'
|
29
|
+
)
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require "girbot"
|
3
|
+
|
4
|
+
class CookieClicker < Girbot::Step
|
5
|
+
def action options
|
6
|
+
goto 'http://orteil.dashnet.org/cookieclicker/'
|
7
|
+
|
8
|
+
cookie = browser.div(id: 'bigCookie')
|
9
|
+
|
10
|
+
i = 0
|
11
|
+
loop do
|
12
|
+
i += 1
|
13
|
+
cookie.click
|
14
|
+
if i == 100
|
15
|
+
grow('product unlocked enabled')
|
16
|
+
grow('crate upgrade enabled')
|
17
|
+
i = 0
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def grow class_name
|
23
|
+
item = browser.divs(class: class_name).to_a.last
|
24
|
+
unless item.nil?
|
25
|
+
item.click
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
CookieClicker.run(
|
31
|
+
headless: false,
|
32
|
+
closeBrowser: false,
|
33
|
+
browser: Girbot::BrowserHolder.new(:chrome, nil)
|
34
|
+
)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require "girbot"
|
3
|
+
|
4
|
+
Girbot::Step.run(
|
5
|
+
headless: false,
|
6
|
+
actions: [
|
7
|
+
{ goto: 'https://www.emag.ro/' },
|
8
|
+
{ text_in_textfield: [ 'hello', id: 'emg-input-autosuggest' ] },
|
9
|
+
{ click: [ 'a', id: 'emg-category-menu-icon' ] }
|
10
|
+
]
|
11
|
+
)
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require "girbot"
|
3
|
+
|
4
|
+
class PlataElectrica < Girbot::Step
|
5
|
+
def action options = {}
|
6
|
+
validate_auth(options)
|
7
|
+
validate_card(options)
|
8
|
+
|
9
|
+
goto 'https://myelectrica.ro/index.php?pagina=login'
|
10
|
+
text_in_textfield(options[:details][:auth][:user], id: 'myelectrica_utilizator')
|
11
|
+
text_in_textfield(options[:details][:auth][:pass], id: 'myelectrica_pass')
|
12
|
+
sleep 1
|
13
|
+
click(:button, id: 'myelectrica_login_btn')
|
14
|
+
|
15
|
+
goto 'https://myelectrica.ro/index.php?pagina=plateste-online'
|
16
|
+
sleep 1
|
17
|
+
fire id: 'myelectrica_checkall'
|
18
|
+
click(:button, type: 'submit')
|
19
|
+
sleep 1
|
20
|
+
click(:button, id: 'requestMobilPay')
|
21
|
+
|
22
|
+
text_in_textfield(options[:details][:card][:number], id: 'paymentCardNumber')
|
23
|
+
text_in_textfield(options[:details][:card][:name], id: 'paymentCardName')
|
24
|
+
browser.execute_script("document.getElementById('paymentExpMonth').style.opacity='1';")
|
25
|
+
select_value(options[:details][:card][:expMonth], id: 'paymentExpMonth')
|
26
|
+
browser.execute_script("document.getElementById('paymentExpYear').style.opacity='1';")
|
27
|
+
select_value(options[:details][:card][:expYear], id: 'paymentExpYear')
|
28
|
+
text_in_textfield(options[:details][:card][:ccv], id: 'paymentCVV2Number')
|
29
|
+
|
30
|
+
click(:button, type: 'submit')
|
31
|
+
|
32
|
+
loop do
|
33
|
+
sleep 1
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
PlataElectrica.run(
|
39
|
+
headless: false,
|
40
|
+
closeBrowser: false,
|
41
|
+
browser: Girbot::BrowserHolder.new(:chrome, nil),
|
42
|
+
details: {
|
43
|
+
auth: Girbot::Step.read('./examples/details.json')[:auth][0],
|
44
|
+
card: Girbot::Step.read('./examples/details.json')[:cards][0]
|
45
|
+
}
|
46
|
+
)
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require "girbot"
|
3
|
+
|
4
|
+
class PlataEon < Girbot::Step
|
5
|
+
def action options = {}
|
6
|
+
validate_auth(options)
|
7
|
+
validate_card(options)
|
8
|
+
|
9
|
+
goto 'https://myline-eon.ro/login'
|
10
|
+
text_in_textfield(options[:details][:auth][:user], id: 'username')
|
11
|
+
text_in_textfield(options[:details][:auth][:pass], id: 'password')
|
12
|
+
sleep 1
|
13
|
+
click(:button, type: 'submit')
|
14
|
+
|
15
|
+
# goto 'https://myelectrica.ro/index.php?pagina=plateste-online'
|
16
|
+
# sleep 1
|
17
|
+
# fire id: 'myelectrica_checkall'
|
18
|
+
# click(:button, type: 'submit')
|
19
|
+
# sleep 1
|
20
|
+
# click(:button, id: 'requestMobilPay')
|
21
|
+
|
22
|
+
# text_in_textfield(options[:details][:card][:number], id: 'paymentCardNumber')
|
23
|
+
# text_in_textfield(options[:details][:card][:name], id: 'paymentCardName')
|
24
|
+
# browser.execute_script("document.getElementById('paymentExpMonth').style.opacity='1';")
|
25
|
+
# select_value(options[:details][:card][:expMonth], id: 'paymentExpMonth')
|
26
|
+
# browser.execute_script("document.getElementById('paymentExpYear').style.opacity='1';")
|
27
|
+
# select_value(options[:details][:card][:expYear], id: 'paymentExpYear')
|
28
|
+
# text_in_textfield(options[:details][:card][:ccv], id: 'paymentCVV2Number')
|
29
|
+
|
30
|
+
# click(:button, type: 'submit')
|
31
|
+
|
32
|
+
loop do
|
33
|
+
sleep 1
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
PlataEon.run(
|
39
|
+
headless: false,
|
40
|
+
closeBrowser: false,
|
41
|
+
browser: Girbot::BrowserHolder.new(:chrome, nil),
|
42
|
+
details: {
|
43
|
+
auth: Girbot::Step.read('./examples/details.json')[:auth][0],
|
44
|
+
card: Girbot::Step.read('./examples/details.json')[:cards][0]
|
45
|
+
}
|
46
|
+
)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require "girbot"
|
3
|
+
|
4
|
+
class TestRun < Girbot::Step
|
5
|
+
def action options = {}
|
6
|
+
goto 'file:///home/kiki/pr0n/girbot/select.html'
|
7
|
+
|
8
|
+
loop do
|
9
|
+
sleep 1
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
TestRun.run(
|
15
|
+
headless: false,
|
16
|
+
closeBrowser: false,
|
17
|
+
browser: Girbot::BrowserHolder.new(:chrome, nil),
|
18
|
+
)
|
data/girbot.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'girbot/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "girbot"
|
8
|
+
spec.version = Girbot::VERSION
|
9
|
+
spec.authors = ["Cristian Mircea Messel"]
|
10
|
+
spec.email = ["mess110@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Summary}
|
13
|
+
spec.description = %q{Description}
|
14
|
+
spec.homepage = "http://google.com"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
27
|
+
|
28
|
+
spec.add_dependency "pry"
|
29
|
+
spec.add_dependency "watir", "6.1.0"
|
30
|
+
spec.add_dependency "selenium-webdriver", "3.0.5"
|
31
|
+
spec.add_dependency "watir-webdriver", "0.9.9"
|
32
|
+
spec.add_dependency "nokogiri", "1.8.1"
|
33
|
+
spec.add_dependency "headless", "2.3.1"
|
34
|
+
end
|
data/lib/girbot.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
require 'watir'
|
3
|
+
require 'open-uri'
|
4
|
+
require 'base64'
|
5
|
+
require 'headless'
|
6
|
+
require 'socket'
|
7
|
+
|
8
|
+
require 'girbot/watir_shortcuts'
|
9
|
+
require 'girbot/browser_holder'
|
10
|
+
require 'girbot/step_foundation'
|
11
|
+
require 'girbot/string_generator'
|
12
|
+
|
13
|
+
require 'girbot/steps/step'
|
14
|
+
require 'girbot/steps/brute_force'
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Girbot
|
2
|
+
class BrowserHolder
|
3
|
+
attr_accessor :which, :proxy, :browser
|
4
|
+
|
5
|
+
def initialize which='firefox', proxy=nil
|
6
|
+
@which = which
|
7
|
+
@proxy = proxy
|
8
|
+
end
|
9
|
+
|
10
|
+
def init
|
11
|
+
if @proxy.nil?
|
12
|
+
@browser = send(@which)
|
13
|
+
else
|
14
|
+
@browser = send("#{@which}_proxy", @proxy)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def firefox
|
19
|
+
Watir::Browser.new :firefox
|
20
|
+
end
|
21
|
+
|
22
|
+
def firefox_proxy proxy
|
23
|
+
profile = Selenium::WebDriver::Firefox::Profile.new
|
24
|
+
profile.proxy = Selenium::WebDriver::Proxy.new :http => proxy, :ssl => proxy
|
25
|
+
Watir::Browser.new :firefox, :profile => profile
|
26
|
+
end
|
27
|
+
|
28
|
+
def chrome
|
29
|
+
Watir::Browser.new :chrome
|
30
|
+
end
|
31
|
+
|
32
|
+
def chrome_proxy proxy
|
33
|
+
switches = "--proxy-server=#{proxy}"
|
34
|
+
Watir::Browser.new :chrome, :switches => switches
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
module Girbot
|
2
|
+
class StepFoundation
|
3
|
+
attr_accessor :browser_holder
|
4
|
+
|
5
|
+
def initialize browser_holder
|
6
|
+
@browser_holder = browser_holder
|
7
|
+
end
|
8
|
+
|
9
|
+
def take_whole_action options, openBrowser, closeBrowser
|
10
|
+
@browser_holder.init if openBrowser
|
11
|
+
validate_browser_presence
|
12
|
+
action(options)
|
13
|
+
close if closeBrowser
|
14
|
+
end
|
15
|
+
|
16
|
+
def validate_browser_presence
|
17
|
+
throw 'browser not set' if browser.nil?
|
18
|
+
end
|
19
|
+
|
20
|
+
def wait_for_sms
|
21
|
+
auth_code = nil
|
22
|
+
server = TCPServer.new('0.0.0.0', 4125)
|
23
|
+
puts 'Listenting on 0.0.0.0:4125'
|
24
|
+
loop do
|
25
|
+
socket = server.accept
|
26
|
+
|
27
|
+
request = socket.gets
|
28
|
+
|
29
|
+
response = "{}\n"
|
30
|
+
socket.print "HTTP/1.1 200 OK\r\n" +
|
31
|
+
"Content-Type: text/plain\r\n" +
|
32
|
+
"Content-Length: #{response.bytesize}\r\n" +
|
33
|
+
"Connection: close\r\n"
|
34
|
+
|
35
|
+
socket.print "\r\n"
|
36
|
+
socket.print response
|
37
|
+
socket.close
|
38
|
+
|
39
|
+
if request.start_with?('GET /sms?authCode=')
|
40
|
+
STDERR.puts request
|
41
|
+
auth_code = request.split('=').last.split(' ').first
|
42
|
+
break
|
43
|
+
end
|
44
|
+
end
|
45
|
+
auth_code
|
46
|
+
end
|
47
|
+
|
48
|
+
def validate_auth(options)
|
49
|
+
raise 'invalid options[:details]' unless options[:details].is_a?(Hash)
|
50
|
+
raise 'invalid options[:details][:auth]' unless options[:details][:auth].is_a?(Hash)
|
51
|
+
raise 'invalid options[:details][:auth][:user]' unless options[:details][:auth][:user].is_a?(String)
|
52
|
+
raise 'invalid options[:details][:auth][:pass]' unless options[:details][:auth][:pass].is_a?(String)
|
53
|
+
end
|
54
|
+
|
55
|
+
def validate_card(options)
|
56
|
+
raise 'invalid options[:details]' unless options[:details].is_a?(Hash)
|
57
|
+
raise 'invalid options[:details][:card]' unless options[:details][:card].is_a?(Hash)
|
58
|
+
raise 'invalid options[:details][:card][:number]' unless options[:details][:card][:number].is_a?(String)
|
59
|
+
raise 'invalid options[:details][:card][:name]' unless options[:details][:card][:name].is_a?(String)
|
60
|
+
raise 'invalid options[:details][:card][:expYear]' unless options[:details][:card][:expYear].is_a?(String)
|
61
|
+
raise 'invalid options[:details][:card][:expMonth]' unless options[:details][:card][:expMonth].is_a?(String)
|
62
|
+
raise 'invalid options[:details][:card][:ccv]' unless options[:details][:card][:ccv].is_a?(String)
|
63
|
+
# TODO: deeper validation
|
64
|
+
# * number is only digits and correct length
|
65
|
+
# * expYear is a year
|
66
|
+
# * expMonth is a month
|
67
|
+
# * ccv is only digits
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.read path
|
71
|
+
JSON.parse(File.read(path), symbolize_names: true)
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.run(options={})
|
75
|
+
options[:browser] = BrowserHolder.new if options[:browser].nil?
|
76
|
+
options[:headless] = true if options[:headless].nil?
|
77
|
+
options[:openBrowser] = true if options[:openBrowser].nil?
|
78
|
+
options[:closeBrowser] = true if options[:closeBrowser].nil?
|
79
|
+
|
80
|
+
step = self.new(options[:browser])
|
81
|
+
if options[:headless]
|
82
|
+
Headless.ly do
|
83
|
+
step.take_whole_action(options, options[:openBrowser], options[:closeBrowser])
|
84
|
+
end
|
85
|
+
else
|
86
|
+
step.take_whole_action(options, options[:openBrowser], options[:closeBrowser])
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Girbot
|
2
|
+
class BruteForce < Step
|
3
|
+
def action options
|
4
|
+
raise 'missing url option' if options[:url].nil?
|
5
|
+
raise 'missing users option' if options[:users].nil?
|
6
|
+
raise 'missing passwords option' if options[:passwords].nil?
|
7
|
+
raise 'missing username_field option' if options[:username_field].nil?
|
8
|
+
raise 'missing password_field option' if options[:password_field].nil?
|
9
|
+
raise 'missing login_button option' if options[:login_button].nil?
|
10
|
+
raise 'missing break_condition option' if options[:break_condition].nil?
|
11
|
+
|
12
|
+
goto options[:url]
|
13
|
+
|
14
|
+
users = read_file(options[:users])
|
15
|
+
passwords = read_file(options[:passwords])
|
16
|
+
|
17
|
+
users.each do |user|
|
18
|
+
passwords.each do |password|
|
19
|
+
puts "trying: #{user}:#{password}"
|
20
|
+
text_in_textfield(user, options[:username_field])
|
21
|
+
text_in_textfield(password, options[:password_field])
|
22
|
+
click('button', options[:login_button])
|
23
|
+
if eval options[:break_condition]
|
24
|
+
puts "success: #{user}:#{password}"
|
25
|
+
break
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def read_file path
|
32
|
+
File.read(path).lines.map(&:strip)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Girbot
|
2
|
+
class Step < StepFoundation
|
3
|
+
include WatirShortcuts
|
4
|
+
|
5
|
+
def action options
|
6
|
+
raise 'actions missing' if options[:actions].nil?
|
7
|
+
raise 'actions needs to be an array' if options[:actions].class != Array
|
8
|
+
|
9
|
+
options[:actions].each do |action|
|
10
|
+
key = action.keys.first
|
11
|
+
raise 'missing action key' if key.nil?
|
12
|
+
raise 'invalid action key' if !Girbot::WatirShortcuts.instance_methods.include? key.to_sym
|
13
|
+
action[key] = [action[key]] if action[key].class != Array
|
14
|
+
end
|
15
|
+
|
16
|
+
options[:actions].each do |action|
|
17
|
+
key = action.keys.first
|
18
|
+
send(key, *action[key])
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Girbot
|
2
|
+
class StringGenerator
|
3
|
+
attr_accessor :items
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@items = ('!'..'~').to_a
|
7
|
+
end
|
8
|
+
|
9
|
+
def items= items
|
10
|
+
@items = items
|
11
|
+
end
|
12
|
+
|
13
|
+
def repeated_permutation min_length=nil, max_length=nil
|
14
|
+
items = []
|
15
|
+
min_length = 1 if min_length.nil?
|
16
|
+
max_length = @items.size if max_length.nil?
|
17
|
+
raise 'min is greater than max' if min_length > max_length
|
18
|
+
|
19
|
+
(min_length..max_length).each do |range|
|
20
|
+
items.concat repeated_permutation_with_length(range)
|
21
|
+
end
|
22
|
+
|
23
|
+
items
|
24
|
+
end
|
25
|
+
|
26
|
+
def repeated_permutation_with_length length
|
27
|
+
stringify @items.repeated_permutation(length).to_a
|
28
|
+
end
|
29
|
+
|
30
|
+
def stringify array
|
31
|
+
array.map { |e| e.join('') }.uniq.reject { |c| c.empty? }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Girbot
|
2
|
+
module WatirShortcuts
|
3
|
+
def browser
|
4
|
+
@browser_holder.browser
|
5
|
+
end
|
6
|
+
|
7
|
+
def goto url
|
8
|
+
browser.goto url
|
9
|
+
end
|
10
|
+
|
11
|
+
def text_in_textfield text, query
|
12
|
+
browser.text_field(query).set text
|
13
|
+
end
|
14
|
+
|
15
|
+
def fire query
|
16
|
+
browser.checkbox(query).fire_event :click
|
17
|
+
end
|
18
|
+
|
19
|
+
def select_value(value, query)
|
20
|
+
browser.select_list(query).select_value(value)
|
21
|
+
end
|
22
|
+
|
23
|
+
# Examples:
|
24
|
+
#
|
25
|
+
# click(:button, id: 'my-id')
|
26
|
+
# click(:button, type: 'submit')
|
27
|
+
#
|
28
|
+
def click(type, query)
|
29
|
+
browser.send(type, query).click
|
30
|
+
end
|
31
|
+
|
32
|
+
def close
|
33
|
+
browser.close
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/pass.txt
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
123456
|
2
|
+
password
|
3
|
+
12345678
|
4
|
+
qwerty
|
5
|
+
123456789
|
6
|
+
12345
|
7
|
+
1234
|
8
|
+
111111
|
9
|
+
1234567
|
10
|
+
dragon
|
11
|
+
123123
|
12
|
+
baseball
|
13
|
+
abc123
|
14
|
+
football
|
15
|
+
monkey
|
16
|
+
letmein
|
17
|
+
696969
|
18
|
+
shadow
|
19
|
+
master
|
20
|
+
666666
|
21
|
+
qwertyuiop
|
22
|
+
123321
|
23
|
+
mustang
|
24
|
+
1234567890
|
25
|
+
michael
|
26
|
+
654321
|
27
|
+
pussy
|
28
|
+
superman
|
29
|
+
1qaz2wsx
|
30
|
+
7777777
|
31
|
+
fuckyou
|
32
|
+
121212
|
33
|
+
000000
|
34
|
+
qazwsx
|
35
|
+
123qwe
|
36
|
+
killer
|
37
|
+
trustno1
|
38
|
+
jordan
|
39
|
+
jennifer
|
40
|
+
zxcvbnm
|
41
|
+
asdfgh
|
42
|
+
hunter
|
43
|
+
buster
|
44
|
+
soccer
|
45
|
+
harley
|
46
|
+
batman
|
47
|
+
andrew
|
48
|
+
tigger
|
49
|
+
sunshine
|
50
|
+
iloveyou
|
51
|
+
fuckme
|
52
|
+
2000
|
53
|
+
charlie
|
54
|
+
robert
|
55
|
+
thomas
|
56
|
+
hockey
|
57
|
+
ranger
|
58
|
+
daniel
|
59
|
+
starwars
|
60
|
+
klaster
|
61
|
+
112233
|
62
|
+
george
|
63
|
+
asshole
|
64
|
+
computer
|
65
|
+
michelle
|
66
|
+
jessica
|
67
|
+
pepper
|
68
|
+
1111
|
69
|
+
zxcvbn
|
70
|
+
555555
|
71
|
+
11111111
|
72
|
+
131313
|
73
|
+
freedom
|
74
|
+
777777
|
75
|
+
pass
|
76
|
+
fuck
|
77
|
+
maggie
|
78
|
+
159753
|
79
|
+
aaaaaa
|
80
|
+
ginger
|
81
|
+
princess
|
82
|
+
joshua
|
83
|
+
cheese
|
84
|
+
amanda
|
85
|
+
summer
|
86
|
+
love
|
87
|
+
ashley
|
88
|
+
6969
|
89
|
+
nicole
|
90
|
+
chelsea
|
91
|
+
biteme
|
92
|
+
matthew
|
93
|
+
access
|
94
|
+
yankees
|
95
|
+
987654321
|
96
|
+
dallas
|
97
|
+
austin
|
98
|
+
thunder
|
99
|
+
taylor
|
100
|
+
matrix
|
data/users.txt
ADDED
metadata
ADDED
@@ -0,0 +1,200 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: girbot
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Cristian Mircea Messel
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-03-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.14'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.14'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: watir
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 6.1.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 6.1.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: selenium-webdriver
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 3.0.5
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 3.0.5
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: watir-webdriver
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.9.9
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.9.9
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: nokogiri
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.8.1
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.8.1
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: headless
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 2.3.1
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 2.3.1
|
139
|
+
description: Description
|
140
|
+
email:
|
141
|
+
- mess110@gmail.com
|
142
|
+
executables: []
|
143
|
+
extensions: []
|
144
|
+
extra_rdoc_files: []
|
145
|
+
files:
|
146
|
+
- ".gitignore"
|
147
|
+
- ".rspec"
|
148
|
+
- ".ruby-gemset"
|
149
|
+
- ".ruby-version"
|
150
|
+
- ".travis.yml"
|
151
|
+
- CODE_OF_CONDUCT.md
|
152
|
+
- Gemfile
|
153
|
+
- LICENSE.txt
|
154
|
+
- README.md
|
155
|
+
- Rakefile
|
156
|
+
- bin/console
|
157
|
+
- bin/setup
|
158
|
+
- examples/brute_force.rb
|
159
|
+
- examples/cookie_clicker.rb
|
160
|
+
- examples/details.json.example
|
161
|
+
- examples/emag_search.rb
|
162
|
+
- examples/plata_electrica.rb
|
163
|
+
- examples/plata_eon.rb
|
164
|
+
- examples/test_run.rb
|
165
|
+
- girbot.gemspec
|
166
|
+
- lib/girbot.rb
|
167
|
+
- lib/girbot/browser_holder.rb
|
168
|
+
- lib/girbot/step_foundation.rb
|
169
|
+
- lib/girbot/steps/brute_force.rb
|
170
|
+
- lib/girbot/steps/step.rb
|
171
|
+
- lib/girbot/string_generator.rb
|
172
|
+
- lib/girbot/version.rb
|
173
|
+
- lib/girbot/watir_shortcuts.rb
|
174
|
+
- pass.txt
|
175
|
+
- users.txt
|
176
|
+
homepage: http://google.com
|
177
|
+
licenses:
|
178
|
+
- MIT
|
179
|
+
metadata: {}
|
180
|
+
post_install_message:
|
181
|
+
rdoc_options: []
|
182
|
+
require_paths:
|
183
|
+
- lib
|
184
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
185
|
+
requirements:
|
186
|
+
- - ">="
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
version: '0'
|
189
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
190
|
+
requirements:
|
191
|
+
- - ">="
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '0'
|
194
|
+
requirements: []
|
195
|
+
rubyforge_project:
|
196
|
+
rubygems_version: 2.6.14
|
197
|
+
signing_key:
|
198
|
+
specification_version: 4
|
199
|
+
summary: Summary
|
200
|
+
test_files: []
|