| 14 | | |
|---|
| 15 | | # Raw data as if pulled from the BeeJob and cleaned |
|---|
| 16 | | #@client_data = {"status"=>"running", "os"=>{"name"=>"Default Windows XP SP2", "shortname"=>"Microsoft Windows", "version"=>"XP Professional", "os_applications"=>[{"shortname"=>"Internet Explorer", "manufacturer"=>"Microsoft", "version"=>6}]}, "start"=>"2008-03-25T11:25:00", "host"=>{"org"=>"MITRE", "ip"=>"172.16.164.108", "hostname"=>"honeyclient8.mitre.org"}, "cid"=>"2df4455a3b0aa690ef4f7da84b"} |
|---|
| 17 | | #@finger_data = {"os_processes"=>[{"name"=>"C:\\WINDOWS\\system32\\wbem\\wmiprvse.exe", "pid"=>1256, "process_files"=>[{"name"=>"C:\\WINDOWS\\PCHEALTH\\HELPCTR\\DataColl", "event"=>"Write", "file_content"=>{"size"=>-1, "mime_type"=>"UNKNOWN", "sha1"=>"C:\\WINDOWS\\PCHEALTH\\HELPCTR\\DataColl2008-03-25 11:58:05.13", "md5"=>"C:\\WINDOWS\\PCHEALTH\\HELPCTR\\DataColl2008-03-25 11:58:05.13"}, "time_at"=>"2008-03-25 11:58:05.13"}, {"name"=>"C:\\Documents and Settings", "event"=>"Write", "file_content"=>{"size"=>-1, "mime_type"=>"UNKNOWN", "sha1"=>"C:\\Documents and Settings2008-03-25 11:58:05.13", "md5"=>"C:\\Documents and Settings2008-03-25 11:58:05.13"}, "time_at"=>"2008-03-25 11:58:05.13"}, {"name"=>"C:\\Documents and Settings\\Default User", "event"=>"Write", "file_content"=>{"size"=>-1, "mime_type"=>"UNKNOWN", "sha1"=>"C:\\Documents and Settings\\Default User2008-03-25 11:58:05.13", "md5"=>"C:\\Documents and Settings\\Default User2008-03-25 11:58:05.13"}, "time_at"=>"2008-03-25 11:58:05.13"}, {"name"=>"C:\\Documents and Settings\\ALL USERS", "event"=>"Write", "file_content"=>{"size"=>-1, "mime_type"=>"UNKNOWN", "sha1"=>"C:\\Documents and Settings\\ALL USERS2008-03-25 11:58:05.13", "md5"=>"C:\\Documents and Settings\\ALL USERS2008-03-25 11:58:05.13"}, "time_at"=>"2008-03-25 11:58:05.13"}, {"name"=>"C:\\Documents and Settings\\Default User\\Start Menu\\Programs", "event"=>"Write", "file_content"=>{"size"=>-1, "mime_type"=>"UNKNOWN", "sha1"=>"C:\\Documents and Settings\\Default User\\Start Menu\\Programs2008-03-25 11:58:05.13", "md5"=>"C:\\Documents and Settings\\Default User\\Start Menu\\Programs2008-03-25 11:58:05.13"}, "time_at"=>"2008-03-25 11:58:05.13"}, {"name"=>"C:\\WINDOWS\\system32\\config\\systemprofile", "event"=>"Write", "file_content"=>{"size"=>-1, "mime_type"=>"UNKNOWN", "sha1"=>"C:\\WINDOWS\\system32\\config\\systemprofile2008-03-25 11:58:05.13", "md5"=>"C:\\WINDOWS\\system32\\config\\systemprofile2008-03-25 11:58:05.13"}, "time_at"=>"2008-03-25 11:58:05.13"}], "regkeys"=>[]}], "cid"=>"2df4455a3b0aa690ef4f7da84b"} |
|---|
| 18 | | #@history_data = {"urls"=>[{"status"=>"visited", "url"=>"http://www.softcashier.com/members/link.php?wmid=1020&l=9&it=2&s=2", "time_at"=>1206468143.41987}], "cid"=>"2df4455a3b0aa690ef4f7da84b"} |
|---|
| | 29 | def test_latest_no_param |
|---|
| | 30 | WorkerBeeAuthorization.configuration = {:activate => true, :secret_key => "1", :access_key => "1"} |
|---|
| | 31 | signed_get(:latest,"1","1") |
|---|
| | 32 | assert_response :success |
|---|
| | 33 | |
|---|
| | 34 | decoded = ActiveSupport::JSON.decode(@response.body) |
|---|
| | 35 | assert_equal 1, decoded.size |
|---|
| | 36 | end |
|---|
| | 37 | |
|---|
| | 38 | def test_latest_with_param |
|---|
| | 39 | WorkerBeeAuthorization.configuration = {:activate => true, :secret_key => "1", :access_key => "1"} |
|---|
| | 40 | signed_get(:latest,"1","1",{"id" => "12191111.01"}) |
|---|
| | 41 | assert_response :success |
|---|
| | 42 | |
|---|
| | 43 | decoded = ActiveSupport::JSON.decode(@response.body) |
|---|
| | 44 | puts "DECODED: #{decoded.inspect}" |
|---|
| | 45 | assert_equal 1, decoded.size |
|---|
| | 46 | end |
|---|
| | 47 | |
|---|
| | 48 | def test_no_latest_urls |
|---|
| | 49 | WorkerBeeAuthorization.configuration = {:activate => true, :secret_key => "1", :access_key => "1"} |
|---|
| | 50 | future = string_to_microseconds(Time.now.advance(:days => 3).to_s) |
|---|
| | 51 | signed_get(:latest,"1","1",{"id" => future.to_s}) |
|---|
| | 52 | assert_response :success |
|---|
| | 53 | |
|---|
| | 54 | decoded = ActiveSupport::JSON.decode(@response.body) |
|---|
| | 55 | assert_equal 0, decoded.size |
|---|
| | 56 | end |
|---|
| | 57 | |
|---|
| | 58 | def test_not_activated |
|---|
| | 59 | WorkerBeeAuthorization.configuration = {:activate => false, :secret_key => "1", :access_key => "1"} |
|---|
| | 60 | signed_post(:work,"hello","1","1",parameters=nil) |
|---|
| | 61 | assert_response(401) |
|---|
| | 62 | end |
|---|
| | 63 | |
|---|
| | 64 | def test_authorized_post |
|---|
| | 65 | WorkerBeeAuthorization.configuration = {:activate => true, :secret_key => "1", :access_key => "1"} |
|---|
| | 66 | signed_post(:work,"hello","1","1",parameters=nil) |
|---|
| | 67 | assert_response :success |
|---|
| | 68 | end |
|---|
| | 69 | |
|---|
| | 70 | def test_not_authorized_post |
|---|
| | 71 | WorkerBeeAuthorization.configuration = {:activate => true, :secret_key => "1000", :access_key => "1"} |
|---|
| | 72 | signed_post(:work,"hello","1","1",parameters=nil) |
|---|
| | 73 | assert_response(401) |
|---|
| | 74 | end |
|---|
| | 75 | |
|---|
| | 76 | def test_authorized_get |
|---|
| | 77 | WorkerBeeAuthorization.configuration = {:activate => true, :secret_key => "1", :access_key => "1"} |
|---|
| | 78 | signed_get(:latest,"1","1") |
|---|
| | 79 | assert_response :success |
|---|
| | 80 | end |
|---|
| | 81 | |
|---|
| | 82 | def test_not_authorized_get |
|---|
| | 83 | WorkerBeeAuthorization.configuration = {:activate => true, :secret_key => "1000", :access_key => "1"} |
|---|
| | 84 | signed_get(:latest,"1","1") |
|---|
| | 85 | assert_response(401) |
|---|
| | 86 | end |
|---|
| | 87 | |
|---|