thomas200813
Programmer
The result is below:
you could find the timestamp and received info is printed in seperate line.How could we change the script and print the info into the capture file in a row.
---------------------------------------------------------
|2/12/2007 1:55:00PM|
TsecStart: port 0, PHY 0, link is up at 100Mbps full duplex
|2/12/2007 1:55:00PM|
Attached IPv4 interface to mottsec unit 2
|2/12/2007 1:55:00PM|
Attached IPv4 interface to mottsec unit 0
|2/12/2007 1:55:00PM|
usrNetDevStart: configured IPC device mottsec0, address 192.168.10.1
|2/12/2007 1:55:00PM|
|2/12/2007 1:55:00PM|
Adding 15452 symbols for standalone.
|2/12/2007 1:55:01PM|
-------------------------------------------------------------
proc main
string DateString, TimeString, sCap
string CapName ; Name of capture file to open.
string datahold
; Grab current time and date and place them into those string variables
ltimestrs $LTIME DateString TimeString
; I found out that Procomm does not like slashes or colons in capture filenames
; so lets replace all of these offending delimiters with hyphens
strreplace DateString "/" "-" ;Replace all slashes in date string with hyphens
strreplace TimeString ":" "-" ;Replace all colons in time string with hyphens
; Now concatenate the capture filename together
strcat CapName "Procomm_Capture_"
strcat CapName DateString
strcat CapName "_"
strcat CapName TimeString
strcat CapName ".cap"
set capture overwrite on ; overwrite old capture file data with new data
set capture query off ; do not prompt user for caputre filename
set capture file CapName ; Set name of capture file (pieced together from above).
capture on ; Open up the capture file.
; We need to set up a "hook" to allow the capture file to be closed when a user
; stops the script.
when USEREXIT call close_capture
; Main capture loop. This is an infinite loop that grabs the current time, formats
; and dumps a time stamp string into the capture stream and then sleeps for 60 seconds
; before it does it again. This loop will run until the user stops the script or
; exits Procomm
while 1
ltimestrs $LTIME DateString TimeString
strfmt sCap "|%s %s|" DateString TimeString
rget datahold 256 FOREVER
strreplace sCap "'n" ""
strreplace sCap "'r" ""
strcat sCap datahold
capturestr sCap
endwhile
endproc
proc close_capture
string DateString, TimeString, sCap
; Drop a final timestamp into the capture file before closing
ltimestrs $LTIME DateString TimeString
strfmt sCap "|%s %s|" DateString TimeString
capturestr sCap
capture off ; Close the capture file.
exit
endproc
you could find the timestamp and received info is printed in seperate line.How could we change the script and print the info into the capture file in a row.
---------------------------------------------------------
|2/12/2007 1:55:00PM|
TsecStart: port 0, PHY 0, link is up at 100Mbps full duplex
|2/12/2007 1:55:00PM|
Attached IPv4 interface to mottsec unit 2
|2/12/2007 1:55:00PM|
Attached IPv4 interface to mottsec unit 0
|2/12/2007 1:55:00PM|
usrNetDevStart: configured IPC device mottsec0, address 192.168.10.1
|2/12/2007 1:55:00PM|
|2/12/2007 1:55:00PM|
Adding 15452 symbols for standalone.
|2/12/2007 1:55:01PM|
-------------------------------------------------------------
proc main
string DateString, TimeString, sCap
string CapName ; Name of capture file to open.
string datahold
; Grab current time and date and place them into those string variables
ltimestrs $LTIME DateString TimeString
; I found out that Procomm does not like slashes or colons in capture filenames
; so lets replace all of these offending delimiters with hyphens
strreplace DateString "/" "-" ;Replace all slashes in date string with hyphens
strreplace TimeString ":" "-" ;Replace all colons in time string with hyphens
; Now concatenate the capture filename together
strcat CapName "Procomm_Capture_"
strcat CapName DateString
strcat CapName "_"
strcat CapName TimeString
strcat CapName ".cap"
set capture overwrite on ; overwrite old capture file data with new data
set capture query off ; do not prompt user for caputre filename
set capture file CapName ; Set name of capture file (pieced together from above).
capture on ; Open up the capture file.
; We need to set up a "hook" to allow the capture file to be closed when a user
; stops the script.
when USEREXIT call close_capture
; Main capture loop. This is an infinite loop that grabs the current time, formats
; and dumps a time stamp string into the capture stream and then sleeps for 60 seconds
; before it does it again. This loop will run until the user stops the script or
; exits Procomm
while 1
ltimestrs $LTIME DateString TimeString
strfmt sCap "|%s %s|" DateString TimeString
rget datahold 256 FOREVER
strreplace sCap "'n" ""
strreplace sCap "'r" ""
strcat sCap datahold
capturestr sCap
endwhile
endproc
proc close_capture
string DateString, TimeString, sCap
; Drop a final timestamp into the capture file before closing
ltimestrs $LTIME DateString TimeString
strfmt sCap "|%s %s|" DateString TimeString
capturestr sCap
capture off ; Close the capture file.
exit
endproc