Skip to content

Commit

Permalink
Merge branch 'main' into ronin_vulns_views_and_worker
Browse files Browse the repository at this point in the history
  • Loading branch information
moozzi authored Nov 17, 2023
2 parents 623e65a + 347c4cb commit f75ec19
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
16 changes: 16 additions & 0 deletions app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
require './workers/vulns'

require 'ronin/app/version'
require 'sidekiq/api'

#
# Main app class.
Expand Down Expand Up @@ -794,4 +795,19 @@ class App < Sinatra::Base
erb :about
end

get '/queue' do
@workers = Sidekiq::Workers.new.map do |_process_id, _thread_id, worker|
payload = JSON.parse(worker["payload"])
{
queue: worker["queue"],
class: payload["class"],
args: payload["args"],
created_at: Time.at(payload["created_at"]),
enqueued_at: Time.at(payload["enqueued_at"]),
run_at: Time.at(worker["run_at"])
}
end

erb :queue
end
end
1 change: 1 addition & 0 deletions views/layout.erb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<a href="/spider" class="navbar-item">spider</a>
<a href="/recon" class="navbar-item">recon</a>
<a href="/vulns" class="navbar-item">vulns</a>
<a href="/queue" class="navbar-item">queue</a>
<a href="/about" class="navbar-item">about</a>
</div>
</div>
Expand Down
28 changes: 28 additions & 0 deletions views/queue.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<h1>Currently running jobs</h1>

<% @workers.each do |worker| %>
<div class="box">
<div>
<div>
<h2 class="my-0"><%= worker[:class] %></h2>
<p class="mb-0"><strong>QUEUE:</strong> <%= worker[:queue] %></p>

<p>
<strong>ARGUMENTS:</strong>
<% worker[:args].each do |arg| %>
<% arg.each do |key, value| %>
<strong><%= key %></strong>: <kbd><%= value %></kbd>
<% end %>
<% end %>
</p>

<hr>
<div class="columns">
<div class="column is-one-third py-0"><strong>Created at:</strong> <%= worker[:created_at] %></div>
<div class="column is-one-third py-0"><strong>Enqueued at:</strong> <%= worker[:enqueued_at] %></div>
<div class="column is-one-third py-0"><strong>Run at:</strong> <%= worker[:run_at] %></div>
</div>
</div>
</div>
</div>
<% end %>

0 comments on commit f75ec19

Please sign in to comment.