10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/netcrawl/output/dot.rb', line 10
def to_s
str = "graph NetCrawl {\n"
@output.to_list.each do |host|
host_label = label(host)
str << INDENT + id(host) + "[label=\"#{host_label}\" color=\"#{color(host_label)}\"]\n"
if @peers.has_key? host
@peers[host].each do |peer|
peer_name = @resolve ? peer.name : peer.ip
next if not CFG.dot.bothlinks and @connections.include?([peer_name, host].sort)
@connections << [peer_name, host].sort
labels = ''
labels = "[headlabel=\"#{peer.dst.to_s}\" taillabel=\"#{peer.src.to_s}\"]" if CFG.dot.linklabel
str << INDENT + INDENT + id(host) + ' -- ' + id(peer_name) + labels + "\n"
end
end
end
str << "}\n"
str
end
|