<?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>postIt &#187; class</title>
	<atom:link href="https://lakm.us/postit/tag/class/feed/" rel="self" type="application/rss+xml" />
	<link>https://lakm.us/postit</link>
	<description>Post-It sticky notes with PasteBin sense</description>
	<lastBuildDate>Thu, 02 Jan 2025 01:33:57 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.0.18</generator>
	<item>
		<title>Port scanner class.</title>
		<link>https://lakm.us/postit/2010/03/port-scanner-class/</link>
		<comments>https://lakm.us/postit/2010/03/port-scanner-class/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 02:39:00 +0000</pubDate>
		<dc:creator><![CDATA[Arif]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[IP]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[port]]></category>
		<category><![CDATA[scan]]></category>

		<guid isPermaLink="false">http://xp-racy.lan/postit/?p=20</guid>
		<description><![CDATA[Port scanner class. An example of usage is as follow where my IP is 192.168.1.10. The upper range for scanning isn&#8217;t alive: 192.168.1.11. I hide warnings due to open socket failure which will happen because the IP isn&#8217;t alive. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.developerfusion.com/code/3088/php-port-scanner/">Port scanner</a> class. An example of usage is as follow where my IP is 192.168.1.10. The upper range for scanning isn&#8217;t alive: 192.168.1.11. I hide warnings due to open socket failure which will happen because the IP isn&#8217;t alive.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
	<span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;display_errors&quot;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;scanner.class.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$ip_address1</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;192.168.1.10&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$ip_address2</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;192.168.1.11&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$my_scanner</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> PortScanner<span style="color: #009900;">&#40;</span><span style="color: #000088;">$ip_address1</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ip_address2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$my_scanner</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_ports</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;80&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$results</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$my_scanner</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">do_scan</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$results</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$ip</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$ip_results</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #990000;">gethostbyaddr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ip</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&lt;blockquote&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
		<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ip_results</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$port</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$port_results</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$port</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; : &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$port_results</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'pname'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; : &quot;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$port_results</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'status'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;open&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
			<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;closed&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;br /&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;/blockquote&gt;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
	  <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Results are as follow (it includes developerfusion.com port scan by default (?)):</p>
<p>developerfusion.com</p>
<blockquote><p>15 : netstat : closed<br />
16 : N/A : closed<br />
17 : qotd : closed<br />
18 : msp : closed<br />
19 : chargen : closed<br />
20 : ftp-data : closed<br />
21 : ftp : closed<br />
22 : ssh : closed<br />
23 : telnet : closed<br />
24 : N/A : closed<br />
25 : smtp : open<br />
80 : www : open<br />
110 : pop3 : closed<br />
3306 : mysql : closed<br />
1337 : N/A : closed<br />
666 : N/A : closed</p></blockquote>
<p>xp-racy.local</p>
<blockquote><p>80 : www : open</p></blockquote>
<p>192.168.1.11</p>
<blockquote><p>80 : www : closed</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/postit/2010/03/port-scanner-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
