<?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/"
	>

<channel>
	<title>Perl &#8211; Phocean.net</title>
	<atom:link href="/tag/perl/feed" rel="self" type="application/rss+xml" />
	<link>/</link>
	<description>Computer Security Blog</description>
	<lastBuildDate>Fri, 24 Feb 2017 21:17:51 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.9.10</generator>
	<item>
		<title>Hostcheck</title>
		<link>/2010/01/15/hostcheck.html</link>
		<pubDate>Fri, 15 Jan 2010 12:44:21 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[Dev]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[Hostcheck]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[scan]]></category>
		<category><![CDATA[scanner]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=696</guid>
		<guid isPermaLink="false">http://www.phocean.net/?p=696</guid>
		<description><![CDATA[I continue to publish some my coding. Hostcheck is a simple Perl script that can be useful to quickly check if a list of host is up. It just read a host file and check if the host are available doing a ping test or trying to open a socket. Nothing great, but it may...<br><i class="icon-right-hand"></i> <span class="read-more"><a href="/2010/01/15/hostcheck.html">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p>I continue to publish some my coding.</p>
<p>Hostcheck is a simple Perl script that can be useful to quickly check if a list of host is up.<br />
It just read a host file and check if the host are available doing a ping test or trying to open a socket.</p>
<p>Nothing great, but it may help to quickly check that most of things are right after a network change, for instance.<br />
Because we want to test many hosts, and not to scan, the pace is fast so it may not be 100% reliable. The idea is to see roughly is the connectivity is correct or if your whole LAN is down.<br />
It uses colors and is easy to read, so it might be good to show to your manager ! :)</p>
<p>I hope it will be useful. More info and download link are <a title="Hostcheck" href="/tools/hostcheck">there</a>.</p>
<p><a href="/wp-content/uploads/2010/01/hostcheck.png" rel="lightbox[696]"><img class="aligncenter size-full wp-image-700" title="hostcheck" src="/wp-content/uploads/2010/01/hostcheck.png" alt="" width="651" height="401" /></a></p>
]]></content:encoded>
			</item>
		<item>
		<title>Perl : how to monitor a service remotely using sockets</title>
		<link>/2007/07/15/perl-how-to-monitor-a-service-remotely-using-sockets.html</link>
		<pubDate>Sun, 15 Jul 2007 17:59:55 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[Network]]></category>
		<category><![CDATA[OpenBSD]]></category>
		<category><![CDATA[IPSEC]]></category>
		<category><![CDATA[Isakmpd]]></category>
		<category><![CDATA[IsakmpdMon]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Protocols]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=64</guid>
		<guid isPermaLink="false">http://www.phocean.net/?p=64</guid>
		<description><![CDATA[I came to program my first Perl script based on sockets, after setting an IPSEC tunnel.

This tunnel is linking the remote peer and the local peer through an OpenBSD VPN gateway (managed with Isakmp).

The problem is that this connection is limited time, for access right reason. So it is not a 24 hours standard tunnel, but rather an on-demand type connection.

Note that the connection is automatically reseted by the remote peer, by invaliding the cookie of the connection and therefore obliging to renegotiate the VPN tunnel from the beginning : phase 1 of the key exchange.

In one word, the Isakmp service has to be restarted every time we need the tunnel to be up.

Of course, this is not the purpose of Isakmp to have such a mecanism and what is interesting is to start the tunnel from the local peer, every time it needs to do some transfer.

The graph below summarizes the situation :

IPSEC tunnel with OpenBSD as a VPN gateway

That why I came to develop a script that listen on a socket and allow that peer to remotely restart the Isakmp service.]]></description>
				<content:encoded><![CDATA[<p>I came to program my first Perl script based on sockets, after setting an IPSEC tunnel.</p>
<p>This tunnel is linking the remote peer and the local peer through an OpenBSD VPN gateway (managed with Isakmp).</p>
<p>The problem is that time allowed for this connection is limited, for security policy reasons. So it is not a 24- hour standard tunnel, but rather an on-demand type connection.</p>
<p>Note that the connection is automatically reset by the remote peer, by invalidating the connection cookie and therefore oblige to renegotiate the VPN tunnel from the beginning (phase 1 of the key exchange).</p>
<p>In other words, the Isakmp service has to be restarted every time we need the tunnel to be up.</p>
<p>Of course, it is not the purpose of Isakmp to have such a mechanism and what we want is to start the tunnel from the local peer, every time it needs to do some transfer.</p>
<p>The graph below summarizes the situation :</p>
<p style="text-align: center;"><img src="/wp-content/uploads/2007/07/ipsec-tunnel.png" alt="IPSEC tunnel with OpenBSD as a VPN gateway" /></p>
<p>That is why I came to develop a script that opens a socket and allows the peer to remotely restart the Isakmp service.</p>
<p><span id="more-64"></span></p>
<p>Perl is once again the perfect language for someone like me, who is not a developer. My script uses mainly 2 CPAN modules : <a title="NetServer::generic" href="http://http://search.cpan.org/~chstross/NetServer-Generic-1.03/Generic.pm" target="_blank">NetServer::Generic</a> to manage the socket and <a title="Proc::ProcessTable" href="http://search.cpan.org/~durist/Proc-ProcessTable-0.41/ProcessTable.pm" target="_blank">Proc::ProcessTable</a> to get the PID of a running process.</p>
<p>You can dowload it here : <strong><a title="IsakmpdMon" href="/wp-content/uploads/2007/07/isakmpdmon.zip">IsakmpdMon</a></strong>.</p>
<p>And here is the documentation on how to use it : <a title="IsakmpdMon Synopsys" href="/wp-content/uploads/2007/07/isakmpdmon.html"><strong>IsakmpdMon Synopsys</strong>.</a></p>
<p><strong>ATTENTION</strong> : for security reason, only trusted IPs should be allowed to send the commands.</p>
<p>To have your commands accepted, edit the line :</p>
<pre>my ($allowed) = ['10\.80\.1\.2'];</pre>
<p>with your IPs. It can be a list of IPs or hostnames separated by commas. You can use some jockers (*) for the names. Please refer to the <a title="NetServer::generic" href="http://http://search.cpan.org/~chstross/NetServer-Generic-1.03/Generic.pm" target="_blank">NetServer::Generic</a> documentation for more info.</p>
<p>Note that this script can be adapted to any usage to manage all kinds of services remotely&#8230;</p>
]]></content:encoded>
			</item>
		<item>
		<title>How to strip the attachment from an IMAP mail</title>
		<link>/2007/06/03/how-to-strip-the-attachment-from-an-imap-mail.html</link>
		<comments>/2007/06/03/how-to-strip-the-attachment-from-an-imap-mail.html#comments</comments>
		<pubDate>Sun, 03 Jun 2007 16:09:21 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[Dev]]></category>
		<category><![CDATA[attachment-stripper]]></category>
		<category><![CDATA[IMAP]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=53</guid>
		<guid isPermaLink="false">http://www.phocean.net/?p=53</guid>
		<description><![CDATA[While trying hard long and long hours to write a perl script that can extract attachments from pieces of e-mail, I realized that there were no clear info on the web on how to do, and that if I successed, I would publish that script.

Finally I succeded. That is actually very easy and that is probably why nothing was ever published about it. But, when you are a beginner in Perl (I learned it in 1 week), you normally need a little bit more help. Also, I was not alone in that case and there were a numerous questions on various forum, but without satisfying answers.]]></description>
				<content:encoded><![CDATA[<p>While trying hard long and long hours to write a perl script that can extract attachments from pieces of e-mail, I realized that there were no clear info on the web on how to do, and that if I successed, I would publish that script.</p>
<p>Finally I succeded. That is actually very easy and that is probably why nothing was ever published about it. But, when you are a beginner in Perl (I learned it in 1 week), you normally need a little bit more help. Also, I was not alone in that case and there were a numerous questions on various forum, but without satisfying answers.</p>
<p><span id="more-53"></span> As I said, my script is extrimely simple.</p>
<p>It is based on the Mail::IMAPTalk module to establish the IMAP connection and on the MIME::Parser module to parse the mail as a MIME object (given by the first module).</p>
<p>I know there is a dedicated CPAN module to strip attachment : Mail::Attachment::Stripper, but, I could never get it to work and the author did not answer to my e-mail.</p>
<p>You will find the script here with some comments that should explain well :</p>
<p><a title="attachment-stripper.zip" href="/wp-content/uploads/2007/06/attachment-stripper.zip">attachment-stripper.zip</a><a title="attachment stripper.pl" rel="attachment wp-att-54" href="/?attachment_id="> </a></p>
<p>Of course, that is just a quick and dirty base : it is up to you to improve / correct / extend it to fit your needs. If so, be nice to update me here. ;)<!--more--></p>
]]></content:encoded>
			<wfw:commentRss>/2007/06/03/how-to-strip-the-attachment-from-an-imap-mail.html/feed</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>
