#!/usr/local/bin/tclsh8.3 # how i process my data: # # cat /home/jose/crimelabs/writing/asmap/trace.out1 /home/jose/crimelabs/writing/asmap/trace.out ../ctrace > data # vi data: s/^M//g s/{}//g # cat graphit # more graphit # ./graphit | sort | uniq | awk '{if (!($1 == $3)) print $0}' > test.dot # vi test.dot fix order # dot -Tps -o test.ps test.dot # let dot know we're starting a new graph puts "digraph ASmap {" puts "\tsize=\"24,24\"" puts "\tcenter=\"\"" puts "\tAS22909 \[shape=diamond,hight=0.12,width=0.12,fontsize=48,color=blue,style=filled];" # read the AS path data set file [open data r] foreach line [split [read $file] "\n"] { if [regexp "^AS \[Pp]ath" $line] { # uncomment this line to get rid of unknown AS data in prtraceroute regsub -all {\?\?\?} $line {} line for {set i 3} {$i < [expr [llength $line] - 1]} {incr i 1} { set src [lindex $line $i] set dst [lindex $line [expr $i + 1]] puts "\t$src -> $dst \[shape=circle,hight=0.12,width=0.12,fontsize=36];" } } } # trailing stuff for dot puts "}"