mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2020
Posts: 10
Bes Offline OP
Pikka bird
OP Offline
Pikka bird
Joined: Dec 2020
Posts: 10
Hello all.

I need help, for this code, maybe its not a dificult and for you its to easy but for me its not easy..

Code
on *:TEXT:*!PROXY*:#kontrolli:{
  if ($nick ison #) && ($2 = $read(C:\telejuara.txt,w,$2)) && ($2) { msg #kontrolli 47I cant add this IP  - $+ $2 $+ - on SHUN because its in ALLOW list - telejuara.txt  halt }
  if ($nick ison #) && ($2 != $read(C:\telejuara.txt,s,$2)) && ($2) { msg #Kontrolli 4,1Proxy: 12I have make this IP in SHUN: 6 $2 | /shun $4 20s 47Β« Your system its not sure because You use Proxy or VPN..  Β» ( /Firewall Off ) halt }
}
}


I have created a file with txt to C:\ with the name telejuara.txt and I have put all IP what are all good from good company and when I make !Proxy 46.19.225.162 read automatic this file and found thit IP in this File (C:\telejuara.txt) and make nothing, WHEN a IP its not in this File (C:\telejuara.txt) i have coded and make SHUN

Now what i want to help ME its:


i want to configure this code, when a make a IP in this File (C:\telejuara.txt) ---> 46.19.* <--- and than, when a make a full IP in my channel maybe !Proxy 46.19.125.19 and make nothing because this IP its sure and its in this File (C:\telejuara.txt).

Thanka for help.

AdmiraL

Last edited by Bes; 12/01/21 11:00 PM.
Joined: Jan 2012
Posts: 301
Pan-dimensional mouse
Offline
Pan-dimensional mouse
Joined: Jan 2012
Posts: 301
I have created a small script for you. Try to use it according to your needs. All settings are made inside the alias "ci_set".

Code
alias -l ci_set {
  %ci_path_list = scripts\CheckIP\allow_list.txt
  %ci_shun_time = 1h
  %ci_shun_reason = You are probably using a Proxy or VPN...
  %ci_chans = #test,#kontrolli
}
---------------------------------------------------------------------
on *:TEXT:!proxy*:#:{
  ci_set | if ($istok(%ci_chans,$chan,44)) {
    if ($imfind($2)) msg $chan I cant add this IP:03 $2 - on SHUN because its in ALLOW list:12 $v1
    else { shun $+(*!*@,$2) %ci_shun_time %ci_shun_reason | msg $chan Proxy - I have added this IP in SHUN:04 $2 }
  }
}
alias -l imfind { var %n $gettok($1,1,46) | var %f %ci_path_list | var %l 1 | :next | if ($read(%f, wt, $+(%n,.*), %l)) { var %r $readn | var %l $calc(%r +1) | var %s $read(%f,%r) | if (%s iswm $1) return %s | if (%l < $lines(%f)) goto next } }



🌐 http://forum.epicnet.ru πŸ“œ irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples
Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
The 't' and 'n' switches of $read seem to have slipped out of the code before you clicked Post Reply!


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jan 2012
Posts: 301
Pan-dimensional mouse
Offline
Pan-dimensional mouse
Joined: Jan 2012
Posts: 301
Originally Posted by Wims
The 't' and 'n' switches of $read seem to have slipped out of the code before you clicked Post Reply!

Not certainly in that way. Just given the condition of delivered the task, I do not consider it necessary to use excess additional switches inside the identifier "$read()" while reading and checking the lines of the file containing only the numbers "0-9", dots "." and asterisks "*". Because with a large number of IP addresses in the list, the script should work as efficiently and quickly as possible.





🌐 http://forum.epicnet.ru πŸ“œ irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
What would make you think adding more switches would slow it down? If anything they'll make it faster because the lines won't be evaluated.

Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
But it is necessary. Either you want the line to be evaluated or you don't, if you don't, you should use the n switch, and it's extremely rare that a script will result in a need to evaluate the line from a $read call, it almost never happen in practice, and it's very dangerous to evaluate unknown content, via a different exploit someone may be able to write code to that file.
The t switch is also almost always required in practice because the content of the file is either unknown, or it's known but the first line is not representing the total number of line. So in practice, not using the t switch will only result in some $read failure when the first line is a number, rather than doing any good to the read call by not using it.

Not using the t switch will only result in failure but not using the n switch can result in someone evaluating code behind your back etc.

You used "wt" switches for the first $read call and then you didn't use the t switch to get the whole line, your t switch usage is not consistent anyway.

And as pointed out evaluating will only make it slower.

Always use the n switch unless you specifically want to evaluate the line, and always use the t switch unless you control the first line of the file and it's a number representing the total number of lines in the file.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jan 2012
Posts: 301
Pan-dimensional mouse
Offline
Pan-dimensional mouse
Joined: Jan 2012
Posts: 301
OΠΊ. To cast aside all doubts, I made several tests and this is the result I got:

    [Linked Image from i.ibb.co]

Hmm... but with the earlier version it was much faster:

    [Linked Image from i.ibb.co]

In principle, I agree with this, when there are fears that unauthorized actions can be performed with working file by extraneous scripts with the addition of new entries or in the case of using unknown files, then in order to avoid dangerous consequences, it is better to always use the "n" switch when reading a file.


🌐 http://forum.epicnet.ru πŸ“œ irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
Your demo is not very legible. Your "earlier" test has a later timestamp, but you have 2 pairs of tests that both happen to start at the same hr:mins:secs ?
This is a test that takes 6 minutes to read from a text? or you have a large number of repeats? When benchmarking things, you must take care to minimize things not being tested. For example, disk access is very slow compared to other things, so to lessen the effect of the disk read, you should have a disk read to put the file into the cache, before doing the timed test. It's really hard to read your test, since the reader is more concerned with how long a test takes, not what the start and stop times are.


Link Copied to Clipboard