<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Mezgani blog</title>
	<atom:link href="http://securfox.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://securfox.wordpress.com</link>
	<description>Hey what is up, figured I my tis well be the first one to put something in here.</description>
	<lastBuildDate>Fri, 20 Jan 2012 16:32:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='securfox.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/666501f0d13b19a3fc24a5e7547bd488?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Mezgani blog</title>
		<link>http://securfox.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://securfox.wordpress.com/osd.xml" title="Mezgani blog" />
	<atom:link rel='hub' href='http://securfox.wordpress.com/?pushpress=hub'/>
		<item>
		<title>مناجاة، أذكار وأدعية</title>
		<link>http://securfox.wordpress.com/2011/05/16/%d8%b0%d9%83%d8%b1-%d9%85%d9%86%d8%a7%d8%ac%d8%a7%d8%aa%d8%8c-%d8%a3%d8%b0%d9%83%d8%a7%d8%b1-%d9%88%d8%a3%d8%af%d8%b9%d9%8a%d8%a9/</link>
		<comments>http://securfox.wordpress.com/2011/05/16/%d8%b0%d9%83%d8%b1-%d9%85%d9%86%d8%a7%d8%ac%d8%a7%d8%aa%d8%8c-%d8%a3%d8%b0%d9%83%d8%a7%d8%b1-%d9%88%d8%a3%d8%af%d8%b9%d9%8a%d8%a9/#comments</comments>
		<pubDate>Mon, 16 May 2011 23:26:28 +0000</pubDate>
		<dc:creator>Ali MEZGANI</dc:creator>
				<category><![CDATA[informational]]></category>
		<category><![CDATA[مناجات]]></category>
		<category><![CDATA[أدعية]]></category>
		<category><![CDATA[أذكار]]></category>

		<guid isPermaLink="false">http://securfox.wordpress.com/?p=513</guid>
		<description><![CDATA[I&#8217;ve recently write a Blog about monologues, prayers and remembrances and i hope that will help me and others to pray to GOD correctly and use each prayer in each contest, the Blog is named Dikr and can be found at the URL: http://www.dikr.tk/ Please feel free to join Dikr community.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=securfox.wordpress.com&amp;blog=2198132&amp;post=513&amp;subd=securfox&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently write a Blog about monologues, prayers and remembrances and i hope that will help me and others to pray to GOD correctly and use each prayer in each contest, the Blog is named <strong><a href="http://www.dikr.tk/">Dikr</a></strong> and can be found at the URL: <a href="http://www.dikr.tk/">http://www.dikr.tk/</a> Please feel free to join Dikr community. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/securfox.wordpress.com/513/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/securfox.wordpress.com/513/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/securfox.wordpress.com/513/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/securfox.wordpress.com/513/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/securfox.wordpress.com/513/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/securfox.wordpress.com/513/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/securfox.wordpress.com/513/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/securfox.wordpress.com/513/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/securfox.wordpress.com/513/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/securfox.wordpress.com/513/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/securfox.wordpress.com/513/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/securfox.wordpress.com/513/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/securfox.wordpress.com/513/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/securfox.wordpress.com/513/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=securfox.wordpress.com&amp;blog=2198132&amp;post=513&amp;subd=securfox&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://securfox.wordpress.com/2011/05/16/%d8%b0%d9%83%d8%b1-%d9%85%d9%86%d8%a7%d8%ac%d8%a7%d8%aa%d8%8c-%d8%a3%d8%b0%d9%83%d8%a7%d8%b1-%d9%88%d8%a3%d8%af%d8%b9%d9%8a%d8%a9/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/44c0ad27ea3da8ed33517faed892646c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Handrix</media:title>
		</media:content>
	</item>
		<item>
		<title>A Method for Transmissing PPP Over Ethernet (PPPoE) (RFC2516)</title>
		<link>http://securfox.wordpress.com/2011/01/22/a-method-for-transmissing-ppp-over-ethernet-pppoe-rfc2516/</link>
		<comments>http://securfox.wordpress.com/2011/01/22/a-method-for-transmissing-ppp-over-ethernet-pppoe-rfc2516/#comments</comments>
		<pubDate>Sat, 22 Jan 2011 01:48:00 +0000</pubDate>
		<dc:creator>Ali MEZGANI</dc:creator>
				<category><![CDATA[informational]]></category>
		<category><![CDATA[rfc]]></category>

		<guid isPermaLink="false">http://securfox.wordpress.com/?p=510</guid>
		<description><![CDATA[Publication date : February 1999 RFC Author(s) : R.Wheeler, D.Simone, D. Carrel, J. Evarts, K. Lidl, L. Mamakos Category : informational The Point-to-point Protocol (PPP) provides a standard method for transporting multi-protocol datagrams over point-to-point links. PPPoE has two differents stages, first one is PPP Discovery stage that contains four steps when a host discovers [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=securfox.wordpress.com&amp;blog=2198132&amp;post=510&amp;subd=securfox&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Publication date : February 1999<br />
RFC Author(s)    : R.Wheeler, D.Simone, D. Carrel, J. Evarts, K. Lidl, L. Mamakos<br />
Category            : informational</p>
<p>The Point-to-point Protocol (PPP) provides a standard method for  transporting multi-protocol datagrams over point-to-point links.</p>
<p>PPPoE has two differents stages, first one is PPP Discovery stage that contains four steps when a host discovers the MAC address of peer (Concentrator) and the PPPoE session ID.<br />
In the fact, the Mac address and PPPoE_SESSION_ID uniquely define a  ession.<br />
The relationship between the peers is a simple client/server when a client asks server(Concentrator) for informations to establish<br />
the session. </p>
<p>The Frame sent is a simple Ethernet frame where the ETHER_TYPE is  set to either 0&#215;8863 (Discovery Stage) or 0&#215;8864 (PPP Session Stage).</p>
<p>Here is the Ethernet Payload for PPPoE:<br />
[ VER:4 | TYPE:4 | CODE:8 | SESSION_ID:16 | LENGTH:16 | PAYLOAD:16 ]</p>
<p>Discovery Stage : Ethernet Frame have the ETHER_TYPE field set to 0&#215;8863</p>
<p> 1. Client to server: Initiation (PPPoE Active Discovery Initiation)<br />
    PADI:<br />
    * Host send a broadcast packet, with the code field set to 0&#215;09<br />
    * The session id set to 0&#215;0000</p>
<p> 2. Server to client: Offer (PPPoE Active Disocvery Offer)<br />
    PADO:<br />
    * Access Concentrator reply to an unicast address, with code set to 0&#215;07<br />
    * The session id set to 0&#215;0000<br />
    * PADO packet contains AC-Name TAG, Service-Name TAG </p>
<p> 3. Client to server: Request (PPPoE Active Discovery Request)<br />
    PADR:<br />
    * Host receive one or more PADO packet and has to choice one<br />
    * Choice is based on AC-Name or Services offred<br />
    * Host send one PADR packet to Concentrator<br />
    * Destination is the unicat Ethernet address of Cencentrator<br />
    * code field is set to 0&#215;19 and session id is set to 0&#215;0000</p>
<p> 4. Server to client: Session-confirmation (PPPoE Active Discovery Session-confirmation)<br />
    PADS:<br />
    * When Access receive PADR it prepare to begin PPP session<br />
    * generate a unique session id<br />
    * reply with an unicat Ethernet address<br />
    * code field is set to 0&#215;65<br />
    * contains exactly one TAG of TAG_TYPE Service-Name</p>
<p> 5. Either end to other end: Termination (PADT)<br />
    * packet sent bu host or Access Concentrator<br />
    * session is established<br />
    * Destination address is unicast<br />
    * session is the SESSION_ID generated<br />
    * code field is set to 0xa7</p>
<p>Examples Using scapy:<br />
1. PADI:<br />
sendp(Ether(type=0&#215;8863,src=&#8221;00:60:4c:72:e7:69&#8243;,dst=&#8221;ff:ff:ff:ff:ff:ff&#8221;)/PPPoED(code=0&#215;09,sessionid=0&#215;0000),iface=&#8221;nas0&#8243;)</p>
<p>PADO:<br />
2. sendp(Ether(type=0&#215;8863,src=&#8221;00:bf:12:fa:90:fd&#8221;, dst=&#8221;00:60:4c:72:e7:69&#8243;)/PPPoED(code=0&#215;07,sessionid=0&#215;0000),iface=&#8221;nas0&#8243;)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/securfox.wordpress.com/510/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/securfox.wordpress.com/510/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/securfox.wordpress.com/510/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/securfox.wordpress.com/510/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/securfox.wordpress.com/510/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/securfox.wordpress.com/510/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/securfox.wordpress.com/510/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/securfox.wordpress.com/510/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/securfox.wordpress.com/510/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/securfox.wordpress.com/510/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/securfox.wordpress.com/510/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/securfox.wordpress.com/510/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/securfox.wordpress.com/510/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/securfox.wordpress.com/510/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=securfox.wordpress.com&amp;blog=2198132&amp;post=510&amp;subd=securfox&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://securfox.wordpress.com/2011/01/22/a-method-for-transmissing-ppp-over-ethernet-pppoe-rfc2516/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/44c0ad27ea3da8ed33517faed892646c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Handrix</media:title>
		</media:content>
	</item>
		<item>
		<title>EtherIP: Tunneling Ethernet Frames in IP Datagrams (RFC3378)</title>
		<link>http://securfox.wordpress.com/2011/01/05/etherip-tunneling-ethernet-frames-in-ip-datagrams-rfc3378/</link>
		<comments>http://securfox.wordpress.com/2011/01/05/etherip-tunneling-ethernet-frames-in-ip-datagrams-rfc3378/#comments</comments>
		<pubDate>Wed, 05 Jan 2011 10:05:28 +0000</pubDate>
		<dc:creator>Ali MEZGANI</dc:creator>
				<category><![CDATA[rfc]]></category>

		<guid isPermaLink="false">http://securfox.wordpress.com/?p=503</guid>
		<description><![CDATA[Publication date : September 2002 RFC Author(s) : R.Housley, S.Hollenbeck Category : informational EtherIP protocol developed in 1991, and used to tunnel Ethernet and IEEE 802.3 media access control (MAC) frames (including IEEE 802.1Q [VLAN] datagrams) across an IP internet. The EtherIP datagrams contains 16-bit header and a variable-length encapsulated Ethernet or IEEE 802.3 frame [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=securfox.wordpress.com&amp;blog=2198132&amp;post=503&amp;subd=securfox&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Publication date  : September 2002<br />
RFC Author(s)     : R.Housley, S.Hollenbeck<br />
Category             : informational</strong></p>
<p>EtherIP protocol developed in 1991, and used to tunnel Ethernet and IEEE 802.3 media access control (MAC) frames (including IEEE 802.1Q [VLAN] datagrams) across an IP internet.</p>
<p>The EtherIP datagrams contains  16-bit header and a variable-length encapsulated Ethernet or IEEE 802.3 frame that immediately follows IP fields.</p>
<p>The 16-bit of EtherIP header contains two fields, the version 4-bit that must be set to 3 (0011) and 12-bit reserved reserved for future that have to be set to zero, for encapsulation and decapsulation operations. An IP datagram with a EtherIP header must set the IPv4 protocol to 97 (decimal).</p>
<p>The brigde-like station must listen for IP datagram that contains the protocol 97 and ignore the rest LAN frames. if this case it extract MAC from datagrams on the LAN and calculate the (FCS) frame check sequence even the IP checksum does not provide integrity protection for Ethernet/IEEE 802.3, and append the frame as part of data link layer.</p>
<p>One security consideration solution is to protect the IP datagram that carry  EtherIP with IPsec [RFC2401].</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/securfox.wordpress.com/503/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/securfox.wordpress.com/503/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/securfox.wordpress.com/503/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/securfox.wordpress.com/503/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/securfox.wordpress.com/503/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/securfox.wordpress.com/503/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/securfox.wordpress.com/503/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/securfox.wordpress.com/503/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/securfox.wordpress.com/503/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/securfox.wordpress.com/503/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/securfox.wordpress.com/503/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/securfox.wordpress.com/503/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/securfox.wordpress.com/503/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/securfox.wordpress.com/503/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=securfox.wordpress.com&amp;blog=2198132&amp;post=503&amp;subd=securfox&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://securfox.wordpress.com/2011/01/05/etherip-tunneling-ethernet-frames-in-ip-datagrams-rfc3378/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/44c0ad27ea3da8ed33517faed892646c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Handrix</media:title>
		</media:content>
	</item>
		<item>
		<title>Sending text message using AT command</title>
		<link>http://securfox.wordpress.com/2011/01/02/sending-text-message-using-at-command/</link>
		<comments>http://securfox.wordpress.com/2011/01/02/sending-text-message-using-at-command/#comments</comments>
		<pubDate>Sun, 02 Jan 2011 17:00:03 +0000</pubDate>
		<dc:creator>Ali MEZGANI</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[system]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[at command linux]]></category>
		<category><![CDATA[modem mesasge text]]></category>
		<category><![CDATA[send message text]]></category>

		<guid isPermaLink="false">http://securfox.wordpress.com/?p=495</guid>
		<description><![CDATA[Playing with my USB dongle that is a 3g modem, i felt the need to send message using this modem. but i saw that it has no support to send message using AT command, well to check this use the AT+CSMS command before any shake. In the case when you have a GSM/GPRS modem/mobile phone [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=securfox.wordpress.com&amp;blog=2198132&amp;post=495&amp;subd=securfox&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Playing with my USB dongle that is a 3g modem, i felt the need to send message using this modem.<br />
but i saw that it has no support to send message using AT command, well to check this use the AT+CSMS command before any shake.</p>
<p>In the case when you have a GSM/GPRS modem/mobile phone with full support of what we talk about before :<br />
You can easily sending message using the great Kannel, or from scratch:<br />
In this article we will focus on how to send message using AT command and we can resume this in five steps :<br />
1. Initializing the modem<br />
2. Setting SMSC<br />
3. Storing the message into storage<br />
4. Sending<br />
5. Delete the message from storage</p>
<p>First of all, to interact with the device you need a serial tools like screen or may be minicom.<br />
Well i recommend the use of screen when you work on pseudo devices :</p>
<p>Let&#8217;s connect to the device (ttyUSB0) using screen with a baud of 9600 :<br />
<strong>$ screen /dev/ttyUSB0 9600</strong></p>
<p>1. Send the initialize strings :<br />
AT<br />
OK<br />
ATZ<br />
OK</p>
<p>2. Define the service center address as follow and verify that it is correct:<br />
AT+CSCA=&#8221;+85290000000&#8243;,145</p>
<p>145 means that we deal with formatted address using typical ISDN/telephony numbering plan<br />
(ITU E.164/E.163) and it is an international number.</p>
<p>3. In the fact if you may send a text messages to +85291234567, write the message first to storage area, as like as:<br />
AT+CMGW=&#8221;+85291234567&#8243;,145,&#8221;STO UNSENT&#8221;Hello world </p>
<p>4. And finally you can now send the message, referenced with it index:<br />
AT+CMSS=3</p>
<p>You can also do this if you rather to send it to mutli destinations:<br />
AT+CMSS=3,&#8221;91234567&#8243;<br />
AT+CMSS=3,&#8221;97777777&#8243;<br />
AT+CMSS=3,&#8221;96666666&#8243;</p>
<p>Lastly, delete the message from storage area.<br />
5. AT+CMGD=3</p>
<p>To read the first message indexed with 1 :<br />
AT+CMGR=1</p>
<p>Also if you need to play or list all the message in the storage<br />
AT+CMGL=&#8221;ALL&#8221;</p>
<p><a href="http://www.developershome.com/sms"><br />
Great document about this can be found here</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/securfox.wordpress.com/495/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/securfox.wordpress.com/495/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/securfox.wordpress.com/495/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/securfox.wordpress.com/495/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/securfox.wordpress.com/495/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/securfox.wordpress.com/495/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/securfox.wordpress.com/495/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/securfox.wordpress.com/495/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/securfox.wordpress.com/495/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/securfox.wordpress.com/495/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/securfox.wordpress.com/495/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/securfox.wordpress.com/495/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/securfox.wordpress.com/495/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/securfox.wordpress.com/495/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=securfox.wordpress.com&amp;blog=2198132&amp;post=495&amp;subd=securfox&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://securfox.wordpress.com/2011/01/02/sending-text-message-using-at-command/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/44c0ad27ea3da8ed33517faed892646c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Handrix</media:title>
		</media:content>
	</item>
		<item>
		<title>ICMPv6 Python client using pcs</title>
		<link>http://securfox.wordpress.com/2010/12/16/icmpv6-python-client-using-pcs/</link>
		<comments>http://securfox.wordpress.com/2010/12/16/icmpv6-python-client-using-pcs/#comments</comments>
		<pubDate>Thu, 16 Dec 2010 04:29:59 +0000</pubDate>
		<dc:creator>Ali MEZGANI</dc:creator>
				<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://blog.nativelabs.org/?p=493</guid>
		<description><![CDATA[Reading about IPv6 security, i get the need to write a simple IPv6 client using  python as first step, and libnet6 later. Well on python there are a nice module named pcs, that permit to forge packet, here is a example of a icmpv6 client : import pcs from pcs.packets.ipv6 import * from pcs.packets.icmpv6 import [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=securfox.wordpress.com&amp;blog=2198132&amp;post=493&amp;subd=securfox&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Reading about IPv6 security, i get the need to write a simple IPv6 client using  python as first step, and libnet6 later.</p>
<p>Well on python there are a nice module named pcs, that permit to forge packet, here is a example of a icmpv6 client :</p>
<pre><code>
import pcs

from pcs.packets.ipv6 import *
from pcs.packets.icmpv6 import *
from pcs.packets.ethernet import *
from socket import *

# building ethernet header
e = ethernet()
e.src = ether_atob(’de:de:de:de:de:de’)
e.dst = ether_atob(’da:da:da:da:da:da’)
e.type = ETHERTYPE_IPV6

# building ipv6 header
ip6 = ipv6()
ip6.src = ip6.dst = inet_pton(AF_INET6, "dead::beef")
ip6.length = 8 # equal to payload length.
ip6.hop = 255
ip6.next_header = IPPROTO_ICMPV6

# building icmpv6 echo request
icmpv6 = icmpv6(ICMP6_ECHO_REQUEST)
icmpv6.code = 0
icmpv6.id = 0x01
icmpv6.checksum = icmpv6.cksum(ip6, "") &amp; 0xffff

# we can now send our packet
pcap = pcs.PcapConnector(’ral0’)
pkt = pcs.Chain([e, ip6, icmpv6])
pcap.write(pkt.bytes, len(pkt.bytes))
</pre>
<p></code><br />
In the fast, you may see a pretty ICMP reply using your favorite sniffer wireshark or may be tcpdump. But if your prefer to be more techos you can get it using pcap module as like as :</p>
<pre><code>
import dpkt, pcap
pc = pcap.pcap()
pc.setfilter('icmp6')
for timestamp, packet in pc:
    print dpkt.ethernet.Ethernet(pkt)
</pre>
<p></code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/securfox.wordpress.com/493/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/securfox.wordpress.com/493/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/securfox.wordpress.com/493/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/securfox.wordpress.com/493/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/securfox.wordpress.com/493/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/securfox.wordpress.com/493/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/securfox.wordpress.com/493/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/securfox.wordpress.com/493/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/securfox.wordpress.com/493/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/securfox.wordpress.com/493/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/securfox.wordpress.com/493/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/securfox.wordpress.com/493/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/securfox.wordpress.com/493/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/securfox.wordpress.com/493/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=securfox.wordpress.com&amp;blog=2198132&amp;post=493&amp;subd=securfox&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://securfox.wordpress.com/2010/12/16/icmpv6-python-client-using-pcs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/44c0ad27ea3da8ed33517faed892646c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Handrix</media:title>
		</media:content>
	</item>
		<item>
		<title>IPv6 Router Advertisement Options for DNS Configuration (RFC6106)</title>
		<link>http://securfox.wordpress.com/2010/12/13/ipv6-router-advertisement-options-for-dns-configuration-rfc6106/</link>
		<comments>http://securfox.wordpress.com/2010/12/13/ipv6-router-advertisement-options-for-dns-configuration-rfc6106/#comments</comments>
		<pubDate>Mon, 13 Dec 2010 23:22:38 +0000</pubDate>
		<dc:creator>Ali MEZGANI</dc:creator>
				<category><![CDATA[rfc]]></category>

		<guid isPermaLink="false">http://blog.nativelabs.org/?p=482</guid>
		<description><![CDATA[Publication date  : November 2010 RFC Author(s)       : S. Park, L. Beloeil, S. Madanapalli Category              : Standards Track This article describe some specifications of RA DNS options, which allow  to IPv6 routers to advertise a list of DNS recursive server addresses and a list of Domain name server Search List to an IPv6 node. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=securfox.wordpress.com&amp;blog=2198132&amp;post=486&amp;subd=securfox&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:left;"><strong> Publication date  : November 2010<br />
RFC Author(s)       : S. Park, L. Beloeil, S. Madanapalli<br />
Category              : Standards Track</strong></p>
<p style="text-align:left;">This article describe some specifications of RA DNS options, which allow  to IPv6 routers to advertise a list of DNS recursive server addresses and a list of Domain name server Search List to an IPv6 node.</p>
<p style="text-align:left;">RA Options are based on Neighbor Discovery (ND) for IPv6 stateless  autoconfiguration, that provide a simple way to configure mobile node in a IPv6 network and which make ability to nomadic hosts to reach Internet Services. In this document (section 5) the IPv6 DNS configuration defines two ND  options :</p>
<p style="text-align:left;">1. The Recursive DNS Server (RDNSS) Contains one or more IPv6 addresses of recursive DNS servers, this Option Format contain 4 field :<br />
Type (8-bit), Length (8-bit), Reserved(16-bit), Lifetime(32-bit) and Addresse of IPv6 Recursive DNS servers (128-bit)</p>
<p style="text-align:left;">2. The DNS Search List (DNSSL) Contains one or more domains name, this Option Format contain 4 field :<br />
Type (8-bit), Length (8-bit), Reserved(16-bit), Lifetime(32-bit) and Domain Names of DNS Search List (128-bit)</p>
<p style="text-align:left;">Section 5.1, define that a packet with lifetime value set all one bits (0xffffffff) represents infinity, which mean that the node must keep the DNS parameters, until next update.</p>
<p style="text-align:left;">Section 5.2, define that a packet with lifetime value set to zero means that RDNSS address must no longer be used.</p>
<p style="text-align:left;">The RFC describe also, that storing RDNSS addresses from at least two different sources is highly recommended.</p>
<p style="text-align:left;">Source : <a title="RFC6106" href="https://tools.ietf.org/html/rfc6106" target="_blank">https://tools.ietf.org/html/rfc6106</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/securfox.wordpress.com/486/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/securfox.wordpress.com/486/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/securfox.wordpress.com/486/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/securfox.wordpress.com/486/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/securfox.wordpress.com/486/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/securfox.wordpress.com/486/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/securfox.wordpress.com/486/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/securfox.wordpress.com/486/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/securfox.wordpress.com/486/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/securfox.wordpress.com/486/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/securfox.wordpress.com/486/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/securfox.wordpress.com/486/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/securfox.wordpress.com/486/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/securfox.wordpress.com/486/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=securfox.wordpress.com&amp;blog=2198132&amp;post=486&amp;subd=securfox&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://securfox.wordpress.com/2010/12/13/ipv6-router-advertisement-options-for-dns-configuration-rfc6106/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/44c0ad27ea3da8ed33517faed892646c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Handrix</media:title>
		</media:content>
	</item>
		<item>
		<title>Converting MySQL to PostgreSQL</title>
		<link>http://securfox.wordpress.com/2010/12/12/converting-mysql-to-postgresql/</link>
		<comments>http://securfox.wordpress.com/2010/12/12/converting-mysql-to-postgresql/#comments</comments>
		<pubDate>Sun, 12 Dec 2010 21:47:42 +0000</pubDate>
		<dc:creator>Ali MEZGANI</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://blog.nativelabs.org/?p=477</guid>
		<description><![CDATA[It has been a long time that i did not write a post into my blog, well it&#8217;s time, working with bacula, i got a need to upgrade my database from MySQL to PostgreSQL. If you have to do so, well you can do it simpley using command line and tools given with these database [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=securfox.wordpress.com&amp;blog=2198132&amp;post=485&amp;subd=securfox&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It has been a long time that i did not write a post into my blog, well it&#8217;s time, working with bacula, i got a need to upgrade my database from MySQL to PostgreSQL.  If you have to do so, well you can do it simpley using command line and tools  given with these database applications.</p>
<p>First of all dump your tables with</p>
<p><strong>$ mysqldump &#8211;compatible=postgresql databasename &gt; outputfile.sql </strong></p>
<p>but even then you will have to change quote escaping:</p>
<p><strong>$ sed &#8220;s/\\\&#8217;/\&#8217;\'/g&#8221; outputfile.sql</strong></p>
<p>You also have to manually modify the data types  when /int.* unsigned/   &#8220;bigint&#8221; when /bigint/   &#8220;bigint&#8221; when &#8220;bit(1)&#8221;   &#8220;boolean&#8221; when &#8220;tinyint(1)&#8221;   &#8220;boolean&#8221; when /tinyint/   &#8220;tinyint&#8221; when /int/   &#8220;integer&#8221; when /varchar/   &#8220;varchar&#8221; when /char/   &#8220;char&#8221; when /(float|decimal)/   &#8220;decimal&#8221; when /double/    &#8220;double precision&#8221;</p>
<p>After you convert your tables, import them the same way you were used to in MySQL, that is</p>
<p><strong>$ psql -h server -d databasename -U username -W &lt; data.sql</strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/securfox.wordpress.com/485/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/securfox.wordpress.com/485/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/securfox.wordpress.com/485/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/securfox.wordpress.com/485/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/securfox.wordpress.com/485/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/securfox.wordpress.com/485/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/securfox.wordpress.com/485/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/securfox.wordpress.com/485/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/securfox.wordpress.com/485/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/securfox.wordpress.com/485/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/securfox.wordpress.com/485/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/securfox.wordpress.com/485/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/securfox.wordpress.com/485/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/securfox.wordpress.com/485/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=securfox.wordpress.com&amp;blog=2198132&amp;post=485&amp;subd=securfox&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://securfox.wordpress.com/2010/12/12/converting-mysql-to-postgresql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/44c0ad27ea3da8ed33517faed892646c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Handrix</media:title>
		</media:content>
	</item>
		<item>
		<title>Create random password using /dev/urandom</title>
		<link>http://securfox.wordpress.com/2010/08/16/create-random-password-using-devurandom/</link>
		<comments>http://securfox.wordpress.com/2010/08/16/create-random-password-using-devurandom/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 11:34:23 +0000</pubDate>
		<dc:creator>Ali MEZGANI</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://securfox.wordpress.com/?p=248</guid>
		<description><![CDATA[In many situation administrators are affronted to generate passwords, however it&#8217;s more secure to keep in eyes random password even that ordinarie one. Well, for such use let&#8217;s keep it simple and let&#8217;s define some files: /dev/random: is a special file that serves as a true random number generator or as a pseudorandom number generator. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=securfox.wordpress.com&amp;blog=2198132&amp;post=248&amp;subd=securfox&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In many situation administrators are affronted to generate passwords, however it&#8217;s more secure to keep in eyes random password even that ordinarie one.<br />
Well, for such use let&#8217;s keep it simple and let&#8217;s define some files:</p>
<p>/dev/random: is a special file that serves as a true random number generator or as a pseudorandom number generator.<br />
/dev/urandom: (&#8220;unlocked&#8221; random source) which reuses the internal pool to produce more pseudo-random bits.</p>
<p>If your system does not have /dev/random and /dev/urandom created already, they can be created with the following commands:<br />
<strong>$ mknod -m 644 /dev/random c 1 8<br />
$ mknod -m 644 /dev/urandom c 1 9<br />
$ chown root:root /dev/random /dev/urandom</strong></p>
<pre><code>
<strong>$ tr -cd a-zA-Z0-9 &lt; /dev/urandom | head -c 12 ; echo &quot;&quot;</strong>
</pre>
<p></code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/securfox.wordpress.com/248/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/securfox.wordpress.com/248/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/securfox.wordpress.com/248/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/securfox.wordpress.com/248/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/securfox.wordpress.com/248/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/securfox.wordpress.com/248/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/securfox.wordpress.com/248/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/securfox.wordpress.com/248/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/securfox.wordpress.com/248/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/securfox.wordpress.com/248/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/securfox.wordpress.com/248/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/securfox.wordpress.com/248/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/securfox.wordpress.com/248/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/securfox.wordpress.com/248/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=securfox.wordpress.com&amp;blog=2198132&amp;post=248&amp;subd=securfox&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://securfox.wordpress.com/2010/08/16/create-random-password-using-devurandom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/44c0ad27ea3da8ed33517faed892646c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Handrix</media:title>
		</media:content>
	</item>
		<item>
		<title>How to run source bash command between two lines and from file</title>
		<link>http://securfox.wordpress.com/2010/08/09/how-to-run-source-bash-command-between-two-lines/</link>
		<comments>http://securfox.wordpress.com/2010/08/09/how-to-run-source-bash-command-between-two-lines/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 01:12:35 +0000</pubDate>
		<dc:creator>Ali MEZGANI</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[source shell command]]></category>

		<guid isPermaLink="false">http://securfox.wordpress.com/?p=462</guid>
		<description><![CDATA[When i ran my start ADSL connection script, i've been many times blocked by a lock somewhere. It's no matter, so i realized a python script that can do what the bash command "source" does, even this few line of python can gives you possibility to run codes given between two lines. Here is the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=securfox.wordpress.com&amp;blog=2198132&amp;post=462&amp;subd=securfox&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><code>
<pre>
When i ran my start ADSL connection script, i've been many times blocked by a lock somewhere.
It's no matter, so i realized a python script that can do what the bash command "source" does, even this few line of python can gives you possibility to run codes given between two lines.
Here is the code :

#!/usr/bin/env python
import sys, os

if len(sys.argv) != 4:
   print "Usage: source file startline endline"
   sys.exit(1)

file  = sys.argv[1]
start = int(sys.argv[2])
end   = int(sys.argv[3])

fd=open(file, 'r')
data=fd.readlines()
enter = '\n'

for item in data:
   if enter  in data:
      data.remove(enter)

for cmd in data[start-1:end]:
   # debug print "exec command:", cmd.strip()
   os.popen(cmd.strip())
</code></pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/securfox.wordpress.com/462/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/securfox.wordpress.com/462/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/securfox.wordpress.com/462/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/securfox.wordpress.com/462/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/securfox.wordpress.com/462/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/securfox.wordpress.com/462/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/securfox.wordpress.com/462/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/securfox.wordpress.com/462/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/securfox.wordpress.com/462/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/securfox.wordpress.com/462/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/securfox.wordpress.com/462/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/securfox.wordpress.com/462/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/securfox.wordpress.com/462/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/securfox.wordpress.com/462/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=securfox.wordpress.com&amp;blog=2198132&amp;post=462&amp;subd=securfox&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://securfox.wordpress.com/2010/08/09/how-to-run-source-bash-command-between-two-lines/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/44c0ad27ea3da8ed33517faed892646c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Handrix</media:title>
		</media:content>
	</item>
		<item>
		<title>How to send a bit to the parallel port on Linux (2nd part)</title>
		<link>http://securfox.wordpress.com/2010/06/16/how-to-send-a-bit-to-the-parallel-port-on-linux-2nd-part/</link>
		<comments>http://securfox.wordpress.com/2010/06/16/how-to-send-a-bit-to-the-parallel-port-on-linux-2nd-part/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 02:19:01 +0000</pubDate>
		<dc:creator>Ali MEZGANI</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[programming c/c++]]></category>
		<category><![CDATA[system]]></category>
		<category><![CDATA[linux module LED parallel port]]></category>
		<category><![CDATA[parallel port driver]]></category>

		<guid isPermaLink="false">http://securfox.wordpress.com/?p=457</guid>
		<description><![CDATA[In this second part of how to send bits to the parallel port on Linux, i describe here basics on how to do the same on kernel space. Here is a simple linux kernel module, that create a char device named parlport, and you can communicate directly with device using the /dev/parlport #include &#60;linux/module.h&#62; #include [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=securfox.wordpress.com&amp;blog=2198132&amp;post=457&amp;subd=securfox&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In this second part of how to send bits to the parallel port on Linux, i describe here  basics on how to do the same on kernel space.<br />
Here is a simple linux kernel module, that create a char device named parlport, and you can communicate directly with device using the /dev/parlport</p>
<p>#include &lt;linux/module.h&gt;<br />
#include &lt;linux/kernel.h&gt;<br />
#include &lt;linux/init.h&gt;<br />
#include &lt;linux/fs.h&gt;<br />
#include &lt;linux/unistd.h&gt;<br />
#include &lt;asm/uaccess.h&gt;<br />
#include &lt;linux/file.h&gt;<br />
#include &lt;asm/io.h&gt;</p>
<p>#define NAME    &#8220;parlp&#8221;<br />
#define VERSION &#8220;0.1&#8243;<br />
#define LICENSE &#8220;GPL&#8221;<br />
#define DESCPT  &#8220;Simple Parallel Port LED driver&#8221;<br />
#define AUTHOR  &#8220;Mezgani Ali\n&#8221;\<br />
                &#8220;mail:           mezgani [AT] nativelabs [.] org\n&#8221;\<br />
                &#8220;blog:           http://securfox.wordpress.com/&#8221;</p>
<p>#define SUCCESS  0<br />
#define DEVICE_NAME &#8220;parlport&#8221;<br />
#define BASEPORT 0&#215;0378</p>
<p>static int major = 61;          /* major number assigned to our device driver */</p>
<p>static int  __init start_module(void);<br />
static void __exit clean_module(void);</p>
<p>static int device_open(struct inode *, struct file *);<br />
static int device_release(struct inode *, struct file *);<br />
static ssize_t device_read(struct file *, char *, size_t, loff_t *);<br />
static ssize_t device_write(struct file *, char *, size_t, loff_t *);</p>
<p>static struct file_operations fops = {<br />
        .open    = device_open,<br />
        .release = device_release,<br />
        .read    = device_read,<br />
        .write   = device_write<br />
};</p>
<p>static int<br />
__init start_module(void)<br />
{<br />
  int result;</p>
<p>  result = register_chrdev(major, DEVICE_NAME, &amp;fops);</p>
<p>  if (result &lt; 0) {<br />
    printk(KERN_ALERT &#8220;Registering device failed with %d\n&#8221;, major);<br />
    return result;<br />
  }</p>
<p>  if (!(request_region(BASEPORT, 1, DEVICE_NAME))){<br />
    printk(KERN_WARNING &#8220;Winbond error request region: %X\n&#8221;, BASEPORT);<br />
    release_region(BASEPORT, 1); </p>
<p>    return result;<br />
  } </p>
<p>  printk(KERN_INFO &#8220;I was assigned major number %d. To talk to\n&#8221;, major);<br />
  printk(KERN_INFO &#8220;the driver, create a dev file with\n&#8221;);<br />
  printk(KERN_INFO &#8220;&#8216;mknod /dev/%s c %d 0&#8242;.\n&#8221;, DEVICE_NAME, major);</p>
<p>  return SUCCESS;<br />
}</p>
<p>static void<br />
__exit clean_module(void)<br />
{<br />
  release_region(BASEPORT, 1);</p>
<p>  unregister_chrdev(major, DEVICE_NAME);<br />
  printk(KERN_ALERT &#8220;unregister_chrdev &amp;&amp; cleaning module\n&#8221;);</p>
<p>}</p>
<p>static int<br />
device_open(struct inode *inode, struct file *file)<br />
{<br />
  try_module_get(THIS_MODULE);<br />
  return SUCCESS;<br />
}</p>
<p>static int<br />
device_release(struct inode *inode, struct file *file)<br />
{<br />
  module_put(THIS_MODULE);<br />
  return 0;<br />
}</p>
<p>static ssize_t<br />
device_read(struct file *filp, char *buffer, size_t length, loff_t * offset)<br />
{<br />
  unsigned char pbuffer;<br />
  int len;</p>
<p>  /* input a byte (8 bits) from a port, call inb(port), it returns the byte it got */<br />
  pbuffer = inb(BASEPORT);</p>
<p>  len = copy_to_user(buffer, &amp;pbuffer, 1);<br />
  if (len)  return -EFAULT;</p>
<p>  if (*offset == 0) {<br />
    *offset += 1;<br />
    return 1;<br />
  } else {<br />
    return 0;<br />
  }<br />
}</p>
<p>static ssize_t<br />
device_write(struct file *filp,  char *buffer, size_t length, loff_t * offset)<br />
{ </p>
<p>  char  pbuffer, *ptr;<br />
  int len;</p>
<p>  ptr = buffer + length &#8211; 1;<br />
  len = copy_from_user(&amp;pbuffer, ptr, 1);<br />
  if (len)  return -EFAULT;</p>
<p>  /* output the data to parallel port */<br />
  outb(pbuffer, BASEPORT);<br />
  return 1;<br />
}</p>
<p>module_init(start_module);<br />
module_exit(clean_module);</p>
<p>MODULE_LICENSE(LICENSE);<br />
MODULE_AUTHOR(AUTHOR);<br />
MODULE_DESCRIPTION(DESCPT);<br />
MODULE_VERSION(VERSION);</p>
<p>Example of use after compilation ;</p>
<p><strong># insmod parlport.ko<br />
# mknod /dev/parlport c 61 0<br />
# chown 666 /dev/parlport<br />
# echo F &gt; /dev/parlport</strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/securfox.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/securfox.wordpress.com/457/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/securfox.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/securfox.wordpress.com/457/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/securfox.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/securfox.wordpress.com/457/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/securfox.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/securfox.wordpress.com/457/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/securfox.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/securfox.wordpress.com/457/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/securfox.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/securfox.wordpress.com/457/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/securfox.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/securfox.wordpress.com/457/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=securfox.wordpress.com&amp;blog=2198132&amp;post=457&amp;subd=securfox&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://securfox.wordpress.com/2010/06/16/how-to-send-a-bit-to-the-parallel-port-on-linux-2nd-part/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/44c0ad27ea3da8ed33517faed892646c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Handrix</media:title>
		</media:content>
	</item>
	</channel>
</rss>
