<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3281601435817430401</id><updated>2011-12-15T01:31:20.077-08:00</updated><category term='network protocols'/><category term='oisf'/><category term='flash'/><category term='tools'/><category term='ipfw'/><category term='valgrind'/><category term='python'/><category term='ips'/><category term='suricata'/><category term='pcap'/><category term='ids'/><category term='macosx'/><category term='streamming'/><category term='videoconference'/><category term='projects'/><category term='scapy'/><category term='actionscript'/><category term='profiling'/><category term='flex'/><category term='fms'/><category term='snort'/><category term='mxml'/><category term='c'/><title type='text'>/dev/one</title><subtitle type='html'>yet another device character</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://pablo-secdev.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://pablo-secdev.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Pablo Rincon Crespo</name><uri>http://www.blogger.com/profile/03815482515770216027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://1.bp.blogspot.com/_pcm25IFkpzE/TTSAATVpVbI/AAAAAAAAABs/sktwWue8ntY/S220/pablo-t.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>18</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3281601435817430401.post-3115334244036481700</id><published>2011-10-16T11:32:00.000-07:00</published><updated>2011-10-16T11:42:06.189-07:00</updated><title type='text'>Some thoughts about MySQL proxy as a DB Firewall</title><content type='html'>Here are some notes about how to do a self learning DB Firewall.&lt;br /&gt;&lt;br /&gt;MySQL proxy as a DB Firewall&lt;br /&gt;&lt;br /&gt;A. Syntactic stats&lt;br /&gt; 1. Get the token chains&lt;br /&gt; 2. Store the chain producing stats&lt;br /&gt; 3. Be flexible on multiple criteria (dis/con)junctions (ie: advanced search forms will append multiple conditions with and/or/IN)&lt;br /&gt;&lt;br /&gt;i.e: &lt;br /&gt;- query:&lt;br /&gt; SELECT user, email FROM users WHERE user = "Something"&lt;br /&gt;- becomes:&lt;br /&gt; TK_SQL_SELECT TK_LITERAL TK_COMMA TK_LITERAL TK_SQL_FROM TK_LITERAL TK_SQL_WHERE TK_LITERAL TK_EQ TK_STRING&lt;br /&gt;&lt;br /&gt;- query:&lt;br /&gt; SELECT user, comment, email FROM comments WHERE user = "someone" AND comment  LIKE "%too bad"&lt;br /&gt;- becomes:&lt;br /&gt; TK_SQL_SELECT TK_LITERAL TK_COMMA TK_LITERAL TK_COMMA TK_LITERAL TK_SQL_FROM TK_LITERAL TK_SQL_WHERE TK_LITERAL TK_EQ TK_STRING TK_SQL_AND TK_LITERAL TK_SQL_LIKE TK_STRING&lt;br /&gt;&lt;br /&gt;- query:&lt;br /&gt; UPDATE comments SET comment = "too good" WHERE user = "someone" AND comment  LIKE "%too bad"&lt;br /&gt;&lt;br /&gt;- becomes:&lt;br /&gt; TK_SQL_UPDATE TK_LITERAL TK_SQL_SET TK_LITERAL TK_EQ TK_STRING TK_SQL_WHERE TK_LITERAL TK_EQ TK_STRING TK_SQL_AND TK_LITERAL TK_SQL_LIKE TK_STRING&lt;br /&gt;&lt;br /&gt;With those token chains we can build a tree of statistics based on SQL syntactic statements.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;B. Value Stats of user-defined words over syntactic stats&lt;br /&gt; 1. For SQL statemens where columns and tables should be constants&lt;br /&gt; 2. Produce stats based on userdatas/values&lt;br /&gt;&lt;br /&gt;i.e:&lt;br /&gt;- query:&lt;br /&gt; SELECT user, email FROM users WHERE user = "Something"&lt;br /&gt;- becomes:&lt;br /&gt; TK_SQL_SELECT TK_LITERAL TK_COMMA TK_LITERAL TK_SQL_FROM TK_LITERAL TK_SQL_WHERE TK_LITERAL TK_EQ TK_STRING&lt;br /&gt;- values to get stats: TK_LITERALs&lt;br /&gt;    user      email                                    users&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;C. Statistical Regex of known chars for specific fields (paranoid mode… approach very restrictive):&lt;br /&gt; 1. By checking TK_STRINGS, we can build automatic regex to allow certain types&lt;br /&gt;i.e:&lt;br /&gt;- query:&lt;br /&gt; SELECT user, email FROM users WHERE user = "Something"&lt;br /&gt;- Char class seen for field "user":&lt;br /&gt; \w&lt;br /&gt;- query:&lt;br /&gt; SELECT user, email FROM users WHERE user = "Some@thing.com"&lt;br /&gt;- Char class seen for field "user":&lt;br /&gt; \w@\.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;D. Administrative data:&lt;br /&gt; 1. Forbid unusual information_scheme queries&lt;br /&gt; 2. Custom triggers&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;E. Other:&lt;br /&gt; 2. Forbid unusual load into IN/OUT file&lt;br /&gt; 3. Other unusual / malicious techniques used in sql injections (i.e: tautological analysis, like 1=1, 1=0, or i.e: listing of fields using NULL or zero in order to build a union select statement, or i.e: ORDER BY 1,2,3..)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;F. Time to learn Lua! Happy Hacking!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3281601435817430401-3115334244036481700?l=pablo-secdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pablo-secdev.blogspot.com/feeds/3115334244036481700/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pablo-secdev.blogspot.com/2011/10/some-thoughts-about-mysql-proxy-as-db.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/3115334244036481700'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/3115334244036481700'/><link rel='alternate' type='text/html' href='http://pablo-secdev.blogspot.com/2011/10/some-thoughts-about-mysql-proxy-as-db.html' title='Some thoughts about MySQL proxy as a DB Firewall'/><author><name>Pablo Rincon Crespo</name><uri>http://www.blogger.com/profile/03815482515770216027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://1.bp.blogspot.com/_pcm25IFkpzE/TTSAATVpVbI/AAAAAAAAABs/sktwWue8ntY/S220/pablo-t.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3281601435817430401.post-3466215153624411284</id><published>2011-05-26T13:35:00.000-07:00</published><updated>2011-05-26T13:38:37.311-07:00</updated><title type='text'>Holograms!</title><content type='html'>Lastly I've been playing with Kinect, Processing, shiffman's openkinect, and a homemade screen :).&lt;br /&gt;&lt;br /&gt;Thanks to Jaime Blasco for his Kinect, and Antonio Rincón for his proyector.&lt;br /&gt;Here is the result: Holograms!&lt;br /&gt;&lt;br /&gt;&lt;iframe width="425" height="349" src="http://www.youtube.com/embed/Wc7ysivE3tM" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3281601435817430401-3466215153624411284?l=pablo-secdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pablo-secdev.blogspot.com/feeds/3466215153624411284/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pablo-secdev.blogspot.com/2011/05/holograms.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/3466215153624411284'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/3466215153624411284'/><link rel='alternate' type='text/html' href='http://pablo-secdev.blogspot.com/2011/05/holograms.html' title='Holograms!'/><author><name>Pablo Rincon Crespo</name><uri>http://www.blogger.com/profile/03815482515770216027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://1.bp.blogspot.com/_pcm25IFkpzE/TTSAATVpVbI/AAAAAAAAABs/sktwWue8ntY/S220/pablo-t.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://img.youtube.com/vi/Wc7ysivE3tM/default.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3281601435817430401.post-7987717291430997155</id><published>2011-05-09T03:12:00.000-07:00</published><updated>2011-05-27T08:02:19.080-07:00</updated><title type='text'>Lost in translation: WTF is happening inside my Android phone</title><content type='html'>&lt;img src="http://farm6.static.flickr.com/5106/5615208673_35cab9f7df.jpg" width="500" height="333" alt="Jaime Blasco and Pablo Rincon"&gt;&lt;br /&gt;&lt;br /&gt;Description&lt;br /&gt;=======&lt;br /&gt;&lt;br /&gt;Lost in translation: WTF is happening inside my Android phone, by Jaime Blasco and I (Pablo Rincón Crespo).&lt;br /&gt;&lt;br /&gt;-- English --&lt;br /&gt;In this talk we'll try to cover the state of the art of Android Security, focussing on the most used techniques to analyze malware apps (tools, environments, static/dynamic analysis, reversing, antiemulation..).&lt;br /&gt;&lt;br /&gt;We will also use a real example of one of the latest known malware for this platform, detected on february 2011, unmasking the logic of the CnC servers that controlled this malware.&lt;br /&gt;&lt;br /&gt;-- Spanish description --&lt;br /&gt;En esta charla trataremos de describir el estado actual de la seguridad en Android, haciendo hincapié en las técnicas más usadas a la hora de analizar aplicaciones maliciosas (herramientas, entorno, análisis estático, dinámico, reversing, anti-emulación, anti-análisis...).&lt;br /&gt;&lt;br /&gt;En la conferencia se utilizará un ejemplo real de uno de los últimos troyanos aparecidos para esta plataforma, llegando a "desenmascarar" el funcionamiento de los servidores utilizados para controlar el malware.&lt;br /&gt;--&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Video and Slides&lt;br /&gt;==========&lt;br /&gt;&lt;br /&gt;At last, we have the video and slides:&lt;br /&gt;The talk I did with Jaime Blasco at Rootedcon 2011. It's in Spanish.&lt;br /&gt;&lt;a href="http://vimeo.com/23058076"&gt;http://vimeo.com/23058076&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;But we have the slides in english&lt;br /&gt;&lt;a href="http://www.slideshare.net/rootedcon/jaime-blasco-pablo-rincn"&gt;http://www.slideshare.net/rootedcon/jaime-blasco-pablo-rincn&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3281601435817430401-7987717291430997155?l=pablo-secdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pablo-secdev.blogspot.com/feeds/7987717291430997155/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pablo-secdev.blogspot.com/2011/05/lost-in-translation-wtf-is-happening.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/7987717291430997155'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/7987717291430997155'/><link rel='alternate' type='text/html' href='http://pablo-secdev.blogspot.com/2011/05/lost-in-translation-wtf-is-happening.html' title='Lost in translation: WTF is happening inside my Android phone'/><author><name>Pablo Rincon Crespo</name><uri>http://www.blogger.com/profile/03815482515770216027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://1.bp.blogspot.com/_pcm25IFkpzE/TTSAATVpVbI/AAAAAAAAABs/sktwWue8ntY/S220/pablo-t.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm6.static.flickr.com/5106/5615208673_35cab9f7df_t.jpg' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3281601435817430401.post-2579900835233784813</id><published>2011-01-14T08:46:00.000-08:00</published><updated>2011-01-14T09:30:30.550-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scapy'/><category scheme='http://www.blogger.com/atom/ns#' term='ips'/><category scheme='http://www.blogger.com/atom/ns#' term='ipfw'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='ids'/><title type='text'>Python + divert sockets + scapy</title><content type='html'>I have prepared a small class for playing with divert sockets and python. This example shows how to register a packet handler for packets fetched from the divert, then it loads a Scapy packet from the IP layer, displaying the contents, and at last it forward the packet to be delivered. It's just a Proof of Concept, that doesn't block packets, but if you implement your logic at the packet handler, setting the veredict to false it should block it.&lt;br /&gt;&lt;br /&gt;And you might think now, why not just use a crafted RST packet from scapy? And I would answer, because it is more reliable, and because you might prefer not to send anything to the source IP that you want to block. An rst packet is enough to know that something (some app) is alive at the other side. On the other hand, a combination of both would be the best fit here, because that will avoid long timeouts while waitting for an answer, and duplicated requests (some browsers make a lot of retries).  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To test it (on MacOSX), you need to have scapy installed. Then create a divert socket with a rule similar to this (be careful, this will enqueue all the packets at ipfw and it might break your connections if you don't attach a program to veredict them on time):&lt;br /&gt;&lt;br /&gt;one@macuto2$ sudo ipfw add divert 3282 tcp from any to any&lt;br /&gt;Password:&lt;br /&gt;00100 divert 3282 ip from any to any proto tcp&lt;br /&gt;&lt;br /&gt;Now run the attached script as follows:&lt;br /&gt;sudo python2.6 DivertSocket.py 3282&lt;br /&gt;And it should start fetching packets reaching the function of the packet handler, where you should place your logic. You might want to try to block petitions by for example ip addresses (just for testing), or content payload, but remember that this doesn't reassemble tcp streams, there would be much more to do for content inspection. Anyway I hope someone will have some fun testing it. &lt;br /&gt;&lt;br /&gt;&lt;div id="code"&gt;&lt;pre&gt;&lt;br /&gt;DivertSocket.py&lt;br /&gt;-- cut here --&lt;br /&gt;import socket&lt;br /&gt;import sys&lt;br /&gt;import re&lt;br /&gt;&lt;br /&gt;from scapy.all import *&lt;br /&gt;&lt;br /&gt;if not socket.__dict__.has_key("IPPROTO_DIVERT"):&lt;br /&gt;    # Define if&lt;br /&gt;    socket.IPPROTO_DIVERT = 254&lt;br /&gt;&lt;br /&gt;class DivertSocket:&lt;br /&gt;    def __init__(self, port, delegateFunc=None):&lt;br /&gt;&lt;br /&gt;        self.sock = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_DIVERT)&lt;br /&gt;        # Here the addr can be any. The important one is the port&lt;br /&gt;        self.sock.bind(("0.0.0.0", port))&lt;br /&gt;        # By default the max&lt;br /&gt;        self.bufsize = 65535&lt;br /&gt;        # Set blocking&lt;br /&gt;        self.sock.setblocking(True)&lt;br /&gt;        # Register callback&lt;br /&gt;        self.delegateFunc = delegateFunc&lt;br /&gt;        self.__loop = 1&lt;br /&gt;&lt;br /&gt;    def start(self, default=0):&lt;br /&gt;        self.fetchPackets(default)&lt;br /&gt;&lt;br /&gt;    def fetchPackets(self, default=0):&lt;br /&gt;        while self.__loop:&lt;br /&gt;            buf, addr = self.sock.recvfrom(self.bufsize)&lt;br /&gt;            # If we registered a delegate funcion, call it&lt;br /&gt;            if self.delegateFunc != None:&lt;br /&gt;                self.delegateFunc(buf, addr)&lt;br /&gt;            # Else send it if the default behavior matches&lt;br /&gt;            else:&lt;br /&gt;                print "Warning, no functions registered for inspection!"&lt;br /&gt;                if default:&lt;br /&gt;                    self.sendPacket(buf, addr)&lt;br /&gt;                else:&lt;br /&gt;                    print "You need to implement a callback function for inspection"&lt;br /&gt;                    sys.exit(-1)&lt;br /&gt;&lt;br /&gt;    def setVeredict(self, buf, addr, veredict=False):&lt;br /&gt;        if veredict:&lt;br /&gt;            if self.__sendPacket(buf, addr) == False:&lt;br /&gt;                print "Pkt not sent. Weird.. Need to see which packet causes this error"&lt;br /&gt;&lt;br /&gt;    def __sendPacket(self, buf, addr = None):&lt;br /&gt;        try:&lt;br /&gt;            if addr:&lt;br /&gt;                return self.sock.sendto(buf, addr)&lt;br /&gt;            #else try send it raw anyway..&lt;br /&gt;            return self.sock.send(buf)&lt;br /&gt;        except KeyboardInterrupt, e:&lt;br /&gt;            print "Stopping Engine..."&lt;br /&gt;            sys.exit(0)&lt;br /&gt;        except:&lt;br /&gt;            print "Could not send packet..."&lt;br /&gt;            return False&lt;br /&gt;&lt;br /&gt;    def stop(self):&lt;br /&gt;        self.__loop = 0&lt;br /&gt;        self.sock.close()&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;def pktHandler(buf, addr):&lt;br /&gt;    p = IP(buf)&lt;br /&gt;    print p.display()&lt;br /&gt;    ds.setVeredict(buf,addr, True)&lt;br /&gt;&lt;br /&gt;ds = DivertSocket(int(sys.argv[1]), pktHandler)&lt;br /&gt;&lt;br /&gt;ds.start()&lt;br /&gt;-- stop here --&lt;br /&gt;&lt;br /&gt;BTW, I would be very pleased if someone can test it under linux using iptables. Sooner or later I'll try it anyway.&lt;br /&gt;&lt;br /&gt;Happy hacking!&lt;br /&gt;;-)&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3281601435817430401-2579900835233784813?l=pablo-secdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pablo-secdev.blogspot.com/feeds/2579900835233784813/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pablo-secdev.blogspot.com/2011/01/python-divert-sockets-scapy.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/2579900835233784813'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/2579900835233784813'/><link rel='alternate' type='text/html' href='http://pablo-secdev.blogspot.com/2011/01/python-divert-sockets-scapy.html' title='Python + divert sockets + scapy'/><author><name>Pablo Rincon Crespo</name><uri>http://www.blogger.com/profile/03815482515770216027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://1.bp.blogspot.com/_pcm25IFkpzE/TTSAATVpVbI/AAAAAAAAABs/sktwWue8ntY/S220/pablo-t.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3281601435817430401.post-2759034823342141066</id><published>2011-01-13T09:38:00.000-08:00</published><updated>2011-01-14T06:01:22.139-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='streamming'/><category scheme='http://www.blogger.com/atom/ns#' term='mxml'/><category scheme='http://www.blogger.com/atom/ns#' term='videoconference'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='fms'/><category scheme='http://www.blogger.com/atom/ns#' term='flash'/><title type='text'>Video Streamming - Flash/Flex/Actionscript3 - NetConnection+NetStream+RTMP FMS (Flash Media Server)</title><content type='html'>I have been playing with flash/flex and video streamming + chat, just for fun. I think there might be some people searching for some working examples, and I didn't find too much on the net working straight forward with the latest versions. So, that's why I want to share my working code:&lt;br /&gt;&lt;br /&gt;Features:&lt;br /&gt;- Publish a Stream (sound included)&lt;br /&gt;- Receive a Stream (playing sound)&lt;br /&gt;- Minimal chat components&lt;br /&gt;&lt;br /&gt;What's needed: Flash Builder/Flex Actionscript 3 (You can addapt the example for normal Flash). FMS aka Flash Media Server with the application "live", that's usually installed by default. FMS will install Apache, publishing an admin console to view connections, app's status and stream status (*Hint: Check the stream status of the app "live").&lt;br /&gt;&lt;br /&gt;3 mxml files:&lt;br /&gt;- Publisher&lt;br /&gt;- Viewer&lt;br /&gt;- Main app&lt;br /&gt;&lt;br /&gt;You would also like to create your own app on FMS, but I'm not covering this at the moment.&lt;br /&gt;&lt;br /&gt;So, here we go:&lt;br /&gt;&lt;br /&gt;The publisher will send the stream to the server through the NetConnection, using the webcam attached to a NetStream (with only 1 direction). It will also attach the mic if any.&lt;br /&gt;&lt;br /&gt;Publisher.mxml&lt;br /&gt;-- cut here --&lt;br /&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;&amp;lt;s:Group xmlns:fx=&amp;quot;http://ns.adobe.com/mxml/2009&amp;quot; &lt;br /&gt;   xmlns:s=&amp;quot;library://ns.adobe.com/flex/spark&amp;quot; &lt;br /&gt;   xmlns:mx=&amp;quot;library://ns.adobe.com/flex/mx&amp;quot; width=&amp;quot;410&amp;quot; height=&amp;quot;490&amp;quot; creationComplete=&amp;quot;LiveStreams()&amp;quot;&amp;gt;&lt;br /&gt; &amp;lt;fx:Declarations&amp;gt;&lt;br /&gt;  &amp;lt;!-- Place non-visual elements (e.g., services, value objects) here --&amp;gt;&lt;br /&gt; &amp;lt;/fx:Declarations&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;fx:Script&amp;gt;&lt;br /&gt;  &amp;lt;![CDATA[&lt;br /&gt;   &lt;br /&gt;   import flash.display.MovieClip;&lt;br /&gt;   import flash.events.ActivityEvent;&lt;br /&gt;   import flash.events.MouseEvent;&lt;br /&gt;   import flash.events.NetStatusEvent;&lt;br /&gt;   import flash.media.Camera;&lt;br /&gt;   import flash.media.Microphone;&lt;br /&gt;   import flash.media.Video;&lt;br /&gt;   import flash.net.NetConnection;&lt;br /&gt;   import flash.net.NetStream;&lt;br /&gt;   &lt;br /&gt;   import mx.utils.ObjectUtil;&lt;br /&gt;   &lt;br /&gt;   var nc:NetConnection;&lt;br /&gt;   var ns:NetStream;&lt;br /&gt;   var video:Video;&lt;br /&gt;   var camera:Camera;&lt;br /&gt;   var mic:Microphone;&lt;br /&gt;   private var meta:Object;&lt;br /&gt;   &lt;br /&gt;   &lt;br /&gt;   public function sendChat() {&lt;br /&gt;    var obj:Object = new Object();&lt;br /&gt;    obj = new Object();&lt;br /&gt;    obj.chat = this.txtSend.text;&lt;br /&gt;    this.txtChat.text = this.txtChat.text + &amp;quot;\n&amp;quot; + this.txtSend.text;&lt;br /&gt;    this.txtChat.verticalScrollPosition = this.txtChat.maxVerticalScrollPosition;&lt;br /&gt;    this.txtSend.text = &amp;quot;&amp;quot;;&lt;br /&gt;    ns.send(&amp;quot;receiveChat&amp;quot;, obj);&lt;br /&gt;   }&lt;br /&gt;   &lt;br /&gt;   public function LiveStreams()&lt;br /&gt;   {&lt;br /&gt;    startBtn.addEventListener(MouseEvent.CLICK, startHandler);&lt;br /&gt;    clearBtn.addEventListener(MouseEvent.CLICK, clearHandler);&lt;br /&gt;    stopBtn.addEventListener(MouseEvent.CLICK, stopHandler);&lt;br /&gt;   }&lt;br /&gt;   &lt;br /&gt;   private function ns_onMetaData(item:Object):void {&lt;br /&gt;    trace(&amp;quot;meta&amp;quot;);&lt;br /&gt;    trace(ObjectUtil.toString(item));&lt;br /&gt;&lt;br /&gt;    /*&lt;br /&gt;    meta = item;&lt;br /&gt;    // Resize Video object to same size as meta data.&lt;br /&gt;    video.width = item.width;&lt;br /&gt;    video.height = item.height;&lt;br /&gt;    // Resize UIComponent to same size as Video object.&lt;br /&gt;    uic.width = video.width;&lt;br /&gt;    uic.height = video.height;&lt;br /&gt;    panel.title = &amp;quot;framerate: &amp;quot; + item.framerate;&lt;br /&gt;    panel.visible = true;&lt;br /&gt;    */&lt;br /&gt;   }&lt;br /&gt;   &amp;nbsp;&lt;br /&gt;   private function ns_onCuePoint(item:Object):void {&lt;br /&gt;    trace(&amp;quot;cue&amp;quot;);&lt;br /&gt;   }&lt;br /&gt;   /*&lt;br /&gt;   *  Connect and start publishing the live stream&lt;br /&gt;   */&lt;br /&gt;   private function startHandler(event:MouseEvent):void {&lt;br /&gt;    trace(&amp;quot;Okay, let's connect now&amp;quot;);&lt;br /&gt;    &lt;br /&gt;    nc = new NetConnection();&lt;br /&gt;    nc.client=this;&lt;br /&gt;    nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);&lt;br /&gt;    nc.connect(this.txtServer.text);&lt;br /&gt;   }&lt;br /&gt;   &lt;br /&gt;   &lt;br /&gt;   /*&lt;br /&gt;   *  Disconnect from the server&lt;br /&gt;   */&lt;br /&gt;   private function stopHandler(event:MouseEvent):void {&lt;br /&gt;    trace(&amp;quot;Now we're disconnecting&amp;quot;);&lt;br /&gt;    nc.close();&lt;br /&gt;   }&lt;br /&gt;   &lt;br /&gt;   /*&lt;br /&gt;   *  Clear the MetaData associated with the stream&lt;br /&gt;   */&lt;br /&gt;   private function clearHandler(event:MouseEvent):void {&lt;br /&gt;    if (ns){&lt;br /&gt;     trace(&amp;quot;Clearing MetaData&amp;quot;);&lt;br /&gt;     ns.send(&amp;quot;@clearDataFrame&amp;quot;, &amp;quot;onMetaData&amp;quot;);&lt;br /&gt;    }&lt;br /&gt;   }&lt;br /&gt;   &lt;br /&gt;   &lt;br /&gt;   private function netStatusHandler(event:NetStatusEvent):void&lt;br /&gt;   {&lt;br /&gt;    trace(&amp;quot;connected is: &amp;quot; + nc.connected );&lt;br /&gt;    trace(&amp;quot;event.info.level: &amp;quot; + event.info.level);&lt;br /&gt;    trace(&amp;quot;event.info.code: &amp;quot; + event.info.code);&lt;br /&gt;    &lt;br /&gt;    switch (event.info.code)&lt;br /&gt;    {&lt;br /&gt;     case &amp;quot;NetConnection.Connect.Success&amp;quot;:&lt;br /&gt;      trace(&amp;quot;Congratulations! you're connected&amp;quot;);&lt;br /&gt;      publishLiveStream();&lt;br /&gt;      break;&lt;br /&gt;     case &amp;quot;NetConnection.Connect.Rejected&amp;quot;:&lt;br /&gt;      trace (&amp;quot;Oops! the connection was rejected&amp;quot;);&lt;br /&gt;      break;&lt;br /&gt;     case &amp;quot;NetStream.Play.Stop&amp;quot;:&lt;br /&gt;      trace(&amp;quot;The stream has finished playing&amp;quot;);&lt;br /&gt;      break;&lt;br /&gt;     case &amp;quot;NetStream.Play.StreamNotFound&amp;quot;:&lt;br /&gt;      trace(&amp;quot;The server could not find the stream you specified&amp;quot;); &lt;br /&gt;      break;&lt;br /&gt;     case &amp;quot;NetStream.Publish.Start&amp;quot;:&lt;br /&gt;      &lt;br /&gt;      trace(&amp;quot;Adding metadata to the stream&amp;quot;);&lt;br /&gt;      // when publishing starts, add the metadata to the stream&lt;br /&gt;      var metaData:Object = new Object();&lt;br /&gt;      metaData.title = &amp;quot;UnStreammmm&amp;quot;;&lt;br /&gt;      metaData.width = 200;&lt;br /&gt;      metaData.height = 150;&lt;br /&gt;      ns.send(&amp;quot;@setDataFrame&amp;quot;, &amp;quot;onMetaData&amp;quot;, metaData);&lt;br /&gt;      break;&lt;br /&gt;     &lt;br /&gt;     case &amp;quot;NetStream.Publish.BadName&amp;quot;:&lt;br /&gt;      trace(&amp;quot;The stream name is already used&amp;quot;);&lt;br /&gt;      break;&lt;br /&gt;    }&lt;br /&gt;   }&lt;br /&gt;   &lt;br /&gt;   public function onBWDone():void{&lt;br /&gt;   }&lt;br /&gt;   &lt;br /&gt;   private function activityHandler(event:ActivityEvent):void {&lt;br /&gt;    trace(&amp;quot;activityHandler: &amp;quot; + event);&lt;br /&gt;    trace(&amp;quot;activating: &amp;quot; + event.activating);&lt;br /&gt;   } &lt;br /&gt;   &lt;br /&gt;   /*&lt;br /&gt;   *  Create a live stream, attach the camera and microphone, and&lt;br /&gt;   *  publish it to the local server&lt;br /&gt;   */&lt;br /&gt;   private function publishLiveStream():void {&lt;br /&gt;    ns = new NetStream(nc);&lt;br /&gt;    ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);&lt;br /&gt;    var nsClient:Object = {};&lt;br /&gt;    nsClient.onMetaData = ns_onMetaData;&lt;br /&gt;    nsClient.onCuePoint = ns_onCuePoint;&lt;br /&gt;    ns.client = nsClient;&lt;br /&gt;    &lt;br /&gt;    camera = Camera.getCamera();&lt;br /&gt;    mic = Microphone.getMicrophone();&lt;br /&gt;    &lt;br /&gt;    if (camera != null){&lt;br /&gt;     &lt;br /&gt;     camera.addEventListener(ActivityEvent.ACTIVITY, activityHandler);&lt;br /&gt;     &lt;br /&gt;     video = new Video();&lt;br /&gt;     video.smoothing=true;&lt;br /&gt;     video.width=200;&lt;br /&gt;     video.height=150;&lt;br /&gt;     video.attachCamera(camera);&lt;br /&gt;     &lt;br /&gt;     ns.attachCamera(camera);&lt;br /&gt;     uic.addChild(video);&lt;br /&gt;     //this.addChild(video);&lt;br /&gt;     //myvid.source=camera;&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    if (mic != null) {&lt;br /&gt;     mic.addEventListener(ActivityEvent.ACTIVITY, activityHandler);&lt;br /&gt;     mic.setUseEchoSuppression(true);&lt;br /&gt;     mic.rate = 44;&lt;br /&gt;     ns.attachAudio(mic);&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    if (camera != null || mic != null){&lt;br /&gt;     // start publishing&lt;br /&gt;     // triggers NetStream.Publish.Start&lt;br /&gt;     ns.publish(this.txtStream.text, &amp;quot;live&amp;quot;);&lt;br /&gt;    } else {&lt;br /&gt;     trace(&amp;quot;Please check your camera and microphone&amp;quot;);&lt;br /&gt;    }&lt;br /&gt;   }  &lt;br /&gt;   &lt;br /&gt;   &lt;br /&gt;&lt;br /&gt;  ]]&amp;gt;&lt;br /&gt; &amp;lt;/fx:Script&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;mx:UIComponent id=&amp;quot;uic&amp;quot; x=&amp;quot;5&amp;quot; y=&amp;quot;72&amp;quot; width=&amp;quot;200&amp;quot; height=&amp;quot;150&amp;quot; /&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;mx:Button id=&amp;quot;startBtn&amp;quot; x=&amp;quot;15&amp;quot; y=&amp;quot;40&amp;quot; label=&amp;quot;Start&amp;quot;/&amp;gt;&lt;br /&gt; &amp;lt;mx:Button id=&amp;quot;clearBtn&amp;quot; x=&amp;quot;93&amp;quot; y=&amp;quot;40&amp;quot; label=&amp;quot;Clear&amp;quot;/&amp;gt;&lt;br /&gt; &amp;lt;mx:Button id=&amp;quot;stopBtn&amp;quot; x=&amp;quot;171&amp;quot; y=&amp;quot;40&amp;quot; label=&amp;quot;Stop&amp;quot;/&amp;gt;&lt;br /&gt; &amp;lt;s:TextInput x=&amp;quot;59&amp;quot; y=&amp;quot;11&amp;quot; id=&amp;quot;txtServer&amp;quot; text=&amp;quot;rtmp://192.168.1.130/live&amp;quot;/&amp;gt;&lt;br /&gt; &amp;lt;s:TextInput x=&amp;quot;266&amp;quot; y=&amp;quot;11&amp;quot; id=&amp;quot;txtStream&amp;quot;/&amp;gt;&lt;br /&gt; &amp;lt;s:Label x=&amp;quot;15&amp;quot; y=&amp;quot;15&amp;quot; text=&amp;quot;Server&amp;quot;/&amp;gt;&lt;br /&gt; &amp;lt;s:Label x=&amp;quot;206&amp;quot; y=&amp;quot;16&amp;quot; text=&amp;quot;Stream&amp;quot;/&amp;gt;&lt;br /&gt; &amp;lt;mx:TextArea x=&amp;quot;10&amp;quot; y=&amp;quot;380&amp;quot; width=&amp;quot;390&amp;quot; height=&amp;quot;66&amp;quot; id=&amp;quot;txtChat&amp;quot; verticalScrollPolicy=&amp;quot;auto&amp;quot; editable=&amp;quot;false&amp;quot;/&amp;gt;&lt;br /&gt; &amp;lt;s:TextInput x=&amp;quot;10&amp;quot; y=&amp;quot;458&amp;quot; width=&amp;quot;308&amp;quot; id=&amp;quot;txtSend&amp;quot;/&amp;gt;&lt;br /&gt; &amp;lt;s:Button x=&amp;quot;326&amp;quot; y=&amp;quot;459&amp;quot; label=&amp;quot;Send&amp;quot; click=&amp;quot;sendChat();&amp;quot;/&amp;gt;&lt;br /&gt;&amp;lt;/s:Group&amp;gt;&lt;br /&gt;&lt;br /&gt;-- stop here --&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The Viewer component can connect to a stream, play sound and receive chat msgs from the stream being published:&lt;br /&gt;&lt;br /&gt;Viewer.mxml&lt;br /&gt;-- start here --&lt;br /&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;&amp;lt;s:Group xmlns:fx=&amp;quot;http://ns.adobe.com/mxml/2009&amp;quot; &lt;br /&gt;   xmlns:s=&amp;quot;library://ns.adobe.com/flex/spark&amp;quot; &lt;br /&gt;   xmlns:mx=&amp;quot;library://ns.adobe.com/flex/mx&amp;quot; width=&amp;quot;410&amp;quot; height=&amp;quot;490&amp;quot; creationComplete=&amp;quot;LiveStreams()&amp;quot;&amp;gt;&lt;br /&gt; &amp;lt;fx:Declarations&amp;gt;&lt;br /&gt;  &amp;lt;!-- Place non-visual elements (e.g., services, value objects) here --&amp;gt;&lt;br /&gt; &amp;lt;/fx:Declarations&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;fx:Script&amp;gt;&lt;br /&gt;  &amp;lt;![CDATA[&lt;br /&gt;   &lt;br /&gt;   import flash.display.MovieClip;&lt;br /&gt;   import flash.events.ActivityEvent;&lt;br /&gt;   import flash.events.MouseEvent;&lt;br /&gt;   import flash.events.NetStatusEvent;&lt;br /&gt;   import flash.media.Camera;&lt;br /&gt;   import flash.media.Microphone;&lt;br /&gt;   import flash.media.Sound;&lt;br /&gt;   import flash.media.Video;&lt;br /&gt;   import flash.net.NetConnection;&lt;br /&gt;   import flash.net.NetStream;&lt;br /&gt;   import flash.media.SoundTransform;&lt;br /&gt;   import mx.utils.ObjectUtil;&lt;br /&gt;   &lt;br /&gt;   var nc:NetConnection;&lt;br /&gt;   var ns:NetStream;&lt;br /&gt;   var video:Video;&lt;br /&gt;   var sound:Sound;&lt;br /&gt;   private var meta:Object;&lt;br /&gt;   &lt;br /&gt;   &lt;br /&gt;   public function LiveStreams()&lt;br /&gt;   {&lt;br /&gt;    startBtn.addEventListener(MouseEvent.CLICK, startHandler);&lt;br /&gt;    clearBtn.addEventListener(MouseEvent.CLICK, clearHandler);&lt;br /&gt;    stopBtn.addEventListener(MouseEvent.CLICK, stopHandler);&lt;br /&gt;   }&lt;br /&gt;   &lt;br /&gt;   public function receiveChat(obj:Object) {&lt;br /&gt;    trace(ObjectUtil.toString(obj));&lt;br /&gt;    this.txtChat.text = this.txtChat.text + &amp;quot;\n&amp;quot; + obj.chat; &lt;br /&gt;    this.txtChat.verticalScrollPosition = this.txtChat.maxVerticalScrollPosition;&lt;br /&gt;   }&lt;br /&gt;   &lt;br /&gt;   private function ns_onMetaData(item:Object):void {&lt;br /&gt;    trace(&amp;quot;meta&amp;quot;+item.toString()+&amp;quot; &amp;quot;+item.title );&lt;br /&gt;    trace(ObjectUtil.toString(item));&lt;br /&gt;&lt;br /&gt;    /*&lt;br /&gt;    meta = item;&lt;br /&gt;    // Resize Video object to same size as meta data.&lt;br /&gt;    video.width = item.width;&lt;br /&gt;    video.height = item.height;&lt;br /&gt;    // Resize UIComponent to same size as Video object.&lt;br /&gt;    uic.width = video.width;&lt;br /&gt;    uic.height = video.height;&lt;br /&gt;    panel.title = &amp;quot;framerate: &amp;quot; + item.framerate;&lt;br /&gt;    panel.visible = true;&lt;br /&gt;    trace(ObjectUtil.toString(item));&lt;br /&gt;    */&lt;br /&gt;   }&lt;br /&gt;   &amp;Acirc;&amp;nbsp;&lt;br /&gt;   private function ns_onCuePoint(item:Object):void {&lt;br /&gt;    trace(&amp;quot;cue&amp;quot;);&lt;br /&gt;   }&lt;br /&gt;   /*&lt;br /&gt;   *  Connect and start publishing the live stream&lt;br /&gt;   */&lt;br /&gt;   private function startHandler(event:MouseEvent):void {&lt;br /&gt;    trace(&amp;quot;Okay, let's connect now&amp;quot;);&lt;br /&gt;    &lt;br /&gt;    nc = new NetConnection();&lt;br /&gt;    nc.client=this;&lt;br /&gt;    nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);&lt;br /&gt;    nc.connect(this.txtServer.text);&lt;br /&gt;   }&lt;br /&gt;   &lt;br /&gt;   &lt;br /&gt;   /*&lt;br /&gt;   *  Disconnect from the server&lt;br /&gt;   */&lt;br /&gt;   private function stopHandler(event:MouseEvent):void {&lt;br /&gt;    trace(&amp;quot;Now we're disconnecting&amp;quot;);&lt;br /&gt;    nc.close();&lt;br /&gt;   }&lt;br /&gt;   &lt;br /&gt;   /*&lt;br /&gt;   *  Clear the MetaData associated with the stream&lt;br /&gt;   */&lt;br /&gt;   private function clearHandler(event:MouseEvent):void {&lt;br /&gt;    if (ns){&lt;br /&gt;     trace(&amp;quot;Clearing MetaData&amp;quot;);&lt;br /&gt;     ns.send(&amp;quot;@clearDataFrame&amp;quot;, &amp;quot;onMetaData&amp;quot;);&lt;br /&gt;    }&lt;br /&gt;   }&lt;br /&gt;   &lt;br /&gt;   &lt;br /&gt;   private function netStatusHandler(event:NetStatusEvent):void&lt;br /&gt;   {&lt;br /&gt;    trace(&amp;quot;connected is: &amp;quot; + nc.connected );&lt;br /&gt;    trace(&amp;quot;event.info.level: &amp;quot; + event.info.level);&lt;br /&gt;    trace(&amp;quot;event.info.code: &amp;quot; + event.info.code);&lt;br /&gt;    &lt;br /&gt;    switch (event.info.code)&lt;br /&gt;    {&lt;br /&gt;     case &amp;quot;NetConnection.Connect.Success&amp;quot;:&lt;br /&gt;      trace(&amp;quot;Congratulations! you're connected&amp;quot;);&lt;br /&gt;      publishLiveStream();&lt;br /&gt;      break;&lt;br /&gt;     case &amp;quot;NetConnection.Connect.Rejected&amp;quot;:&lt;br /&gt;      trace (&amp;quot;Oops! the connection was rejected&amp;quot;);&lt;br /&gt;      break;&lt;br /&gt;     case &amp;quot;NetStream.Play.Stop&amp;quot;:&lt;br /&gt;      trace(&amp;quot;The stream has finished playing&amp;quot;);&lt;br /&gt;      break;&lt;br /&gt;     case &amp;quot;NetStream.Play.StreamNotFound&amp;quot;:&lt;br /&gt;      trace(&amp;quot;The server could not find the stream you specified&amp;quot;); &lt;br /&gt;      break;&lt;br /&gt;     case &amp;quot;NetStream.Publish.Start&amp;quot;:&lt;br /&gt;      &lt;br /&gt;      trace(&amp;quot;Adding metadata to the stream&amp;quot;);&lt;br /&gt;      // when publishing starts, add the metadata to the stream&lt;br /&gt;      var metaData:Object = new Object();&lt;br /&gt;      metaData.title = &amp;quot;UnStreammmm&amp;quot;;&lt;br /&gt;      metaData.width = 200;&lt;br /&gt;      metaData.height = 150;&lt;br /&gt;      ns.send(&amp;quot;@setDataFrame&amp;quot;, &amp;quot;onMetaData&amp;quot;, metaData);&lt;br /&gt;      break;&lt;br /&gt;     &lt;br /&gt;     case &amp;quot;NetStream.Publish.BadName&amp;quot;:&lt;br /&gt;      trace(&amp;quot;The stream name is already used&amp;quot;);&lt;br /&gt;      break;&lt;br /&gt;    }&lt;br /&gt;   }&lt;br /&gt;   &lt;br /&gt;   public function onBWDone():void{&lt;br /&gt;   }&lt;br /&gt;   &lt;br /&gt;   private function activityHandler(event:ActivityEvent):void {&lt;br /&gt;    trace(&amp;quot;activityHandler: &amp;quot; + event);&lt;br /&gt;    trace(&amp;quot;activating: &amp;quot; + event.activating);&lt;br /&gt;   } &lt;br /&gt;   &lt;br /&gt;   /*&lt;br /&gt;   *  Create a live stream, attach the camera and microphone, and&lt;br /&gt;   *  publish it to the local server&lt;br /&gt;   */&lt;br /&gt;   private function publishLiveStream():void {&lt;br /&gt;    ns = new NetStream(nc);&lt;br /&gt;    ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);&lt;br /&gt;    var nsClient:Object = {};&lt;br /&gt;    nsClient.receiveChat = receiveChat;&lt;br /&gt;    nsClient.onMetaData = ns_onMetaData;&lt;br /&gt;    nsClient.onCuePoint = ns_onCuePoint;&lt;br /&gt;    ns.client = nsClient;&lt;br /&gt;    &lt;br /&gt;    &lt;br /&gt;    video = new Video();&lt;br /&gt;    video.smoothing=true;&lt;br /&gt;    video.attachNetStream(ns);&lt;br /&gt;    video.width=200;&lt;br /&gt;    video.height=150;&lt;br /&gt;    sound = new Sound();&lt;br /&gt;    ns.soundTransform = new SoundTransform(1);&lt;br /&gt;    ns.play(this.txtStream.text);&lt;br /&gt;    uic.addChild(video);&lt;br /&gt;    //this.addChild(video);&lt;br /&gt;    //myvid.source=camera;&lt;br /&gt; &lt;br /&gt;   }  &lt;br /&gt;   &lt;br /&gt;   &lt;br /&gt;   &lt;br /&gt;  ]]&amp;gt;&lt;br /&gt; &amp;lt;/fx:Script&amp;gt;&lt;br /&gt; &amp;lt;mx:UIComponent id=&amp;quot;uic&amp;quot; x=&amp;quot;5&amp;quot; y=&amp;quot;70&amp;quot; width=&amp;quot;200&amp;quot; height=&amp;quot;150&amp;quot; /&amp;gt;&lt;br /&gt; &amp;lt;mx:Button id=&amp;quot;startBtn&amp;quot; x=&amp;quot;15&amp;quot; y=&amp;quot;40&amp;quot; label=&amp;quot;Start&amp;quot;/&amp;gt;&lt;br /&gt; &amp;lt;mx:Button id=&amp;quot;clearBtn&amp;quot; x=&amp;quot;98&amp;quot; y=&amp;quot;40&amp;quot; label=&amp;quot;Clear&amp;quot;/&amp;gt;&lt;br /&gt; &amp;lt;mx:Button id=&amp;quot;stopBtn&amp;quot; x=&amp;quot;176&amp;quot; y=&amp;quot;40&amp;quot; label=&amp;quot;Stop&amp;quot;/&amp;gt;&lt;br /&gt; &amp;lt;s:TextInput x=&amp;quot;54&amp;quot; y=&amp;quot;9&amp;quot; id=&amp;quot;txtServer&amp;quot; text=&amp;quot;rtmp://192.168.1.130/live&amp;quot;/&amp;gt;&lt;br /&gt; &amp;lt;s:TextInput x=&amp;quot;261&amp;quot; y=&amp;quot;9&amp;quot; id=&amp;quot;txtStream&amp;quot;/&amp;gt;&lt;br /&gt; &amp;lt;s:Label x=&amp;quot;10&amp;quot; y=&amp;quot;13&amp;quot; text=&amp;quot;Server&amp;quot;/&amp;gt;&lt;br /&gt; &amp;lt;s:Label x=&amp;quot;201&amp;quot; y=&amp;quot;14&amp;quot; text=&amp;quot;Stream&amp;quot;/&amp;gt;&lt;br /&gt; &amp;lt;mx:TextArea x=&amp;quot;10&amp;quot; y=&amp;quot;380&amp;quot; width=&amp;quot;390&amp;quot; height=&amp;quot;100&amp;quot; id=&amp;quot;txtChat&amp;quot; verticalScrollPolicy=&amp;quot;auto&amp;quot; editable=&amp;quot;false&amp;quot;/&amp;gt;&lt;br /&gt;&amp;lt;/s:Group&amp;gt;&lt;br /&gt;&lt;br /&gt;-- stop here --&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now we merge both components, Publisher and Viewer into a single app:&lt;br /&gt;&lt;br /&gt;MainApp.mxml&lt;br /&gt;-- start here --&lt;br /&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;&amp;lt;s:Application xmlns:fx=&amp;quot;http://ns.adobe.com/mxml/2009&amp;quot; &lt;br /&gt;      xmlns:s=&amp;quot;library://ns.adobe.com/flex/spark&amp;quot; &lt;br /&gt;      xmlns:mx=&amp;quot;library://ns.adobe.com/flex/mx&amp;quot; minWidth=&amp;quot;955&amp;quot; minHeight=&amp;quot;600&amp;quot; xmlns:ns1=&amp;quot;*&amp;quot;&amp;gt;&lt;br /&gt; &amp;lt;fx:Declarations&amp;gt;&lt;br /&gt;  &amp;lt;!-- Place non-visual elements (e.g., services, value objects) here --&amp;gt;&lt;br /&gt; &amp;lt;/fx:Declarations&amp;gt;&lt;br /&gt; &amp;lt;ns1:Publisher x=&amp;quot;10&amp;quot; y=&amp;quot;10&amp;quot; width=&amp;quot;410&amp;quot; height=&amp;quot;350&amp;quot;&amp;gt;&lt;br /&gt; &amp;lt;/ns1:Publisher&amp;gt;&lt;br /&gt; &amp;lt;ns1:Viewer x=&amp;quot;432&amp;quot; y=&amp;quot;10&amp;quot; width=&amp;quot;410&amp;quot; height=&amp;quot;350&amp;quot;&amp;gt;&lt;br /&gt; &amp;lt;/ns1:Viewer&amp;gt;&lt;br /&gt;&amp;lt;/s:Application&amp;gt;&lt;br /&gt;&lt;br /&gt;-- stop here --&lt;br /&gt;&lt;br /&gt;To run the examples you must set the IP of the FMS server (IP_OF_THE_SERVER). Then open the webpage in 2 different browsers/tabs.&lt;br /&gt;On browser/tab 1 set the stream name of the publisher component to for example "Jaime" (Thanks for testing), and the stream name of the viewer to "Pablo".&lt;br /&gt;On browser/tab 2 set the stream name of the publisher component to for example "Pablo" (Thanks for testing), and the stream name of the viewer to "Jaime" (just the opposite to the other browser/tab).&lt;br /&gt;Now click start on the publisher components and then start on the viewer components. You can also try to send some text with the chat window. That is thanks to metadata functions, where you can define a function handler at the netstream and send metadata with that handler name.&lt;br /&gt;&lt;br /&gt;I found some issues because of older versions (ex:onBWDone()). That's why you will find some empty definitions at the code. Anyway they are not needed as soon as you create a custom client attached to the NetConnection.&lt;br /&gt;&lt;br /&gt;As a final note, I'm not capturing all the exceptions that the application can throw, so please be careful using it! It is just a proof of concept..&lt;br /&gt;&lt;br /&gt;;-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3281601435817430401-2759034823342141066?l=pablo-secdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pablo-secdev.blogspot.com/feeds/2759034823342141066/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pablo-secdev.blogspot.com/2011/01/video-streamming-flashflexactionscript3.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/2759034823342141066'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/2759034823342141066'/><link rel='alternate' type='text/html' href='http://pablo-secdev.blogspot.com/2011/01/video-streamming-flashflexactionscript3.html' title='Video Streamming - Flash/Flex/Actionscript3 - NetConnection+NetStream+RTMP FMS (Flash Media Server)'/><author><name>Pablo Rincon Crespo</name><uri>http://www.blogger.com/profile/03815482515770216027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://1.bp.blogspot.com/_pcm25IFkpzE/TTSAATVpVbI/AAAAAAAAABs/sktwWue8ntY/S220/pablo-t.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3281601435817430401.post-2874095888240062112</id><published>2010-09-08T07:29:00.000-07:00</published><updated>2010-09-08T07:32:06.171-07:00</updated><title type='text'>Suricata 1.0.2 Released</title><content type='html'>We have a new release! Today, Victor Julien announced a new release of Suricata. See the details below:&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;The OISF development team is proud to announce Suricata 1.0.2, the&lt;br /&gt;second maintenance release for Suricata 1.0, the Open Source Intrusion&lt;br /&gt;Detection and Prevention engine.&lt;br /&gt;&lt;br /&gt;Get the new release here:&lt;br /&gt;http://www.openinfosecfoundation.org/download/suricata-1.0.2.tar.gz&lt;br /&gt;&lt;br /&gt;New features&lt;br /&gt;&lt;br /&gt;- Added an SSH application layer module, improving performance and accuracy&lt;br /&gt;- Added two new SSH rule keywords: "ssh.protoversion" and&lt;br /&gt;"ssh.softwareversion"&lt;br /&gt;- Added support for missing HTTP related PCRE modifiers /H, /M and /C&lt;br /&gt;(bug #220)&lt;br /&gt;&lt;br /&gt;Improvements&lt;br /&gt;&lt;br /&gt;- Fixed several TCP stream engine evasion issues found by Judy Novak&lt;br /&gt;from G2, Inc.&lt;br /&gt;- Improved accuracy of the http_client_body keyword&lt;br /&gt;- Improved dropping of packets in IPS mode when a signature matches in&lt;br /&gt;the reassembled stream or the application layer&lt;br /&gt;- Improved error reporting if the engine runs out of memory in the&lt;br /&gt;initialization stage&lt;br /&gt;- Fixed a reported segv in the HTTP method detection keyword (bug #231)&lt;br /&gt;- Several smaller issues were fixed&lt;br /&gt;&lt;br /&gt;Because of the TCP evasions that are fixed upgrading is highly recommended.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Known issues &amp; missing features&lt;br /&gt;&lt;br /&gt;As always, we are doing our best to make you aware of continuing&lt;br /&gt;development and items within the engine that are not yet complete or&lt;br /&gt;optimal.  With this in mind, please notice the list we have included of&lt;br /&gt;known items we are working on.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3281601435817430401-2874095888240062112?l=pablo-secdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pablo-secdev.blogspot.com/feeds/2874095888240062112/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pablo-secdev.blogspot.com/2010/09/suricata-102-released.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/2874095888240062112'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/2874095888240062112'/><link rel='alternate' type='text/html' href='http://pablo-secdev.blogspot.com/2010/09/suricata-102-released.html' title='Suricata 1.0.2 Released'/><author><name>Pablo Rincon Crespo</name><uri>http://www.blogger.com/profile/03815482515770216027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://1.bp.blogspot.com/_pcm25IFkpzE/TTSAATVpVbI/AAAAAAAAABs/sktwWue8ntY/S220/pablo-t.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3281601435817430401.post-489317933992887120</id><published>2010-07-21T14:39:00.000-07:00</published><updated>2010-07-22T02:43:14.849-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='suricata'/><category scheme='http://www.blogger.com/atom/ns#' term='ips'/><category scheme='http://www.blogger.com/atom/ns#' term='ipfw'/><category scheme='http://www.blogger.com/atom/ns#' term='oisf'/><category scheme='http://www.blogger.com/atom/ns#' term='ids'/><category scheme='http://www.blogger.com/atom/ns#' term='macosx'/><title type='text'>HowTo setup suricata 1.0.0 on Mac OS X on IDS and IPS mode with IPFW</title><content type='html'>I'm really proud to announce that &lt;a href="http://www.openinfosecfoundation.org/"&gt;Suricata&lt;/a&gt; 1.0 has been released. This is the first stable version, with just one year old, as a result of a great effort of the development team, covering compatibility with nearly all the emerging-threats rule feed. Thanks to all of you guys! Keep up the good work. The engine has some known issues, that you can check on &lt;a href="http://redmine.openinfosecfoundation.org/"&gt;the OISF redmine &lt;/a&gt;. After the SF meeting I'm sure that we will work out a lot of new features for incoming releases that will start accomplishing the phase two of the project.&lt;br /&gt;&lt;br /&gt;In order to &lt;a href="http://www.inliniac.net/blog/2010/05/10/setting-up-suricata-0-9-0-for-initial-use-on-ubuntu-lucid-10-04.html"&gt;setup Suricata running on a Ubuntu Linux/GNU box &lt;/a&gt;, you might want to follow the howto's of Victor Julien, posted at his &lt;a href="http://www.inliniac.net/blog/2010/05/10/setting-up-suricata-0-9-0-for-initial-use-on-ubuntu-lucid-10-04.html"&gt;blog (Inliniac)&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;But if you are a Mac OS X user, you might want to follow this steps. First I will try to cover a basic setup on IDS mode, and later will add the steps needed for IPS mode with IPFW.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;1. Get the compiler and libraries:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The fastest way is to install &lt;a href="http://www.macports.org/"&gt;XCode&lt;/a&gt;. XCode is a toolkit for Mac OS X developers that includes the most common compilers for GUI and terminal development. It includes GNU gcc, and is able to compile C, C++, Objective-C, Objective-C++, Java and AppleScript.&lt;br /&gt;&lt;br /&gt;Next you need the libraries. You can install them one by one, but I guess it's easier, and probably faster to install a port manager tool like &lt;a href="http://www.macports.org/"&gt;MacPorts&lt;/a&gt; (that was my choice).&lt;br /&gt;&lt;br /&gt;After setting up MacPorts, run the following command:&lt;br /&gt;&lt;pre&gt;port install autoconf automake make libnet11 libpcap pcre \&lt;br /&gt;libyaml libtool pkgconfig&lt;/pre&gt;(*probably the auto* tools and "make" are yet installed by xcode).&lt;br /&gt;&lt;br /&gt;Ok, now we should have the libraries installed (by default the paths differs a bit from linux.. they are usually installed at /opt/local/include).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;2. Get and build the source.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now let's get the source. Go to the &lt;a href="http://openinfosecfoundation.org/index.php/download-suricata"&gt;download section&lt;/a&gt; of OISF to fetch the latest stable release. Anyway, you can also do this (but you should get the latest up2date version):&lt;br /&gt;&lt;pre&gt;wget \&lt;br /&gt;"http://openinfosecfoundation.org/download/suricata-1.0.0.tar.gz"&lt;br /&gt;tar xvzf suricata-1.0.0.tar.gz&lt;br /&gt;cd suricata-1.0.0&lt;br /&gt;# If you want to play with suricata code&lt;br /&gt;# you might want to enable debug with --enable-debug.&lt;br /&gt;# if not, unittests should be more than enough&lt;br /&gt;./configure --enable-unittests&lt;br /&gt;make&lt;br /&gt;sudo make install&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;3. Prepare the environment&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now that we have the source code compiled, let's prepare the environment.&lt;br /&gt;&lt;br /&gt;Let's follow some common steps (should be nearly the same as Linux).&lt;br /&gt;Aadd a user account and group for running suricata. If you have Mac OS X 10.4 or less:&lt;br /&gt;&lt;pre&gt;dscl / -create /Users/suricata UserShell /bin/false \&lt;br /&gt;RealName "Suricata idps engine" UniqueID 500 PrimaryGroupID 500&lt;/pre&gt;If you have Mac OS X 10.5 or higher:&lt;br /&gt;&lt;pre&gt;dscl . -create /Users/suricata UserShell /bin/false \&lt;br /&gt;RealName "Suricata idps engine" UniqueID 500 PrimaryGroupID 500&lt;br /&gt;&lt;/pre&gt;As the shell is /bin/false, you should not be able to log in with it.&lt;br /&gt;&lt;pre&gt;# Create a directory for logs:&lt;br /&gt;sudo mkdir /var/log/suricata/&lt;br /&gt;# A directory for the config files:&lt;br /&gt;sudo mkdir /etc/suricata/&lt;br /&gt;&lt;br /&gt;# Copy the config file and classification config to /etc/suricata/&lt;br /&gt;sudo cp /path/to/suricata-1.0.0/suricata.yaml /etc/suricata/&lt;br /&gt;sudo cp /path/to/suricata-1.0.0/classification.config\&lt;br /&gt;/etc/suricata/&lt;br /&gt;&lt;br /&gt;# Ensure we will have enough perms to write the logs&lt;br /&gt;sudo chown suricata:suricata /var/log/suricata/&lt;br /&gt;&lt;/pre&gt;Now you can get rule feeds for the engine from two different providers: &lt;a href="http://www.emergingthreats.net/"&gt;Emerging Threats&lt;/a&gt;, and &lt;a href="http://www.snort.org/snort-rules/"&gt;Sourcefire VRT&lt;/a&gt;. Let's go with emerging threats:&lt;br /&gt;&lt;pre&gt;wget http://www.emergingthreats.net/rules/emerging.rules.tar.gz&lt;br /&gt;cd /etc/suricata/&lt;br /&gt;sudo tar xzvf /path/to/emerging.rules.tar.gz&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;4. Start the engine&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now we have a basic environment prepared for running the engine, on IDS mode and emerging threats rule feed.&lt;br /&gt;&lt;br /&gt;You can start the engine by executing:&lt;br /&gt;&lt;pre&gt;suricata -c /etc/suricata/suricata.yaml -i en1 --user suricata\&lt;br /&gt;--group suricata&lt;br /&gt;&lt;/pre&gt;(the interface is en1 on my box, but it might differ to yours).&lt;br /&gt;&lt;br /&gt;Cool, now we have the engine working. You can now check the stats log files located at /var/log/suricata. By default all the output types are enabled. Of course this is not the most optimal configuration. You can disable the outputs that doesn't work for you by editing /etc/suricata/suricata.yaml. maybe you want to go further and install sguil, acidbase, snorby, or any other viewer compatible with unified output (but that's another article I should write). By now, lets just check /var/log/suricata/fast.log to view the generated alerts.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;5. Setup suricata as IPS with IPFW.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you want to use suricata as IPS you will need to recompile the source, adding an extra option to the configure script. Go to the path of the sources and run the following commands:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;cd /path/to/suricata-1.0.0&lt;br /&gt;./configure --enable-unittests --enable-ipfw&lt;br /&gt;make&lt;br /&gt;sudo make install&lt;br /&gt;&lt;/pre&gt;Now that we have the binary capable of talking with ipfw, let's say to ipfw what traffic we want to allow/reject with suricata. By default, ipfw has a "catch all" rule, allowing all ip traffic. This one:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;ipfw list&lt;br /&gt;65535 allow ip from any to any&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;We need a ipfw rule to forward the traffic to the engine. We also need the engine to be running and getting the packets from the divert port of ipfw.&lt;br /&gt;***Otherwise, no program will say to ipfw to allow the traffic, and you'll break all your connections! :)&lt;br /&gt;No worries. Just keep in mind that you can execute the following command to stop the ipfw rule:&lt;br /&gt;&lt;pre&gt;ipfw flush&lt;br /&gt;Are you sure? [yn] y&lt;br /&gt;&lt;br /&gt;Flushed all rules.&lt;br /&gt;&lt;/pre&gt;And you will have connection again. So, what we are going to do is to add the following rule:&lt;br /&gt;&lt;pre&gt;ipfw add 100 divert 8000 ip from any to any&lt;br /&gt;&lt;br /&gt;# it should print something like this:&lt;br /&gt;# 00100 divert 8000 ip from any to any&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;You can check the rules by running ipfw list. And then, launch suricata reading from the divert 8000 we have just loaded into ipfw:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;suricata -c /etc/suricata/suricata.yaml -d 8000 --user suricata\&lt;br /&gt;--group suricata&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Please, notice that we do not specify an interface here. We are getting the traffic from ipfw (not the interface). Now suricata can tell ipfw which packets to allow and which ones to deny.&lt;br /&gt;&lt;br /&gt;The engine will also need special rules. By default the rules start with the action "alert", but to use IPS, that word should be "drop".&lt;br /&gt;&lt;br /&gt;So now, you can test someting like this:&lt;br /&gt;&lt;br /&gt;drop tcp any any -&gt; any 80 (msg:"testing drop"; content:"google"; http_header; sid:123321;)&lt;br /&gt;&lt;br /&gt;Save this rule to a file named test.rules and start the engine with&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;suricata -c /etc/suricata/suricata.yaml -d 8000 --user suricata\&lt;br /&gt;--group suricata -s test.rules&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;And then try to load any webpage different to google. It should work. And if you try to navigate to google, the engine should directly stop that packets. Getting no response on your web browser (probably a timeout).&lt;br /&gt;&lt;br /&gt;Please, notice that to "drop" packets is different to "reject". A reject packet is not dropped, but a special packet is sent to the endpoints to force a connection close. You might want to combine rules with different actions on the same file. Something like:&lt;br /&gt;&lt;br /&gt;alert tcp any any -&gt; any 80 (msg:"testing drop"; content:"google"; http_header; sid:1;)&lt;br /&gt;&lt;br /&gt;reject tcp any any -&gt; any 80 (msg:"testing reject"; content:"yahoo"; http_header; sid:2;)&lt;br /&gt;&lt;br /&gt;drop tcp any any -&gt; any 80 (msg:"testing drop"; content:"bing"; http_header; sid:3;)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;And the engine should log all of them, but should only drop requests to bing, reject requests to yahoo, and alert requests to google.&lt;br /&gt;&lt;br /&gt;But there's another important action that we need to know. That is "pass". A "pass" rule allows as to ignore anyothers actions triggered from other rules. This means that you can use it to fix possible false positives and add certain exceptions, depending on your network, your ruleset, etc preventing that connections to be dropped or rejected. So we can add the following rule as an exception:&lt;br /&gt;&lt;br /&gt;pass tcp any any -&gt; any 80 (msg:"testing drop"; content:"mail.yahoo.com"; http_header; sid:4;)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;6. Final notes&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To build a good rule set for IPS mode is definitely a must, and a critical task. You will need to fine tune your rule set since you must prevent the engine to fall under false positives that might be the result of a bad rule design, that could drop packets where it should allow them. So you will need to keep an eye on this, and maybe write some scripts to make your own score of reliability for rules (for a huge number of rules), or check them.. one by one. Of course, for a production environment you should use a more adaptative approach, like setting up suricata as ids mode first for a certain testing period, check all the generated alerts for false positives, and avoid using them with the action drop/reject. After that period of time (that should depend on the number of hosts you're monitoring and the throughgput and type of traffic), you should have a more trustable list of rules to modify with the action of drop (or reject).&lt;br /&gt;&lt;br /&gt;Reject doesn't depend on ipfw. Keep this in mind since you don't need to pass all the traffic through ipfw to block connections. You can do a midterm approach. For example, you can pass only certain traffic to ipfw by creating more custom rules like "ipfw add 100 divert 8000 ip from 192.168.10.0/24 to my.server.com", then write reject rules like "reject !192.168.10.0/24 any &lt;&gt; !my.server.com any (...)". The "drop" rules will only affect to the communication between 192.168.10.0/24 and my.server.com, but reject will affect to the rest of connections. IPFW has a lot of features you should check, in order to set up your firewall.&lt;br /&gt;&lt;br /&gt;With all of this said, you can go further into more complex configurations.&lt;br /&gt;And that's all for now.&lt;br /&gt;&lt;br /&gt;Please, feel free to ask me any questions/problems/suggestions you might have following this guideline. I'll be happy to help.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3281601435817430401-489317933992887120?l=pablo-secdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pablo-secdev.blogspot.com/feeds/489317933992887120/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pablo-secdev.blogspot.com/2010/07/howto-setup-suricata-100-on-mac-os-x.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/489317933992887120'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/489317933992887120'/><link rel='alternate' type='text/html' href='http://pablo-secdev.blogspot.com/2010/07/howto-setup-suricata-100-on-mac-os-x.html' title='HowTo setup suricata 1.0.0 on Mac OS X on IDS and IPS mode with IPFW'/><author><name>Pablo Rincon Crespo</name><uri>http://www.blogger.com/profile/03815482515770216027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://1.bp.blogspot.com/_pcm25IFkpzE/TTSAATVpVbI/AAAAAAAAABs/sktwWue8ntY/S220/pablo-t.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3281601435817430401.post-4386438614025844245</id><published>2010-04-20T10:37:00.000-07:00</published><updated>2010-07-22T03:20:14.978-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='suricata'/><category scheme='http://www.blogger.com/atom/ns#' term='ips'/><category scheme='http://www.blogger.com/atom/ns#' term='oisf'/><category scheme='http://www.blogger.com/atom/ns#' term='ids'/><title type='text'>New suricata release 0.8.2</title><content type='html'>New suricata release! Have a look at the new features and changelog!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: 85%;"&gt;The OISF development team is proud to introduce the 3rd beta  release of&lt;br /&gt;Suricata, the Open Source Intrusion Detection and  Prevention engine. The&lt;br /&gt;first release candidate is currently scheduled  for early May, but check&lt;br /&gt;https://redmine.openinfosecfoundation.org/projects/roadmap/suricata  for&lt;br /&gt;the up to date schedule!&lt;br /&gt;&lt;br /&gt;Get the new release here:&lt;br /&gt;http://www.openinfosecfoundation.org/download/suricata-0.8.2.tar.gz&lt;br /&gt;&lt;br /&gt;New  features&lt;br /&gt;&lt;br /&gt;- Support for the following keywords: detection_filter,  http_client_body&lt;br /&gt;- The HTTP parser can now set server personalities&lt;br /&gt;-  threshold.config support&lt;br /&gt;- The experimental CUDA code now also works  on x86_64&lt;br /&gt;- IP address only rules for IPv6 are now supported as well&lt;br /&gt;-  Suricata can now write a pid file (pass --pidfile &lt;file&gt;)&lt;br /&gt;- A fuzzer  script was added to the code base&lt;br /&gt;- Policy lookup for defrag module&lt;br /&gt;&lt;br /&gt;Improvements&lt;br /&gt;&lt;br /&gt;-  Much better average and worstcase performance in the detection engine&lt;br /&gt;-  Memory footprint was reduced&lt;br /&gt;- More validation at signature loading  stage&lt;br /&gt;- Libnet 1.1 is now optional&lt;br /&gt;- Negated uricontent and  http_cookie matching is now supported&lt;br /&gt;- Lots of fixes of issues found  by Valgrind's DRD, CLANG and Parfait.&lt;br /&gt;- Threads are named now in  "top" (Linux only atm).&lt;br /&gt;- Unified1 file handling is improved&lt;br /&gt;&lt;br /&gt;Bugs  fixed&lt;br /&gt;&lt;br /&gt;Many :)&lt;br /&gt;Several segmentation faults, upgrading is  highly recommended.&lt;br /&gt;&lt;br /&gt;See&lt;br /&gt;https://redmine.openinfosecfoundation.org/projects/suricata/issues?fixed_version_id=6&amp;amp;set_filter=1&amp;amp;status_id=c&lt;br /&gt;&lt;br /&gt;Known  issues &amp;amp; missing features&lt;br /&gt;&lt;br /&gt;We have made significant progress  towards reaching our first full&lt;br /&gt;(non-beta) release of Suricata.  Your  feedback is always important to us&lt;br /&gt;and we appreciate your time and  effort.  As always, we are doing our&lt;br /&gt;best to make you aware of  continuing development and items within the&lt;br /&gt;engine that are not yet  complete.  With this in mind, please notice the&lt;br /&gt;list we have included  of known items we are working on.&lt;br /&gt;&lt;br /&gt;- Using the http_cookie  keyword seems to cause a match on all packets.&lt;br /&gt;- Currently we dont'  support the dce option for byte_test and byte_jump.&lt;br /&gt;- Stream  reassembly is currently only performed for app-layer code.&lt;br /&gt;-  Inconsistent time stamps in http log file due to handling &amp;amp; updating&lt;br /&gt;of  the http state.&lt;br /&gt;- DCE/RPC over udp is not currently supported.&lt;br /&gt;-  dce_stub_data does not respect relative modifiers.&lt;br /&gt;- Engine does not  work properly on big endian platforms.&lt;br /&gt;- Time based stats are not  calculated correctly.&lt;br /&gt;&lt;br /&gt;See  https://redmine.openinfosecfoundation.org/projects/suricata/issues&lt;br /&gt;for  an up to date list and to report new issues.&lt;/file&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3281601435817430401-4386438614025844245?l=pablo-secdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pablo-secdev.blogspot.com/feeds/4386438614025844245/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pablo-secdev.blogspot.com/2010/04/new-suricata-release-082.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/4386438614025844245'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/4386438614025844245'/><link rel='alternate' type='text/html' href='http://pablo-secdev.blogspot.com/2010/04/new-suricata-release-082.html' title='New suricata release 0.8.2'/><author><name>Pablo Rincon Crespo</name><uri>http://www.blogger.com/profile/03815482515770216027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://1.bp.blogspot.com/_pcm25IFkpzE/TTSAATVpVbI/AAAAAAAAABs/sktwWue8ntY/S220/pablo-t.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3281601435817430401.post-4413402354786573089</id><published>2009-12-25T09:43:00.000-08:00</published><updated>2010-07-22T03:20:48.318-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scapy'/><category scheme='http://www.blogger.com/atom/ns#' term='pcap'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='c'/><title type='text'>Improved version of pcap2rawc</title><content type='html'>This version split each packet into layers, and each layer is pointed from an array of name like rawpktLayer_name[]&lt;br /&gt;&lt;br /&gt;&lt;div id="code"&gt;&lt;pre&gt;&lt;br /&gt;-- pcap2RawCLayers.py --&lt;br /&gt;#!/usr/bin/python&lt;br /&gt;try:&lt;br /&gt;    from scapy.all import *&lt;br /&gt;except:&lt;br /&gt;    print "old way..."&lt;br /&gt;    from scapy import *&lt;br /&gt;&lt;br /&gt;import sys&lt;br /&gt;from binascii import *&lt;br /&gt;&lt;br /&gt;if len(sys.argv) ==2:&lt;br /&gt;    print "Parsing "+str(sys.argv[1])&lt;br /&gt;else:&lt;br /&gt;    print "Usage: python "+sys.argv[0]+" file.pcap"&lt;br /&gt;    exit(10)&lt;br /&gt;&lt;br /&gt;pcap=rdpcap(sys.argv[1])&lt;br /&gt;out=file(sys.argv[1]+".rawc","w")&lt;br /&gt;&lt;br /&gt;out.write("// Generated from pcap2RawCLayers.py\n")&lt;br /&gt;&lt;br /&gt;i=0&lt;br /&gt;buff=""&lt;br /&gt;arrays=[]&lt;br /&gt;&lt;br /&gt;for p in pcap:&lt;br /&gt;    print "// packet "+str(i)+": ***"&lt;br /&gt;&lt;br /&gt;    while p.payload and len(p.payload) &gt; 0:&lt;br /&gt;        q=p.copy()&lt;br /&gt;        q.payload = ''&lt;br /&gt;        bytes=len(q)&lt;br /&gt;        strbyte=""&lt;br /&gt;&lt;br /&gt;        for j in range(0,bytes):&lt;br /&gt;            if j %8 ==0:&lt;br /&gt;                strbyte = strbyte +"\n        "&lt;br /&gt;            strbyte = strbyte + "0x" + str(hexlify(str(q)[j]))&lt;br /&gt;            if j &lt; bytes-1:&lt;br /&gt;                if j+1 %8:&lt;br /&gt;                    strbyte= strbyte + ","&lt;br /&gt;                else:&lt;br /&gt;                    strbyte= strbyte + ", "&lt;br /&gt;&lt;br /&gt;        rawpkt="    rawpkt" + str(q.name) + "["+str(i)+"] = {" + strbyte + " }; /* end rawpkt" + str(p.name) +"["+ str(i) +"] */\n"&lt;br /&gt;        p=p.payload&lt;br /&gt;        arrays.append("rawpkt" + str(q.name))&lt;br /&gt;        buff = buff + rawpkt&lt;br /&gt;&lt;br /&gt;    if not p.payload and p.load:&lt;br /&gt;        q=p.copy()&lt;br /&gt;        bytes=len(q.load)&lt;br /&gt;        strbyte=""&lt;br /&gt;&lt;br /&gt;        for j in range(0,bytes):&lt;br /&gt;            if j %8 ==0:&lt;br /&gt;                strbyte = strbyte +"\n        "&lt;br /&gt;            strbyte = strbyte + "0x" + str(hexlify(str(q.load)[j]))&lt;br /&gt;            if j &lt; bytes-1:&lt;br /&gt;                if j+1 %8:&lt;br /&gt;                    strbyte= strbyte + ","&lt;br /&gt;                else:&lt;br /&gt;                    strbyte= strbyte + ", "&lt;br /&gt;&lt;br /&gt;        rawpkt="    rawpktPayload["+str(i)+"] = {" + strbyte + " }; /* end rawpktPayload["+ str(i) +"] */\n"&lt;br /&gt;        p=p.payload&lt;br /&gt;        arrays.append("rawpktPayload")&lt;br /&gt;&lt;br /&gt;    i=i+1&lt;br /&gt;    buff = buff + rawpkt&lt;br /&gt;&lt;br /&gt;declares=""&lt;br /&gt;for l in arrays:&lt;br /&gt;    declares = declares + "    uint8_t *"+ l +"["+str(i)+"];\n"&lt;br /&gt;       &lt;br /&gt;filebuff = declares+ "\n"+ buff + "\n"&lt;br /&gt;out.write(filebuff)&lt;br /&gt;out.close()&lt;br /&gt;&lt;br /&gt;print filebuff&lt;br /&gt;print "//"+ str(i) +" packets written in "+sys.argv[1]+".rawc"&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3281601435817430401-4413402354786573089?l=pablo-secdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pablo-secdev.blogspot.com/feeds/4413402354786573089/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pablo-secdev.blogspot.com/2009/12/improved-version-of-pcap2rawc.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/4413402354786573089'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/4413402354786573089'/><link rel='alternate' type='text/html' href='http://pablo-secdev.blogspot.com/2009/12/improved-version-of-pcap2rawc.html' title='Improved version of pcap2rawc'/><author><name>Pablo Rincon Crespo</name><uri>http://www.blogger.com/profile/03815482515770216027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://1.bp.blogspot.com/_pcm25IFkpzE/TTSAATVpVbI/AAAAAAAAABs/sktwWue8ntY/S220/pablo-t.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3281601435817430401.post-7591797790117467776</id><published>2009-12-22T14:30:00.000-08:00</published><updated>2009-12-22T14:48:24.798-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='projects'/><category scheme='http://www.blogger.com/atom/ns#' term='tools'/><category scheme='http://www.blogger.com/atom/ns#' term='suricata'/><category scheme='http://www.blogger.com/atom/ns#' term='scapy'/><category scheme='http://www.blogger.com/atom/ns#' term='snort'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Rule2Alert</title><content type='html'>Hi, some updates.&lt;br /&gt;I have started a new project with &lt;a href="http://malforge.com/"&gt;Josh Smith&lt;/a&gt; and &lt;a href="http://node5.blogspot.com/"&gt;Will Metcalf&lt;/a&gt;. Talking about scapy Josh told me if I would like to get involved in the project, and we created a google project called "&lt;a href="http://code.google.com/p/rule2alert/"&gt;rule2alert&lt;/a&gt;".&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;It's written in python and use scapy. The purpose of this project is to read snort compatible rules and write a pcap with packets that should match the rules. This can be used later to test NIDS like suricata and snort and detect problems on the detection plugins. Of course this needs a lot of development, for each rule keyword, so we don't think we will generate payloads for all the rules, but also for the majority of them. At the moment we deal with content and content modifiers, and also content hexa data specification, and flow options, performing TCP 3 way handshakes. The next steps will be focussed on http protocol options, like uricontent.&lt;br /&gt;&lt;br /&gt;We hope it will be a good QA tool. If you would like to get involved, feel free to get in touch.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3281601435817430401-7591797790117467776?l=pablo-secdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pablo-secdev.blogspot.com/feeds/7591797790117467776/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pablo-secdev.blogspot.com/2009/12/rule2alert.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/7591797790117467776'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/7591797790117467776'/><link rel='alternate' type='text/html' href='http://pablo-secdev.blogspot.com/2009/12/rule2alert.html' title='Rule2Alert'/><author><name>Pablo Rincon Crespo</name><uri>http://www.blogger.com/profile/03815482515770216027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://1.bp.blogspot.com/_pcm25IFkpzE/TTSAATVpVbI/AAAAAAAAABs/sktwWue8ntY/S220/pablo-t.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3281601435817430401.post-7489865743889130130</id><published>2009-12-07T11:53:00.001-08:00</published><updated>2009-12-07T11:54:24.923-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='valgrind'/><title type='text'>I must feel lucky...</title><content type='html'>Not too much people can say that saw this line:&lt;br /&gt;"the 'impossible' happened"...&lt;br /&gt;lol!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;valgrind: m_scheduler/scheduler.c:1144 (vgPlain_scheduler): &lt;span style="color: rgb(255, 0, 0);"&gt;the 'impossible' happened.&lt;/span&gt;&lt;br /&gt;valgrind: VG_(scheduler), phase 3: run_innerloop detected host state invariant failure&lt;br /&gt;==28716==    at 0x3802A7AC: report_and_quit (m_libcassert.c:140)&lt;br /&gt;==28716==    by 0x3802AABA: vgPlain_assert_fail (m_libcassert.c:205)&lt;br /&gt;==28716==    by 0x3804E283: vgPlain_scheduler (scheduler.c:1165)&lt;br /&gt;==28716==    by 0x38060CB0: run_a_thread_NORETURN (syswrap-linux.c:89)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3281601435817430401-7489865743889130130?l=pablo-secdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pablo-secdev.blogspot.com/feeds/7489865743889130130/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pablo-secdev.blogspot.com/2009/12/i-must-feel-lucky.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/7489865743889130130'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/7489865743889130130'/><link rel='alternate' type='text/html' href='http://pablo-secdev.blogspot.com/2009/12/i-must-feel-lucky.html' title='I must feel lucky...'/><author><name>Pablo Rincon Crespo</name><uri>http://www.blogger.com/profile/03815482515770216027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://1.bp.blogspot.com/_pcm25IFkpzE/TTSAATVpVbI/AAAAAAAAABs/sktwWue8ntY/S220/pablo-t.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3281601435817430401.post-7088922178897871662</id><published>2009-12-03T08:13:00.000-08:00</published><updated>2009-12-03T08:20:17.774-08:00</updated><title type='text'>Ante la inclusión en el Anteproyecto de Ley de Economía Sostenible</title><content type='html'>Today in Spain ... The gov want to be able to close a webpage without a court procedure if they "consider that there's" Author rights infringed.&lt;br /&gt;&lt;br /&gt;Ante la inclusión en el Anteproyecto de Ley de Economía sostenible de modificaciones legislativas que afectan al libre ejercicio de las libertades de expresión, información y el derecho de acceso a la cultura a través de Internet, los periodistas, bloggers, usuarios, profesionales y creadores de internet manifestamos nuestra firme oposición al proyecto, y declaramos que… &lt;p&gt;&lt;strong&gt;1.- Los derechos de autor no pueden situarse por encima de los derechos fundamentales de los ciudadanos&lt;/strong&gt;, como el derecho a la privacidad, a la seguridad, a la presunción de inocencia, a la tutela judicial efectiva y a la libertad de expresión.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;2.- La suspensión de derechos fundamentales es y debe seguir siendo competencia exclusiva del poder judicial.&lt;/strong&gt; Ni un cierre sin sentencia. Este anteproyecto, en contra de lo establecido en el artículo 20.5 de la Constitución, pone en manos de un órgano no judicial -un organismo dependiente del ministerio de Cultura-, la potestad de impedir a los ciudadanos españoles el acceso a cualquier página web.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;3.- La nueva legislación creará inseguridad jurídica en todo el sector tecnológico español&lt;/strong&gt;, perjudicando uno de los pocos campos de desarrollo y futuro de nuestra economía, entorpeciendo la creación de empresas, introduciendo trabas a la libre competencia y ralentizando su proyección internacional.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;4.- La nueva legislación propuesta amenaza a los nuevos creadores y entorpece la creación cultural&lt;/strong&gt;. Con Internet y los sucesivos avances tecnológicos se ha democratizado extraordinariamente la creación y emisión de contenidos de todo tipo, que ya no provienen prevalentemente de las industrias culturales tradicionales, sino de multitud de fuentes diferentes.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;5.- Los autores, como todos los trabajadores, tienen derecho a vivir de su trabajo con nuevas ideas creativas, modelos de negocio y actividades asociadas a sus creaciones&lt;/strong&gt;. Intentar sostener con cambios legislativos a una industria obsoleta que no sabe adaptarse a este nuevo entorno no es ni justo ni realista. Si su modelo de negocio se basaba en el control de las copias de las obras y en Internet no es posible sin vulnerar derechos fundamentales, deberían buscar otro modelo.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;6.- Consideramos que las industrias culturales necesitan para sobrevivir alternativas modernas, eficaces, creíbles y asequibles&lt;/strong&gt; y que se adecuen a los nuevos usos sociales, en lugar de limitaciones tan desproporcionadas como ineficaces para el fin que dicen perseguir.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;7.- Internet debe funcionar de forma libre y sin interferencias políticas auspiciadas por sectores que pretenden perpetuar obsoletos modelos de negocio e imposibilitar que el saber humano siga siendo libre.&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;8.- Exigimos que el Gobierno garantice por ley la neutralidad de la Red en España&lt;/strong&gt;, ante cualquier presión que pueda producirse, como marco para el desarrollo de una economía sostenible y realista de cara al futuro.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;9.- Proponemos una verdadera reforma del derecho de propiedad intelectual orientada a su fin: devolver a la sociedad el conocimiento, promover el dominio público y limitar los abusos de las entidades gestoras.&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;10.- En democracia las leyes y sus modificaciones deben aprobarse tras el oportuno debate público y habiendo consultado previamente a todas las partes implicadas.&lt;/strong&gt; No es de recibo que se realicen cambios legislativos que afectan a derechos fundamentales en una ley no orgánica y que versa sobre otra materia.&lt;/p&gt; &lt;p&gt;&lt;em&gt;&lt;strong&gt;Este texto se publica multitud de sitios web. Si estás de acuerdo, publícalo también en tu blog, twittéalo, facebookéalo.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3281601435817430401-7088922178897871662?l=pablo-secdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pablo-secdev.blogspot.com/feeds/7088922178897871662/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pablo-secdev.blogspot.com/2009/12/ante-la-inclusion-en-el-anteproyecto-de.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/7088922178897871662'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/7088922178897871662'/><link rel='alternate' type='text/html' href='http://pablo-secdev.blogspot.com/2009/12/ante-la-inclusion-en-el-anteproyecto-de.html' title='Ante la inclusión en el Anteproyecto de Ley de Economía Sostenible'/><author><name>Pablo Rincon Crespo</name><uri>http://www.blogger.com/profile/03815482515770216027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://1.bp.blogspot.com/_pcm25IFkpzE/TTSAATVpVbI/AAAAAAAAABs/sktwWue8ntY/S220/pablo-t.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3281601435817430401.post-6421668847042125430</id><published>2009-11-27T12:28:00.000-08:00</published><updated>2010-07-22T02:43:48.727-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='profiling'/><category scheme='http://www.blogger.com/atom/ns#' term='macosx'/><title type='text'>Profiling with shark on Mac OS X - Snow Leopard</title><content type='html'>Mac OS X has a simple  but useful tool called "Shark", that allows you to profile applications of different languages. The following are the steps to do a simple profile:&lt;br /&gt;&lt;br /&gt;How to do profiling with Mac OS X. &lt;p&gt; The version I'm running is Mac OS X 10.6.1 (Snow Leopard). I have installed the Development toolkit X-code and the typical tools like autoconf, automake, etc. You may also need to run it as root depending on your configuration. Mac OSX provide a great program for profiling on different languages. It's called "Shark". &lt;/p&gt;&lt;p&gt; 1. To run it type cmd+space bar and type Shark (Spotlight search is useful). &lt;/p&gt;&lt;p&gt;2. Now that you have Shark opened select "Launch" at the last combo (It list all the running processes, and you could also profile everything, but we are interested only on our app). &lt;/p&gt;&lt;p&gt;3. Now you can click on "Start", and a new dialog box will ask you for the executable path, and the arguments. Set them as you need.  You may also set environment vars for debugging or whatever. &lt;/p&gt;&lt;p&gt; 4. Now just click Ok and wait to see the results. &lt;/p&gt;&lt;p&gt;Now that the results are generated, you can order them by each of the columns "Self" and "Total" will indicate you the cost of each part, and this will give you the most critical sections. They can be simple code, but maybe it's executed a lot of times. So even appering very simple, if you can improve that part just a bit, you will win on performance!&lt;/p&gt;&lt;p&gt;Now you can check some features of Shark. You can expand in a hierarchical list, the traces of the function calls, and also the self/total cost% will be splitted into each function call, so you may see a grouped call with 24% but expanding it, you may have one call that use 10% another 5% and another 9%. This way you can get a draft in your mind of the execution flow. It is also able to show the profile by threads, and the call stack as "Heavy", "Tree" or both &lt;img src="https://wiki.openinfosecfoundation.org/pub/TWiki/SmiliesPlugin/smile.gif" alt="smile" title="smile" border="0" /&gt;&lt;/p&gt;&lt;p&gt;If you don't have the source code, don't worry. Shark disassemble the application for you, lol!&lt;br /&gt;&lt;/p&gt;&lt;p&gt; So now you may think you need to check the code of that part. Shark will also help you on that. Double click on the function call and the code will be displayed automatically. The cpu cost will appear with each important line.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;The rest is at your logic. You may need to determine where a loop can be costing a lot, or a performance improvement can be done. You can also have a look at the generated charts. The id of the cpu can be also specfied here. &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3281601435817430401-6421668847042125430?l=pablo-secdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pablo-secdev.blogspot.com/feeds/6421668847042125430/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pablo-secdev.blogspot.com/2009/11/profiling-with-shark-on-mac-os-x-snow.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/6421668847042125430'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/6421668847042125430'/><link rel='alternate' type='text/html' href='http://pablo-secdev.blogspot.com/2009/11/profiling-with-shark-on-mac-os-x-snow.html' title='Profiling with shark on Mac OS X - Snow Leopard'/><author><name>Pablo Rincon Crespo</name><uri>http://www.blogger.com/profile/03815482515770216027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://1.bp.blogspot.com/_pcm25IFkpzE/TTSAATVpVbI/AAAAAAAAABs/sktwWue8ntY/S220/pablo-t.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3281601435817430401.post-960636463007179796</id><published>2009-10-27T07:40:00.000-07:00</published><updated>2010-04-25T15:33:26.392-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scapy'/><category scheme='http://www.blogger.com/atom/ns#' term='pcap'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='network protocols'/><title type='text'>pcap2rawc.py</title><content type='html'>This is another script that maybe help someone coding things with raw c Packets. It take a pcap file and create a file with all that packets declared as c arrays.&lt;br /&gt;&lt;br /&gt;&lt;div class="code"&gt; &lt;pre&gt;&lt;br /&gt;&lt;br /&gt;#!/usr/bin/python&lt;br /&gt;# File: pcap2rawc.py&lt;br /&gt;# Pablo Rincon Crespo [pablo.rincon.crespo at gmail]&lt;br /&gt;#&lt;br /&gt;try:&lt;br /&gt;    from scapy.all import *&lt;br /&gt;except:&lt;br /&gt;    print "old way..."&lt;br /&gt;    from scapy import *&lt;br /&gt;&lt;br /&gt;import sys&lt;br /&gt;from binascii import *&lt;br /&gt;&lt;br /&gt;if len(sys.argv) ==2:&lt;br /&gt;    print "//Parsing "+str(sys.argv[1])&lt;br /&gt;else:&lt;br /&gt;    print "Usage: python "+sys.argv[0]+" file.pcap"&lt;br /&gt;    exit(10)&lt;br /&gt;&lt;br /&gt;pcap=rdpcap(sys.argv[1])&lt;br /&gt;out=file(sys.argv[1]+".rawc","w")&lt;br /&gt;&lt;br /&gt;out.write("// Generated from pcap2rawc.py\n")&lt;br /&gt;&lt;br /&gt;i=0&lt;br /&gt;for p in pcap:&lt;br /&gt;    i=i+1&lt;br /&gt;    print "//processing packet "+str(i)+": ***"&lt;br /&gt;    print p.command()&lt;br /&gt;    bytes=len(p)&lt;br /&gt;    strbyte=""&lt;br /&gt;    for j in range(0,bytes):&lt;br /&gt;        if j %8 ==0:&lt;br /&gt;            strbyte = strbyte +"\n        "&lt;br /&gt;        strbyte = strbyte + "0x" + str(hexlify(str(p)[j]))&lt;br /&gt;        if j &lt; bytes-1:&lt;br /&gt;            if j+1 %8:&lt;br /&gt;                strbyte= strbyte + ","&lt;br /&gt;            else:&lt;br /&gt;                strbyte= strbyte + ", "&lt;br /&gt;    rawpkt="    uint8_t rawpkt" + str(i) + "[] = {" +strbyte + " }; /* end rawpkt" + str(i) +" */\n"&lt;br /&gt;    print rawpkt&lt;br /&gt;&lt;br /&gt;    out.write(rawpkt + "\n")&lt;br /&gt;&lt;br /&gt;out.close()&lt;br /&gt;print "//"+ str(i) +" packets written in "+sys.argv[1]+".rawc"&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3281601435817430401-960636463007179796?l=pablo-secdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pablo-secdev.blogspot.com/feeds/960636463007179796/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pablo-secdev.blogspot.com/2009/10/pcap2rawcpy.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/960636463007179796'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/960636463007179796'/><link rel='alternate' type='text/html' href='http://pablo-secdev.blogspot.com/2009/10/pcap2rawcpy.html' title='pcap2rawc.py'/><author><name>Pablo Rincon Crespo</name><uri>http://www.blogger.com/profile/03815482515770216027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://1.bp.blogspot.com/_pcm25IFkpzE/TTSAATVpVbI/AAAAAAAAABs/sktwWue8ntY/S220/pablo-t.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3281601435817430401.post-2349929107457806896</id><published>2009-09-19T13:15:00.000-07:00</published><updated>2010-07-22T05:08:19.119-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='snort'/><category scheme='http://www.blogger.com/atom/ns#' term='ids'/><title type='text'>Snort  ( 2.8.* &lt; 2.8.5stable) Unified1 output bug</title><content type='html'>I have published a bug of snort 2.8. There are two proof of concept scripts here in this &lt;a target="_blank" href="http://www.megaupload.com/?d=HT4XX0LQ"&gt;tar.gz&lt;/a&gt; and a deep explanation of the problem in the .pdf&lt;br /&gt;&lt;br /&gt;Here is the advisory :)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Advisory:&lt;br /&gt;=========&lt;br /&gt;Snort unified 1 IDS Logging Alert Evasion, Logfile Corruption/Alert Falsify&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Log:&lt;br /&gt;====&lt;br /&gt;30/06/2009 Bug detected.&lt;br /&gt;20/07/2009 First mail with snort team.&lt;br /&gt;20/07/2009 Snort team answer they will fix it in the next release (2.8.5).&lt;br /&gt;16/09/2009 Snort 2.8.5 released, bug fixed.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Affected Versions:&lt;br /&gt;==================&lt;br /&gt;snort-2.8.1&lt;br /&gt;snort-2.8.2&lt;br /&gt;snort-2.8.3&lt;br /&gt;snort-2.8.4&lt;br /&gt;snort-2.8.5.beta*&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Discussion:&lt;br /&gt;===========&lt;br /&gt;snort-2.8.* is susceptible to a Denial Of Service Vulnerability with Snort unified 1 binary format.&lt;br /&gt;It occurs when snort.conf use the classic unified 1 output configuration as follows:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;output unified: filename snort.log, limit 128&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;and Stream5 preprocessor is enabled.&lt;br /&gt;&lt;br /&gt;This issue is due to the application's failure to properly set the offset of a memory buffer write when logging packet rebuilt streams data, resulting in corrupted unified log header and data in the logfile, out-of-bounds offsets, making impossible to parse/view the generated alerts with a normal parser/alert frontend.&lt;br /&gt;&lt;br /&gt;When an alert has packet data information (the raw packet) the function UnifiedLogStreamCallback() write the raw packet data overwriting the UnifiedLog header, that has the type and size of the alert, followed by the alert information.&lt;br /&gt;&lt;br /&gt;--output-plugins/spo_unified.c line 803 at least in snort-2.8.4 function UnifiedLogStreamCallback()&lt;br /&gt;--------&gt;SafeMemcpy(write_pkt_buffer, packet_data,...&lt;br /&gt;should be&lt;br /&gt;--------&gt;SafeMemcpy(write_pkt_buffer + offset, packet_data,...&lt;br /&gt;&lt;br /&gt;With this bug, the alert type and size are overwritten with the MAC addresses of the raw packet, so with malformed packets (Eth/IP/TCP/Data with modified MAC addresses), the size and the type (and other information) can be set falsifing alerts for a later parsing process. If an attacker build malformed packets, so an alert is falsified the size is bigger than 128M (the unified log limit size by default), snort will continue inserting alerts in the file, but a parser when reading that alert will try to jump 128M skipping the alerts inserted after the falsified one.&lt;br /&gt;&lt;br /&gt;An attacker can also insert a complete list of falsified alerts malforming packets, because the raw packet has TCP data that you can fill with falsified UnifiedLog alert structures (with the binary data), so would need to adjust the packet headers to set the "size of the alert" (overwritten with the MACs of the packet) making that the parser read the next alert in the offset that the TCP data will overwrite(the list of falsified alerts).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Impact:&lt;br /&gt;=======&lt;br /&gt;With this bug an attacker can break the alert log headers, making impossible for a parser to extract the alert information correctly. An attacker can also insert falsified alerts in the logfiles by injecting unified structures with false alerts, false pcaps (Ethernet/Ip/Tcp/Data) by malforming the packets of a TCP stream that match a normal alert, which wont be even correctly inserted.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Proof of concept:&lt;br /&gt;=================&lt;br /&gt;&lt;br /&gt;To reproduce the bug you must have a unified 1 parser accepting unified logs with the configuration in snort.conf as "  output unified: filename snort.log, limit 128" and the Stream5 preprocessor enabled. Then you need to send a content payload that will generate an alert, but this payload must be divided in two parts, sending them in two consecutive (and different) packets so Stream5 will reassemble as a PKT_REBUILT_STREAM. The header of the unified Alert log will be overwritten with the raw packet information. There are two proof of concept scapy scripts, one generate a pcap that insert an alert overwriting the header so that a parser think that the alert is bigger than 128M, and another that insert a falsified alert.&lt;br /&gt;&lt;br /&gt;The pcaps can be processed in snort with snort -r "the_file.pcap"...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Fix:&lt;br /&gt;====&lt;br /&gt;Install snort-2.8.5 or add the offset and recompile snort:&lt;br /&gt;--output-plugins/spo_unified.c line 803 at least in snort-2.8.4 function UnifiedLogStreamCallback()&lt;br /&gt;&lt;br /&gt;SafeMemcpy(write_pkt_buffer + offset, unifiedData-&gt;logheader,&lt;br /&gt;        sizeof(UnifiedLog), write_pkt_buffer,&lt;br /&gt;        write_pkt_buffer + sizeof(DataHeader) +&lt;br /&gt;        sizeof(UnifiedLog) + IP_MAXPACKET);&lt;br /&gt;&lt;br /&gt;offset += sizeof(UnifiedLog);&lt;br /&gt;&lt;br /&gt;unifiedData-&gt;data-&gt;current += sizeof(UnifiedLog);&lt;br /&gt;&lt;br /&gt;if(packet_data)&lt;br /&gt;{&lt;br /&gt;--------&gt;SafeMemcpy(write_pkt_buffer, packet_data,&lt;br /&gt;       offset + unifiedData-&gt;logheader-&gt;pkth.caplen,&lt;br /&gt;       write_pkt_buffer, write_pkt_buffer +&lt;br /&gt;       sizeof(DataHeader) + sizeof(UnifiedLog) + IP_MAXPACKET);&lt;br /&gt;&lt;br /&gt;if(fwrite(write_pkt_buffer, offset + unifiedData-&gt;logheader-&gt;pkth.caplen,&lt;br /&gt;          1, unifiedData-&gt;data-&gt;stream) != 1)&lt;br /&gt;    FatalError("SpoUnified: write failed: %s\n", strerror(errno));&lt;br /&gt;&lt;br /&gt;unifiedData-&gt;data-&gt;current += unifiedData-&gt;logheader-&gt;pkth.caplen;&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;--+ 825&lt;br /&gt;&lt;br /&gt;Look at that closely and you'll see that the buffer is overwritten if packet_data is not 0, and then the buffer is written to the log file. The fix is really simple. Just write to write_pkt_buffer +offset, instead of write_pkt_buffer.&lt;br /&gt;&lt;br /&gt;--------&gt;SafeMemcpy(write_pkt_buffer, packet_data,...&lt;br /&gt;--------&gt;SafeMemcpy(write_pkt_buffer + offset, packet_data,...&lt;br /&gt;&lt;br /&gt;or use unified 2.&lt;br /&gt;&lt;br /&gt;Conclusions:&lt;br /&gt;========&lt;br /&gt;An attacker can:&lt;br /&gt;1. Corrupt the log files.&lt;br /&gt;2. Perform attacks after malformed packets in order prevent that they would get&lt;br /&gt;logged/displayed.&lt;br /&gt;3. Make a DOS for the parsers by inserting alerts with header size &gt; than the filesize limit&lt;br /&gt;(They would loose a lot of alerts...).&lt;br /&gt;4. Insert a complete falsified attack session by encapsulating many alerts in the malformed&lt;br /&gt;tcp packets.&lt;br /&gt;5. We can patch it and be happy with our systems using Stream5 and the rest of the&lt;br /&gt;preprocessors :)&lt;br /&gt;6. It's extremely recommended to use unified2 if you're not using it yet.&lt;br /&gt;7. If you still using unified1, use alert_unified or (log_unified), or just unified but patching snort.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Thanks to:&lt;br /&gt;==========&lt;br /&gt;Jaime Blasco and Juan Blanco working on the ossim-agent "arakiri".&lt;br /&gt;Matt Jonkman and Victor Julien (a pcap generated with the splicer script was the starting point for the scapy scripts).&lt;br /&gt;Carlos Terrón for his great unified1 parser.&lt;br /&gt;The OSSIM project.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Credits:&lt;br /&gt;========&lt;br /&gt;Pablo Rincón Crespo 31/07/2009&lt;br /&gt;pablo.rincon.crespo&lt;br /&gt;at gmail&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3281601435817430401-2349929107457806896?l=pablo-secdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pablo-secdev.blogspot.com/feeds/2349929107457806896/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pablo-secdev.blogspot.com/2009/09/snort-28-285stable-unified1-output-bug.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/2349929107457806896'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/2349929107457806896'/><link rel='alternate' type='text/html' href='http://pablo-secdev.blogspot.com/2009/09/snort-28-285stable-unified1-output-bug.html' title='Snort  ( 2.8.* &lt; 2.8.5stable) Unified1 output bug'/><author><name>Pablo Rincon Crespo</name><uri>http://www.blogger.com/profile/03815482515770216027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://1.bp.blogspot.com/_pcm25IFkpzE/TTSAATVpVbI/AAAAAAAAABs/sktwWue8ntY/S220/pablo-t.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3281601435817430401.post-3781699508527337289</id><published>2009-09-16T22:28:00.000-07:00</published><updated>2010-07-22T03:21:45.890-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='snort'/><category scheme='http://www.blogger.com/atom/ns#' term='ids'/><title type='text'>another birthday present</title><content type='html'>From: &lt;span class="gI"&gt;&lt;span email="snortreleases@snort.org" class="gD" style="color: rgb(0, 104, 28);"&gt;Snort Releases&lt;/span&gt; &lt;span class="go"&gt;&lt;snortreleases@snort.org&gt;&lt;br /&gt;To: &lt;/span&gt;&lt;/span&gt;&lt;span class="gI"&gt;snort-devel@lists.sourceforge.net&lt;br /&gt;&lt;/span&gt;&lt;span class="gI"&gt;Subject: [Snort-devel] Snort 2.8.5 Now Available&lt;/span&gt;&lt;br /&gt;&lt;span class="gI"&gt;&lt;br /&gt;&lt;/span&gt;Snort 2.8.5 is now available on &lt;a href="http://snort.org/" target="_blank"&gt;snort.org&lt;/a&gt;, at&lt;br /&gt;&lt;a href="http://www.snort.org/downloads/" target="_blank"&gt;http://www.snort.org/&lt;wbr&gt;downloads/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;[...]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3281601435817430401-3781699508527337289?l=pablo-secdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pablo-secdev.blogspot.com/feeds/3781699508527337289/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pablo-secdev.blogspot.com/2009/09/another-birthday-present.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/3781699508527337289'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/3781699508527337289'/><link rel='alternate' type='text/html' href='http://pablo-secdev.blogspot.com/2009/09/another-birthday-present.html' title='another birthday present'/><author><name>Pablo Rincon Crespo</name><uri>http://www.blogger.com/profile/03815482515770216027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://1.bp.blogspot.com/_pcm25IFkpzE/TTSAATVpVbI/AAAAAAAAABs/sktwWue8ntY/S220/pablo-t.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3281601435817430401.post-1400824070696950304</id><published>2009-08-10T13:10:00.000-07:00</published><updated>2010-07-22T03:22:17.373-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scapy'/><category scheme='http://www.blogger.com/atom/ns#' term='pcap'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>NetMirror</title><content type='html'>I have created a small project hosted in code.google.com. The project hosting in Google has a lot of great features. If you are interested in network traffic mirroring, soft taps, traffic redistribution, have a look at &lt;a target="_blank" href="http://code.google.com/p/netmirror"&gt;NetMirror&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3281601435817430401-1400824070696950304?l=pablo-secdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pablo-secdev.blogspot.com/feeds/1400824070696950304/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pablo-secdev.blogspot.com/2009/08/netmirror.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/1400824070696950304'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/1400824070696950304'/><link rel='alternate' type='text/html' href='http://pablo-secdev.blogspot.com/2009/08/netmirror.html' title='NetMirror'/><author><name>Pablo Rincon Crespo</name><uri>http://www.blogger.com/profile/03815482515770216027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://1.bp.blogspot.com/_pcm25IFkpzE/TTSAATVpVbI/AAAAAAAAABs/sktwWue8ntY/S220/pablo-t.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3281601435817430401.post-5234686066149502041</id><published>2009-06-19T10:36:00.000-07:00</published><updated>2009-10-16T07:31:43.589-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scapy'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>pcap to scapy</title><content type='html'>&lt;span class="ossim_grey"&gt;  &lt;p&gt;Script that generate a python file with the packet generation code that Scapy need to replicate the traffic of a pcap file. I hope it would be useful for someone when testing NIDS features :)&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;dl&gt;&lt;div class="code"&gt; &lt;pre&gt;## pcap2scapy.py ##&lt;br /&gt;###################&lt;br /&gt;# Author: Pablo Rincon Crespo&lt;br /&gt;# mail: pablo@ossim.net&lt;br /&gt;# Comments: This script read a pcap and write a .py with the scapy commands needed to replicate the traffic.&lt;br /&gt;&lt;br /&gt;from scapy import *&lt;br /&gt;import sys&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;if len(sys.argv) ==2:&lt;br /&gt;     print "Parsing "+str(sys.argv[1])&lt;br /&gt;else:&lt;br /&gt;     print "Usage: python "+sys.argv[0]+" file.pcap"&lt;br /&gt;     exit(10)&lt;br /&gt;&lt;br /&gt;pcap=rdpcap(sys.argv[1])&lt;br /&gt;out=file(sys.argv[1]+".py","w")&lt;br /&gt;&lt;br /&gt;out.write("from scapy import *\n\nl=[]\n")&lt;br /&gt;i=0&lt;br /&gt;for p in pcap:&lt;br /&gt;     i=i+1&lt;br /&gt;#       p.display()&lt;br /&gt;     print "*** Scapy packet "+str(i)+": ***"&lt;br /&gt;     print p.command()&lt;br /&gt;     out.write("p="+p.command()+"\nl.append(p)\n\n")&lt;br /&gt;&lt;br /&gt;out.write("\n\n#sendp(l,iface='eth0')\n#wrpcap('/tmp/tmp.pcap',l)")&lt;br /&gt;&lt;br /&gt;out.close()&lt;br /&gt;print str(i) +" packets written in "+sys.argv[1]+".py"&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt; &lt;/div&gt;&lt;/dl&gt;   &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3281601435817430401-5234686066149502041?l=pablo-secdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pablo-secdev.blogspot.com/feeds/5234686066149502041/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pablo-secdev.blogspot.com/2009/09/pcap-to-scapy.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/5234686066149502041'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3281601435817430401/posts/default/5234686066149502041'/><link rel='alternate' type='text/html' href='http://pablo-secdev.blogspot.com/2009/09/pcap-to-scapy.html' title='pcap to scapy'/><author><name>Pablo Rincon Crespo</name><uri>http://www.blogger.com/profile/03815482515770216027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://1.bp.blogspot.com/_pcm25IFkpzE/TTSAATVpVbI/AAAAAAAAABs/sktwWue8ntY/S220/pablo-t.jpg'/></author><thr:total>0</thr:total></entry></feed>
