Raised This Month: $75 Target: $400
 18% 

Block IP Pattern (With Spaces)


Post New Thread Reply   
 
Thread Tools Display Modes
Alber9091
Senior Member
Join Date: Jun 2014
Location: Some Where On Earth
Old 08-10-2019 , 17:32   Re: Block IP Pattern (With Spaces)
Reply With Quote #21

Quote:
Originally Posted by bad_boy View Post
I tested the previous code and it worked. However it will only block 1 space between the numbers.
This one will block up to 4 spaces between the numbers. If they use 5 spaces or more this will not work.


PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <regex>

new const BlockIps[ ] = "\d{1,3}\s{1,4}\d{1,3}\s{1,4}\d{1,3}\s{1,4}\d{1,3}"

new ret,error]
new 
Regex:Spam

public plugin_init() 
{
    
register_plugin"Block IP""1.0""Allied")

    
register_clcmd"say""spamming" )
    
register_clcmd"say_team""spamming" )

    
Spam regex_compile BlockIpsreterrorcharsmax error ) )
}

public 
spammingid 
{
    new 
text128 ], ret
    read_args
textcharsmaxtext ) )

    new 
Check regex_match_ctextSpamret )
        
    if( 
Check 
    {
        
client_printidprint_chat"Stop Advertising !!" )
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE

Its working awesome and as I wanted but can you add white list for ips? like I can add white list my own server Ips? + can you make client_print_color? I'm using AMXX 1.90

Thanks Alot Mate @bad_boy And @Relaxing Thank You too mate !!
__________________
Alber9091 is online now
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Location: Derbent, Caucasian
Old 08-10-2019 , 18:04   Re: Block IP Pattern (With Spaces)
Reply With Quote #22

Quote:
Originally Posted by bad_boy View Post
It's not supposed to match 123.456.789.123:27015
But it will match 123 456 789 123:27015

He asked for it to block Ips with spaces between the numbers.
why not supposed .?
Fuck For Fun is offline
bad_boy
Junior Member
Join Date: Oct 2018
Old 08-10-2019 , 18:46   Re: Block IP Pattern (With Spaces)
Reply With Quote #23

Quote:
Originally Posted by Alber9091 View Post
Its working awesome and as I wanted but can you add white list for ips? like I can add white list my own server Ips? + can you make client_print_color? I'm using AMXX 1.90
I don't think a whitelist is necessary because it will only block Ips written like this "123 456 789". You still can write "123.456.789" and it will not block it.
I will add the color for you in a few.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <regex>

new const BlockIps[ ] = "\d{1,3}\s{1,4}\d{1,3}\s{1,4}\d{1,3}\s{1,4}\d{1,3}"

new ret,error]
new 
Regex:Spam

public plugin_init() 
{
    
register_plugin"Block IP""1.0""Allied")

    
register_clcmd"say""spamming" )
    
register_clcmd"say_team""spamming" )

    
Spam regex_compile BlockIpsreterrorcharsmax error ) )
}

public 
spammingid 
{
    new 
text128 ], ret
    read_args
textcharsmaxtext ) )

    new 
Check regex_match_ctextSpamret )
        
    if( 
Check 
    {
        
client_print_coloridprint_team_red"^3Stop Advertising !!" )
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE

Quote:
Originally Posted by Fuck For Fun View Post
why not supposed .?
He asked for it to block Ips with spaces between the numbers.

Last edited by bad_boy; 08-10-2019 at 19:03.
bad_boy is offline
Alber9091
Senior Member
Join Date: Jun 2014
Location: Some Where On Earth
Old 08-10-2019 , 19:16   Re: Block IP Pattern (With Spaces)
Reply With Quote #24

Quote:
Originally Posted by bad_boy View Post
I don't think a whitelist is necessary because it will only block Ips written like this "123 456 789". You still can write "123.456.789" and it will not block it.
I will add the color for you in a few.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <regex>

new const BlockIps[ ] = "\d{1,3}\s{1,4}\d{1,3}\s{1,4}\d{1,3}\s{1,4}\d{1,3}"

new ret,error]
new 
Regex:Spam

public plugin_init() 
{
    
register_plugin"Block IP""1.0""Allied")

    
register_clcmd"say""spamming" )
    
register_clcmd"say_team""spamming" )

    
Spam regex_compile BlockIpsreterrorcharsmax error ) )
}

public 
spammingid 
{
    new 
text128 ], ret
    read_args
textcharsmaxtext ) )

    new 
Check regex_match_ctextSpamret )
        
    if( 
Check 
    {
        
client_print_coloridprint_team_red"^3Stop Advertising !!" )
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE

He asked for it to block Ips with spaces between the numbers.
Opps yes I forget that :p
Normal IP would make no problem !! (88.88.88.88:26271 etc)

P.S: I'm using Chat Manager by Mistrick to block IP patterns Ip's and had put my server ips on white list in it, hence you rightly mentioned, there is no need.

Once again, Thanks alot for the help !!
__________________
Alber9091 is online now
Natsheh
Veteran Member
Join Date: Sep 2012
Location: Muslim and proud!
Old 08-11-2019 , 02:14   Re: Block IP Pattern (With Spaces)
Reply With Quote #25

Better Pattren : "^^.*\d{1,3}(?:\D*\d{1,3}\D*\d{1,3}\D*\d{1,3} |\D*\d{1,3}\D*\d{1,3}|\D*\d{1,3}| *).*$"

It will detect the following.

123.223.223.243
123 2 232 2 243
123 223 223 243
123,223,223,243
Basically any character between (three or less) numbers

Also will detect
244.244.244
244.244
244
__________________
@Jailbreak MOD [Alot of features + API] 100% done !
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Last edited by Natsheh; 08-11-2019 at 07:55.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Alber9091
Senior Member
Join Date: Jun 2014
Location: Some Where On Earth
Old 08-11-2019 , 06:29   Re: Block IP Pattern (With Spaces)
Reply With Quote #26

Quote:
Originally Posted by Natsheh View Post
Better Pattren : "^^.*\d{1,3}(?:\D*\d{1,3}\D*\d{1,3}\D*\d{1,3} |\D*\d{1,3}\D*\d{1,3}|\D*\d{1,3}| *).*$"

It will detect the following.

123.223.223.243
123223223243
123 223 223 243
123,223,223,243
Basically any character between (three or less) numbers

Also will detect
244.244.244
244.244
244
I will test it in a while.
But won't this thing, block other common chats too, it would be annoying for users.

Quote:
123223223243
__________________

Last edited by Alber9091; 08-11-2019 at 06:57. Reason: Sorry, I misjudged the pattern.
Alber9091 is online now
Natsheh
Veteran Member
Join Date: Sep 2012
Location: Muslim and proud!
Old 08-11-2019 , 07:57   Re: Block IP Pattern (With Spaces)
Reply With Quote #27

Quote:
Originally Posted by Alber9091 View Post
I will test it in a while.
But won't this thing, block other common chats too, it would be annoying for users.
Nah it wont block it.
that following example was wrong
__________________
@Jailbreak MOD [Alot of features + API] 100% done !
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
bad_boy
Junior Member
Join Date: Oct 2018
Old 08-11-2019 , 08:08   Re: Block IP Pattern (With Spaces)
Reply With Quote #28

Quote:
Originally Posted by Natsheh View Post
Better Pattren : "^^.*\d{1,3}(?:\D*\d{1,3}\D*\d{1,3}\D*\d{1,3} |\D*\d{1,3}\D*\d{1,3}|\D*\d{1,3}| *).*$"
Sorry but it's worst because it will detect any number

It will detect
1
12
123
and so on.

Last edited by bad_boy; 08-11-2019 at 08:08.
bad_boy is offline
Alber9091
Senior Member
Join Date: Jun 2014
Location: Some Where On Earth
Old 08-11-2019 , 08:13   Re: Block IP Pattern (With Spaces)
Reply With Quote #29

Quote:
Originally Posted by Natsheh View Post
Better Pattren : "^^.*\d{1,3}(?:\D*\d{1,3}\D*\d{1,3}\D*\d{1,3} |\D*\d{1,3}\D*\d{1,3}|\D*\d{1,3}| *).*$"

It will detect the following.

123.223.223.243
123 2 232 2 243
123 223 223 243
123,223,223,243
Basically any character between (three or less) numbers

Also will detect
244.244.244
244.244
244
Its not between 3 or less but, Its blocking every single digit.

either 1 or 12 or 1234567

I like the Idea but Pattern needs to be fixed.
__________________
Alber9091 is online now
Alber9091
Senior Member
Join Date: Jun 2014
Location: Some Where On Earth
Old 08-11-2019 , 08:21   Re: Block IP Pattern (With Spaces)
Reply With Quote #30

Quote:
Originally Posted by bad_boy View Post
Sorry but it's worst because it will detect any number

It will detect
1
12
123
and so on.
Yes, Its actually doing like that.
__________________
Alber9091 is online now
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:38.


Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Theme made by Freecode