antfarm 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. data/CHANGELOG +9 -0
  2. data/{README → README.rdoc} +39 -5
  3. data/bin/antfarm +37 -4
  4. data/db/migrate/010_create_dns_entries.rb +32 -0
  5. data/db/migrate/011_create_actions.rb +34 -0
  6. data/db/migrate/012_create_services.rb +36 -0
  7. data/db/migrate/013_create_operating_systems.rb +34 -0
  8. data/db/schema.rb +30 -22
  9. data/lib/antfarm.jar +0 -0
  10. data/lib/antfarm.rb +4 -0
  11. data/lib/antfarm/action.rb +29 -0
  12. data/lib/antfarm/dns_entry.rb +23 -0
  13. data/lib/antfarm/ip_interface.rb +38 -26
  14. data/lib/antfarm/ip_network.rb +3 -3
  15. data/lib/antfarm/layer2_interface.rb +16 -3
  16. data/lib/antfarm/layer3_network.rb +4 -4
  17. data/lib/antfarm/node.rb +6 -0
  18. data/lib/antfarm/operating_system.rb +25 -0
  19. data/lib/antfarm/service.rb +25 -0
  20. data/lib/console.rb +9 -0
  21. data/lib/cpscript.rb +70 -0
  22. data/lib/dbmanage.rb +34 -5
  23. data/lib/init/initializer.rb +25 -3
  24. data/lib/scparse.rb +14 -1
  25. data/lib/scripts/cisco/parse-pix-config.rb +5 -14
  26. data/lib/scripts/manipulate-dns.rb +87 -0
  27. data/lib/scripts/nmap/parse-xml.rb +147 -0
  28. data/lib/scripts/pcap/parse-pcap-file.rb +83 -21
  29. data/lib/scripts/viz/display-networks.rb +16 -25
  30. data/lib/scripts/viz/display-traffic.rb +111 -0
  31. data/lib/scripts/viz/dump-graphml.rb +1 -1
  32. data/lib/version.rb +5 -0
  33. data/rails/app/controllers/actions_controller.rb +5 -0
  34. data/rails/app/controllers/dns_entries_controller.rb +4 -0
  35. data/rails/app/controllers/layer3_interfaces_controller.rb +2 -2
  36. data/rails/app/controllers/nodes_controller.rb +4 -4
  37. data/rails/app/controllers/operating_systems_controller.rb +5 -0
  38. data/rails/app/controllers/services_controller.rb +5 -0
  39. data/rails/app/controllers/traffic_controller.rb +1 -0
  40. data/rails/app/views/layouts/application.html.erb +35 -0
  41. data/rails/public/stylesheets/site.css +11 -0
  42. metadata +26 -35
  43. data/lib/scripts/load-route.rb +0 -79
  44. data/lib/scripts/load-router-nomac.rb +0 -60
  45. data/lib/scripts/load-router.rb +0 -59
  46. data/lib/scripts/nmap/parse-xml-results.rb +0 -240
  47. data/lib/scripts/route.rb +0 -89
  48. data/lib/scripts/tethereal/load-arp.rb +0 -67
  49. data/lib/scripts/tethereal/load-ip.rb +0 -65
  50. data/rails/app/helpers/application_helper.rb +0 -3
  51. data/rails/app/helpers/ethernet_interfaces_helper.rb +0 -2
  52. data/rails/app/helpers/ip_interfaces_helper.rb +0 -2
  53. data/rails/app/helpers/ip_networks_helper.rb +0 -2
  54. data/rails/app/helpers/layer2_interfaces_helper.rb +0 -2
  55. data/rails/app/helpers/layer3_interfaces_helper.rb +0 -5
  56. data/rails/app/helpers/layer3_networks_helper.rb +0 -2
  57. data/rails/app/helpers/nodes_helper.rb +0 -2
  58. data/rails/app/helpers/private_networks_helper.rb +0 -2
  59. data/rails/app/helpers/traffic_helper.rb +0 -2
  60. data/rails/app/views/layouts/ethernet_interfaces.html.erb +0 -15
  61. data/rails/app/views/layouts/ip_interfaces.html.erb +0 -15
  62. data/rails/app/views/layouts/ip_networks.html.erb +0 -15
  63. data/rails/app/views/layouts/layer2_interfaces.html.erb +0 -15
  64. data/rails/app/views/layouts/layer3_interfaces.html.erb +0 -15
  65. data/rails/app/views/layouts/layer3_networks.html.erb +0 -15
  66. data/rails/app/views/layouts/nodes.html.erb +0 -15
  67. data/rails/app/views/layouts/private_networks.html.erb +0 -15
  68. data/rails/app/views/layouts/traffic.html.erb +0 -15
  69. data/rails/public/000-index.html +0 -277
@@ -97,20 +97,13 @@ def parse(file)
97
97
  # end
98
98
  # end
99
99
  end
100
-
101
100
  list.close
102
101
 
103
- node = Node.create(:certainty_factor => 0.75, :name => hostname, :device_type => "FW") if hostname
104
-
105
102
  fw_if_ips.uniq!
106
103
  fw_if_ips.each do |address|
107
104
  ip_if = IpInterface.new :address => address
108
- if node
109
- ip_if.node = node
110
- else
111
- ip_if.node_device_type = "FW"
112
- end
113
-
105
+ ip_if.node_name = hostname
106
+ ip_if.node_device_type = 'FW'
114
107
  unless ip_if.save
115
108
  ip_if.errors.each_full do |msg|
116
109
  puts msg
@@ -121,8 +114,7 @@ def parse(file)
121
114
  net_obj_ips.uniq!
122
115
  net_obj_ips.each do |address|
123
116
  ip_if = IpInterface.new :address => address
124
- ip_if.node_device_type = "FWGRP"
125
-
117
+ ip_if.node_device_type = 'FW NW OBJECT'
126
118
  unless ip_if.save
127
119
  ip_if.errors.each_full do |msg|
128
120
  puts msg
@@ -133,7 +125,6 @@ def parse(file)
133
125
  net_obj_networks.uniq!
134
126
  net_obj_networks.each do |network|
135
127
  ip_net = IpNetwork.new :address => network
136
-
137
128
  unless ip_net.save
138
129
  ip_net.errors.each_full do |msg|
139
130
  puts msg
@@ -223,14 +214,14 @@ def parse_tunnels(file)
223
214
  target_ip_if = IpInterface.find_by_address(addr)
224
215
 
225
216
  if target_ip_if
226
- Traffic.create(:source_layer3_interface => source_ip_if.layer3_interface, :target_layer3_interface => target_ip_if.layer3_interface, :type => "Tunnel")
217
+ Traffic.create(:source_layer3_interface => source_ip_if.layer3_interface, :target_layer3_interface => target_ip_if.layer3_interface, :description => 'TUNNEL')
227
218
  end
228
219
  end
229
220
  end
230
221
  end
231
222
  end
232
223
 
233
- if ARGV[0] == '--help'
224
+ if ['-h', '--help'].include?(ARGV[0])
234
225
  print_help
235
226
  else
236
227
  if ARGV.include?('-t')
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/ruby
2
+
3
+ # Copyright (2008) Sandia Corporation.
4
+ # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
5
+ # the U.S. Government retains certain rights in this software.
6
+ #
7
+ # Original Author: Michael Berg, Sandia National Laboratories <mjberg@sandia.gov>
8
+ # Modified By: Bryan T. Richardson, Sandia National Laboratories <btricha@sandia.gov>
9
+ #
10
+ # This library is free software; you can redistribute it and/or modify it
11
+ # under the terms of the GNU Lesser General Public License as published by
12
+ # the Free Software Foundation; either version 2.1 of the License, or (at
13
+ # your option) any later version.
14
+ #
15
+ # This library is distributed in the hope that it will be useful, but WITHOUT
16
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
18
+ # details.
19
+ #
20
+ # You should have received a copy of the GNU Lesser General Public License
21
+ # along with this library; if not, write to the Free Software Foundation, Inc.,
22
+ # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
+
24
+ def print_help
25
+ puts "Usage: antfarm [options] manipulate-dns [options]"
26
+ puts
27
+ puts "Script Options:"
28
+ puts " --merge-entries Find duplicate entries in the table and merge them"
29
+ puts " --name-nodes Set node names using DNS entries"
30
+ puts " --merge-nodes Find entries with the same hostname but different IP"
31
+ puts " addresses and merge the nodes for those interfaces"
32
+ end
33
+
34
+ def merge_entries
35
+ entries = DnsEntry.find(:all)
36
+ while !entries.empty?
37
+ entry = entries.shift
38
+ entries.each do |e|
39
+ e.destroy if entry.address == e.address && entry.hostname == e.hostname
40
+ entries.delete(e)
41
+ end
42
+ end
43
+ end
44
+
45
+ def name_nodes
46
+ entries = DnsEntry.find(:all)
47
+ entries.each do |entry|
48
+ iface = IpInterface.find :first, :conditions => { :address => entry.address }
49
+ if iface
50
+ node = iface.layer3_interface.layer2_interface.node
51
+ node.name = entry.hostname unless node.nil?
52
+ node.save false
53
+ end
54
+ end
55
+ end
56
+
57
+ def merge_nodes
58
+ entries = DnsEntry.find(:all)
59
+ while !entries.empty?
60
+ entry = entries.shift
61
+ entries.each do |e|
62
+ if entry.hostname == e.hostname
63
+ iface0 = IpInterface.find :first, :conditions => { :address => entry.address }
64
+ iface1 = IpInterface.find :first, :conditions => { :address => e.address }
65
+ l2_iface = iface1.layer3_interface.layer2_interface
66
+ l2_iface.node.destroy
67
+ l2_iface.node = iface0.layer3_interface.layer2_interface.node
68
+ l2_iface.save false
69
+ entries.delete(e)
70
+ end
71
+ end
72
+ end
73
+ end
74
+
75
+ if ['-h', '--help'].include?(ARGV[0])
76
+ print_help
77
+ else
78
+ if ARGV.include?('--merge-entries')
79
+ merge_entries
80
+ end
81
+ if ARGV.include?('--name-nodes')
82
+ name_nodes
83
+ end
84
+ if ARGV.include?('--merge-nodes')
85
+ merge_nodes
86
+ end
87
+ end
@@ -0,0 +1,147 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Copyright (2008) Sandia Corporation.
4
+ # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
5
+ # the U.S. Government retains certain rights in this software.
6
+ #
7
+ # Original Author: Michael Berg, Sandia National Laboratories <mjberg@sandia.gov>
8
+ # Modified By: Bryan T. Richardson, Sandia National Laboratories <btricha@sandia.gov>
9
+ #
10
+ # This library is free software; you can redistribute it and/or modify it
11
+ # under the terms of the GNU Lesser General Public License as published by
12
+ # the Free Software Foundation; either version 2.1 of the License, or (at
13
+ # your option) any later version.
14
+ #
15
+ # This library is distributed in the hope that it will be useful, but WITHOUT
16
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
18
+ # details.
19
+ #
20
+ # You should have received a copy of the GNU Lesser General Public License
21
+ # along with this library; if not, write to the Free Software Foundation, Inc.,
22
+ # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
+
24
+ def print_help
25
+ puts "Usage: antfarm [options] nmap [options] parse-xml [directories ...] [files ...]"
26
+ puts
27
+ puts "This script parses one or more Nmap xml-formatted output files and creates"
28
+ puts "an IP Interface object for each host detected."
29
+ end
30
+
31
+ def string_to_portlist(string)
32
+ result = Array.new
33
+ ranges = string.split(',')
34
+ ranges.each do |range|
35
+ (start, stop) = range.split('-')
36
+ unless stop
37
+ stop = start
38
+ end
39
+ for i in (start.to_i)..(stop.to_i)
40
+ result.push(i)
41
+ end
42
+ end
43
+ result.sort!
44
+ result.uniq!
45
+ result.flatten!
46
+ return result
47
+ end
48
+
49
+ def parse(file)
50
+ puts file
51
+ results = REXML::Document.new(File.new(file))
52
+ results.elements.each('nmaprun') do |scan|
53
+ action = Action.new
54
+ action.tool = scan.attributes['scanner']
55
+ action.description = scan.attributes['args']
56
+ action.start = scan.attributes['startstr']
57
+ action.end = scan.elements['runstats/finished'].attributes['timestr']
58
+ action.save false
59
+ scanned_ports = Hash.new
60
+ scan.elements.each("scaninfo") do |info|
61
+ type = info.attributes["type"]
62
+ protocol = info.attributes["protocol"]
63
+ services = info.attributes["services"]
64
+ # Need to track this info since many ports are "scanned but not listed"
65
+ # in all of Nmap's available output formats.
66
+ scanned_ports[protocol] = string_to_portlist(services)
67
+ end
68
+ scan.elements.each('host') do |host|
69
+ host_state = host.elements['status'].attributes['state']
70
+ interface = IpInterface.create :address => host.elements['address'].attributes['addr']
71
+ host.elements.each('hostnames/hostname') do |hostname|
72
+ DnsEntry.create :address => host.elements['address'].attributes['addr'],
73
+ :hostname => hostname.attributes['name']
74
+ end
75
+ if host_state == 'up'
76
+ host_scanned_ports = scanned_ports.dup # does this create a separate hash?
77
+ host.elements.each("ports/port") do |port|
78
+ protocol = port.attributes["protocol"]
79
+ number = port.attributes["portid"].to_i
80
+ port_state = port.elements["state"].attributes["state"]
81
+
82
+ # This port was listed, so we don't need to handle it later
83
+ host_scanned_ports[protocol].delete(number)
84
+
85
+ # Only store service information for open ports
86
+ if port_state == 'open'
87
+ port_service = port.elements['service']
88
+ service = Service.new
89
+ service.node = interface.layer3_interface.layer2_interface.node
90
+ service.action = action
91
+ service.protocol = protocol
92
+ service.port = number
93
+ service.name = port_service.attributes['name']
94
+ service.certainty_factor = 0.9 * ((port_service.attributes["conf"]).to_f / 10.0)
95
+ service.save false
96
+ end
97
+ end
98
+
99
+ # Handle extra ports that are "scanned but not listed" if state is open
100
+ if host.elements['ports/extraports'] && host.elements['ports/extraports'].attributes['state'] == 'open'
101
+ host_scanned_ports.each do |protocol,number|
102
+ service = Service.new
103
+ service.node = interface.layer3_interface.layer2_interface.node
104
+ service.action = action
105
+ service.protocol = protocol
106
+ service.port = number
107
+ service.certainty_factor = 0.9
108
+ service.save false
109
+ end
110
+ end
111
+
112
+ if host.elements['os/osfingerprint']
113
+ os = OperatingSystem.new
114
+ os.node = interface.layer3_interface.layer2_interface.node
115
+ os.action = action
116
+ os.fingerprint = host.elements['os/osfingerprint'].attributes['fingerprint']
117
+ os.certainty_factor = 0.9
118
+ os.save false
119
+ end
120
+
121
+ host.elements.each('trace/hop') do |hop|
122
+ IpInterface.create :address => hop.attributes['ipaddr']
123
+ if hop.attributes['host']
124
+ DnsEntry.create :address => hop.attributes['ipaddr'],
125
+ :hostname => hop.attributes['host']
126
+ end
127
+ end
128
+ end
129
+ end
130
+ end
131
+ end
132
+
133
+ if ['-h', '--help'].include?(ARGV[0])
134
+ print_help
135
+ else
136
+ ARGV.each do |arg|
137
+ if File.directory?(arg)
138
+ Find.find(arg) do |path|
139
+ if File.file?(path)
140
+ parse(path)
141
+ end
142
+ end
143
+ else
144
+ parse(arg)
145
+ end
146
+ end
147
+ end
@@ -24,41 +24,103 @@
24
24
  require 'pcap'
25
25
 
26
26
  def print_help
27
- puts "Usage: antfarm [options] pcap [options] parse-pcap-file <pcap file>"
27
+ puts "Usage: antfarm [options] pcap [options] parse-pcap-file [options] <pcap file>"
28
28
  puts
29
29
  puts "This script parses a libPcap file containing traffic capture data,"
30
30
  puts "creating an IP interface for each endpoint and a traffic object"
31
31
  puts "for the traffic between them. Node device types are set to 'PCAP',"
32
32
  puts "as well as traffic descriptions."
33
+ puts
34
+ puts "Script Options:"
35
+ puts " --create-new-networks Create new networks if networks containing the"
36
+ puts " source or destination address don't already exist."
33
37
  end
34
38
 
35
- def parse(file)
36
- cap = Pcap::Capture.open_offline(ARGV[0])
39
+ def parse(file, options = [])
40
+ cap = Pcap::Capture.open_offline(file)
37
41
  cap.each do |pkt|
38
42
  if pkt.ip?
39
- source_ip_addr = pkt.src.to_num_s
40
- target_ip_addr = pkt.dst.to_num_s
41
-
42
- source_l3_net = Layer3Network.network_containing(source_ip_addr)
43
- target_l3_net = Layer3Network.network_containing(target_ip_addr)
44
-
45
- if source_l3_net && target_l3_net
46
- puts "Added traffic -- #{source_ip_addr} ==> #{target_ip_addr}"
47
-
48
- source_ip_iface = IpInterface.create :address => source_ip_addr, :layer3_network => source_l3_net, :node_device_type => "PCAP"
49
- target_ip_iface = IpInterface.create :address => target_ip_addr, :layer3_network => target_l3_net, :node_device_type => "PCAP"
50
-
51
- Traffic.create :source_layer3_interface => source_ip_iface.layer3_interface, \
52
- :target_layer3_interface => target_ip_iface.layer3_interface, \
53
- :description => "PCAP"
43
+ source_addr = pkt.src.to_num_s
44
+ target_addr = pkt.dst.to_num_s
45
+ if options.include?('--create-new-networks')
46
+ source_iface = IpInterface.find_or_initialize_by_address(source_addr)
47
+ if source_iface.new_record?
48
+ source_iface.node_name = source_addr
49
+ source_iface.node_device_type = 'PCAP'
50
+ source_iface.save false
51
+ end
52
+ target_iface = IpInterface.find_or_initialize_by_address(target_addr)
53
+ if target_iface.new_record?
54
+ target_iface.node_name = target_addr
55
+ target_iface.node_device_type = 'PCAP'
56
+ target_iface.save false
57
+ end
58
+ if pkt.tcp? || pkt.udp?
59
+ traffic = Traffic.first(:conditions => { :source_layer3_interface_id => source_iface.layer3_interface.id,
60
+ :target_layer3_interface_id => target_iface.layer3_interface.id,
61
+ :port => pkt.dport})
62
+ else
63
+ traffic = Traffic.first(:conditions => { :source_layer3_interface_id => source_iface.layer3_interface.id,
64
+ :target_layer3_interface_id => target_iface.layer3_interface.id })
65
+ end
66
+ unless traffic
67
+ if pkt.tcp? || pkt.udp?
68
+ traffic = Traffic.create :source_layer3_interface => source_iface.layer3_interface,
69
+ :target_layer3_interface => target_iface.layer3_interface,
70
+ :port => pkt.dport,
71
+ :description => "PCAP"
72
+ else
73
+ traffic = Traffic.create :source_layer3_interface => source_iface.layer3_interface,
74
+ :target_layer3_interface => target_iface.layer3_interface,
75
+ :description => "PCAP"
76
+ end
77
+ puts "Added traffic -- #{source_addr} ==> #{target_addr}"
78
+ end
79
+ else
80
+ source_net = Layer3Network.network_containing(source_addr)
81
+ target_net = Layer3Network.network_containing(target_addr)
82
+ if source_net && target_net
83
+ source_iface = IpInterface.find_or_initialize_by_address(source_addr)
84
+ if source_iface.new_record?
85
+ source_iface.node_name = source_addr
86
+ source_iface.node_device_type = 'PCAP'
87
+ source_iface.save false
88
+ end
89
+ target_iface = IpInterface.find_or_initialize_by_address(target_addr)
90
+ if target_iface.new_record?
91
+ target_iface.node_name = target_addr
92
+ target_iface.node_device_type = 'PCAP'
93
+ target_iface.save false
94
+ end
95
+ if pkt.tcp? || pkt.udp?
96
+ traffic = Traffic.first(:conditions => { :source_layer3_interface_id => source_iface.layer3_interface.id,
97
+ :target_layer3_interface_id => target_iface.layer3_interface.id,
98
+ :port => pkt.dport})
99
+ else
100
+ traffic = Traffic.first(:conditions => { :source_layer3_interface_id => source_iface.layer3_interface.id,
101
+ :target_layer3_interface_id => target_iface.layer3_interface.id })
102
+ end
103
+ unless traffic
104
+ if pkt.tcp? || pkt.udp?
105
+ traffic = Traffic.create :source_layer3_interface => source_iface.layer3_interface,
106
+ :target_layer3_interface => target_iface.layer3_interface,
107
+ :port => pkt.dport,
108
+ :description => "PCAP"
109
+ else
110
+ traffic = Traffic.create :source_layer3_interface => source_iface.layer3_interface,
111
+ :target_layer3_interface => target_iface.layer3_interface,
112
+ :description => "PCAP"
113
+ end
114
+ puts "Added traffic -- #{source_addr} ==> #{target_addr}"
115
+ end
116
+ end
54
117
  end
55
118
  end
56
119
  end
57
120
  end
58
121
 
59
- if ARGV.empty? || ARGV.length > 1 || ARGV[0] == '--help'
122
+ if ['-h', '--help'].include?(ARGV[0])
60
123
  print_help
61
124
  else
62
- parse(ARGV[0])
125
+ parse(ARGV.pop, ARGV)
63
126
  end
64
-
@@ -27,9 +27,12 @@ def print_help
27
27
  puts "This script utilizes the provided Prefuse-based Java application"
28
28
  puts "to display the networks contained in the current database."
29
29
  puts
30
+ puts "Script Options:"
31
+ puts " --active Rendered graph will be 'active' -- it will expand,"
32
+ puts " move around, etc."
30
33
  end
31
34
 
32
- def display
35
+ def display(options = [])
33
36
  output = File.open("#{Antfarm.tmp_dir_to_use}/network.gml", "w")
34
37
  output.puts "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
35
38
  output.puts "<graphml xmlns=\"http://graphml.graphdrawing.org/xmlns\">"
@@ -59,39 +62,27 @@ def display
59
62
  output.puts " <edge source=\"node_#{node.id}\" target=\"network_#{l3_if.layer3_network.id}\" />"
60
63
  end
61
64
  end
62
- node_list = Array.new
63
- Traffic.find(:all).each do |traffic|
64
- source_node = traffic.source_layer3_interface.layer2_interface.node
65
- target_node = traffic.target_layer3_interface.layer2_interface.node
66
- unless node_list.include?(source_node)
67
- output.puts " <node id=\"node_#{source_node.id}\">"
68
- output.puts " <data key=\"name\">#{source_node.name.nil? ? source_node.device_type : source_node.name}</data>"
69
- output.puts " <data key=\"type\">#{source_node.device_type}</data>"
70
- output.puts " </node>"
71
- end
72
- unless node_list.include?(target_node)
73
- output.puts " <node id=\"node_#{target_node.id}\">"
74
- output.puts " <data key=\"name\">#{target_node.name.nil? ? target_node.device_type : target_node.name}</data>"
75
- output.puts " <data key=\"type\">#{target_node.device_type}</data>"
76
- output.puts " </node>"
77
- end
78
- output.puts " <edge source=\"node_#{source_node.id}\" target=\"node_#{target_node.id}\">"
79
- output.puts " <data key=\"line\">PCAP</data>"
80
- output.puts " </edge>"
81
- end
82
65
  output.puts " </graph>"
83
66
  output.puts "</graphml>"
84
67
  output.close
85
68
 
86
69
  if (defined? USER_DIR) && File.exists?("#{USER_DIR}/config/colors.xml")
87
- `java -jar #{ANTFARM_ROOT}/lib/antfarm.jar -active -colors #{USER_DIR}/config/colors.xml #{Antfarm.tmp_dir_to_use}/network.gml`
70
+ if options.include?('--active')
71
+ `java -jar #{ANTFARM_ROOT}/lib/antfarm.jar -active -colors #{USER_DIR}/config/colors.xml #{Antfarm.tmp_dir_to_use}/network.gml`
72
+ else
73
+ `java -jar #{ANTFARM_ROOT}/lib/antfarm.jar -colors #{USER_DIR}/config/colors.xml #{Antfarm.tmp_dir_to_use}/network.gml`
74
+ end
88
75
  else
89
- `java -jar #{ANTFARM_ROOT}/lib/antfarm.jar -active #{Antfarm.tmp_dir_to_use}/network.gml`
76
+ if options.include?('--active')
77
+ `java -jar #{ANTFARM_ROOT}/lib/antfarm.jar -active #{Antfarm.tmp_dir_to_use}/network.gml`
78
+ else
79
+ `java -jar #{ANTFARM_ROOT}/lib/antfarm.jar #{Antfarm.tmp_dir_to_use}/network.gml`
80
+ end
90
81
  end
91
82
  end
92
83
 
93
- if ARGV.length > 0
84
+ if ['-h', '--help'].include?(ARGV[0])
94
85
  print_help
95
86
  else
96
- display
87
+ display(ARGV)
97
88
  end