I am trying to execute HoneyC, which code is on this link: HoneyC Source Code. I have followed the 'readme' document instructions, which says that the UnitTest have to be run first.
It says: "Unpack the HoneyC distribution into a directory, cd into that directory, and execute ‘ruby UnitTester.rb’. This will start the unit tests executing some basic module tests. (Note that you need to have network connectivity and direct outgoing access on port 80 for the unit tests to succeed.)"
I am using Ruby version 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
*I've never programmed using Ruby before.
Port 80 seems to be okay ... if I run the command netstat I get:
:~$ netstat -tulnap (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:30800 0.0.0.0:*
LISTEN - tcp 0 0 0.0.0.0:80
0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:30900 0.0.0.0:* LISTEN -
tcp 0 0 127.0.1.1:53 0.0.0.0:*
LISTEN
However, I am getting the following error when I try to run the UnitTest:
:~/honeypot/honeyc-master$ ruby UnitTester.rb
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- HoneyCConfiguration (LoadError)
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from UnitTester.rb:39:in `block in suite'
from /usr/lib/ruby/2.3.0/find.rb:49:in `block (2 levels) in find'
from /usr/lib/ruby/2.3.0/find.rb:48:in `catch'
from /usr/lib/ruby/2.3.0/find.rb:48:in `block in find'
from /usr/lib/ruby/2.3.0/find.rb:43:in `each'
from /usr/lib/ruby/2.3.0/find.rb:43:in `find'
from UnitTester.rb:29:in `suite'
from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunner.rb:12:in `initialize'
from /usr/lib/ruby/vendor_ruby/test/unit/ui/console/testrunner.rb:38:in `initialize'
from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunnerutilities.rb:24:in `new'
from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunnerutilities.rb:24:in `run'
from UnitTester.rb:54:in `<main>'
The ruby code of the Unit Test is:
require 'test/unit/testsuite'
require 'test/unit/ui/console/testrunner'
require 'find'
module Kernel
def get_class_for_name(name, objects = [Object])
#STDERR.puts name.to_s
return nil if objects.size == 0
object = objects.shift
object.constants.each do |constant_name|
real_object = object.const_get(constant_name)
case real_object
when Class
return real_object if constant_name == name
when Module
objects << real_object
end
end
return get_class_for_name(name, objects)
end
end
class UnitTester
def self.suite
exceptions = ["HoneyC","UnitTester"]
suite = Test::Unit::TestSuite.new("HoneyC Unit Tests")
#find all rb files
Find.find(".") do |full_file_name|
if /.rb/ =~ full_file_name and !(/.svn/ =~ full_file_name)
/.*\// =~ full_file_name
path = $&[2..$&.length]
classname = full_file_name[$&.length..-4]
if !exceptions.index(classname)
#assume test is under classname + "Test"
#run unit test on them except on the exceptions
require path + classname
classname.sub!(/\.tab/,"") #silly replacement for the snortruleparser, since this is an automatically generated class.
unit_test = get_class_for_name(classname + "Test")
if(unit_test==nil)
STDERR.puts "No unit test defined for class " + classname + "."
else
suite << unit_test.suite
end
end
end
end
return suite
end
end
Test::Unit::UI::Console::TestRunner.run(UnitTester)
What should I do to get this honeypot running?