Advertisement
NeoAky

Untitled

Sep 27th, 2022
1,469
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 1.79 KB | None | 0 0
  1. bind pub - !test asn_report
  2. proc asn_report {nick host handle chan text} {
  3.        set ipv6 0
  4.        set ipv4 0
  5.        set asn [lindex $text 0]
  6.        set subnet [lindex $text 1]
  7.        # nel caso in cui scrivano cazzate
  8.        set ipv6 [string match -nocase "*:*" $subnet]
  9.        set ipv4 [string match -nocase "*.*" $subnet]
  10.        putlog "ipv4: $ipv4"
  11.        putlog "ipv6: $ipv6"
  12.        if {[expr {$ipv4 == 0 && $ipv6 == 0} ] } {
  13.                 putserv "NOTICE $nick :- \037CIDR6-REPORT\037 - \002$nick\002, esempio per la sintassi !aspath 6939 2001:"
  14.                 return 0
  15.        }
  16.        putlog "sono dopo il notice di errore"
  17.        if { [expr {$ipv6 > 0 }] } {
  18.              putserv "PRIVMSG $chan : \002 "
  19.              putserv "PRIVMSG $chan : \002##\002 Request \037AS-PATH\037 of \002AS$asn\002 on prefix \002$subnet\002 via \037CI"
  20.              putserv "PRIVMSG $chan : \002 "
  21.              set data_var [exec w3m https://www.cidr-report.org/cgi-bin/as-report?as=$asn&view=2.0&v=6 2>&1 | grep "$subnet"]
  22.              set l [split $data_var "\r\n"]
  23.              foreach i $l { puthelp "PRIVMSG $chan : $i " }
  24.              putlog "<<$chan>> !$handle! !aspath"
  25.        } else {
  26.               if { [expr {$ipv4 > 0} ] } {  
  27.                      putserv "PRIVMSG $chan : \002 "
  28.                      putserv "PRIVMSG $chan : \002##\002 Request \037AS-PATH\037 of \002AS$asn\002 on prefix \002$subnet\002 via \037CI"
  29.                      putserv "PRIVMSG $chan : \002 "
  30.                      set data_var [exec w3m https://www.cidr-report.org/cgi-bin/as-report?as=$subnet&view=2.0 2>&1 | grep "$subnet"]
  31.                      set l [split $data_var "\r\n"]
  32.                      foreach i $l { puthelp "PRIVMSG $chan : $i " }
  33.                      putlog "<<$chan>> !$handle! !aspath"
  34.               }
  35.        }             
  36. }
Tags: TCL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement