|
From: <xr...@us...> - 2012-02-10 15:55:25
|
Revision: 1312
http://scstudio.svn.sourceforge.net/scstudio/?rev=1312&view=rev
Author: xrehak
Date: 2012-02-10 15:55:14 +0000 (Fri, 10 Feb 2012)
Log Message:
-----------
pcap2z120 moved to tools directory.
Modified Paths:
--------------
trunk/COPYING
trunk/README
Added Paths:
-----------
trunk/tools/
trunk/tools/pcap2z120/
trunk/tools/pcap2z120/README
trunk/tools/pcap2z120.py
Modified: trunk/COPYING
===================================================================
--- trunk/COPYING 2012-02-10 13:42:37 UTC (rev 1311)
+++ trunk/COPYING 2012-02-10 15:55:14 UTC (rev 1312)
@@ -1,3 +1,17 @@
+This software is the result of the project Institute for Theoretical
+Computer Science, No. 1M0545, and this result is consistent with
+the expected objectives of the project. The owner of the result is
+Masaryk University, a public university, ID: 00216224. Masaryk University
+allows other companies and individuals to use this software free
+of charge and without territorial restrictions under the terms of
+the license listed bellow. This permission is granted for the duration
+of property rights. This software is not subject to special information
+treatment according to Act No. 412/2005 Coll., as amended. In case
+that a person who will use the software under this license offer
+violates the license terms, the permission to use the software terminates.
+
+
+
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Modified: trunk/README
===================================================================
--- trunk/README 2012-02-10 13:42:37 UTC (rev 1311)
+++ trunk/README 2012-02-10 15:55:14 UTC (rev 1312)
@@ -8,6 +8,10 @@
Part B. Developer Instructions
==============================
+
+Obtaining the source code
+-------------------------
+
The repository has the following structure
doc/ Documentation, manual pages.
src/ Source codes.
@@ -15,8 +19,8 @@
data/ Structures for MSC, export and import functions.
view/ Applications.
visio/ Microsoft Visio plug-in.
- test/ Console application for tests under Unix/Linux.
tests/ Automated regression tests.
+ tools/ Auxiliary tools and third-party SW.
To get the latest sources
svn co https://scstudio.svn.sourceforge.net/svnroot/scstudio/trunk scstudio
@@ -25,6 +29,30 @@
svn cp trunk https://scstudio.svn.sourceforge.net/svnroot/scstudio/tags/0.1
+Compiling SCStudio (Linux version)
+----------------------------------
+
+$ cd scstudio/trunk
+$ cmake .
+$ make
+[$ make test]
+
+
+Compiling SCStudio (Windows version)
+------------------------------------
+
+CMake.exe on scstudio\trunk\CMakeList.txt
+
+MS Visual Studio on scstudio\trunk\src\scstudio.sln
+
+MS Visual Studio on scstudio\trunk\src\view\visio\scstudio.sln
+
+NSIS on scstudio\src\view\visio\scstudio.nsi
+
+
+Configuring SVN for commits
+---------------------------
+
Source files should have the following properties
svn:eol-style=native
svn:keywords=Id
Added: trunk/tools/pcap2z120/README
===================================================================
--- trunk/tools/pcap2z120/README (rev 0)
+++ trunk/tools/pcap2z120/README 2012-02-10 15:55:14 UTC (rev 1312)
@@ -0,0 +1,24 @@
+$Id$
+
+
+pcap2z120.py is a python script that transforms network trefic saved
+in pcap files to textual MSC file following Z120 recommendation.
+The script was created in cooperation with SCStudio developers. In
+case message labels contains unsupported characters, a warning is
+printed to stderr but the file could be used for import into SCStudio.
+
+The script is a modification of pcap2msc script which transforms
+pcap files into mscgen-compatible file.
+pcap2z120.py (as wel as pcap2msc) uses tshark behind the scenes.
+
+More information can be found at http://code.google.com/p/pcap2msc/
+
+Usage:
+
+$ pcap2z120.py ./avses-tosip.cap sip
+
+or
+
+$ python pcap2z120.py ./avses-tosip.cap sip
+
+
Property changes on: trunk/tools/pcap2z120/README
___________________________________________________________________
Added: svn:keywords
+ Date Revision Author HeadURL Id
Added: svn:eol-style
+ native
Copied: trunk/tools/pcap2z120.py (from rev 1311, threeparted/pcap2z120)
===================================================================
--- trunk/tools/pcap2z120.py (rev 0)
+++ trunk/tools/pcap2z120.py 2012-02-10 15:55:14 UTC (rev 1312)
@@ -0,0 +1,138 @@
+#!/usr/bin/python
+
+
+#This script transforms network trefic saved in pcap files to textual MSC file following Z120 recommendation. The scripc was created with cooperation of SCStudio developers.
+#In case message labels contains unsupported characters, a warning is printed to stderr but the file could be used for import into SCStudio.
+
+#The script is a modification of pcap2msc script which transforms pcap files into mscgen-compatible file. More information can be found at http://code.google.com/p/pcap2msc/
+
+#Code License: GPL v2
+#contact: ma...@gm...
+
+import sys
+import subprocess
+import re
+
+def usage():
+ print >>sys.stderr, '%s: <.pcap> [tshark additional options] "wireshark display filter"' % sys.argv[0]
+ sys.exit(1)
+
+n = len(sys.argv)
+if n < 3:
+ usage()
+
+capture = sys.argv[1]
+dfilter = sys.argv[-1]
+
+tshark_cmd = [ 'tshark', '-n' ]
+tshark_cmd.extend(sys.argv[2:-1])
+tshark_cmd.append('-r')
+tshark_cmd.append(sys.argv[1])
+tshark_cmd.append(sys.argv[-1])
+
+# start tshark subprocess and prepare a pipe to which it will write stdout
+shark = subprocess.Popen(tshark_cmd, stdout=subprocess.PIPE)
+sharkout = shark.stdout
+
+# list of messages displayed by tshark
+messages = []
+
+#accord Z120 recommendation
+z120 = True
+
+while True:
+ line = sharkout.readline()
+ # eof encountered
+ if len(line) == 0:
+ break
+
+ regex = re.compile('^ *(\d+) +(\d+\.\d+) +(\d+\.\d+\.\d+\.\d+) -> (\d+\.\d+\.\d+\.\d+) (.*?)$')
+
+ ret = regex.match(line)
+ if ret != None:
+ msg = {}
+ msg['num'] = ret.group(1)
+ msg['date'] = ret.group(2)
+ msg['src'] = ret.group(3)
+ msg['dst'] = ret.group(4)
+
+ mesg = ret.group(5).lstrip().rstrip()
+
+ if any([mesg.find(" ") != -1, mesg.find("\"") != -1,
+ mesg.find("?") != -1, mesg.find("%") != -1,
+ mesg.find("+") != -1, mesg.find("-") != -1,
+ mesg.find("!") != -1, mesg.find("/") != -1,
+ mesg.find("*") != -1, mesg.find("=") != -1,
+ mesg.find("@") != -1, mesg.find("&") != -1,
+ mesg.find("(") != -1, mesg.find(")") != -1,
+ mesg.find("[") != -1, mesg.find("]") != -1,
+ mesg.find("<") != -1, mesg.find(">") != -1,
+ mesg.find("#") != -1, mesg.find(",") != -1,
+ mesg.find(";") != -1, mesg.find(":") != -1]):
+ if z120:
+ print >> sys.stderr, "Warning: Message lable violates Z120 recomendation. The label includes special symbol, e.g. space, ?, /, (, &, etc."
+ z120 = False
+
+ msg['msg'] = mesg
+ messages.append(msg)
+ else:
+ print >>sys.stderr, "line '%s' not handled by regex !" % line
+ break
+
+# synchronously wait for tshark termination
+shark.wait()
+if shark.returncode != 0:
+ print >>sys.stderr, "tshark returned error code %d" % shark.returncode
+ sys.exit(1)
+
+# list of entity
+# contains IP addresses used IP datagrams exchanged in this capture
+entities = []
+for msg in messages:
+ if msg['src'] not in entities:
+ entities.append(msg['src'])
+ if msg['dst'] not in entities:
+ entities.append(msg['dst'])
+
+
+# PRINT GENERATED FILE ON STDOUT
+
+#print header
+print("mscdocument FILE;")
+#print("mscdocument " + sys.argv[1] + ";")
+print("msc traffic;")
+
+#print instances
+line = ''
+for i in range(0, len(entities)):
+ line += '%s: instance;' % (entities[i])
+ if i < len(entities)-1:
+ line += '\n'
+print("%s" % line)
+
+#print messages
+identificator = 0
+for msg in messages:
+ src = entities.index(msg['src'])
+ dst = entities.index(msg['dst'])
+
+ if z120:
+ print("%s: out %s,%d to %s;") % (entities[src], msg['msg'], identificator, entities[dst])
+ print("%s: in %s,%d from %s;") % (entities[dst], msg['msg'], identificator, entities[src])
+ identificator += 1
+ else:
+ print("%s: out \'%s\',%d to %s;") % (entities[src], msg['msg'], identificator, entities[dst])
+ print("%s: in \'%s\',%d from %s;") % (entities[dst], msg['msg'], identificator, entities[src])
+ identificator += 1
+
+#end all instances
+line = ''
+for i in range(0, len(entities)):
+ line += '%s: endinstance;' % (entities[i])
+ if i < len(entities)-1:
+ line += '\n'
+print("%s" % line)
+
+#end of msc
+print("endmsc;")
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|