Changeset 1362
- Timestamp:
- 03/24/08 16:51:59 (6 months ago)
- Files:
-
- hive/trunk/data_webapp/app/controllers/data_controller.rb (modified) (1 diff)
- hive/trunk/data_webapp/app/helpers/data_helper.rb (modified) (3 diffs)
- hive/trunk/data_webapp/app/models/client.rb (modified) (1 diff)
- hive/trunk/data_webapp/app/models/fingerprint.rb (modified) (1 diff)
- hive/trunk/data_webapp/app/models/process_file.rb (modified) (1 diff)
- hive/trunk/data_webapp/app/models/regkey.rb (modified) (1 diff)
- hive/trunk/data_webapp/app/views/data/details.rhtml (modified) (2 diffs)
- hive/trunk/data_webapp/app/views/data/index.rhtml (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
hive/trunk/data_webapp/app/controllers/data_controller.rb
r1304 r1362 5 5 # List the latest client data 6 6 def index 7 @clients = Client.paginate(:order => 'compromise DESC',:page => params[:page],:per_page => 10) 7 @statuses = [''] 8 @statuses += Client.find(:all,:select=>"DISTINCT(status)").map(&:status).to_a 9 if request.post? 10 @status = params[:client][:status] 11 elsif not params[:status].nil? 12 @status = params[:status] 13 else 14 @status = nil 15 end 16 if @status.nil? 17 @clients = Client.paginate(:order => 'compromise DESC,start DESC',:page => params[:page],:per_page => 10) 18 else 19 @clients = Client.paginate(:conditions => {:status => @status},:order => 'compromise DESC,start DESC',:page => params[:page],:per_page => 10) 20 end 8 21 end 9 22 hive/trunk/data_webapp/app/helpers/data_helper.rb
r1295 r1362 1 1 module DataHelper 2 2 3 def column_value(model,column) 3 4 model.send(column) … … 110 111 def fingerprint_data_row(instance) 111 112 display_fields = %w(name event) 113 microfields = %w(time_at created) 112 114 if instance.nil? 113 115 return … … 121 123 elsif c.name == "false_positive" 122 124 row_def += %{ class="} + (instance.send(c.name) == false ? %{positive} : %{falsePositive}) + %{"} 125 elsif microfields.include?(c.name) 126 row_def += %{ title="#{ microseconds_to_string(instance.send(c.name)) }"} 123 127 end 124 128 end hive/trunk/data_webapp/app/models/client.rb
r1299 r1362 34 34 35 35 def self.last_url(id) 36 last = HistoryUrl.find(:first,: conditions => {:client_id => id}, :order => "time_at DESC", :limit => 1)36 last = HistoryUrl.find(:first,:select => "url", :conditions => {:client_id => id}, :order => "time_at DESC", :limit => 1) 37 37 if last.nil? 38 38 "" 39 39 else 40 last.url()40 URI.parse(last.url()).host() 41 41 end 42 42 end hive/trunk/data_webapp/app/models/fingerprint.rb
r1300 r1362 1 1 class Fingerprint < ActiveRecord::Base 2 2 belongs_to :client 3 has_many :os_processes 3 has_many :os_processes, :order => 'created ASC' 4 4 5 5 validates_presence_of :checksum hive/trunk/data_webapp/app/models/process_file.rb
r1111 r1362 1 1 class ProcessFile < ActiveRecord::Base 2 belongs_to :os_process, :counter_cache => :process_file_count 2 belongs_to :os_process, :counter_cache => :process_file_count, :order => "time_at ASC" 3 3 belongs_to :file_content, :dependent => true 4 4 hive/trunk/data_webapp/app/models/regkey.rb
r1111 r1362 1 1 class Regkey < ActiveRecord::Base 2 belongs_to :os_process, :counter_cache => :regkey_count 2 belongs_to :os_process, :counter_cache => :regkey_count, :order => "time_at ASC" 3 3 4 4 validates_presence_of :name hive/trunk/data_webapp/app/views/data/details.rhtml
r1295 r1362 20 20 </table> 21 21 <% for p in @client.fingerprint.os_processes %> 22 <p/> 22 23 <table border="1" width="100%"> 23 24 <tbody> … … 40 41 <table class="details" cellspacing="1" width="100%"> 41 42 <%= fingerprint_header_row(Regkey) %> 42 <% for r in p.regkeys %>43 <% for r in p.regkeys %> 43 44 <%= fingerprint_data_row(r) %> 44 45 <% end %> hive/trunk/data_webapp/app/views/data/index.rhtml
r1304 r1362 1 1 <h2>Client data</h2> 2 <p>Ordered by the most recent compromise time</p> 2 <div style="display:block;"> 3 View Clients of type: 4 <% if not @statuses.nil? %> 5 <% form_for :client, :html => {:style => "display:inline"} do |f| %> 6 <%= f.select('status',@statuses,{:selected => @status},{:onchange => "submit()"}) %> 7 <% end %> 8 <% end %> 9 </div> 10 <p/> 3 11 <div id="data"> 4 12 <table class="details"> … … 9 17 <th>Start Time</th> 10 18 <th>Compromise Time</th> 11 <th>Last Url</th>19 <th>Last Domain</th> 12 20 <th> </th> 13 21 </tr> … … 28 36 29 37 <br/> 30 <%= will_paginate @clients, : inner_window => 10, :outer_window => 10 %>38 <%= will_paginate @clients, :params => {:status => @status}, :inner_window => 10, :outer_window => 10 %>
