Advertisement
Guest User

Untitled

a guest
Apr 9th, 2018
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 68.79 KB | None | 0 0
  1. ; AntiSpam Bot by toucan on DALnet -- Version 3.4.1
  2. ; Additional code by ShaiTaan` on DALnet.
  3. ;
  4.  
  5. on *:LOAD:{
  6. if ($version < 6) {
  7. .echo -q $input(Sorry you need version 6 or above of mIRC to use this script.,260,AntiSpam Bot)
  8. unload -rs antispam.mrc
  9. return
  10. }
  11. antispam.reset
  12. .echo -q $input(AntiSpam Bot 3.4.1 has been successully loaded. Anti Spam Bot By ShaiTaaN)
  13. }
  14.  
  15. on *:START:{
  16. unset %antispam.*
  17. if ($asini(personalize,password) == $null) {
  18. writeini -s " $+ $scriptdir $+ antispam.ini $+ " personalize identify no
  19. }
  20. }
  21.  
  22.  
  23.  
  24. on *:INPUT:@antispambot:{
  25. if ($left($1,1) != /) {
  26. if ($sock(antispam).status == active) {
  27. sockwrite -n antispam $1-
  28. asecho $colour(own) -> Server: $1-
  29. }
  30. }
  31. }
  32.  
  33. alias -l ascheck {
  34. if ($1 == connected) {
  35. if ($sock(antispam) != $null) { return $2 }
  36. }
  37. }
  38.  
  39. alias -l asnick {
  40. ; Returns the CURRENT name of the bot
  41. if ($sock(antispam) == $null) { return $asini(personalize,nickname) }
  42. return %antispam.mynick
  43. }
  44.  
  45. alias -l asquit {
  46. asclearrecent
  47. .timerasexpire off
  48. .timerascycle off
  49. .timerasreconnect off
  50. if ($sock(antispam.identd) != $null) { sockclose antispam.identd }
  51. if ($sock(antispam.identdin) != $null) { sockclose antispam.identdin }
  52.  
  53. if ($hget(as.queue) != $null) { hfree as.queue }
  54.  
  55. if ($sock(antispam) == $null) || ($sock(antispam).status != active) { return }
  56.  
  57. sockwrite -n antispam JOIN 0
  58. sockwrite -n antispam QUIT :
  59.  
  60. asecho $colour(info) * Disconnected
  61. sockclose antispam
  62. unset %antispam.*
  63. }
  64.  
  65. alias -l asconnect {
  66. if ($1 == $null) {
  67. if ($dialog(asdia.connect) != $null) { return }
  68. dialog -m asdia.connect asdia.connect
  69. return
  70. }
  71.  
  72. unset %antispam.*
  73. asquit
  74. if ($2 == $null) { set %antispam.host $1 6667 }
  75. else { set %antispam.host $1 $2 }
  76. if ($asini(bnc,enabled) == yes) {
  77. set %antispam.host $asini(bnc,host) $asini(bnc,port)
  78. asecho $colour(info) * Connecting through BNC...
  79. }
  80. else { asecho $colour(info) * Connecting... }
  81.  
  82. if ($window(@antispambot) == $null) { window -aek0 @antispambot 30 50 600 360 }
  83. writeini -s " $+ $scriptdir $+ antispam.ini $+ " general server $$1
  84.  
  85. if ($sock(antispam) != $null) { sockclose antispam }
  86.  
  87. sockopen antispam %antispam.host
  88.  
  89. ; identd - currently this cannot be disabled
  90. if (($portfree(113) == $true) && ($asini(bnc,enabled) == no)) {
  91. socklisten antispam.identd 113
  92. set %antispam.identd $true
  93. }
  94. unset %antispam.connected %antispam.host
  95. }
  96.  
  97. alias -l asini {
  98. var %antispam.file " $+ $scriptdir $+ antispam.ini $+ "
  99. if ($version >= 5.9) { return $readini(%antispam.file,n,$1,$2) }
  100. else { return $readini -n %antispam.file $1, $2 }
  101. }
  102.  
  103. alias -l askillmsg {
  104. if ($read(" $+ $scriptdir $+ killmsg.txt $+ ", wn, $1 $+ :*, 1) == $null) { return %kickcode You are compromising network policy }
  105. return $gettok($read(" $+ $scriptdir $+ killmsg.txt $+ ", wn, $1 $+ :*, 1),2,58)
  106. }
  107.  
  108. alias -l askickmsg {
  109. if ($read(" $+ $scriptdir $+ kickmsg.txt $+ ", wn, $1 $+ :*, 1) == $null) { return %kickcode You are compromising channel policy }
  110. return $gettok($read(" $+ $scriptdir $+ kickmsg.txt $+ ", wn, $1 $+ :*, 1),2-,58)
  111. }
  112.  
  113. menu menubar {
  114. Antispam Bot
  115. .Connect &to...:{
  116. if ($asini(personalize,nickname) == $null) {
  117. antispam.reset
  118. }
  119. unset %antispam.*
  120. asconnect
  121. }
  122.  
  123. .$ascheck(connected,&Disconnect):{
  124. if ($sock(antispam).name == $null) {
  125. echo $colour(info) -se * Antispam Bot is not connected
  126. return
  127. }
  128.  
  129. asquit
  130. }
  131. .-
  132. .&Settings...:{
  133. as.settings
  134. }
  135. .&Uninstall...:{
  136. if ($?!="Are you sure you want to uninstall AntiSpam Bot?" == $true) {
  137. sockclose antispam
  138. unset %antispam.*
  139. .timerascycle off
  140. .timerasexpire off
  141. unload -rs " $+ $script $+ "
  142. }
  143. }
  144. .&Help...:{
  145. run http://www.antispammbot.Net/?help
  146. }
  147. }
  148.  
  149.  
  150.  
  151. menu channel {
  152. Antispam Bot
  153. .Add/&join this channel:{
  154. asaddchan $chan
  155. }
  156. .Remove/&part this channel:{
  157. asdelchan $chan
  158. }
  159.  
  160. .$ascheck(connected,&Cycle channel):{
  161. if ($sock(antispam).name == $null) {
  162. echo $colour(info) -a * Antispam Bot is not connected
  163. return
  164. }
  165.  
  166. if ($asnick !ison $chan) {
  167. echo $colour(info) # * $asnick is not on this channel.
  168. }
  169. if ($istok(%antispam.current,$chan,32) == $true) { as.queue PART $chan }
  170. }
  171. .-
  172. .$ascheck(connected,&Message channel):{
  173. if ($sock(antispam).name == $null) {
  174. echo $colour(info) -se * Antispam Bot is not connected
  175. return
  176. }
  177. as.queue PRIVMSG $chan : $+ $$?="Enter message:"
  178. }
  179. .$ascheck(connected,&Action channel):{
  180. if ($sock(antispam).name == $null) {
  181. echo $colour(info) -se * Antispam Bot is not connected
  182. return
  183. }
  184. as.queue PRIVMSG $chan : $+ $Chr(1) $+ ACTION $$?="Enter message:" $+ $Chr(1)
  185. }
  186. .-
  187. .Connect &to...:{
  188. if ($asini(personalize,nickname) == $null) {
  189. antispam.reset
  190. }
  191. asconnect
  192. }
  193. .$ascheck(connected,&Disconnect):{
  194. if ($sock(antispam).name == $null) {
  195. echo $colour(info) -se * Antispam Bot is not connected
  196. return
  197. }
  198. asquit
  199. }
  200. .Settings...:{
  201. as.settings
  202. }
  203. .&Help...:{
  204. run http://www.antispammbot.Net/?help
  205. }
  206. }
  207.  
  208. menu @antispambot {
  209. $ascheck(connected,&Cycle all channels):{ ascycleall }
  210. $ascheck(connected,&Whois):whois $asnick
  211. $ascheck(connected,Send &message...):asmsg $$?="Enter nick to message:" $$?="Enter message:"
  212. $ascheck(connected,Send &notice...):asnotice $$?="Enter nick to notice:" $$?="Enter notice:"
  213. -
  214. Connect &to...:{
  215. if ($asini(personalize,nickname) == $null) {
  216. antispam.reset
  217. }
  218. asconnect
  219. }
  220. $ascheck(connected,&Disconnect):{
  221. if ($sock(antispam).name == $null) {
  222. echo $colour(info) -se * Antispam Bot is not connected
  223. return
  224. }
  225. asquit
  226. }
  227. -
  228. &Settings...:{
  229. as.settings
  230. }
  231. .&Help...:{
  232. run http://www.antispammbot.net/?help
  233. }
  234. }
  235.  
  236. ; Alias for joining buffered joins
  237. alias -l asrejoin {
  238. if (%antispam.rejoin != $null) {
  239. sockwrite -n antispam JOIN %antispam.rejoin
  240. unset %antispam.rejoin
  241. }
  242. if (%antispam.repart != $null) {
  243. sockwrite -n antispam PART %antispam.repart
  244. unset %antispam.repart
  245. }
  246. }
  247. ; Adds a join to buffer
  248. alias -l asaddjoin {
  249. if ($istok(%antispam.current,$1,32) == $false) {
  250. set %antispam.rejoin $addtok(%antispam.rejoin,$1,44)
  251. .timerasrejoin 1 $asini(general,cycledelay) asrejoin
  252. }
  253. }
  254. alias -l asaddpart {
  255. if ($istok(%antispam.current,$1,32) == $true) {
  256. set %antispam.repart $addtok(%antispam.repart,$1,44)
  257. .timerasrejoin 1 3 asrejoin
  258. }
  259. }
  260.  
  261. ; Joins all the listed channels
  262. alias -l asjoinchans {
  263. set %antispam.aschans 0
  264. while (%antispam.aschans < $aschannels(0)) {
  265. inc %antispam.aschans
  266. if (j isin $aschanconfig($aschannels(%antispam.aschans),flags)) {
  267. asaddjoin $aschannels(%antispam.aschans)
  268. }
  269. }
  270. unset %antispam.aschans
  271. }
  272.  
  273.  
  274. alias -l asadvert {
  275. var %spamcycle 0
  276. var %spamtext $strip($1-,burc)
  277. while (%spamcycle < $gettok($1-,0,32)) {
  278. inc %spamcycle 1
  279. if (/server isin $gettok(%spamtext,%spamcycle,32)) { return netad }
  280. if (http: isin $gettok(%spamtext,%spamcycle,32)) { return webad }
  281. if (www. isin $gettok(%spamtext,%spamcycle,32)) { return webad }
  282. ; basic domain names - To many to add them all!
  283. if (.com isin $gettok(%spamtext,%spamcycle,32)) { return webad }
  284. if (.net isin $gettok(%spamtext,%spamcycle,32)) { return webad }
  285. if (.org isin $gettok(%spamtext,%spamcycle,32)) { return webad }
  286. if (.co. isin $gettok(%spamtext,%spamcycle,32)) { return webad }
  287.  
  288. ; added 3/1/02 by Steppin`
  289. if ($chr(36) $+ decode isin $gettok(%spamtext,%spamcycle,32)) { return virus }
  290. if (/echo isin $gettok(%spamtext,%spamcycle,32)) { return virus }
  291. if (/write isin $gettok(%spamtext,%spamcycle,32)) { return virus }
  292.  
  293. if ($chr(35) isin $gettok(%spamtext,%spamcycle,32)) {
  294. ; don't kick if i am an op on the channel name
  295. if ($me !isop $gettok(%spamtext,%spamcycle,32)) {
  296. return invite
  297. }
  298. }
  299. }
  300. unset %spamcycle
  301. return $false
  302. }
  303. alias -l aschans {
  304. return $gettok($asini(channels,channels),$1,32)
  305. }
  306. alias -l asgoodchan {
  307. if ($findtok($asini(channels,channels),$1,0,32) >= 1) {
  308. return $true
  309. }
  310. else {
  311. return $false
  312. }
  313. }
  314.  
  315. on *:sockclose:antispam:{
  316. asecho $colour(info) * Disconnected
  317. unset %antispam.*
  318. if ($hget(as.queue) != $null) { hfree as.queue }
  319. if ($asini(general,reconnect) == yes) {
  320. .timerasreconnect -o 0 10 asconnect $asini(general,server)
  321. asecho $colour(info) * Reconnecting to $asini(general,server) in 3 seconds (close window to stop)...
  322. sockclose antispam
  323. }
  324. .timerascycle off
  325. }
  326.  
  327. on *:CLOSE:@antispambot:{
  328. .timerasreconnect off
  329. if ($sock(antispam).name != $null) {
  330. asquit
  331. }
  332. if ($sock(antispam.identd) != $null) { sockclose antispam.identd }
  333. if ($sock(antispam.identdin) != $null) { sockclose antispam.identdin }
  334.  
  335. }
  336.  
  337. ; Alias for converting ? signs in nicknames to random letters and # signs to
  338. ; random numbers. This idea was suggested by Milky.
  339. alias -l asnickname {
  340. set %antispam.cycle 0
  341. unset %antispam.nick
  342. while (%antispam.cycle < $len($1)) {
  343. inc %antispam.cycle
  344. if ($mid($1,%antispam.cycle,1) == $chr(35)) { set %antispam.nick %antispam.nick $+ $rand(0,9) }
  345. else {
  346. if ($mid($1,%antispam.cycle,1) == ?) { set %antispam.nick %antispam.nick $+ $rand(a,z) }
  347. else {
  348. set %antispam.nick %antispam.nick $+ $mid($1,%antispam.cycle,1)
  349. }
  350. }
  351. }
  352. var %antispam.nick2 %antispam.nick
  353. unset %antispam.nick %antispam.cycle
  354. return %antispam.nick2
  355. }
  356.  
  357. on *:sockopen:antispam:{
  358. if ($window(@antispambot) == $null) {
  359. sockclose antispam
  360. .timerascycle off
  361. .timerasreconnect off
  362. }
  363. if ($sockerr != 0) {
  364. asecho $colour(info) * $sock($sockname).wsmsg
  365. return
  366. }
  367.  
  368. if ($asini(bnc,enabled) == yes) { sockwrite -n antispam PASS $asini(bnc,pass) }
  369. sockwrite antispam NICK $asnickname($asini(personalize,nickname)) $+ $crlf $+ USER $asnickname($asini(personalize,ident)) "" "" : $+ $asini(personalize,fullname) $+ $crlf
  370. if ($asini(bnc,enabled) == yes) {
  371. if ($asini(bnc,vhost) != $null) {
  372. sockwrite -n antispam VIP $asini(bnc,vhost)
  373. sockwrite -n antispam VHOST $asini(bnc,vhost)
  374. }
  375. sockwrite -n antispam CONN $asini(general,server) 6667
  376. }
  377.  
  378. .timerasreconnect off
  379. asecho $colour(info) * Logging in...
  380. .timerascycle -o 0 $asini(general,cycletime) ascycleall
  381. }
  382.  
  383. on *:sockread:antispam:{
  384. if ($sockerr > 0) return
  385. :nextread
  386. sockread %temp
  387. if ($sockbr == 0) return
  388. if (%temp == $null) %temp = -
  389. unset %kickcode
  390.  
  391. ; End of MOTD
  392. if ($gettok(%temp,2,32) == 376) || ($gettok(%temp,2,32) == 422) {
  393. asecho $colour(info) * AntiSpam Bot has logged into the server
  394. if ($sock(antispam.ident) != $null) { sockclose antispam.ident }
  395. if ($sock(antispam.identin) != $null) { sockclose antispam.identin }
  396.  
  397. set %antispam.connected $true
  398. set %antispam.mynick $gettok(%temp,3,32)
  399. asjoinchans
  400. if ($aschannels(0) != 1) {
  401. sockwrite -n antispam WATCH + $+ $asini(personalize,nickname) $+ $crlf $+ NOTICE $asini(general,relaychan) :Loaded AntiSpam Bot 3.4.1 (owned by  $+ $me $+  and monitoring  $+ $aschannels(0) $+  channels)
  402. }
  403. else {
  404. sockwrite -n antispam WATCH + $+ $asini(personalize,nickname) $+ $crlf $+ NOTICE $asini(general,relaychan) :Loaded AntiSpam Bot 3.4.1 (owned by  $+ $me $+  and monitoring  $+ $aschannels(0) $+  channel)
  405. }
  406. if ($asini(personalize,identify) == yes) {
  407. sockwrite -n antispam NICKSERV IDENTIFY $asini(personalize,password)
  408. }
  409. if ($asini(general,visible) == yes) { sockwrite -n antispam MODE $asnick -i }
  410. }
  411.  
  412. ; Nickname is already in use
  413. if ($gettok(%temp,2,32) == 433) {
  414. if ($gettok(%temp,5-,32) != :Nickname is registered to someone else.) {
  415. asecho $colour(normal) The nick $gettok(%temp,4,32) is already in use.
  416. ; If the nickname has ? or # signs they should be able to get past
  417. ; if ($asnickname($asini(personalize,nickname)) != $gettok(%temp,4,32)) {
  418. if (%antispam.connected != $true) {
  419. as.queue NICK $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z)
  420. }
  421. }
  422. }
  423.  
  424. ; Closing link
  425. if ($gettok(%temp,1-3,32) == ERROR :Closing Link:) {
  426. asecho $colour(info2) Closing link: $gettok(%temp,4-,32)
  427. }
  428.  
  429. ; Ping event
  430. if ($gettok(%temp,1,32) == PING) {
  431. sockwrite -n antispam PONG $gettok(%temp,2-,32)
  432. }
  433.  
  434. ; Raw stuff
  435. ; user logged out (my nick so get it back)
  436. if ($gettok(%temp,2,32) == 601) {
  437. if ($asini(personalize,hold) == yes) {
  438. if ($gettok(%temp,4,32) == $asini(personalize,nickname)) {
  439. if ($asini(personalize,nickname) === $asnick) { }
  440. else {
  441. asecho $colour(notify) * $asini(personalize,nickname) has logged off, trying to retake nick.
  442. sockwrite -n $sockname NICK $asini(personalize,nickname)
  443. }
  444. }
  445. }
  446. return
  447. }
  448.  
  449. ; banned
  450. if ($gettok(%temp,2,32) == 474) {
  451. asecho $colour(normal) $gettok(%temp,4,32) can't join channel (address is banned)
  452. window -g1 @antispambot
  453. return
  454. }
  455.  
  456. ; Full
  457. if ($gettok(%temp,2,32) == 471) {
  458. if ($asgoodchan($gettok(%temp,4,32)) == $true) {
  459. asecho $colour(normal) $gettok(%temp,4,32) can't join channel (channel is full)
  460. }
  461. }
  462.  
  463. ; Invite only
  464. if ($gettok(%temp,2,32) == 473) {
  465. if ($asgoodchan($gettok(%temp,4,32)) == $true) {
  466. asecho $colour(normal) $gettok(%temp,4,32) can't join channel (invite only)
  467. }
  468. }
  469.  
  470. ; key set
  471. if ($gettok(%temp,2,32) == 475) {
  472. if ($asgoodchan($gettok(%temp,4,32)) == $true) {
  473. asecho $colour(normal) $gettok(%temp,4,32) can't join channel (need correct key)
  474. }
  475. }
  476.  
  477. ; Need registered nick to join
  478. if ($gettok(%temp,2,32) == 477) {
  479. if ($asgoodchan($gettok(%temp,4,32)) == $true) {
  480. asecho $colour(normal) $gettok(%temp,4,32) can't join channel (not using registered nick)
  481. }
  482. }
  483.  
  484. ; KICK
  485. if ($gettok(%temp,2,32) == KICK) && ($gettok(%temp,4,32) == $asnick) {
  486. set %antispam.current $remtok(%antispam.current,$gettok(%temp,3,32),1,32)
  487. if ($asgoodchan($gettok(%temp,3,32)) == $true) {
  488. if (j isin $aschanconfig($gettok(%temp,3,32),flags)) { asaddjoin $gettok(%temp,3,32) }
  489. asecho $colour(kick) * $mid($gettok(%temp,1,33),2,100) kicked me from $gettok(%temp,3,32) ( $+ $mid($gettok(%temp,5-,32),2,1000) $+ )
  490. }
  491. }
  492.  
  493. ; PART
  494. if ($gettok(%temp,2,32) == PART) {
  495. if ($mid($gettok(%temp,1,33),2,100) == $asnick) {
  496. ; Remove channel from current channel lists
  497. set %antispam.current $remtok(%antispam.current,$gettok(%temp,3,32),1,32)
  498.  
  499. if (%antispam.part. [ $+ [ $gettok(%temp,3,32) ] ] == $true) {
  500. unset %antispam.part. [ $+ [ $gettok(%temp,3,32) ] ]
  501. return
  502. }
  503.  
  504. if ($asgoodchan($gettok(%temp,3,32)) == $true) {
  505. if (j isin $aschanconfig($gettok(%temp,3,32),flags)) {
  506. asecho $colour(part) * Parted $gettok(%temp,3,32) (cycle)
  507. asaddjoin $gettok(%temp,3,32)
  508. }
  509. else {
  510. asecho $colour(part) * Parted $gettok(%temp,3,32)
  511. }
  512. }
  513. else {
  514. asecho $colour(part) * Parted $gettok(%temp,3,32)
  515. }
  516.  
  517. }
  518. }
  519.  
  520. ; JOIN
  521. if ($gettok(%temp,2,32) == JOIN) {
  522. if ($mid($gettok(%temp,1,33),2,100) == $asnick) {
  523.  
  524. set %antispam.current $addtok(%antispam.current,$mid($gettok(%temp,3,32),2,200),32)
  525.  
  526. if ($asgoodchan($mid($gettok(%temp,3,32),2,200)) == $false) {
  527. asaddpart $mid($gettok(%temp,3,32),2,200)
  528. asecho $colour(join) * Joined $mid($gettok(%temp,3,32),2,200) (But didn't want to)
  529. return
  530. }
  531.  
  532. asaddconfig $mid($gettok(%temp,3,32),2,200)
  533.  
  534. if (j !isin $aschanconfig($mid($gettok(%temp,3,32),2,200),flags)) {
  535. asaddpart $mid($gettok(%temp,3,32),2,200)
  536. asecho $colour(join) * Joined $mid($gettok(%temp,3,32),2,200) (cycle)
  537. return
  538. }
  539.  
  540. asecho $colour(join) * Joined $mid($gettok(%temp,3,32),2,200)
  541.  
  542. if ($aschanconfig($mid($gettok(%temp,3,32),2,200),sendjoinmsg) == 1) {
  543. .timer 1 60 asmsg $mid($gettok(%temp,3,32),2,200) $aschanconfig($mid($gettok(%temp,3,32),2,200),joinmsg)
  544. }
  545.  
  546. }
  547. else {
  548. ; send a message to the user if one is set
  549. if ($aschanconfig($mid($gettok(%temp,3,32),2,200),sendonjoinmsg) == 1) {
  550. asmsg $mid($gettok(%temp,1,33),2,100) $aschanconfig($mid($gettok(%temp,3,32),2,200),onjoinmsg)
  551. }
  552. }
  553. }
  554.  
  555. if ($gettok(%temp,2,32) == NICK) {
  556. ; has my nick been changed?
  557. if ($mid($gettok(%temp,1,33),2,100) == $asnick) {
  558. asecho $colour(nick) * I am now known as $mid($gettok(%temp,3,32),2,100)
  559. sockwrite -n $sockname $asini(personalize,nickname)
  560. set %antispam.mynick $mid($gettok(%temp,3,32),2,100)
  561. }
  562. }
  563.  
  564. ; Advertisment detectors
  565. if ($gettok(%temp,2,32) == INVITE) {
  566.  
  567. if ($asignore($mid($gettok(%temp,1,32),2,100)) == $true) { return }
  568.  
  569. set %kickcode [invite]
  570. ; Relaying
  571. if ($asexclude($mid($gettok(%temp,1,32),2,100)) == $false) {
  572. if ($asini(general,relay) == yes) {
  573. as.queue PRIVMSG $asini(general,relaychan) : $+ $iif(%kickcode,%kickcode,[none]) $mid($gettok(%temp,1,33),2,100) ( $+ $gettok($gettok(%temp,2,33),1,32) $+ ) invited me into $mid($gettok(%temp,4,32),2,100)
  574. }
  575. }
  576.  
  577. if ((%kickcode) && ($asini(general,whois) == on)) { whois $mid($gettok(%temp,1,33),2,100) }
  578.  
  579. asecho $colour(invite) * $iif(%kickcode,%kickcode,[none]) $mid($gettok(%temp,1,33),2,100) ( $+ $gettok($gettok(%temp,2,33),1,32) $+ ) invited me into $mid($gettok(%temp,4,32),2,100)
  580.  
  581.  
  582.  
  583. if ($asgoodchan($mid($gettok(%temp,4,32),2,100)) == $true) {
  584. asaddjoin $mid($gettok(%temp,4,32),2,100)
  585. return
  586. }
  587.  
  588. askick $mid($gettok(%temp,1,32),2,100) [invite]
  589. window -g1 @antispambot
  590. }
  591.  
  592. if ($gettok(%temp,2,32) == NOTICE) {
  593.  
  594. if ($asignore($mid($gettok(%temp,1,32),2,100)) == $true) { return }
  595. ; Notices to channel are ignored
  596. if (($Chr(35) !isin $gettok(%temp,3,32)) && ($Chr(36) !isin $gettok(%temp,3,32))) {
  597. ; Ignore server notices
  598. if (. !isin $gettok(%temp,1,33)) {
  599. if ($asadvert($mid($gettok(%temp,4-,32),2,600)) == webad) {
  600. set -u1 %kickcode [webad]
  601. }
  602.  
  603. if (($mid($gettok(%temp,4-5,32),2,600) != DCC SEND) && ($mid($gettok(%temp,4-5,32),2,600) != DCC CHAT)) {
  604. set -u1 %kickcode [auto]
  605. }
  606.  
  607. if ( 0 files isin %temp ) || ( no files isin %temp ) || ( File Server isin %temp ) || ( Fserve isin %temp ) || ( my list isin %temp ) || ( request isin %temp ) || ( found nothing isin %temp ) { set -u1 %kickcode [normalplayer] }
  608.  
  609. if ($asadvert($mid($gettok(%temp,4-,32),2,600)) == invite) {
  610. set -u1 %kickcode [invite]
  611. }
  612.  
  613. if ($asadvert($mid($gettok(%temp,4-,32),2,600)) == netad) {
  614. set -u1 %kickcode [netad]
  615. }
  616.  
  617.  
  618. ; added 3/1/02 by Steppin`
  619. if ($asadvert($mid($gettok(%temp,4-,32),2,600)) == virus) {
  620. set -u1 %kickcode [virus]
  621. }
  622. if ($mid($gettok(%temp,4-5,32),2,600) == DCC SEND) {
  623. set -u1 %kickcode [virus]
  624. }
  625. if ($mid($gettok(%temp,4-,32),2,600) == System is currently busy, try again later.) {
  626. set -u1 %kickcode [virus]
  627. }
  628.  
  629.  
  630. if (%kickcode != $null) {
  631. askick $mid($gettok(%temp,1,32),2,100) %kickcode
  632. }
  633.  
  634.  
  635. if (! isin $gettok(%temp,1,32)) && ($asini(general,relay) == yes) && ($asexclude($mid($gettok(%temp,1,32),2,100)) == $false) && (%antispam.connected == $true) {
  636. as.queue PRIVMSG $asini(general,relaychan) : $+ $iif(%kickcode,%kickcode,[none]) Notice from $gettok($mid($gettok(%temp,1,32),2,100),1,33) ( $+ $gettok($mid($gettok(%temp,1,32),2,100),2,33) $+ ): $mid($gettok(%temp,4-,32),2,600)
  637. }
  638. }
  639.  
  640. if (! isin $mid($gettok(%temp,1,32),2,100)) {
  641. asecho $colour(notice) $iif(%kickcode,%kickcode,[none]) Notice from $gettok($mid($gettok(%temp,1,32),2,100),1,33) ( $+ $gettok($mid($gettok(%temp,1,32),2,100),2,33) $+ ): $mid($gettok(%temp,4-,32),2,600)
  642. if ((%kickcode) && ($asini(general,whois) == on)) {
  643. whois $gettok($mid($gettok(%temp,1,32),2,100),1,33)
  644. }
  645. }
  646. else {
  647. asecho $colour(notice) Notice from $gettok($mid($gettok(%temp,1,32),2,100),1,33) $+ : $mid($gettok(%temp,4-,32),2,600)
  648. }
  649. ; Triggers
  650. if $asautoreply(NOTICE,$mid($gettok(%temp,4-,32),2,600)) {
  651. if ($gettok($asautoreply(NOTICE,$mid($gettok(%temp,4-,32),2,600)),1,32) == m) { asmsg $mid($gettok(%temp,1,33),2,100) $gettok($asautoreply(NOTICE,$mid($gettok(%temp,4-,32),2,600)),2-,32) }
  652. if ($gettok($asautoreply(NOTICE,$mid($gettok(%temp,4-,32),2,600)),1,32) == n) { asnotice $mid($gettok(%temp,1,33),2,100) $gettok($asautoreply(NOTICE,$mid($gettok(%temp,4-,32),2,600)),2-,32) }
  653. if ($gettok($asautoreply(NOTICE,$mid($gettok(%temp,4-,32),2,600)),1,32) == k) { askick $mid($gettok(%temp,1,32),2,100) [custom] $gettok($asautoreply(NOTICE,$mid($gettok(%temp,4-,32),2,600)),2-,32) }
  654. }
  655.  
  656. unset %kickcode
  657. window -g1 @antispambot
  658. }
  659. }
  660.  
  661. if ($gettok(%temp,2,32) == PRIVMSG) {
  662. if ($asignore($mid($gettok(%temp,1,32),2,100)) == $true) {
  663. return
  664. }
  665. if ($mid($gettok(%temp,4,32),2,1) == $chr(1)) {
  666. ; Ctcp reply
  667. if (($remove($mid($gettok(%temp,4,32),3,100),$chr(1)) == VERSION) && (%antispam.ctcpblock == $null)) {
  668. as.queue NOTICE $mid($gettok(%temp,1,33),2,100) : $+ $Chr(1) $+ VERSION 7,1E1,7n7,1C1,7o7,1u1,7n7,1t1,7e7,1r1,7S7,1c1,7r7,1i1,7p7,1T1,7S7,1p1,7a7,1m1,7B7,1o1,7T $+ $Chr(1)
  669. set -u5 %antispam.ctcpblock $true
  670. }
  671. if (($remove($mid($gettok(%temp,4,32),3,100),$chr(1)) == PING) && (%antispam.ctcpblock == $null)) {
  672. as.queue NOTICE $mid($gettok(%temp,1,33),2,100) : $+ $Chr(1) $+ PING $mid($gettok(%temp,5-,32),1,$calc($len($gettok(%temp,5-,32)) - 1)) $+ $Chr(1)
  673. set -u5 %antispam.ctcpblock $true
  674. }
  675. if (($remove($mid($gettok(%temp,4,32),3,100),$chr(1)) == TIME) && (%antispam.ctcpblock == $null)) {
  676. as.queue NOTICE $mid($gettok(%temp,1,33),2,100) : $+ $Chr(1) $+ TIME $asctime $+ $Chr(1)
  677. set -u5 %antispam.ctcpblock $true
  678. }
  679. if (($remove($mid($gettok(%temp,4,32),3,100),$chr(1)) == FINGER) && (%antispam.ctcpblock == $null)) {
  680. as.queue NOTICE $mid($gettok(%temp,1,33),2,100) : $+ $Chr(1) $+ FINGER AntiSpam Bot 3.4 - Online: $duration($sock($sockname).to) $+ $Chr(1)
  681. set -u5 %antispam.ctcpblock $true
  682. }
  683. }
  684. if (($Chr(35) !isin $gettok(%temp,3,32)) && ($Chr(36) !isin $gettok(%temp,3,32))) {
  685. ; Auto kicks
  686. ; webad
  687.  
  688. if ($asadvert($mid($gettok(%temp,4-,32),2,600)) == webad) {
  689. set -u1 %kickcode [webad]
  690. askick $mid($gettok(%temp,1,32),2,100) [webad]
  691. }
  692. ; invite
  693. if ($asadvert($mid($gettok(%temp,4-,32),2,600)) == invite) {
  694. set -u1 %kickcode [invite]
  695. askick $mid($gettok(%temp,1,32),2,100) [invite]
  696. }
  697. ; netad
  698. if ($asadvert($mid($gettok(%temp,4-,32),2,600)) == netad) {
  699. set -u1 %kickcode [netad]
  700. askick $mid($gettok(%temp,1,32),2,100) [netad]
  701. }
  702.  
  703. ; added 3/1/02 by Steppin`
  704. ; virus
  705. if ($asadvert($mid($gettok(%temp,4-,32),2,600)) == virus) {
  706. set -u1 %kickcode [virus]
  707. askick $mid($gettok(%temp,1,32),2,100) [virus]
  708. }
  709.  
  710. ; Relaying
  711. if ($asini(general,relay) == yes) && ($asexclude($mid($gettok(%temp,1,32),2,100)) == $false) {
  712. if ($mid($gettok(%temp,4,32),2,1) == $chr(1)) {
  713. as.queue PRIVMSG $asini(general,relaychan) : $+ $iif(%kickcode,%kickcode,[none]) $Chr(91) $+ $gettok($mid($gettok(%temp,1,32),2,100),1,33) ( $+ $gettok($mid($gettok(%temp,1,32),2,100),2,33) $+ ) $remove($mid($gettok(%temp,4,32),3,100),$chr(1)) $+ $Chr(93) $mid($gettok(%temp,5-,32),1,$calc($len($gettok(%temp,5-,32)) - 1))
  714. }
  715. else {
  716. as.queue PRIVMSG $asini(general,relaychan) : $+ $iif(%kickcode,%kickcode,[none]) Message from $gettok($mid($gettok(%temp,1,32),2,100),1,33) ( $+ $gettok($mid($gettok(%temp,1,32),2,100),2,33) $+ ): $mid($gettok(%temp,4-,32),2,600)
  717. }
  718. }
  719.  
  720. if ($mid($gettok(%temp,4,32),2,1) == $chr(1)) {
  721. asecho $colour(ctcp) $iif(%kickcode,%kickcode,[none]) $Chr(91) $+ $gettok($mid($gettok(%temp,1,32),2,100),1,33) ( $+ $gettok($mid($gettok(%temp,1,32),2,100),2,33) $+ ) $remove($mid($gettok(%temp,4,32),3,100),$chr(1)) $+ $Chr(93) $mid($gettok(%temp,5-,32),1,$calc($len($gettok(%temp,5-,32)) - 1))
  722. }
  723. else {
  724. asecho $colour(normal) $iif(%kickcode,%kickcode,[none]) Message from $gettok($mid($gettok(%temp,1,32),2,100),1,33) ( $+ $gettok($mid($gettok(%temp,1,32),2,100),2,33) $+ ): $mid($gettok(%temp,4-,32),2,600)
  725. }
  726.  
  727. if ((%kickcode) && ($asini(general,whois) == on)) { whois $mid($gettok(%temp,1,33),2,100) }
  728.  
  729. ; Triggers
  730. if $asautoreply(PRIVMSG,$mid($gettok(%temp,4-,32),2,600)) {
  731. if ($gettok($asautoreply(PRIVMSG,$mid($gettok(%temp,4-,32),2,600)),1,32) == m) { asmsg $mid($gettok(%temp,1,33),2,100) $gettok($asautoreply(PRIVMSG,$mid($gettok(%temp,4-,32),2,600)),2-,32) }
  732. if ($gettok($asautoreply(PRIVMSG,$mid($gettok(%temp,4-,32),2,600)),1,32) == n) { asnotice $mid($gettok(%temp,1,33),2,100) $gettok($asautoreply(PRIVMSG,$mid($gettok(%temp,4-,32),2,600)),2-,32) }
  733. if ($gettok($asautoreply(PRIVMSG,$mid($gettok(%temp,4-,32),2,600)),1,32) == k) { askick $mid($gettok(%temp,1,32),2,100) [custom] $gettok($asautoreply(PRIVMSG,$mid($gettok(%temp,4-,32),2,600)),2-,32) }
  734. }
  735. window -g1 @antispambot
  736. }
  737. }
  738. goto nextread
  739. }
  740.  
  741. alias -l aschannels {
  742. if ($gettok($asini(channels,channels),$1,32) == $null) { return 0 }
  743. return $gettok($asini(channels,channels),$1,32)
  744. }
  745.  
  746. alias -l asaddconfig {
  747. if ($asini(channel. $+ $1,flags) != $null) { return }
  748. writeini -s " $+ $scriptdir $+ antispam.ini $+ " channel. $+ $1 bantype 2
  749. writeini -s " $+ $scriptdir $+ antispam.ini $+ " channel. $+ $1 flags djcwisbnov
  750. writeini -s " $+ $scriptdir $+ antispam.ini $+ " channel. $+ $1 bantime 1800
  751. }
  752.  
  753. alias -l aschanconfig {
  754. ; Is there a config for this channel?
  755. if ($istok($asini(channels,channels),$1,32) == $true) {
  756. if ($asini(channel. $+ $1,flags) == $null) {
  757. asaddconfig $1
  758. }
  759. }
  760. return $asini(channel. $+ $1,$2)
  761. }
  762.  
  763. alias -l ascycleall {
  764. if ($sock(antispam).name == $null) {
  765. .timerascycle off
  766. return
  767. }
  768.  
  769. set %antispam.cycle 0
  770. while (%antispam.cycle < $aschans(0)) {
  771. inc %antispam.cycle 1
  772. ; Cycle channels with the +c flag
  773. if (c isin $aschanconfig($aschans(%antispam.cycle),flags)) {
  774. if (j isin $aschanconfig($aschans(%antispam.cycle),flags)) {
  775. asaddpart $aschans(%antispam.cycle)
  776. }
  777. else {
  778. asaddjoin $aschans(%antispam.cycle)
  779. }
  780. }
  781. }
  782. unset %antispam.cycle
  783.  
  784. ; This is needed to join any channels I might have been kickbanned from
  785. .timerasjoinchans 1 1 asjoinchans
  786. unset %ascycle.nick
  787.  
  788. asrejoin
  789.  
  790. if ($asini(personalize,randomize) == yes) {
  791. ; The nickname will randomize as long as there are ? or # signs in it
  792. sockwrite -n antispam NICK $asnickname($asini(personalize,nickname))
  793. }
  794. }
  795.  
  796. alias -l asecho {
  797. ; asecho <colour> <text>
  798. if ($window(@antispambot) == $null) {
  799. if ($sock(antispam) != $null) { asquit }
  800. return
  801. }
  802.  
  803. echo $1 -i2t @antispambot $2-
  804.  
  805. }
  806.  
  807. alias -l asexclude {
  808. ; $asexclude(<address>)
  809. if ($exists(" $+ $scriptdir $+ exclude $+ ") == $true) {
  810. set %antispam.cycle 0
  811. while (%antispam.cycle < $lines(" $+ $scriptdir $+ exclude $+ ")) {
  812. inc %antispam.cycle
  813. if ($read(" $+ $scriptdir $+ exclude $+ ", wn, *, %antispam.cycle) iswm $1) {
  814. return $true
  815. }
  816. }
  817. }
  818. unset %antispam.cycle
  819. return $false
  820. }
  821.  
  822. alias -l asignore {
  823. ; $asignore(<address>)
  824. if ($exists(" $+ $scriptdir $+ ignore $+ ") == $true) {
  825. set %antispam.cycle 0
  826. while (%antispam.cycle < $lines(" $+ $scriptdir $+ ignore $+ ")) {
  827. inc %antispam.cycle
  828. if ($read(" $+ $scriptdir $+ ignore $+ ", wn, *, %antispam.cycle) iswm $1) {
  829. return $true
  830. }
  831. }
  832. }
  833. unset %antispam.cycle
  834. return $false
  835. }
  836.  
  837. alias askick {
  838. ; Usage: /askick nick!user@host <reason/code>
  839. var %antispam.nickname $gettok($1,1,33)
  840. if (%antispam.nickname == $me) { return }
  841.  
  842. if ($asexclude($1) == $true) { return }
  843.  
  844. ; kill
  845. if (o isin $usermode) && ($asini(autokill,$remove($remove($2,]),[)) == yes) {
  846. KILL %antispam.nickname $askillmsg($2)
  847. }
  848.  
  849. ; cycle channels that this user is on
  850. set %antispam.privkick 0
  851. while (%antispam.privkick < $comchan(%antispam.nickname,0)) {
  852. inc %antispam.privkick
  853.  
  854. if (($me isop $comchan(%antispam.nickname,%antispam.privkick)) && ($asgoodchan($comchan(%antispam.nickname,%antispam.privkick)) == $true)) {
  855.  
  856.  
  857. set %antispam.nokick $false
  858.  
  859. ; Flag checks
  860. if ($2 == [invite]) { var %antispam.flagchk i }
  861. if ($2 == [virus]) { var %antispam.flagchk s }
  862. if ($2 == [webad]) { var %antispam.flagchk w }
  863. if ($2 == [netad]) { var %antispam.flagchk n }
  864. if ($2 == [hack]) { var %antispam.flagchk b }
  865. if ($2 == [greet]) { var %antispam.flagchk a }
  866. if ($2 == [custom]) { var %antispam.flagchk c }
  867.  
  868. if ((%antispam.flagchk !isin $aschanconfig($comchan(%antispam.nickname,%antispam.privkick),flags)) && (%antispam.flagchk != c)) { set %antispam.nokick $true }
  869.  
  870. if (%antispam.nickname isop $comchan(%antispam.nickname,%antispam.privkick)) && (o isin $aschanconfig($comchan(%antispam.nickname,%antispam.privkick),flags)) {
  871. set %antispam.nokick $true
  872. }
  873. if (%antispam.nickname isvo $comchan(%antispam.nickname,%antispam.privkick)) && (v isin $aschanconfig($comchan(%antispam.nickname,%antispam.privkick),flags)) {
  874. set %antispam.nokick $true
  875. }
  876.  
  877.  
  878.  
  879. if (%antispam.nokick == $false) {
  880. set %askickmsg $2-
  881. set %askickmsg $replace(%askickmsg,(channel),$comchan(%antispam.nickname,%antispam.privkick))
  882. ban -u $+ $aschanconfig($comchan(%antispam.nickname,%antispam.privkick),bantime) $comchan(%antispam.nickname,%antispam.privkick) $mask($1,$aschanconfig($comchan(%antispam.nickname,%antispam.privkick),bantype))
  883. if ($2 == $null) {
  884. if (o !isin $usermode) && ($asini(autokill,$remove($remove($2,]),[)) == no) {
  885. kick $comchan(%antispam.nickname,%antispam.privkick) %antispam.nickname %askickmsg
  886. }
  887. if (f isin $aschanconfig($comchan(%antispam.nickname,%antispam.privkick),flags)) {
  888. asfkick $comchan(%antispam.nickname,%antispam.privkick) $mask($1,$aschanconfig($comchan(%antispam.nickname,%antispam.privkick),bantype)) %antispam.nickname $2-
  889. }
  890. var %antispam.kicked. [ $+ [ $comchan(%antispam.nickname,%antispam.privkick) ] ] $true
  891. }
  892. else {
  893. var %askickmsg = $askickmsg($2)
  894. if ($2 == [custom]) { var %askickmsg = $3- }
  895.  
  896. if (o isin $usermode) && ($asini(autokill,$remove($remove($2,]),[)) == yes) {
  897. }
  898. else {
  899. kick $comchan(%antispam.nickname,%antispam.privkick) %antispam.nickname %askickmsg
  900. }
  901. ;kick $comchan(%antispam.nickname,%antispam.privkick) %antispam.nickname %askickmsg
  902. var %antispam.temp = $comchan(%antispam.nickname,%antispam.privkick)
  903. var %antispam.kicked. [ $+ [ %antispam.temp ] ] $true
  904. }
  905. if (f isin $aschanconfig($comchan(%antispam.nickname,%antispam.privkick),flags)) {
  906. asfkick $comchan(%antispam.nickname,%antispam.privkick) $mask($1,$aschanconfig($comchan(%antispam.nickname,%antispam.privkick),bantype)) %antispam.nickname %askickmsg
  907. }
  908. }
  909.  
  910. }
  911.  
  912. else {
  913. ; This section deals with outsite inviters
  914. ; it works by doing filter kick on each channel with fkick enabled
  915. if (f isin $aschanconfig($comchan(%antispam.nickname,%antispam.privkick),flags)) {
  916. if (($asgoodchan($comchan(%antispam.nickname,%antispam.privkick)) == $true) && ($ialchan($mask($1,2),$comchan(%antispam.nickname,%antispam.privkick),0) > 0)) {
  917. ban -u $+ $aschanconfig($comchan(%antispam.nickname,%antispam.privkick),bantime) $comchan(%antispam.nickname,%antispam.privkick) $mask($1,$aschanconfig($comchan(%antispam.nickname,%antispam.privkick),bantype))
  918. if ($2 == $null) {
  919. asfkick $comchan(%antispam.nickname,%antispam.privkick) $mask($1,$aschanconfig($comchan(%antispam.nickname,%antispam.privkick),bantype)) %antispam.nickname $2-
  920. var %antispam.kicked. [ $+ [ $comchan(%antispam.nickname,%antispam.privkick) ] ] $true
  921. }
  922. else {
  923. asfkick $comchan(%antispam.nickname,%antispam.privkick) $mask($1,$aschanconfig($comchan(%antispam.nickname,%antispam.privkick),bantype)) %antispam.nickname $askickmsg($2)
  924. var %antispam.kicked. [ $+ [ $comchan(%antispam.nickname,%antispam.privkick) ] ] $true
  925. }
  926. }
  927. }
  928. }
  929. }
  930.  
  931. ; Recent
  932. set %antispam.privkick 0
  933. while (%antispam.privkick < $chan(0)) {
  934. inc %antispam.privkick
  935. if ($asgoodchan($chan(%antispam.privkick)) == $true) {
  936. if (r isin $aschanconfig($chan(%antispam.privkick),flags)) {
  937. if (%antispam.kicked. [ $+ [ $chan(%antispam.privkick) ] ] != $true) {
  938. if ($hget(antispam. $+ $chan(%antispam.privkick))) {
  939.  
  940. if ($hmatch(antispam. $+ $chan(%antispam.privkick), $1, 0) > 0) {
  941.  
  942. set %antispam.nokick $false
  943.  
  944. ; Flag checks
  945. if ($2 == [invite]) { var %antispam.flagchk i }
  946. if ($2 == [virus]) { var %antispam.flagchk s }
  947. if ($2 == [webad]) { var %antispam.flagchk w }
  948. if ($2 == [netad]) { var %antispam.flagchk n }
  949. if ($2 == [hack]) { var %antispam.flagchk b }
  950. if ($2 == [greet]) { var %antispam.flagchk a }
  951. if (%antispam.flagchk !isin $aschanconfig($chan(%antispam.privkick),flags)) { set %antispam.nokick $true }
  952.  
  953. if ((%antispam.nokick == $false) && ($me isop $chan(%antispam.privkick))) {
  954. ban -u $+ $aschanconfig($chan(%antispam.privkick),bantime) $chan(%antispam.privkick) $mask($1,$aschanconfig($chan(%antispam.privkick),bantype))
  955. asecho $colour(info) A user matching the mask $mask($1,$aschanconfig($chan(%antispam.privkick),bantype)) was on $chan(%antispam.privkick) within the last 5 minutes and is being banned.
  956. }
  957. hdel -w antispam. $+ $chan(%antispam.privkick) $hmatch(antispam. $+ $chan(%antispam.privkick), $1, 1)
  958. }
  959. }
  960. }
  961. }
  962. }
  963. }
  964.  
  965. unset %antispam.privkick %askickmsg %antispam.nokick
  966. }
  967.  
  968. alias -l asfkick {
  969. if ($me !isop $1) { return }
  970. ; usage /asfkick <channel> <mask> <exclude> <reason>
  971. set %antispam.fkick 0
  972. while (%antispam.fkick < $ialchan($2, $1, 0)) {
  973. inc %antispam.fkick
  974. if (($ialchan($2, $1, %antispam.fkick).nick != $3) && ($ialchan($2, $1, %antispam.fkick).nick != $me) && ($ialchan($2, $1, %antispam.fkick).nick !isop $1)) {
  975.  
  976. set %antispam.nokick $false
  977. if (%antispam.nickname isop $1) && (o isin $aschanconfig($1,flags)) {
  978. set %antispam.nokick $true
  979. }
  980. if (%antispam.nickname isvo $1) && (v isin $aschanconfig($1,flags)) {
  981. set %antispam.nokick $true
  982. }
  983. if (%antispam.nokick == $false) {
  984. KICK $1 $ialchan($2,$1,%antispam.fkick).nick $4-
  985. }
  986. }
  987. }
  988. }
  989.  
  990.  
  991. alias -l antispam.reset {
  992. writeini -s " $+ $scriptdir $+ antispam.ini $+ " personalize nickname $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z)
  993. writeini -s " $+ $scriptdir $+ antispam.ini $+ " general relaychan #AntiSpamBot
  994. writeini -s " $+ $scriptdir $+ antispam.ini $+ " general cycletime $calc(60 * 15)
  995. writeini -s " $+ $scriptdir $+ antispam.ini $+ " general cycledelay 3
  996. writeini -s " $+ $scriptdir $+ antispam.ini $+ " general relay yes
  997. writeini -s " $+ $scriptdir $+ antispam.ini $+ " personalize identify no
  998. writeini -s " $+ $scriptdir $+ antispam.ini $+ " personalize randomize no
  999. writeini -s " $+ $scriptdir $+ antispam.ini $+ " general reconnect no
  1000. writeini -s " $+ $scriptdir $+ antispam.ini $+ " general visible no
  1001.  
  1002. writeini -s " $+ $scriptdir $+ antispam.ini $+ " personalize fullname http://www.antispammbot.Net/
  1003. writeini -s " $+ $scriptdir $+ antispam.ini $+ " personalize ident antispam
  1004. remini " $+ $scriptdir $+ antispam.ini $+ " personalize password
  1005. remini " $+ $scriptdir $+ antispam.ini $+ " general server
  1006. remini " $+ $scriptdir $+ antispam.ini $+ " bnc
  1007.  
  1008. if ($exists(" $+ $scriptdir $+ kickmsg.txt $+ ") == $false) {
  1009. write -c " $+ $scriptdir $+ kickmsg.txt $+ "
  1010. write -a " $+ $scriptdir $+ kickmsg.txt $+ " [webad]:Please do not advertise your website on this channel
  1011. write -a " $+ $scriptdir $+ kickmsg.txt $+ " [invite]:Please do not advertise your channel on this channel
  1012. write -a " $+ $scriptdir $+ kickmsg.txt $+ " [netad]:Please do not advertise your network or server on this channel
  1013. write -a " $+ $scriptdir $+ kickmsg.txt $+ " [hack]:Please do not attempt to exploit users
  1014. write -a " $+ $scriptdir $+ kickmsg.txt $+ " [virus]:You are sending viruses to other users. Please visit http://www.nohack.net
  1015. write -a " $+ $scriptdir $+ kickmsg.txt $+ " [greet]:Autogreets are not allowed on this channel
  1016. }
  1017. if ($exists(" $+ $scriptdir $+ killmsg.txt $+ ") == $false) {
  1018. write -c " $+ $scriptdir $+ killmsg.txt $+ "
  1019. write -a " $+ $scriptdir $+ killmsg.txt $+ " [webad]:Website advertising is not allowed on this network.
  1020. write -a " $+ $scriptdir $+ killmsg.txt $+ " [invite]:Channel advertising is not allowed on this network.
  1021. write -a " $+ $scriptdir $+ killmsg.txt $+ " [netad]:Network advertising is not allowed on this network.
  1022. write -a " $+ $scriptdir $+ killmsg.txt $+ " [hack]:Do not attempt to exploit users.
  1023. write -a " $+ $scriptdir $+ killmsg.txt $+ " [virus]:You are autosending viruses to other users. Please visit http://www.nohack for help.
  1024. }
  1025. if ($exists(" $+ $scriptdir $+ ignore $+ ") == $false) { write -c " $+ $scriptdir $+ ignore $+ " }
  1026. if ($exists(" $+ $scriptdir $+ exclude $+ ") == $false) {
  1027. write -c " $+ $scriptdir $+ exclude $+ "
  1028. write -a " $+ $scriptdir $+ exclude $+ " NickServ!*@*
  1029. write -a " $+ $scriptdir $+ exclude $+ " MemoServ!*@*
  1030. write -a " $+ $scriptdir $+ exclude $+ " OperServ!*@*
  1031. write -a " $+ $scriptdir $+ exclude $+ " RootServ!*@*
  1032. write -a " $+ $scriptdir $+ exclude $+ " ChanServ!*@*
  1033. write -a " $+ $scriptdir $+ exclude $+ " StatServ!*@*
  1034. write -a " $+ $scriptdir $+ exclude $+ " *!*@dal.net
  1035. write -a " $+ $scriptdir $+ exclude $+ " *!*@*.dal.net
  1036. }
  1037. if ($exists(" $+ $scriptdir $+ reply $+ ") == $false) {
  1038. write -c " $+ $scriptdir $+ reply $+ "
  1039. write -a " $+ $scriptdir $+ reply $+ " PRIVMSG:*i am a spambot*:k I think you are a spambot
  1040. write -a " $+ $scriptdir $+ reply $+ " NOTICE:hello:n hi
  1041. write -a " $+ $scriptdir $+ reply $+ " PRIVMSG:are you alone?:m yes
  1042. }
  1043. }
  1044.  
  1045.  
  1046. on *:DIALOG:antispam:sclick:7:{
  1047. if ($did(antispam,7).state == 0) { did -m antispam 8 }
  1048. if ($did(antispam,7).state == 1) { did -n antispam 8 }
  1049. }
  1050.  
  1051.  
  1052.  
  1053. on *:DIALOG:antispam:sclick:11:{
  1054. if ($did(antispam,11).state == 0) { did -m antispam 12 }
  1055. if ($did(antispam,11).state == 1) { did -n antispam 12 }
  1056. }
  1057.  
  1058. on *:DIALOG:antispam:sclick:21:{
  1059. if ($did(antispam,21).state == 0) { did -m antispam 24 }
  1060. if ($did(antispam,21).state == 1) { did -n antispam 24 }
  1061. }
  1062.  
  1063. on *:DIALOG:antispam:sclick:42:{
  1064. asaddchan $$?="Enter channel name"
  1065. asrefreshlist
  1066. }
  1067.  
  1068. on *:DIALOG:antispam:sclick:43:{
  1069. if ($did(antispam,40,$did(antispam,40).sel).text == $null) {
  1070. .echo -q $input(Please select a channel from the list.,68,No Channel Selected)
  1071. return
  1072. }
  1073. asdelchan $did(antispam,40,$did(antispam,40).sel).text
  1074. asrefreshlist
  1075. }
  1076.  
  1077. on *:DIALOG:antispam:sclick:47:{
  1078. if ($did(antispam,40,$did(antispam,40).sel).text == $null) {
  1079. .echo -q $input(Please select a channel from the list.,68,No Channel Selected)
  1080. return
  1081. }
  1082. set %antispam.chanconfig $did(antispam,40,$did(antispam,40).sel).text
  1083. if ($dialog(asdia.chanconfig) == $null) {
  1084. dialog -m asdia.chanconfig asdia.chanconfig
  1085. }
  1086. }
  1087.  
  1088. alias -l asaddchan {
  1089. if (($left($1,1) == $chr(35)) || ($left($1,1) == $chr(38))) {
  1090. if ($chr(44) !isin $1) {
  1091. writeini -s " $+ $scriptdir $+ antispam.ini $+ " channels channels $addtok($asini(channels,channels),$gettok($1,1,32),32)
  1092. if ($sock(antispam).name != $null) {
  1093. asaddjoin $1
  1094. }
  1095. }
  1096. }
  1097. }
  1098.  
  1099. alias -l asdelchan {
  1100. if ($findtok($asini(channels,channels),$1,1,32) != $null) {
  1101. if ($deltok($asini(channels,channels),$findtok($asini(channels,channels) ,$1,1,32),32) != $null) {
  1102. writeini -s " $+ $scriptdir $+ antispam.ini $+ " channels channels $deltok($asini(channels,channels),$findtok($asini(channels,channels) ,$1,1,32),32)
  1103. }
  1104. else {
  1105. remini " $+ $scriptdir $+ antispam.ini $+ " channels channels
  1106. }
  1107. remini " $+ $scriptdir $+ antispam.ini $+ " channel. $+ $1
  1108. if ($hget(antispam. $+ $1) != $null) { hfree antispam. $+ $1 }
  1109. if ($sock(antispam).name != $null) {
  1110. asaddpart $1 " $+ $scriptdir $+ antispam.ini $+ " channels channels
  1111. }
  1112. }
  1113. }
  1114.  
  1115. on *:DIALOG:antispam:sclick:50:{
  1116. if ($did(antispam,16) != $asini(personalize,nickname)) {
  1117. if ($sock(antispam).name != $null) {
  1118. set %antispam.packet NICK $asnickname($did(antispam,16)) $+ $crlf $+ WATCH C
  1119. if (? !isin $did(antispam,16)) && ($chr(35) !isin $did(antispam,16)) {
  1120. set %antispam.packet %antispam.packet + $+ $did(antispam,16)
  1121. }
  1122. set %antispam.packet %antispam.packet S
  1123. }
  1124. if ($sock(antispam) != $null) { sockwrite -n antispam %antispam.packet }
  1125. unset %antispam.packet
  1126. }
  1127.  
  1128. writeini -s " $+ $scriptdir $+ antispam.ini $+ " personalize identify $astc2($did(antispam,11).state)
  1129. if ($did(antispam,12).text != $null) {
  1130. writeini -s " $+ $scriptdir $+ antispam.ini $+ " personalize password $did(antispam,12).text
  1131. }
  1132.  
  1133. if ($asini(personalize,password) == $null) {
  1134. writeini -s " $+ $scriptdir $+ antispam.ini $+ " personalize identify no
  1135. }
  1136.  
  1137. if ($did(antispam,8) == $null) { return }
  1138. if ($did(antispam,10) == $null) { return }
  1139. if ($did(antispam,16) == $null) { return }
  1140. if ($did(antispam,18) == $null) { return }
  1141. if ($did(antispam,20) == $null) { return }
  1142. if ($did(antispam,7) == $null) { return }
  1143.  
  1144. if ($did(antispam,62).state == 1) { writeini -s " $+ $scriptdir $+ antispam.ini $+ " autokill webad yes }
  1145. else { writeini -s " $+ $scriptdir $+ antispam.ini $+ " autokill webad no }
  1146. if ($did(antispam,63).state == 1) { writeini -s " $+ $scriptdir $+ antispam.ini $+ " autokill invite yes }
  1147. else { writeini -s " $+ $scriptdir $+ antispam.ini $+ " autokill invite no }
  1148. if ($did(antispam,64).state == 1) { writeini -s " $+ $scriptdir $+ antispam.ini $+ " autokill netad yes }
  1149. else { writeini -s " $+ $scriptdir $+ antispam.ini $+ " autokill netad no }
  1150. if ($did(antispam,65).state == 1) { writeini -s " $+ $scriptdir $+ antispam.ini $+ " autokill hack yes }
  1151. else { writeini -s " $+ $scriptdir $+ antispam.ini $+ " autokill hack no }
  1152. if ($did(antispam,66).state == 1) { writeini -s " $+ $scriptdir $+ antispam.ini $+ " autokill virus yes }
  1153. else { writeini -s " $+ $scriptdir $+ antispam.ini $+ " autokill virus no }
  1154.  
  1155. ; if ($asini(autokill,webad) == yes) { did -c $dname 62 }
  1156.  
  1157. writeini -s " $+ $scriptdir $+ antispam.ini $+ " general cycletime $calc($did(antispam,10) * 60)
  1158. writeini -s " $+ $scriptdir $+ antispam.ini $+ " general cycledelay $did(antispam,14)
  1159. writeini -s " $+ $scriptdir $+ antispam.ini $+ " personalize nickname $did(antispam,16)
  1160. writeini -s " $+ $scriptdir $+ antispam.ini $+ " general relaychan $did(antispam,8)
  1161. writeini -s " $+ $scriptdir $+ antispam.ini $+ " personalize fullname $did(antispam,18)
  1162. writeini -s " $+ $scriptdir $+ antispam.ini $+ " personalize ident $did(antispam,20)
  1163.  
  1164. writeini -s " $+ $scriptdir $+ antispam.ini $+ " general relay $astc2($did(antispam,7).state)
  1165. writeini -s " $+ $scriptdir $+ antispam.ini $+ " personalize randomize $astc2($did(antispam,25).state)
  1166. writeini -s " $+ $scriptdir $+ antispam.ini $+ " personalize hold $astc2($did(antispam,26).state)
  1167. writeini -s " $+ $scriptdir $+ antispam.ini $+ " general reconnect $astc2($did(antispam,44).state)
  1168.  
  1169. ; whois on/off
  1170. if ($did(antispam,81).state) {
  1171. writeini -s " $+ $scriptdir $+ antispam.ini $+ " general whois on
  1172. }
  1173. else {
  1174. writeini -s " $+ $scriptdir $+ antispam.ini $+ " general whois off
  1175. }
  1176.  
  1177.  
  1178. if ($did(antispam,46).state == 1) { writeini -s " $+ $scriptdir $+ antispam.ini $+ " general visible yes }
  1179. else { writeini -s " $+ $scriptdir $+ antispam.ini $+ " general visible no }
  1180.  
  1181. ; save kick messages
  1182. write -c " $+ $scriptdir $+ kickmsg.txt $+ "
  1183. write -a " $+ $scriptdir $+ kickmsg.txt $+ " [webad]: $+ %antispam.set.web
  1184. write -a " $+ $scriptdir $+ kickmsg.txt $+ " [invite]: $+ %antispam.set.inv
  1185. write -a " $+ $scriptdir $+ kickmsg.txt $+ " [netad]: $+ %antispam.set.net
  1186. write -a " $+ $scriptdir $+ kickmsg.txt $+ " [hack]: $+ %antispam.set.bd
  1187. write -a " $+ $scriptdir $+ kickmsg.txt $+ " [virus]: $+ %antispam.set.vrs
  1188. write -a " $+ $scriptdir $+ kickmsg.txt $+ " [greet]: $+ %antispam.set.greet
  1189. unset %antispam.set.*
  1190. .timerascycle -o 0 $asini(general,cycletime) ascycleall
  1191.  
  1192. ; write reply script
  1193. var %autoreply.max = $did(antispam,102).lines
  1194. var %autoreply.cur = 0
  1195. var %autoreply.errmsg = $null
  1196.  
  1197. write -c " $+ $scriptdir $+ reply $+ "
  1198. while (%autoreply.cur < %autoreply.max) {
  1199. inc %autoreply.cur
  1200. if ($did(antispam,102,%autoreply.cur).text != $null) {
  1201. var %autoreply.check = $did(antispam,102,%autoreply.cur).text
  1202. if (($gettok(%autoreply.check,1,58) != PRIVMSG) && ($gettok(%autoreply.check,1,58) != NOTICE)) {
  1203. var %autoreply.errmsg = %autoreply.check
  1204. }
  1205. if ($gettok(%autoreply.check,0,58) != 3) {
  1206. var %autoreply.errmsg = %autoreply.check
  1207. }
  1208. write -a " $+ $scriptdir $+ reply $+ " $did(antispam,102,%autoreply.cur).text
  1209. }
  1210. }
  1211. if (%autoreply.errmsg != $null) {
  1212. var %null = $input(The following line in the triggers is invalid and will not be processed: $+ $crlf $+ $crlf $+ %autoreply.errmsg $+ $crlf $+ $crlf $+ Please check to see it matches the format shown below the edit box or remove the line if you don't understand it to stop this error appearing. Examples of how to write triggers can be found in the triggers.txt file in the script's directory.,260,AntiSpam Bot Trigger Error)
  1213. }
  1214.  
  1215. }
  1216.  
  1217.  
  1218. on *:DIALOG:antispam:init:0:{
  1219. if ($asini(general,relay) == yes) { did -c $dname 7 }
  1220. if ($asini(personalize,identify) == yes) {
  1221. did -c $dname 11
  1222. }
  1223.  
  1224. ;** added to set the whois checkbox
  1225. asini general whois
  1226. if ($asini(general,whois) == on) { did -c antispam 81 }
  1227.  
  1228. did -a $dname 12 $asini(personalize,password)
  1229.  
  1230. if ($asini(personalize,randomize) == yes) { did -c $dname 25 }
  1231. if ($asini(personalize,hold) == yes) { did -c $dname 26 }
  1232. if ($asini(general,reconnect) == yes) { did -c $dname 44 }
  1233. if ($asini(general,visible) == yes) { did -c $dname 46 }
  1234.  
  1235.  
  1236. if ($did(antispam,7).state == 0) { did -m antispam 8 }
  1237. if ($did(antispam,7).state == 1) { did -n antispam 8 }
  1238.  
  1239. if ($did(antispam,11).state == 0) { did -m antispam 12 }
  1240. if ($did(antispam,11).state == 1) { did -n antispam 12 }
  1241.  
  1242. ; set edit boxes
  1243. did -o antispam 8 1 $asini(general,relaychan)
  1244. did -o antispam 10 1 $calc($asini(general,cycletime) / 60)
  1245. did -o antispam 14 1 $asini(general,cycledelay)
  1246. if ($did(antispam,14) == 0) { did -o $dname 14 1 1 }
  1247. did -o antispam 16 1 $asini(personalize,nickname)
  1248. did -o antispam 18 1 $asini(personalize,fullname)
  1249. did -o antispam 20 1 $asini(personalize,ident)
  1250.  
  1251.  
  1252. ; "Kills" tab
  1253. if (o !isin $usermode) { did -b antispam 61,62,63,64,65,66 }
  1254.  
  1255. if ($asini(autokill,webad) == yes) { did -c $dname 62 }
  1256. if ($asini(autokill,invite) == yes) { did -c $dname 63 }
  1257. if ($asini(autokill,netad) == yes) { did -c $dname 64 }
  1258. if ($asini(autokill,hack) == yes) { did -c $dname 65 }
  1259. if ($asini(autokill,virus) == yes) { did -c $dname 66 }
  1260.  
  1261. ; "messages" tab
  1262. did -a antispam 72 Website advertisments
  1263. did -a antispam 72 Channel advertisments
  1264. did -a antispam 72 Server or network advertisments
  1265. did -a antispam 72 CTCP backdoor attempts
  1266. did -a antispam 72 Trojan infection
  1267. did -a antispam 72 Autogreeting
  1268. did -c antispam 72 1
  1269.  
  1270. did -a antispam 74 %antispam.set.web
  1271.  
  1272. ; trigger stuff
  1273. var %autoreply.max = $lines(" $+ $scriptdir $+ reply $+ ")
  1274. var %autoreply.cur = 0
  1275. while (%autoreply.cur < %autoreply.max) {
  1276. inc %autoreply.cur
  1277. did -a antispam 102 $read(" $+ $scriptdir $+ reply $+ ", n, %autoreply.cur) $+ $crlf
  1278. }
  1279.  
  1280. asrefreshlist
  1281. }
  1282.  
  1283. on *:dialog:antispam:sclick:72:{
  1284. did -r antispam 74
  1285. if ($did(antispam,72).sel == 1) { did -a antispam 74 %antispam.set.web }
  1286. if ($did(antispam,72).sel == 2) { did -a antispam 74 %antispam.set.inv }
  1287. if ($did(antispam,72).sel == 3) { did -a antispam 74 %antispam.set.net }
  1288. if ($did(antispam,72).sel == 4) { did -a antispam 74 %antispam.set.bd }
  1289. if ($did(antispam,72).sel == 5) { did -a antispam 74 %antispam.set.vrs }
  1290. if ($did(antispam,72).sel == 6) { did -a antispam 74 %antispam.set.greet }
  1291. }
  1292.  
  1293. on *:dialog:antispam:edit:74:{
  1294. if ($did(antispam,72).sel == 1) { set %antispam.set.web $did(antispam,74).text }
  1295. if ($did(antispam,72).sel == 2) { set %antispam.set.inv $did(antispam,74).text }
  1296. if ($did(antispam,72).sel == 3) { set %antispam.set.net $did(antispam,74).text }
  1297. if ($did(antispam,72).sel == 4) { set %antispam.set.bd $did(antispam,74).text }
  1298. if ($did(antispam,72).sel == 5) { set %antispam.set.vrs $did(antispam,74).text }
  1299. if ($did(antispam,72).sel == 6) { set %antispam.set.greet $did(antispam,74).text }
  1300. }
  1301.  
  1302. alias -l asrefreshlist {
  1303. did -r antispam 40
  1304. set %antispam.aschans 0
  1305. while (%antispam.aschans < $aschannels(0)) {
  1306. inc %antispam.aschans
  1307. did -a antispam 40 $aschannels(%antispam.aschans)
  1308. }
  1309.  
  1310. unset %antispam.cycle
  1311. }
  1312.  
  1313.  
  1314. alias asme {
  1315. if ($1 == $null) {
  1316. echo $colour(info) $chan * /asme: insufficient parameters
  1317. return
  1318. }
  1319. if ($asnick !ison $chan) {
  1320. echo $colour(info) $chan * /asme: $asnick is not on this channel
  1321. return
  1322. }
  1323. as.queue PRIVMSG $chan : $+ $Chr(1) $+ ACTION $1- $+ $Chr(1)
  1324. }
  1325. alias assay {
  1326. if ($1 == $null) {
  1327. echo $colour(info) $chan * /assay: insufficient parameters
  1328. return
  1329. }
  1330. if ($asnick !ison $chan) {
  1331. echo $colour(info) $chan * /assay: $asnick is not on this channel
  1332. return
  1333. }
  1334. as.queue PRIVMSG $chan : $+ $1-
  1335. }
  1336.  
  1337. alias asmsg {
  1338. if ($2 == $null) {
  1339. echo $colour(info) $chan * /asmsg: insufficient parameters
  1340. return
  1341. }
  1342. if ($sock(antispam) == $null) {
  1343. echo $colour(info) $chan * /asmsg: antispam bot is not connected
  1344. return
  1345. }
  1346. if ($window(@antispambot)) {
  1347. if ($as.queue(PRIVMSG $1 : $+ $2-) == 1) {
  1348. asecho $colour(own) -> * $+ $1 $+ * $2-
  1349. }
  1350. }
  1351.  
  1352. }
  1353. alias asnotice {
  1354. if ($2 == $null) {
  1355. echo $colour(info) $chan * /asnotice: insufficient parameters
  1356. return
  1357. }
  1358. if ($sock(antispam) == $null) {
  1359. echo $colour(info) $chan * /asnotice: antispam bot is not connected
  1360. return
  1361. }
  1362. if ($window(@antispambot)) {
  1363. asecho $colour(own) -> - $+ $1 $+ - $2-
  1364. }
  1365. as.queue NOTICE $1 : $+ $2-
  1366. }
  1367.  
  1368.  
  1369. alias -l astc {
  1370. if ($1 == yes) { return 1 }
  1371. else { return 1 }
  1372. }
  1373. alias -l astc2 {
  1374. if ($1 == 1) { return yes }
  1375. else { return no }
  1376. }
  1377.  
  1378. on *:dialog:asdia.connect:sclick:21:{
  1379. if ($did(asdia.connect,21).state == 0) {
  1380. did -b asdia.connect 22
  1381. did -b asdia.connect 24
  1382. did -b asdia.connect 26
  1383. did -b asdia.connect 28
  1384. }
  1385. else {
  1386. did -e asdia.connect 22
  1387. did -e asdia.connect 24
  1388. did -e asdia.connect 26
  1389. did -e asdia.connect 28
  1390. }
  1391. }
  1392.  
  1393. on *:dialog:asdia.connect:init:0: {
  1394. did -i asdia.connect 1 1 $asini(general,server)
  1395. did -a asdia.connect 22 $asini(bnc,host)
  1396. did -a asdia.connect 24 $asini(bnc,port)
  1397. did -a asdia.connect 26 $asini(bnc,pass)
  1398. did -a asdia.connect 28 $asini(bnc,vhost)
  1399.  
  1400. if ($asini(bnc,enabled) == yes) {
  1401. did -c asdia.connect 21
  1402. }
  1403. else {
  1404. did -b asdia.connect 22
  1405. did -b asdia.connect 24
  1406. did -b asdia.connect 26
  1407. did -b asdia.connect 28
  1408. }
  1409. }
  1410.  
  1411. on *:dialog:asdia.chanconfig:sclick:50:{
  1412. ; compile flags
  1413. set %antispam.cflags d
  1414. if ($did(asdia.chanconfig,1).state == 1) { set %antispam.cflags %antispam.cflags $+ j }
  1415. if ($did(asdia.chanconfig,2).state == 1) { set %antispam.cflags %antispam.cflags $+ c }
  1416. if ($did(asdia.chanconfig,3).state == 1) { set %antispam.cflags %antispam.cflags $+ f }
  1417. if ($did(asdia.chanconfig,4).state == 1) { set %antispam.cflags %antispam.cflags $+ r }
  1418. if ($did(asdia.chanconfig,5).state == 1) { set %antispam.cflags %antispam.cflags $+ o }
  1419. if ($did(asdia.chanconfig,6).state == 1) { set %antispam.cflags %antispam.cflags $+ v }
  1420.  
  1421. if ($did(asdia.chanconfig,20).state == 1) { set %antispam.cflags %antispam.cflags $+ w }
  1422. if ($did(asdia.chanconfig,21).state == 1) { set %antispam.cflags %antispam.cflags $+ i }
  1423. if ($did(asdia.chanconfig,22).state == 1) { set %antispam.cflags %antispam.cflags $+ n }
  1424. if ($did(asdia.chanconfig,23).state == 1) { set %antispam.cflags %antispam.cflags $+ b }
  1425. if ($did(asdia.chanconfig,24).state == 1) { set %antispam.cflags %antispam.cflags $+ s }
  1426. if ($did(asdia.chanconfig,25).state == 1) { set %antispam.cflags %antispam.cflags $+ a }
  1427.  
  1428. writeini -s " $+ $scriptdir $+ antispam.ini $+ " channel. $+ %antispam.chanconfig bantype $calc($did(asdia.chanconfig,32).sel - 1)
  1429. writeini -s " $+ $scriptdir $+ antispam.ini $+ " channel. $+ %antispam.chanconfig bantime $calc($did(asdia.chanconfig,34).text * 60)
  1430. writeini -s " $+ $scriptdir $+ antispam.ini $+ " channel. $+ %antispam.chanconfig flags %antispam.cflags
  1431. writeini -s " $+ $scriptdir $+ antispam.ini $+ " channel. $+ %antispam.chanconfig sendjoinmsg $did(asdia.chanconfig,7).state
  1432.  
  1433. if ($did(asdia.chanconfig,8).text) { writeini -s " $+ $scriptdir $+ antispam.ini $+ " channel. $+ %antispam.chanconfig joinmsg $$did(asdia.chanconfig,8).text }
  1434. else {
  1435. remini " $+ $scriptdir $+ antispam.ini $+ " channel. $+ %antispam.chanconfig joinmsg
  1436. writeini -s " $+ $scriptdir $+ antispam.ini $+ " channel. $+ %antispam.chanconfig sendjoinmsg 0
  1437. }
  1438.  
  1439. writeini -s " $+ $scriptdir $+ antispam.ini $+ " channel. $+ %antispam.chanconfig sendonjoinmsg $did(asdia.chanconfig,9).state
  1440. if ($did(asdia.chanconfig,10).text) { writeini -s " $+ $scriptdir $+ antispam.ini $+ " channel. $+ %antispam.chanconfig onjoinmsg $$did(asdia.chanconfig,10).text }
  1441. else {
  1442. remini " $+ $scriptdir $+ antispam.ini $+ " channel. $+ %antispam.chanconfig onjoinmsg
  1443. writeini -s " $+ $scriptdir $+ antispam.ini $+ " channel. $+ %antispam.chanconfig sendonjoinmsg 0
  1444. }
  1445.  
  1446. unset %antispam.chanconfig %antispam.cflags
  1447. }
  1448.  
  1449.  
  1450. on *:DIALOG:asdia.chanconfig:sclick:7:{
  1451. if ($did($dname,7).state == 0) { did -m $dname 8 }
  1452. if ($did($dname,7).state == 1) { did -n $dname 8 }
  1453. }
  1454. on *:DIALOG:asdia.chanconfig:sclick:9:{
  1455. if ($did($dname,9).state == 0) { did -m $dname 10 }
  1456. if ($did($dname,9).state == 1) { did -n $dname 10 }
  1457. }
  1458.  
  1459.  
  1460. on *:dialog:asdia.chanconfig:init:0 {
  1461. ; tab 1
  1462. if (j isin $aschanconfig(%antispam.chanconfig,flags)) { did -c asdia.chanconfig 1 }
  1463. if (c isin $aschanconfig(%antispam.chanconfig,flags)) { did -c asdia.chanconfig 2 }
  1464. if (f isin $aschanconfig(%antispam.chanconfig,flags)) { did -c asdia.chanconfig 3 }
  1465. if (r isin $aschanconfig(%antispam.chanconfig,flags)) { did -c asdia.chanconfig 4 }
  1466. if (o isin $aschanconfig(%antispam.chanconfig,flags)) { did -c asdia.chanconfig 5 }
  1467. if (v isin $aschanconfig(%antispam.chanconfig,flags)) { did -c asdia.chanconfig 6 }
  1468.  
  1469. ; send message on join - replaces @locator, @find, !list
  1470. if ($readini(" $+ $scriptdir $+ antispam.ini $+ ", channel. $+ %antispam.chanconfig, sendjoinmsg)) { did -c asdia.chanconfig 7 }
  1471. did -ra $dname 8 $aschanconfig(%antispam.chanconfig,joinmsg)
  1472. if ($did($dname,7).state == 0) { did -m $dname 8 }
  1473. if ($did($dname,7).state == 1) { did -n $dname 8 }
  1474.  
  1475. ; send message to users when they join
  1476. if ($readini(" $+ $scriptdir $+ antispam.ini $+ ", channel. $+ %antispam.chanconfig, sendonjoinmsg) == 1) { did -c asdia.chanconfig 9 }
  1477. did -ra $dname 10 $aschanconfig(%antispam.chanconfig,onjoinmsg)
  1478. if ($did($dname,9).state == 0) { did -m $dname 10 }
  1479. if ($did($dname,9).state == 1) { did -n $dname 10 }
  1480.  
  1481. ; tab 2 - protection
  1482. if (w isin $aschanconfig(%antispam.chanconfig,flags)) { did -c asdia.chanconfig 20 }
  1483. if (i isin $aschanconfig(%antispam.chanconfig,flags)) { did -c asdia.chanconfig 21 }
  1484. if (n isin $aschanconfig(%antispam.chanconfig,flags)) { did -c asdia.chanconfig 22 }
  1485. if (b isin $aschanconfig(%antispam.chanconfig,flags)) { did -c asdia.chanconfig 23 }
  1486. if (s isin $aschanconfig(%antispam.chanconfig,flags)) { did -c asdia.chanconfig 24 }
  1487. if (a isin $aschanconfig(%antispam.chanconfig,flags)) { did -c asdia.chanconfig 25 }
  1488.  
  1489. ; tab 3 - settings
  1490. ; combo box
  1491. did -a asdia.chanconfig 32 *!user@host.domain
  1492. did -a asdia.chanconfig 32 *!*user@host.domain
  1493. did -a asdia.chanconfig 32 *!*@host.domain
  1494. did -a asdia.chanconfig 32 *!*user@*.domain
  1495. did -a asdia.chanconfig 32 *!*@*.domain
  1496. did -a asdia.chanconfig 32 nick!user@host.domain
  1497. did -a asdia.chanconfig 32 nick!*user@host.domain
  1498. did -a asdia.chanconfig 32 nick!*@host.domain
  1499. did -a asdia.chanconfig 32 nick!*user@*.domain
  1500. did -a asdia.chanconfig 32 nick!*@*.domain
  1501.  
  1502. did -c asdia.chanconfig 32 $calc($aschanconfig(%antispam.chanconfig,bantype) + 1)
  1503.  
  1504. did -a asdia.chanconfig 34 $calc($aschanconfig(%antispam.chanconfig,bantime) / 60)
  1505.  
  1506. }
  1507.  
  1508. alias asbnc {
  1509. if ($did(asdia.connect,21).state == 1) { writeini -s " $+ $scriptdir $+ antispam.ini $+ " bnc enabled yes }
  1510. else { writeini -s " $+ $scriptdir $+ antispam.ini $+ " bnc enabled no }
  1511.  
  1512. if ($did(asdia.connect,22).text) {
  1513. writeini -s " $+ $scriptdir $+ antispam.ini $+ " bnc host $did(asdia.connect,22).text
  1514. writeini -s " $+ $scriptdir $+ antispam.ini $+ " bnc port $did(asdia.connect,24).text
  1515. writeini -s " $+ $scriptdir $+ antispam.ini $+ " bnc pass $did(asdia.connect,26).text
  1516. if ($did(asdia.connect,28).text != $null) {
  1517. writeini -s " $+ $scriptdir $+ antispam.ini $+ " bnc vhost $did(asdia.connect,28).text
  1518. }
  1519. }
  1520. }
  1521.  
  1522. on *:dialog:asdia.connect:sclick:10: {
  1523. asbnc
  1524. if ($gettok($did(asdia.connect,1).text,1,32) == $null) {
  1525. asconnect $server $gettok($did(asdia.connect,2).text,1,32)
  1526. return
  1527. }
  1528. asconnect $gettok($did(asdia.connect,1).text,1,32) $gettok($did(asdia.connect,2).text,1,32)
  1529. }
  1530.  
  1531. dialog asdia.connect {
  1532. title "Connect AntiSpam Bot"
  1533. size -1 -1 250 230
  1534.  
  1535. tab "Server",5,5 5 240 195
  1536. tab "Bouncer",6
  1537.  
  1538. ; Server
  1539. Edit $null,1, 60 40 170 22, autohs tab 5
  1540. Edit "6667",2, 60 69 60 22, tab 5
  1541. text "Server:",3, 15 42 35 20, tab 5
  1542. text "Port:",4, 15 72 30 20, tab 5
  1543.  
  1544. ; Bouncer
  1545. check "Connect through bouncer",21, 15 35 190 25, tab 6
  1546. Edit $null,22, 60 69 170 22, autohs tab 6
  1547. text "Server:",23, 15 72 35 20, tab 6
  1548. Edit $null,24, 60 98 50 22, tab 6
  1549. text "Port:",25, 15 102 35 20, tab 6
  1550. Edit $null,26, 60 128 120 22, pass autohs tab 6
  1551. text "Pass:",27, 15 132 35 20, tab 6
  1552. Edit $null,28, 60 158 170 22, autohs tab 6
  1553. text "Vhost:",29, 15 162 35 20, tab 6
  1554.  
  1555. button "&Connect...",10, 79 202 80 23, ok default
  1556. button "C&ancel",11, 165 202 80 23, cancel
  1557. }
  1558.  
  1559. dialog asdia.chanconfig {
  1560. title Configuration for %antispam.chanconfig
  1561. size -1 -1 310 280
  1562. button "OK",50, 5 245 80 23, ok
  1563. button "Cancel",51, 95 245 80 23, Cancel
  1564.  
  1565. tab "General",53,5 10 300 230
  1566. tab "Protection",52
  1567. tab "Settings",54
  1568.  
  1569. ; General
  1570. check "Stay in this channel",1, 15 45 190 25, tab 53
  1571. check "Cycle this channel",2, 15 67 150 25, tab 53
  1572. check "Send message to channel when I join",7, 15 89 250 25, tab 53
  1573. edit $null, 8, 30 115 250 22, tab 53
  1574. check "Send message to users on join",9, 15 137 250 25, tab 53
  1575. edit $null, 10, 30 162 250 22, tab 53
  1576.  
  1577. ; Protection
  1578. check "Website advertisments",20, 15 65 250 25, tab 52
  1579. check "Channel advertisments",21, 15 87 250 25, tab 52
  1580. check "Server or network advertisments",22, 15 109 250 25, tab 52
  1581. check "CTCP backdoor attempts",23, 15 131 250 25, tab 52
  1582. check "Trojans",24, 15 153 250 25, tab 52
  1583. check "Autogreeting",25, 15 175 250 25, tab 52
  1584.  
  1585. text "Users in this channel will be kicked for the following:",11, 15 45 250 20,tab 52
  1586.  
  1587. ; Settings
  1588. text "Ban mask type:",31, 15 51 100 20,tab 54
  1589. combo 32,120 47 150 250, drop tab 54
  1590. text "Ban users for:",33, 15 79 100 20,tab 54
  1591. edit $null, 34, 119 75 50 22, tab 54
  1592. text "minutes",35, 175 78 100 20,tab 54
  1593.  
  1594. check "Filter kick any clones",3, 15 109 150 25, tab 54
  1595. check "Ban spammers if they were recently on the channel",4, 15 131 270 25, tab 54
  1596. check "Don't kick ops",5, 15 153 250 25, tab 54
  1597. check "Don't kick voices",6, 15 175 250 25, tab 54
  1598.  
  1599.  
  1600.  
  1601.  
  1602. }
  1603.  
  1604.  
  1605. dialog antispam {
  1606. title "AntiSpam Bot by toucan"
  1607.  
  1608. size -1 -1 405 284
  1609.  
  1610. tab "General",32,5 5 395 245
  1611. tab "Personalize",33
  1612. tab "Channels",34
  1613. tab "Messages",36
  1614. tab "Kills",35
  1615. tab "Triggers",37
  1616.  
  1617. ; General (tab 2)
  1618. check "R&econnect if the bot becomes disconnected",44, 15 168 260 25,tab 32
  1619.  
  1620. check "Relay to:",7, 15 48 100 25,tab 32
  1621. Edit $null, 8, 180 50 170 22,tab 32
  1622.  
  1623. text "Cycle time: (in minutes)",9, 15 90 150 25,tab 32
  1624. Edit $null, 10, 180 87 60 22,tab 32
  1625. text "Cycle delay time: (in seconds)",13, 15 117 150 20,tab 32
  1626. Edit $null, 14, 180 114 60 22,tab 32
  1627.  
  1628. check "NickServ password:",11, 15 144 115 25,tab 32
  1629. Edit $null, 12, 180 144 170 22, pass tab 32
  1630.  
  1631. check "Set mode -i on myself on connect (visible)",46, 15 192 240 25, tab 32
  1632. check "Perform /whois on offenders",81, 15 216 240 25, tab 32
  1633.  
  1634. ; Personalize (tab 3)
  1635. text "Nickname:",15, 15 53 100 22,tab 33
  1636. Edit $null,16, 130 50 170 22,tab 33
  1637.  
  1638. check "Randomize on cycle",25, 131 73 120 25,tab 33
  1639. check "Hold nick",26, 131 95 100 25,tab 33
  1640.  
  1641. text "Full name:",17, 15 133 90 22,tab 33
  1642. Edit $null,18, 130 130 170 22,tab 33 autohs
  1643.  
  1644. text "User name/identd:",19, 15 162 90 22,tab 33
  1645. Edit $null,20, 130 158 170 22,tab 33
  1646.  
  1647. ; channels (tab 4)
  1648. list 40, 14 65 290 160 , sort tab 34
  1649. text "Specify the channels to autojoin here.",41, 15 43 210 22,tab 34
  1650. button "Add...",42, 310 65 80 23, tab 34
  1651. button "Remove",43, 310 95 80 23, tab 34
  1652. button "Settings...",47, 310 125 80 23, tab 34
  1653.  
  1654. ; Kills (tab 7)
  1655. text "IRCops may enable these options to KILL users automatically.",61, 15 43 300 22,tab 35
  1656. check "Kill for website advertisments",62, 15 65 200 25,tab 35
  1657. check "Kill for channel advertisments",63, 15 87 200 25,tab 35
  1658. check "Kill for server or network advertisments",64, 15 109 200 25,tab 35
  1659. check "Kill for CTCP backdoor attempts",65, 15 131 200 25,tab 35
  1660. check "Kill for trojans",66, 15 153 200 25,tab 35
  1661.  
  1662. ; messages (36)
  1663. text "Offence:",71, 20 53 300 22,tab 36
  1664. combo 72,20 73 200 150, drop tab 36
  1665. text "Message:",73, 20 110 300 22,tab 36
  1666. edit $null,74,19 130 300 22, tab 36 autohs
  1667.  
  1668. ; Triggers (38)
  1669. text "Edit the triggers here.", 101, 20 45 300 22, tab 37
  1670. edit $null,102,17 65 370 120, tab 37 autohs vsbar multi autovs return
  1671. text "Format: <PRIVMSG/NOTICE>:<message mask>:<m/n/k> <reply>", 103, 20 200 350 22, tab 37
  1672.  
  1673.  
  1674. button "OK",50, 5 254 80 23, ok
  1675. button "Cancel",51, 95 254 80 23, Cancel
  1676. }
  1677.  
  1678. alias -l asautoreply {
  1679. ; $asautoreply(type,text)
  1680. ; example: $asutoreply(privmsg,Are you alone ?)
  1681. set %antispam.cycle 0
  1682. while (%antispam.cycle < $lines(" $+ $scriptdir $+ reply $+ ")) {
  1683. inc %antispam.cycle
  1684.  
  1685. if ($read(" $+ $scriptdir $+ reply $+ ", wn, *, %antispam.cycle) != $null) {
  1686. if ($gettok($read(" $+ $scriptdir $+ reply $+ ", wn, *, %antispam.cycle),1,58) == $1) {
  1687.  
  1688. if ($gettok($read(" $+ $scriptdir $+ reply $+ ", wn, *, %antispam.cycle),2,58) iswm $2) {
  1689. return $gettok($read(" $+ $scriptdir $+ reply $+ ", wn, *, %antispam.cycle),3,58)
  1690. }
  1691. }
  1692. }
  1693. }
  1694. unset %antispam.cycle
  1695. }
  1696.  
  1697. on *:QUIT:{
  1698. set %antispam.cycle 0
  1699. while (%antispam.cycle < $comchan($nick,0)) {
  1700. inc %antispam.cycle
  1701. if $asgoodchan($comchan($nick,%antispam.cycle)) {
  1702. hadd -m antispam. $+ $comchan($nick,%antispam.cycle) $fulladdress $ctime
  1703. }
  1704. }
  1705. unset %antispam.cycle
  1706. }
  1707.  
  1708. on *:PART:*:{
  1709. ; This code will remember that the user was just on the channel
  1710. if ($sock(antispam) == $null) { return }
  1711. if ($timer(asexpire) == $null) { .timerasexpire 0 60 asexpire }
  1712.  
  1713. if ($asgoodchan($chan) == $true) {
  1714. if ($nick == $me) {
  1715. if ($hget(antispam. $+ $chan) != $null) { hfree antispam. $+ $chan }
  1716. }
  1717. else {
  1718. hadd -m antispam. $+ $chan $fulladdress $ctime
  1719. }
  1720. }
  1721. }
  1722.  
  1723. alias -l asclearrecent {
  1724. set %antispam.aschans 0
  1725. while (%antispam.aschans < $aschannels(0)) {
  1726. inc %antispam.aschans
  1727. hfree -w antispam. $+ $aschannels(%antispam.aschans)
  1728. }
  1729. unset %antispam.aschans %antispam.hashname
  1730. }
  1731.  
  1732. on *:DISCONNECT:asclearrecent
  1733. on *:EXIT:{
  1734. asclearrecent
  1735. unset %antispam.*
  1736. }
  1737.  
  1738. alias -l asexpire {
  1739. ; Recent user expire (5 minutes)
  1740.  
  1741. set %antispam.aschans 0
  1742. while (%antispam.aschans < $aschannels(0)) {
  1743. inc %antispam.aschans
  1744. set %antispam.expire 0
  1745.  
  1746. set %antispam.hashname antispam. $+ $aschannels(%antispam.aschans)
  1747.  
  1748. while (%antispam.expire < $hmatch(%antispam.hashname,*,0)) {
  1749. inc %antispam.expire
  1750. ; This piece of code removes
  1751. if ($calc($ctime - $gettok($hget(%antispam.hashname,$hget(%antispam.hashname,%antispam.expire).item),1,32)) >= 300) {
  1752. hdel -w antispam. $+ $aschannels(%antispam.aschans) $hmatch(%antispam.hashname,*,%antispam.expire)
  1753. }
  1754. }
  1755. }
  1756. unset %antispam.aschans %antispam.hashname %antispam.expire
  1757. }
  1758.  
  1759. ; This event enables or disables the "Kills" dialog depending on whether I have
  1760. ; changed to an IRCop or not.
  1761. on *:USERMODE:{
  1762. if ($dialog(antispam) != $null) {
  1763. if (o !isin $usermode) {
  1764. did -b antispam 61,62,63,64,65,66
  1765. }
  1766. else {
  1767. did -e antispam 61,62,63,64,65,66
  1768. }
  1769. }
  1770. }
  1771.  
  1772. ; The identd idea and parts of the code are by wshs
  1773. on *:socklisten:antispam.identd:{
  1774. if ($sock(antispam.identdin) != $null) { sockclose antispam.identdin }
  1775. sockaccept antispam.identdin
  1776. asecho $colour(other) * Identd request from $sock($sockname).ip
  1777. sockclose antispam.identd
  1778. unset %antispam.identd
  1779.  
  1780. }
  1781. on *:sockread:antispam.identdin:{
  1782. if ($sockerr) { return }
  1783. var %temp
  1784. sockread %temp
  1785. if (!%temp) { return }
  1786. tokenize 32 %temp
  1787. sockwrite -n $sockname $1 $+ , $3 : USERID : UNIX : $asnickname($asini(personalize,ident))
  1788. asecho $colour(other) * Identd replied: $1 $+ , $3 : USERID : UNIX : $asnickname($asini(personalize,ident))
  1789. sockclose antispam.identdin
  1790. }
  1791.  
  1792.  
  1793. ; queue code from wshs
  1794. alias -l as.queue {
  1795. if ($hget(as.queue) == $null) { hmake as.queue }
  1796.  
  1797. ; code to prevent re-queuing of the same commands
  1798. var %max = $hget(as.queue,0).item
  1799. var %index = 0
  1800. while (%index < %max) {
  1801. inc %index
  1802. if ($hget(as.queue,$hget(as.queue,%index).item) == $1-) {
  1803. return 0
  1804. }
  1805. }
  1806.  
  1807. as.hinc as.queue max
  1808. var %antispam.qx = a $+ $hget(as.queue,max)
  1809. hadd as.queue %antispam.qx $1-
  1810. if ($timer(as.queue) == $null) { .timeras.queue 0 1 as.sendqueue }
  1811. return 1
  1812. }
  1813. alias -l as.hinc { if ($hget($1)) { hadd $1 $2 $calc($hget($1,$2) + $iif($3 isnum,$3,1)) } }
  1814. alias -l as.hdec { if ($hget($1)) { hadd $1 $2 $calc($hget($1,$2) - $iif($3 isnum,$3,1)) } }
  1815. alias -l as.sendqueue {
  1816. if ($hget(as.queue,a1) == $null) || ($hget(as.queue,max) <= 0) { .timeras.queue off | return }
  1817. sockwrite -n antispam $hget(as.queue,a1)
  1818. var %antispam.start = 2
  1819. var %antispam.end = $hget(as.queue,max)
  1820. while (%antispam.start <= %antispam.end) {
  1821. var %antispam.cur = a $+ $calc(%antispam.start - 1)
  1822. var %antispam.las = a $+ %antispam.start
  1823. if ($hget(as.queue,%antispam.las)) hadd as.queue %antispam.cur $hget(as.queue,%antispam.las)
  1824. inc %antispam.start
  1825. }
  1826. var %antispam.las = a $+ $hget(as.queue,max)
  1827. hdel as.queue %antispam.las
  1828. hadd as.queue max $calc($hget(as.queue,max) - 1)
  1829. }
  1830. alias -l as.clearqueue {
  1831. if (!$hget(as.queue)) { hmake as.queue }
  1832. var %antispam.bleh = $hmatch(as.queue,a*,0)
  1833. hfree as.queue
  1834. hmake as.queue
  1835. hadd as.queue max 0
  1836. return %antispam.bleh
  1837. }
  1838.  
  1839. alias -l as.settings {
  1840. if ($dialog(antispam) == $null) {
  1841. set %antispam.set.web $askickmsg([webad])
  1842. set %antispam.set.inv $askickmsg([invite])
  1843. set %antispam.set.net $askickmsg([netad])
  1844. set %antispam.set.bd $askickmsg([hack])
  1845. set %antispam.set.vrs $askickmsg([virus])
  1846. set %antispam.set.greet $askickmsg([greet])
  1847. dialog -m antispam antispam
  1848. }
  1849. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement