160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
|
pktdb-pktspec
;; utility procs
increment-string ;; used to get indexes for strings in ref pkts
make-report ;; make a .dot file
)
(import
chicken.base
chicken.condition
chicken.file
chicken.file.posix
chicken.io
chicken.port
chicken.process
chicken.process-context.posix
chicken.time
chicken.time.posix
chicken.sort
chicken.string
scheme
;; data-structures posix
(import chicken scheme data-structures posix srfi-1 regex srfi-13 srfi-69 ports extras)
(use crypt sha1 message-digest (prefix dbi dbi:) typed-records)
srfi-1 regex srfi-13 srfi-69
;; ports extras)
crypt sha1 message-digest
(prefix dbi dbi:)
typed-records)
;;======================================================================
;; DATA MANIPULATION UTILS
;;======================================================================
(define-inline (unescape-data data)
(string-translate* data '(("\\n" . "\n") ("\\\\" . "\\"))))
|
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
|
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
|
-
+
|
(for-each
(lambda (pktsdir) ;; look at all
(cond
((not (file-exists? pktsdir))
(print "ERROR: packets directory " pktsdir " does not exist."))
((not (directory? pktsdir))
(print "ERROR: packets directory path " pktsdir " is not a directory."))
((not (file-read-access? pktsdir))
((not (file-readable? pktsdir))
(print "ERROR: packets directory path " pktsdir " is not readable."))
(else
;; (print "INFO: Loading packets found in " pktsdir)
(let ((pkts (glob (conc pktsdir "/*.pkt"))))
(for-each
(lambda (pkt)
(let* ((uuid (cadr (string-match ".*/([0-9a-f]+).pkt" pkt)))
|