Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
the .bat file for checking internet is not needed anymore lot of improvemnts
- Loading branch information
Showing
3 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require "test/unit" | ||
|
||
class DoroTest < Test::Unit::TestCase | ||
|
||
# Called before every test method runs. Can be used | ||
# to set up fixture information. | ||
def setup | ||
# Do nothing | ||
end | ||
|
||
# Called after every test method runs. Can be used to tear | ||
# down fixture information. | ||
|
||
def teardown | ||
# Do nothing | ||
end | ||
|
||
# Fake test | ||
def test_fail | ||
|
||
# To change this template use File | Settings | File Templates. | ||
fail("Not implemented") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
require 'rubygems' | ||
require "test/unit" | ||
#require 'dorothy2' #comment for testing/developmnet | ||
|
||
load '../lib/dorothy2.rb' | ||
|
||
include Dorothy | ||
|
||
LOGGER = DoroLogger.new(STDOUT, "weekly") | ||
|
||
class DoroTest < Test::Unit::TestCase | ||
|
||
# Called before every test method runs. Can be used | ||
# to set up fixture information. | ||
def setup | ||
DoroSettings.load!('../etc/dorothy.yml') | ||
@db = Insertdb.new | ||
guestvm = @db.find_vm | ||
assert_nothing_raised { @vsm = Doro_VSM::ESX.new(DoroSettings.esx[:host],DoroSettings.esx[:user],DoroSettings.esx[:pass],guestvm[1], guestvm[3], guestvm[4]) } | ||
@nam = Doro_NAM.new(DoroSettings.nam) | ||
end | ||
|
||
# Called after every test method runs. Can be used to tear | ||
# down fixture information. | ||
|
||
def teardown | ||
@db.vm_init | ||
@db.close | ||
end | ||
|
||
# Fake test | ||
def test_db | ||
assert_kind_of(Dorothy::Insertdb, @db, "Problem, can't connect to DB") | ||
end | ||
|
||
def test_instert_db | ||
randstring = (0...8).map{(65+rand(26)).chr}.join | ||
values = [randstring, 16, "pe", "", "test.exe", "testtest", "test"] | ||
assert_kind_of(PG::Result, @db.insert("samples", values), "Problem, can't insert data into the DB") | ||
end | ||
|
||
# def test_vsm | ||
# guestvm = @db.find_vm | ||
# assert_nothing_raised { @vsm = Doro_VSM::ESX.new(DoroSettings.esx[:host],DoroSettings.esx[:user],DoroSettings.esx[:pass],guestvm[1], guestvm[3], guestvm[4]) } | ||
# end | ||
|
||
def test_vsm_A_execute | ||
assert_nothing_raised {@vsm.exec_file("windows\\system32\\calc.exe")} | ||
assert_kind_of(Fixnum, @vsm.exec_file("windows\\system32\\calc.exe")) | ||
end | ||
|
||
def test_vsm_B_chk_internet | ||
assert_nothing_raised {@vsm.check_internet} | ||
end | ||
|
||
def test_vsm_C_screenshot | ||
assert_nothing_raised {@vsm.screenshot} | ||
end | ||
|
||
def test_vsm_D_copy_screenshot | ||
screen = @vsm.screenshot | ||
assert_nothing_raised {Ssh.download(DoroSettings.esx[:host],DoroSettings.esx[:user], DoroSettings.esx[:pass], screen, Dir.pwd)} | ||
end | ||
|
||
def test_vsm_E_revertvm | ||
assert_nothing_raised {@vsm.revert_vm} | ||
end | ||
|
||
def test_nam_A_start_stop | ||
puts "NAM".yellow + " Starting sniffer on NAM" | ||
assert_nothing_raised { @nampid = @nam.start_sniffer("localhost",DoroSettings.nam[:interface], "testpcap", DoroSettings.nam[:pcaphome])} | ||
assert_kind_of(Fixnum, @nampid) | ||
sleep 3 | ||
puts "NAM".yellow + " Stopping sniffer on NAM" | ||
assert_nothing_raised {@nam.stop_sniffer(@nampid)} | ||
end | ||
|
||
def test_nam_C_copydump | ||
assert_nothing_raised {Ssh.download(DoroSettings.nam[:host], DoroSettings.nam[:user],DoroSettings.nam[:pass], DoroSettings.nam[:pcaphome] + "/" + "testpcap.pcap", Dir.pwd)} | ||
end | ||
|
||
|
||
end |