How to ban a dynamic ip?

Post here if you need help setting up your server, etc.
zoidberg
On Lightcycle Grid
Posts: 25
Joined: Thu Mar 13, 2008 2:45 am

Post by zoidberg »

yikes! what a thread :)

while you're at it, since yer using perl, just make an external file with a list of "bad words" and load 'em into a hash or something, you can put variable values directly into regular expressions.
or was that already discusses ?:P

would it lag the server if you had a script constantly checking through every line of chat text? or is the load pretty insignificant...

User avatar
Lucifer
Project Developer & Local Moonshiner
Posts: 8610
Joined: Sun Aug 15, 2004 3:32 pm
Location: Republic of Texas
Contact:

Post by Lucifer »

The load is pretty insignificant. Provided the script doesn't do a whole buttload of processing, but there is definitely plenty of room for the script to do useful stuff.
Image

Be the devil's own, Lucifer's my name.
- Iron Maiden

User avatar
ivantis
Round Winner
Posts: 269
Joined: Mon Mar 03, 2008 2:33 pm
Contact:

Post by ivantis »

the load of checking could be downsized by using inotail, which, on my system, doesnt display as much as just cat or something
Image
Image
Image

QUARG
Round Winner
Posts: 223
Joined: Thu Sep 14, 2006 2:38 pm
Location: montreal

Post by QUARG »

A question about range banning. Is there a right way to go about it so as to concentrate the ban. Also want is the format for range bans that i would use in the .cfg?

epsy
Adjust Outside Corner Grinder
Posts: 2006
Joined: Tue Nov 07, 2006 6:02 pm
Location: paris
Contact:

Post by epsy »

one line for one IP

EDIT:

Code: Select all

BAN_IP 1.1.0.0
BAN_IP 1.1.0.1
BAN_IP 1.1.0.2
[...]

QUARG
Round Winner
Posts: 223
Joined: Thu Sep 14, 2006 2:38 pm
Location: montreal

Post by QUARG »

Isnt there a way to ban a person with say 22.40 as a prefix. Maybe something like "ban_ip 22.40.*.*" ? Because with your method i would have to type in a load of ips. Also is the [...] part of the command line?

epsy
Adjust Outside Corner Grinder
Posts: 2006
Joined: Tue Nov 07, 2006 6:02 pm
Location: paris
Contact:

Post by epsy »

no and no
to print all these lines make your own little script

zoidberg
On Lightcycle Grid
Posts: 25
Joined: Thu Mar 13, 2008 2:45 am

Post by zoidberg »

Okay, so I spent a few hours thinking about that tail thing that was posted a LONG time ago on this thread.

What I did is: there are two files, a "talk_in" file and a "talk_out" file. The dedicated server is run via. that wonderful tail command given earlier (I have to use just tail -f, for some reason tail -fn0 doesn't work well). Then I wrote a little perl script that will talk to the server via the talk_in file, and will read server information via. the talk_out file. So it's a sort of "hook" that hooks into a running server that's executed with this tail dealy, so you can communicate with it as it's running.

This can be modified to do stuff like monitor IP's and language and whatnot. It comes with a tail routine that isn't based on the perl Tail module. Since I'm only dealing with whole lines it does this:
the first time it opens the file-to-be-tailed it just counts the number of lines, stores that number and closes the file. Then it periodically opens the file again and checks to see if there are any new lines, if there are, they will be displayed to the console. You can set a delay so the file isn't constantly opened, but the delay number is just the size of a for loop because I figured seconds were too long and i didn't want to get into hi-res time.

Anyway, I just got done testing it and it works pretty well...
I'd like to put in a lock so that you can't run more than one of these at a time on the same files, but I'll deal with that later.

All you need to do is put the two attached files in the same folder as the dedicated server executable. Then make two blank files "talk_in.txt" and "talk_out.txt" then run the dedicated server via the tail command, which is included as a bash script in this email to feed IO through those two txt files. Then do "perl ArmaHook.pl".
Armahook fires up two threads, one called "runliner", which handles STDIN and another called "tailer" which tails the "talk_out.txt" file (your server output).
you can send commands to the server by prefixing them with a slash /,
so /center_message poopyface will center_message the word poopyface.
Then you can talk to the tailer thread too, type "tailer help" to get a brief list of commands for it. It starts out in the "off" mode, so you have to turn it on with "tailer on" to see any of the server output.

It was a quick little ditty so please, don't bash my poor little child :)
thoughtful comments are welcome tho.

hmm, forum won't let me attach .sh or .pl files, so I'm going to archive this on a mac. Hopefully anyone who wants to see it will be able to unpack it.
Attachments
ArmaHook.zip
run_arma.sh is the bash script
(2.68 KiB) Downloaded 96 times

Monkey
Match Winner
Posts: 734
Joined: Thu May 22, 2008 12:36 am
Location: England, UK

Post by Monkey »

epsy wrote:
ivantis wrote:is there a way to empty a file with a single command (does "touch <filename>" do that)? that would be a handy crontab for the input file
echo "" >file_to_empty
> file_to_empty
That is a standard shortcut that exists for emptying files
Playing since December 2006

superkikim
On Lightcycle Grid
Posts: 37
Joined: Tue Jan 08, 2008 1:40 pm

Re: How to ban a dynamic ip?

Post by superkikim »

Long time no news in here :-)

All this thread is very interesting. Thank you for the inspiration.

I'm using screen to run my multiple servers (Fast Track).

Screen is able to make a log, and is able to send commands to the console. So I expected that it would be able to get a script running at each new line in the log (greping on bad words to avoid high overhead) and send a command to ban the user.

Unfortunately, I am unsuccesful in sending a command to the screen window :-(

I used: screen -S session -X command

i.e.

screen -S fightnow -X say Do not swear

but the command is not relayed :-( How could I address this ?

User avatar
Z-Man
God & Project Admin
Posts: 11331
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Re: How to ban a dynamic ip?

Post by Z-Man »

The -X command does not work like you think it does. It sends screen commands, not direct input. Change it to

Code: Select all

screen -S fightnow -X stuff "say Do not swear
"
and it should work. The quotes and embedded newline are important, I found no less convoluted way of sending the newline to the screen session.

superkikim
On Lightcycle Grid
Posts: 37
Joined: Tue Jan 08, 2008 1:40 pm

Re: How to ban a dynamic ip?

Post by superkikim »

Works perfectly :-) Tx a lot.

For the carriage return, CTRL-V then ENTER

It gives a litteral ^M which is correctly interpreted.

I will post my script as soon as I've made it.

User avatar
Infa(mous)
Round Winner
Posts: 255
Joined: Thu Aug 14, 2008 11:27 pm

Re: How to ban a dynamic ip?

Post by Infa(mous) »

With the whole censoring thing, should the list be some type of xml?
The sort of thing I was thinking is attached. Just not sure if it would really be terribly useful.
Attachments
censor.aalist.xml
A sort of censorlist thingy...
(7.64 KiB) Downloaded 23 times
-Infamous

User avatar
-=VcL.Rajinn
Round Winner
Posts: 242
Joined: Fri Aug 29, 2008 9:35 pm

Re: How to ban a dynamic ip?

Post by -=VcL.Rajinn »

I would like it if Arma did have a way of range banning an IP using the wildcard characters.

Plausible?
Image

epsy
Adjust Outside Corner Grinder
Posts: 2006
Joined: Tue Nov 07, 2006 6:02 pm
Location: paris
Contact:

Re: How to ban a dynamic ip?

Post by epsy »

Plausible, but busy with more important stuff.

Post Reply