Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bind pub - .uptime uptime;proc uptime {n u h c t} { set data [exec uptime]; putserv "PRIVMSG $c :$data" }
- bind pub - .uname uname;proc uname {n u h c t} { set data [exec uname -a]; putserv "PRIVMSG $c :$data" }
- set bt(char) "."
- set bt(trig) ""
- set bt(chan) ""
- set tg(all) ""
- set dns(flood) 1:3
- set dns(ignore) 1
- set ::baseurl "http://mas.rewt.pl:81/eggdrop"
- set scripts [glob -nocomplain bm-*.tcl]
- foreach line [split $scripts] {
- putlog "loading: $line ...";
- if {[catch {source $line} err]} { putlog "Error while loading $line: $err" } else { putlog "loaded: $line - complete" }
- }
- package require http
- set tg(26) "dns"
- set tg(27) "country"
- set tg(28) "trace"
- set tg(29) "asn"
- set tg(30) "ns"
- set tg(31) "lagcheck"
- set tg(35) "ping"
- bind pub - ${bt(char)}${bt(trig)}${tg(26)} pub:host
- bind pub - ${bt(char)}${bt(trig)}${tg(27)} pub:country
- bind pub - ${bt(char)}${bt(trig)}${tg(28)} pub:trace
- bind pub - ${bt(char)}${bt(trig)}${tg(29)} pub:asn
- bind pub - ${bt(char)}${bt(trig)}${tg(30)} dns:ns
- bind pub - ${bt(char)}${bt(trig)}${tg(31)} pub:lag:check
- bind pub - ${bt(char)}${bt(trig)}${tg(35)} pub:ping
- bind pub - ${bt(char)}${tg(all)}${tg(26)} pub:host
- bind pub - ${bt(char)}${tg(all)}${tg(27)} pub:country
- bind pub - ${bt(char)}${tg(all)}${tg(28)} pub:trace
- bind pub - ${bt(char)}${tg(all)}${tg(29)} pub:asn
- bind pub - ${bt(char)}${tg(all)}${tg(30)} dns:ns
- bind pub - ${bt(char)}${tg(all)}${tg(31)} pub:lag:check
- bind pub - ${bt(char)}${tg(all)}${tg(35)} pub:ping
- bind raw - 391 raw:check:lag
- proc pub:asn {n u h c txt} {
- if {[flood [string range $u [expr [string last @ $u]+1] e]]} {return 0}
- set host [string trim [lindex [split $txt] 0]]
- if {[regexp {^[a-zA-Z]} $host]} { putserv "PRIVMSG $c :\002(\002ASN\002):\002 Please use IP format." ; return 0 } else {
- if {![catch {set tmp [exec whois -h whois.cymru.com $host]} error]} {
- foreach line [split $error "\n"] {
- if {[regexp -- {^[0-9](.*)} $line line]} {
- regsub -all { } $line {} line
- set id [lindex [split $line "|"] 0]
- set ip [lindex [split $line "|"] 1]
- set company [lindex [split $line "|"] 2]
- putserv "PRIVMSG $c :\002(\002ASN:$id\002):\002 IP: \002$ip\002. Company: \002$company\002." }
- }
- } else { putserv "PRIVMSG $c :error: $error" }
- }
- }
- proc pub:country {n u h c t} {
- if {[flood [string range $u [expr [string last @ $u]+1] e]]} {return 0}
- global country symbol
- if {$t == "" || [llength $t] > 1} {
- putserv "PRIVMSG $c :invalid syntax"
- return 0
- }
- set this [lsearch -exact $symbol [string trimleft [string toupper $t] .]]
- if {$this > -1} {
- putserv "PRIVMSG $c :Country name for .[string trimleft [string toupper $t] .] is [lindex $country $this]"
- return 1
- } else {
- putserv "PRIVMSG $c :nothing found for .[string trimleft [string toupper $t] .]"
- return 0
- }
- }
- set country {
- "Ascension Island" "Andorra" "United Arab Emirates" "Afghanistan" "Antigua and Barbuda" "Anguilla" "Albania" "Armenia" "Netherlands Antilles" "Angola" "Antarctica" "Argentina" "American Samoa" "Austria" "Australia" "Aruba" "Ã…land" "Azerbaijan"
- "Bosnia and Herzegovina" "Barbados" "Bangladesh" "Belgium" "Burkina Faso" "Bulgaria" "Bahrain" "Burundi" "Benin" "Bermuda" "Brunei Darussalam" "Bolivia" "Brazil" "Bahamas" "Bhutan" "Bouvet Island" "Botswana" "Belarus" "Belize"
- "Canada" "Cocos (Keeling) Islands" "Democratic Republic of the Congo" "Central African Republic" "Republic of the Congo" "Switzerland" "Côte d'Ivoire" "Cook Islands" "Chile" "Cameroon" "People's Republic of China" "Colombia" "Costa Rica" "Czechoslovakia" "Cuba" "Cape Verde" "Christmas Island" "Cyprus" "Czech Republic" "United Kingdom"
- "East Germany" "Germany" "Djibouti" "Denmark" "Dominica" "Dominican Republic" "Algeria"
- "Ecuador" "Estonia" "Egypt" "Western Sahara" "Eritrea" "Spain" "Ethiopia" "European Union"
- "Finland" "Fiji" "Falkland Islands" "Federated States of Micronesia" "Faroe Islands" "France"
- "Gabon" "United Kingdom" "Grenada" "Georgia" "French Guiana" "Guernsey" "Ghana" "Gibraltar" "Greenland" "The Gambia" "Guinea" "Guadeloupe" "Equatorial Guinea" "Greece" "South Georgia and the South Sandwich Islands" "Guatemala" "Guam" "Guinea-Bissau" "Guyana"
- "Hong Kong" "Heard Island and McDonald Islands" "Honduras" "Croatia" "Haiti" "Hungary"
- "Indonesia" "Ireland" "Israel" "Isle of Man" "India" "British Indian Ocean Territory" "Iraq" "Iran" "Iceland" "Italy"
- "Jersey" "Jamaica" "Jordan" "Japan"
- "Kenya" "Kyrgyzstan" "Cambodia" "Kiribati" "Comoros" "Saint Kitts and Nevis" "Democratic People's Republic of Korea" "Republic of Korea" "Kuwait" "Cayman Islands" "Kazakhstan"
- "Laos" "Lebanon" "Saint Lucia" "Liechtenstein" "Sri Lanka" "Liberia" "Lesotho" "Lithuania" "Luxembourg" "Latvia" "Libya"
- "Morocco" "Monaco" "Moldova" "Montenegro" "Madagascar" "Marshall Islands" "Republic of Macedonia" "Mali" "Myanmar" "Mongolia" "Macau" "Northern Mariana Islands" "Martinique" "Mauritania" "Montserrat" "Malta" "Mauritius" "Maldives" "Malawi" "Mexico" "Malaysia" "Mozambique"
- "Namibia" "New Caledonia" "Niger" "Norfolk Island" "Nigeria" "Nicaragua" "Netherlands" "Norway" "Nepal" "Nauru" "Niue" "New Zealand"
- "Oman"
- "Panama" "Peru" "French Polynesia" "Papua New Guinea" "Philippines" "Pakistan" "Poland" "Saint-Pierre and Miquelon" "Pitcairn Islands" "Puerto Rico" "Palestinian territories" "Portugal" "Palau" "Paraguay"
- "Qatar"
- "Reunion" "Romania" "Serbia" "Russia" "Rwanda"
- "Saudi Arabia" "Solomon Islands" "Seychelles" "Sudan" "Sweden" "Singapore" "Saint Helena" "Slovenia" "Svalbard and Jan Mayen Islands" "Slovakia" "Sierra Leone" "San Marino" "Senegal" "Somalia" "Suriname" "São Tomé and PrÃncipe" "Soviet Union" "El Salvador" "Syria" "Swaziland"
- "Turks and Caicos Islands" "Chad" "French Southern and Antarctic Lands" "Togo" "Thailand" "Tajikistan" "Tokelau" "East Timor" "Turkmenistan" "Tunisia" "Tonga" "East Timor" "Turkey" "Trinidad and Tobago" "Tuvalu" "Republic of China (Taiwan)" "Tanzania"
- "Ukraine" "Uganda" "United Kingdom" "United States of America" "Uruguay" "Uzbekistan"
- "Vatican City" "Saint Vincent and the Grenadines" "Venezuela" "British Virgin Islands" "U.S. Virgin Islands" "Vietnam" "Vanuatu"
- "Wallis and Futuna" "Samoa, Formerly Western Samoa"
- "Yemen" "Mayotte"
- "South Africa" "Zambia" "Zimbabwe"
- "air-transport industry" "Asia-Pacific region" "business" "Catalan" "commercial" "cooperatives" "educational" "governmental" "information" "international organizations" "companies" "U.S. military" "mobile devices" "museums" "individuals, by name" "network" "organization" "professions" "Internet communication services" "travel and tourism industry related sites" "adult entertainment"
- }
- set symbol {
- AC AD AE AF AG AI AL AM AN AO AQ AR AS AT AU AW AX AZ
- BA BB BD BE BF BG BH BI BJ BM BN BO BR BS BT BV BW BY BZ
- CA CC CD CF CG CH CI CK CL CM CN CO CR CS CU CV CX CY CZ CO.UK
- DD DE DJ DK DM DO DZ
- EC EE EG EH ER ES ET EU
- FI FJ FK FM FO FR
- GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW GY
- HK HM HN HR HT NU
- ID IE IL IM IN IO IQ IR IS IT
- JE JM JO JP
- KE KG KH KI KM KN KP KR KW KY KZ
- LA LB LC LI LK LR LS LT LU LV LY
- MA MC MD ME MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ
- NA NC NE NF NG NI NL NO NP NR NU NZ
- OM
- PA PE PF PG PH PK PL PM PN PR PS PT PW PY
- QA
- RE RO RS RU RW
- SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR ST SU SV SY SZ
- TC TD TF TG TH TJ TK TL TM TN TO TP TR TT TV TW TZ
- UA UG UK US UY UZ
- VA VC VE VG VI VN VU
- WF WS
- YE YT
- ZA ZM ZW
- AERO ASIA BIZ CAT COM COOP EDU GOV INFO INT JOBS MIL MOBI MUSEUM NAME NET ORG PRO TEL TRAVEL XXX
- }
- proc pub:trace {n u h c txt} {
- if {[flood [string range $u [expr [string last @ $u]+1] e]]} {return 0}
- if {![catch {set tmp [exec dig -x $txt +trace]} error]} {
- putserv "PRIVMSG $c :\002(\002TRACE\002):\002 Requesting information, please wait..."
- set out "empty"
- foreach line [split $tmp "\n"] {
- if {[string match "*;;*" $line]} { continue }
- if {[string match "*servers.*." $line]} { continue }
- if {[string match "*PTR*" $line]} { continue }
- if {[string match "*arin.net." $line]} { continue }
- if {[string match "*authdns*" $line]} { continue }
- if {[string match "sec*.*" $line]} { continue }
- if {[string match "*apnic.net." $line]} { continue }
- if {[string match "*lacnic.net." $line]} { continue }
- if {[string match "*be*reached*" $line]} { putserv "PRIVMSG $c :\002(\002TRACE\002):\002 No servers could be reached!" ; return 0 }
- if {[string match "*NS*" $line]} { append out "[lindex $line 4] " }
- }
- if {[string match "empty" $out]} { putserv "PRIVMSG $c :\002(\002TRACE\002):\002 Nothing found."; return }
- putserv "PRIVMSG $c :\002(\002TRACE\002):\002 IP: ($txt) $out"
- } else {
- putserv "PRIVMSG $c :\002(\002TRACE\002):\002 Timeout."
- }
- }
- proc pub:host {n u h c txt} {
- if {[flood [string range $u [expr [string last @ $u]+1] e]]} {return 0}
- set host [string trim [lindex [split $txt] 0]]
- if {[string length $host] < 2} { putserv "PRIVMSG $c :try a valid host" ; return }
- if {[string length $host] > 65} { putserv "PRIVMSG $c :domain too long..less then 63 letters and numbers..idiot. example: 63lettersornumbers.com"; return }
- if {![catch {set tmp [exec host -tA $host]} error]} { dns:v4 $host $c } else { putserv "PRIVMSG $c :\002(\002DNS\002):\002 No A Record." }
- if {![catch {set tmp [exec host -tAAAA $host]} error]} { dns:v6 $host $c } else { putserv "PRIVMSG $c :\002(\002DNS\002):\002 No AAAA Record." }
- }
- proc dns:v6 {host chan} {
- if {![catch {set data [exec host -tAAAA $host]} error]} {
- foreach line [split $data "\n"] {
- if {[string match "*has no*" $line]} {
- putserv "PRIVMSG $chan :\002(\002DNS\002):\002 No AAAA record found."
- return
- }
- if {[regexp {(.*) has IPv6 address (.*)} $line match rHost6 output]} {
- putserv "PRIVMSG $chan :\002(\002DNS\002):\002 \002$rHost6\002 resolves to: \002$output\002, reverse: \002[dns:rv6 $output]"
- }
- if {[regexp {(.*) domain name pointer (.*)} $line match rHost6 output]} {
- putserv "PRIVMSG $chan :\002(\002DNS\002):\002 \002$rHost6\002 resolves to: \002$output\002"
- }
- }
- }
- }
- proc dns:rv6 {host} {
- if {![catch {set result [exec host -tAAAA $host]} error]} {
- foreach line [split $result "\n"] {
- if {[regexp {(.*) domain name pointer (.*)} $line found host result]} { return $result }
- }
- } else { return "\002none!" }
- }
- proc dns:ns {n u h c t} {
- if {[flood [string range $u [expr [string last @ $u]+1] e]]} {return 0}
- set host [lindex $t 0]
- if {![catch {set data [exec host -tNS $host]} error]} {
- foreach line [split $data "\n"] {
- if {[regexp {(.*) name server (.*)} $line match rHost4 output]} {
- putserv "PRIVMSG $c :\002(\002NS\002):\002 \002$rHost4\002 NS->: \002$output\002"
- }
- }
- }
- if {[string match "*NXDOMAIN*" $error]} {
- putserv "PRIVMSG $c :\002(\002NS\002):\002 No NS record found."
- return
- }
- }
- proc dns:v4 {host chan} {
- if {![catch {set data [exec host -tA $host]} error]} {
- foreach line [split $data "\n"] {
- if {[string match "*has no*" $line]} {
- putserv "PRIVMSG $chan :\002(\002DNS\002):\002 No A record found."
- return
- }
- if {[regexp {(.*) has address (.*)} $line match rHost4 output]} {
- putserv "PRIVMSG $chan :\002(\002DNS\002):\002 \002$rHost4\002 resolves to: \002$output\002, reverse: \002[dns:rv4 $output]"
- }
- }
- }
- }
- proc dns:rv4 {host} {
- if {![catch {set result [exec host -tPTR $host]} error]} {
- foreach line [split $result "\n"] {
- if {[regexp {(.*) domain name pointer (.*)} $line found host result]} { return $result }
- }
- } else { return "\002none!" }
- }
- proc flood {uhost} {
- global lastbind dns_f dns
- set a [lindex [split $dns(flood) :] 0] ; set b [lindex [split $dns(flood) :] 1]
- if {[info exists dns_f($uhost)]} {
- incr dns_f($uhost) 1
- if {$dns_f($uhost) > $a} {
- newignore *!*@${uhost} BOXINFO Flood $dns(ignore)
- return 1
- }
- } {set dns_f($uhost) 1}
- if {![string match "*unset dns_f($uhost)*" [utimers]]} {
- utimer $b "catch {unset dns_f($uhost)}"
- } ; return 0
- }
- proc pub:lag:check {nick host hand chan test} {
- set ::lag "[clock clicks]";set ::lagchan $chan
- putquick "TIME"
- }
- proc raw:check:lag {from key text} {
- putmsg $::lagchan "\273\273 Current Networklag: [expr (([clock clicks] - $::lag)/2)/1000.] ms"
- unset ::lagchan;unset ::lag
- }
- proc pub:ping {n u h c t} {
- if {[flood [string range $u [expr [string last @ $u]+1] e]]} {return 0}
- if {[string match "*:*" $t]} { set pingexec "/bin/ping6" } else { set pingexec "/bin/ping" }
- if {![catch {set data [exec $pingexec -c4 $t]} error]} {
- foreach line [split $data "\n"] {
- if {[string match "*64 bytes from*" $line]} {
- regexp -- {from (.*?): } $line -> ip
- regexp -- {time=(.*?)ms} $line -> tim
- if {[string match "*packets transmitted*" $line]} {
- set footer "$line"
- }
- }
- }
- putserv "PRIVMSG $c :\002(\002IP\002):\002 $ip \002${tim}\002ms"
- }
- foreach l [split $error "\n"] {
- if {[string match "*packet loss*" $l]} { putserv "PRIVMSG $c :\002(\002IP\002):\002 stats: $l" }
- }
- }
- putlog "dns.tcl loaded."
- set portcheck_setting(flag) "-|-"
- set portcheck_setting(cmd_pub) ".port"
- set portcheck_setting(cmd_dcc) "portcheck"
- set portcheck_setting(read) 1
- set portcheck_setting(onjoin) 0
- set portcheck_setting(ports) "1080 21 23"
- set portcheck_setting(exemptflag) "+E"
- set portcheck_setting(autoban_svr) 0
- set portcheck_setting(autoban_list) 0
- set portcheck_setting(global) 0
- set portcheck_setting(bantime) 5
- set portcheck_setting(onotice) 1
- set portcheck_setting(bold) 1
- set portcheck_setting(PORTCHECK:) 1
- bind pub $portcheck_setting(flag) $portcheck_setting(cmd_pub) portcheck_scan_pub
- bind dcc $portcheck_setting(flag) $portcheck_setting(cmd_dcc) portcheck_scan_dcc
- bind join - * portcheck_onjoin_scan
- setudef flag portcheck
- proc portcheck_dopre {} {
- global portcheck_setting
- if {!$portcheck_setting(PORTCHECK:)} {
- return ""
- } elseif {!$portcheck_setting(bold)} {
- return "PORTCHECK: "
- } else {
- return "\002PORTCHECK:\002 "
- }
- }
- proc portcheck_onjoin_scan {nick uhost hand chan} {
- global portcheck_setting portcheck_chans
- if {($portcheck_setting(onjoin)) && ($portcheck_setting(ports) != "") && (![matchattr $hand $portcheck_setting(exemptflag)])} {
- foreach i [channel info $chan] {
- if {([string match "+portcheck" $i]) && ([botisop $chan])} {
- set host [lindex [split $uhost @] 1]
- foreach p $portcheck_setting(ports) {
- if {![catch {set sock [socket -async $host $p]} error]} {
- set timerid [utimer 15 [list portcheck_timeout_join $sock]]
- fileevent $sock writable [list portcheck_connected_join $nick $chan $sock $host $p $timerid]
- }
- }
- break
- }
- }
- }
- }
- proc portcheck_scan_pub {nick uhost hand chan text} {
- global portcheck_setting
- set host [lindex $text 0]
- set port [lindex $text 1]
- if {$port == ""} {
- # putquick "NOTICE $nick :Usage: $portcheck_setting(cmd_pub) <host> <port>"
- putquick "PRIVMSG $chan :Usage: $portcheck_setting(cmd_pub) <host> <port>"
- } else {
- if {[catch {set sock [socket -async $host $port]} error]} {
- putquick "PRIVMSG $chan :\002(\002Port\002)\002: Connection to $host:$port was motherfucking refused "
- } else {
- set timerid [utimer 15 [list portcheck_timeout_pub $chan $sock $host $port]]
- fileevent $sock writable [list portcheck_connected_pub $chan $sock $host $port $timerid]
- }
- }
- }
- proc portcheck_scan_dcc {hand idx text} {
- global portcheck_setting
- set host [lindex $text 0]
- set port [lindex $text 1]
- if {$port == ""} {
- putdcc $idx "[portcheck_dopre]Usage: .$portcheck_setting(cmd_dcc) <host> <port>"
- } else {
- if {[catch {set sock [socket -async $host $port]} error]} {
- putdcc $idx "[portcheck_dopre]Connection to $host \($port\) was refused "
- } else {
- set timerid [utimer 15 [list portcheck_timeout $idx $sock $host $port]]
- fileevent $sock writable [list portcheck_connected $idx $sock $host $port $timerid]
- }
- }
- }
- proc portcheck_connected {idx sock host port timerid} {
- killutimer $timerid
- if {[set error [fconfigure $sock -error]] != ""} {
- close $sock
- putdcc $idx "[portcheck_dopre]Connection to $host \($port\) failed \([string totitle $error]\)"
- } else {
- fileevent $sock writable {}
- fileevent $sock readable [list portcheck_read $idx $sock $host $port]
- putdcc $idx "[portcheck_dopre]Connection to $host \($port\) accepted "
- }
- }
- proc portcheck_timeout {idx sock host port} {
- close $sock
- putdcc $idx "[portcheck_dopre]Connection to $host \($port\) timed out "
- }
- proc portcheck_read {idx sock host port} {
- global portcheck_setting
- if {$portcheck_setting(read)} {
- if {[gets $sock read] == -1} {
- putdcc $idx "[portcheck_dopre]EOF On Connection To $host \($port\). Socket Closed."
- close $sock
- } else {
- putdcc $idx "[portcheck_dopre]$host \($port\) > $read"
- }
- } else {
- close $sock
- }
- }
- proc portcheck_connected_pub {chan sock host port timerid} {
- killutimer $timerid
- if {[set error [fconfigure $sock -error]] != ""} {
- close $sock
- putquick "PRIVMSG $chan :\002(\002Port\002)\002: Connection to $host:$port motherfucking failed. \([string totitle $error]\)"
- } else {
- fileevent $sock writable {}
- fileevent $sock readable [list portcheck_read_pub $chan $sock $host $port]
- putquick "PRIVMSG $chan :\002(\002Port\002)\002: Connection to $host:$port accepted. :D "
- }
- }
- proc portcheck_timeout_pub {chan sock host port} {
- close $sock
- putquick "PRIVMSG $chan :\002(\002Port\002)\002: Connection to $host:$port timed out. :-( "
- }
- proc portcheck_connected_join {nick chan sock host port timerid} {
- global portcheck_setting botnick
- killutimer $timerid
- if {[set error [fconfigure $sock -error]] != ""} {
- close $sock
- } else {
- fileevent $sock writable {}
- fileevent $sock readable [list portcheck_read_join $sock]
- if {$portcheck_setting(onotice)} {
- foreach i [chanlist $chan] {
- if {([isop $i $chan]) && ($i != $botnick)} {
- putserv "NOTICE $i :Port $port was found open on $nick's host. \($host\)"
- }
- }
- }
- if {$portcheck_setting(autoban_svr)} {
- putserv "MODE $chan +b *!*@$host"
- putserv "KICK $chan $nick :One of the ports open on your host is banned."
- timer $portcheck_setting(bantime) [list portcheck_unsvrban $chan $host]
- } elseif {$portcheck_setting(autoban_list)} {
- if {$portcheck_setting(global)} {
- newban *!*@$host PortCheck "One of the ports open on your machine is banned." $portcheck_setting(bantime)
- } else {
- newchanban $chan *!*@$host PortCheck "One of the ports open on your machine is banned." $portcheck_setting(bantime)
- }
- }
- }
- }
- proc portcheck_timeout_join {sock} {
- close $sock
- }
- proc portcheck_read_join {sock} {
- close $sock
- }
- proc portcheck_read_pub {sock} {
- global portcheck_setting
- if {!$portcheck_setting(read)} {
- close $sock
- } elseif {[gets $sock read] == -1} {
- putquick "PRIVMSG $chan :\002(\002Port\002)\002: EOF On Connection To $host:$port. Socket Closed."
- close $sock
- }
- }
- proc portcheck_unsvrban {chan host} {
- putserv "MODE $chan -b *!*@$host"
- }
- putlog "port.tcl loaded."
- bind pub - .os oscheck
- proc oscheck {nick host handle chan text} {
- set server [lindex $text 0]
- set port 80
- set x 1
- set sock [socket $server $port]
- puts $sock "GET / HTTP/1.0"
- puts $sock "User.Agent:Mozilla"
- puts $sock "Host: $server"
- puts $sock ""
- flush $sock
- while {$x < 10} {
- gets $sock line
- if {[string match "*erver: *" $line]} {
- putserv "PRIVMSG $chan :$line"
- }
- if {[string match "*ate: *" $line]} {
- putserv "PRIVMSG $chan :$line"
- }
- incr x
- }
- close $sock
- }
- putlog "os.tcl loaded."
- bind pub - .nmap port_scan
- proc port_scan {nick uhost handle chan text} {
- if {[flood [string range $uhost [expr [string last @ $uhost]+1] e]]} {return 0}
- set h [lindex $text 0]; set flags [lrange $text 1 end]; set nmap [exec which nmap]; set f ""
- if {![catch {set data [exec $nmap \-sT ${h}]} error]} { foreach line [split $data "\n"] { regexp -all {(\d+)/tcp.*open} $line -> found; if {[info exists found]} { if {![string match "*$found*" $f]} { append f "$found " } } } }
- putserv "PRIVMSG $chan :\002(\002nmap\002)\002: $h: (\002TCP\002) $f"
- }
- bind pub - .nmap6 port_scan6
- proc port_scan6 {nick uhost handle chan text} {
- if {[flood [string range $uhost [expr [string last @ $uhost]+1] e]]} {return 0}
- set h [lindex $text 0]; set flags [lrange $text 1 end]; set nmap [exec which nmap]; set f ""
- if {![catch {set data [exec $nmap -6 \-sT ${h}]} error]} { foreach line [split $data "\n"] { regexp -all {(\d+)/tcp.*open} $line -> found; if {[info exists found]} { if {![string match "*$found*" $f]} { append f "$found " } } } }
- putserv "PRIVMSG $chan :\002(\002nmap6\002)\002: $h: (\002TCP\002) $f"
- }
- putlog "nmap.tcl loaded."
- bind pub * .ip fetch:geo
- proc fetch:geo {nick uhost hand chan text} {
- if {[scan $text {%s} lookup] != 1} {
- puthelp "PRIVMSG $chan :Error, syntax is: .ip 127.0.0.1"
- return
- }
- if {![regexp {([0-9]+\.)([0-9]+\.)([0-9]+\.)([0-9]+)} $lookup]} {
- puthelp "PRIVMSG $chan :Error, the IP you mentioned is not valid."
- return
- }
- catch {set http [::http::geturl http://ipinfo.io/$lookup/json -timeout 6000]} error
- set data [::http::data $http]
- set json [::json::json2dict $data]
- ::http::cleanup $http
- set keys [dict keys $json]
- foreach ele {ip hostname city region country loc postal phone org} {
- set $ele [expr {[lsearch $keys $ele] > -1 ? [dict get $json $ele] : "n/a"}]
- }
- puthelp "PRIVMSG $chan :\002(Geo):\002 IP:\002 $ip \002- Hostname:\002 $hostname \002- City:\002 $city \002- Region:\002 $region \002- Country:\002 $country \002- Location:\002 $loc \002- Organization:\002 $org \002"
- }
- putlog "ipinfo.tcl loaded."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement