Skip to content

Commit

Permalink
Fix intigriti
Browse files Browse the repository at this point in the history
  • Loading branch information
arkadiyt committed Jan 9, 2025
1 parent ba26376 commit 14df3a4
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion lib/bounty-targets/intigriti.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,24 @@ def uris

private

def find_programs(obj)
case obj
when Array
obj.each do |elm|
result = find_programs(elm)
return result unless result.nil?
end
when Hash
return obj if obj.key?('programs')

obj.each do |_, value|
result = find_programs(value)
return result unless result.nil?
end
end
nil
end

def encode(component)
# Ruby dropped URI.encode, and CGI.escape converts spaces to `+` instead of `%20`
URI.encode_www_form_component(component).gsub('+', '%20')
Expand All @@ -54,7 +72,7 @@ def directory_index
script = page.css('script').max_by do |node|
node.to_s.length
end.inner_text.match(/self\.__next_f\.push\(\[1,(.*)\]/)[1]
programs = JSON.parse(JSON.parse(script)[2..])[3]['children'][1][3]['programs']
programs = find_programs(JSON.parse(JSON.parse(script)[2..]))['programs']
programs.map do |program|
{
id: program['programId'],
Expand Down

0 comments on commit 14df3a4

Please sign in to comment.