<?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; php</title>
	<atom:link href="https://lakm.us/postit/tag/php/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>WIth php5-snmp installed, tried snmpwalk &#8230;</title>
		<link>https://lakm.us/postit/2010/03/with-php5-snmp-installed-tried-snmpwalk/</link>
		<comments>https://lakm.us/postit/2010/03/with-php5-snmp-installed-tried-snmpwalk/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 08:59:05 +0000</pubDate>
		<dc:creator><![CDATA[Arif]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[SNMP]]></category>

		<guid isPermaLink="false">http://xp-racy.lan/postit/?p=38</guid>
		<description><![CDATA[WIth php5-snmp installed, tried snmpwalk through php: 1 2 3 4 5 6 7 &#60;?php $a = snmpwalk&#40;&#34;127.0.0.1&#34;, &#34;public&#34;, &#34;&#34;&#41;; &#160; foreach &#40;$a as $val&#41; &#123; echo &#34;$val\n&#34;; &#125; ?&#62;]]></description>
				<content:encoded><![CDATA[<p>WIth php5-snmp installed, tried snmpwalk through php:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</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: #000088;">$a</span> <span style="color: #339933;">=</span> <span style="color: #990000;">snmpwalk</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;127.0.0.1&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;public&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</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;">$a</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$val</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: #006699; font-weight: bold;">$val</span><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: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>https://lakm.us/postit/2010/03/with-php5-snmp-installed-tried-snmpwalk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>$first_ip=$_SERVER[&#039;REMOTE_ADDR&#039;];  $ &#8230;</title>
		<link>https://lakm.us/postit/2010/03/first_ip_serverremote_addr/</link>
		<comments>https://lakm.us/postit/2010/03/first_ip_serverremote_addr/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 03:30:08 +0000</pubDate>
		<dc:creator><![CDATA[Arif]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[rDNS]]></category>

		<guid isPermaLink="false">http://xp-racy.lan/postit/?p=25</guid>
		<description><![CDATA[1 2 $first_ip=$_SERVER&#91;'REMOTE_ADDR'&#93;; $hostname=gethostbyaddr&#40;$first_ip&#41;; For example 1 2 3 4 5 &#60;?php $first_ip=&#34;192.168.1.17&#34;; $hostname=gethostbyaddr&#40;$first_ip&#41;; echo $hostname; ?&#62; which in my current LAN will gives the output: gungz-3c2d7c341.local]]></description>
				<content:encoded><![CDATA[
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$first_ip</span><span style="color: #339933;">=</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REMOTE_ADDR'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$hostname</span><span style="color: #339933;">=</span><span style="color: #990000;">gethostbyaddr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$first_ip</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>For example</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</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: #000088;">$first_ip</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;192.168.1.17&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$hostname</span><span style="color: #339933;">=</span><span style="color: #990000;">gethostbyaddr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$first_ip</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$hostname</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>which in my current LAN will gives the output:<br />
gungz-3c2d7c341.local</p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/postit/2010/03/first_ip_serverremote_addr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>
