<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/12867" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2006-12-24T16:27:39-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/12867</id>

		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2006-12-23T22:32:39-04:00</updated>

		<published>2006-12-23T22:32:39-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=69211#p69211</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=69211#p69211"/>
		<title type="html"><![CDATA[[Solved] Formating ip's: CIDR to dotted?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=69211#p69211"><![CDATA[
Cool..  I had thought about making a cidr calculator for tcl, having plenty of em in perl and other script languages, but few in tcl (most of which that I've seen didn't have as many features as their perl counterparts, and also needed tk)  <br><br>I'd love to see someone make a full-featured cidr/network calculator for tcl/eggdrop <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Sat Dec 23, 2006 10:32 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Garp]]></name></author>
		<updated>2006-12-23T21:07:21-04:00</updated>

		<published>2006-12-23T21:07:21-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=69204#p69204</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=69204#p69204"/>
		<title type="html"><![CDATA[[Solved] Formating ip's: CIDR to dotted?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=69204#p69204"><![CDATA[
Ok, found a solution for that. Just for the records here the way on retriving the range of ips on a given CIDR (Classless Inter-Domain Routing) ip like 190.40.112.0/25<br><br><div class="codebox"><p>Code: </p><pre><code>                    set max_ip [expr ($min_ip + round(pow(2, [expr 32 - $subnetmask]))) - 1]</code></pre></div>Subnetmask is the part after / in CIDR.<br><br>The formula returns a long_ip. The min_ip is already in the CIDR format (190.40.112.0) and has to be turned into long_ip format for being calculated.<br><br>We get 190.40.112.0/25 is 3190321152 - 3190321279  or 190.40.112.0 - 190.40.112.127.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3849">Garp</a> — Sat Dec 23, 2006 9:07 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Garp]]></name></author>
		<updated>2006-12-24T16:27:39-04:00</updated>

		<published>2006-12-23T08:39:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=69187#p69187</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=69187#p69187"/>
		<title type="html"><![CDATA[[Solved] Formating ip's: CIDR to dotted?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=69187#p69187"><![CDATA[
I wrote a little tcl script to do a whois lookup on a certain ip like 10.43.8.67 and return the country and the ip-range.<br><br>If the ip-range is in the format "10.43.8.64 - 10.43.8.79" everything is ok, I can turn the ips into longips and store them for later lookups in a mysql db. <br><br>But sometimes the whois lookup returns CIDR formated values like 10.43.8.67/28 and I don't know on which way I can calculate the dotted ip range. Could somebody help?<br><br>My code at the moment:<br><div class="codebox"><p>Code: </p><pre><code>if {[namespace exists ::ip2nation]} {namespace delete ::ip2nation}namespace eval ::ip2nation {namespace export dowhoisvariable whoisbin [lindex [split [exec which whois]] 0]variable version 0.1variable rp; array set rp {inetnum {(?ni)inetnum: (.*)}country {(?ni)country: (.*)}}putlog "\00312$rp(inetnum)\003";proc dowhois {uhost} {if [regexp {[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$} $uhost] {            if {[catch {set lookup [eval exec $::ip2nation::whoisbin $uhost]} xError] != 0} {                return -code error "Error calling whois:  ($::ip2nation::whoisbin $uhost): $xError"            }                        foreach line [split [string trim [regsub -all {;(.+?)\n} $lookup {}]] \n] {if {![string length $line]} {continue}                if [string match "*inetnum*" $line] {                    regexp $::ip2nation::rp(inetnum) $line {} netblock                    putlog "\00304netblock [string trim $netblock]\003";                    if [string match "*/*" $rep] {                    # here I am lost, I could start a perl script to calculate the ip but that's not what I want.                                        }                }                           if [string match "*country*" $line] {                    regexp $::ip2nation::rp(country) $line {} country                    putlog "\00304country [string trim $country]\003";                                    }}                                           } else {                dnslookup $uhost dns_test                }}     proc dns_test {ip uhost status} {     dowhois $ip     }}package provide ip2nation $::ip2nation::versionputlog "\00304ip2nation.tcl v$::iptnation:version\003 "</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3849">Garp</a> — Sat Dec 23, 2006 8:39 am</p><hr />
]]></content>
	</entry>
	</feed>
