Raptor, traffic control plugin

interesting to write the domain of my former server (conference.server.la) does not work, if you write ex (server.la) but works perfectly, but so is the effect on all packets from the server …

I will continue to study the xml now makes me really miss this feature and to block just one user.

I think many users of openfire enjoy what I want to, while the (server jabberd process one) such function antiflood

url = http :// www.vippt.com/images/ 75966limite.png

I took a picture of jabberd to run with it, show the xml code to see …

11shinyiconsTraffic rate limit is exceeded

Excuse my English, with much help from google translator.

coolcat my friend if I do that I would pay money to work, something to block users for 3 seconds when trying to send more than 3 posts in less than 3 seconds or something … thanks

Maybe my code didn’t work because you didn’t send enough messages. I forgot to change the packet rates. The code above allows more than 50 messages per second over some time, more than 1500 messages in total. It’s probally not possible to create such rates by hand. I’m using these values to protect the server from bugs in Openfire where messages are send in infinite loops internally.

However, for 3 posts in 3 seconds, you should try something like this:

<?xml version="1.0" encoding="UTF-8"?>

<raptor xmlns:action="http://martin-weusten.de/raptor/action" xmlns:check="http://martin-weusten.de/raptor/check">
  <name>MUC-FloodDetection</name>
  <desc>This example is a simple flood detection for MUC-rooms. If it detects a flood all packets from the user are droped for the next 3 seconds.</desc>
  <version>2</version>
  <counter name="TIMER" interval="500" decrement="1"/>    
  <counter name="TRAFFIC" interval="1000" decrement="1"/>
  <function name="MAIN">
    <action:rule>
      <if>
        <check:packet packet="MESSAGE" />
        <check:address fromtype="ANY" from="" totype="DOMAIN" to="conference.localhost" />
      </if>
      <then>
        <action:rule>
          <if>
            <check:count counter="TIMER" count="FROM" compare="GREATER" ref="0"/>
          </if>
          <then>
            <action:drop/>
          </then>
        </action:rule>
        <action:count counter="TRAFFIC" count="FROM"/>
        <action:rule>
          <if>
            <check:set_count counter="TRAFFIC" count="FROM" compare="GREATER" ref="3" newvalue="0"/>
          </if>
          <then>
            <action:set_count counter="TIMER" count="FROM" newvalue="6"/>
            <action:message mode="FROM">Traffic rate limit is exceeded. All your messages to the chatroom are ignored for 3 seconds.</action:log>
            <action:drop/>
          </then>
        </action:rule>
      </then>
    </action:rule>
  </function>
</raptor>

Note that this does drop messages to ALL chatrooms, not only the one you flooded in. Also it does count messages in all rooms in total.

Friend you have even a great capacity for this!

I had to change the line:

error:

<action:message mode="FROM">Traffic rate limit is exceeded. All your messages to the chatroom are ignored for 3 seconds.</action:log>

correct;

action:logFlood from user ‘\F’ with IP=\I. Dropping all packets from this user to conference server for 3 scds.</action:log>

so the user can receive a warning  in your account with a warning window?
<action:message mode="FROM">Traffic rate limit is exceeded. All your messages to the chatroom are ignored for 3 seconds.</action:
message
>

 I love it this  is fantastic when you make a system of donations?

Thank you for your  precious time to help

I had to change the line

Sorry…let’s say it with the words of Donald Knuth:

“Beware of bugs in the above code; I have only proved it correct, not tried it.”

so the user can receive a warning in your account with a warning window?
You can send Jabber messages to users using action:message. However, that’s only a simple chat message, not a “warning window”. Note, you can also send emails using action:email.

when you make a system of donations?
I’m glad you like Raptor. However, I don’t accept any donations, because then I would feel forced to work on Raptor again. My time is really limited. The only reason why I programmed Raptor was because I needed it myself. Actually I prefer to work on things like this or this in my spare free time.

If you really want to donate money, maybe you should donate to the people on Haiti.

I have made a donation to the haiti … I think everyone should help, but look at what could make a donation to their work, would not feel obliged to work more on it, lots of people would help, I think it deserves …

I’ll try to see the action: message to see if it works …

Thanks again friend.

**I see the manual to try to do the same but for incoming and outgoing messages in private chat … help me again?

reject more than 4 messages per second being sent or received, guided me through his example …

changed this:**

MUC-FloodDetection This example is a simple flood detection for MUC-rooms. If it detects a flood all packets from the user are droped for the next 3 seconds. 2 Flood from user '\F' with IP=\I. Dropping all packets from this user to conference server for 3 scds. AntiFlood: IP: \I

I promise not to annoy the more friend and thanks for everything, I have to study better the plugin

Your profile won’t work because the first rule does only apply if the counter is greater 0. But that way the counter is never incremented.

for incoming and outgoing messages in private chat****
That’s excatly what the original FloodDetect example does. You just need to adjust the counter values. Additionally you might want to restrict the counter on messages of type “message”. Otherwise your users will be blocked during their login, because you get hunderds of IQ and Presence packets during login with a large roster.

Hello friend coolcat

Then change your example and only for packages messages?

is possible with this block any user who submit more than 5 words repeated?

example

lol lol lol lol lol

or

lol
lol
lol
lol
lol

I will clean install a server on another computer to better study your plugin that promises enough to help me on my server …

It is possible that a more active xml? how can I join 2 xml assets

I think he could have multiple xml assets … I was frustrated … eheheh

I can now for the work I did for the chat rooms for more than one domain of rooms? eg

action:rule

<check:packet packet=“MESSAGE” />
<check:address fromtype=“ANY” from=“” totype=“DOMAIN” to=“1.localhost”/>
<check:address fromtype=“ANY” from=“” totype=“DOMAIN” to=“2.localhost”/>
<check:address fromtype=“ANY” from=“” totype=“DOMAIN” to=“3.localhost”/>


action:rule

???

is possible with this block any user who submit more than 5 words repeated?

No, Raptor is not able to inspect the packet in depth. However, you could extend Raptor.

It is possible that a more active xml?

No, because it’s unclear how to join them. E.g in which order should Openfire execute them? That makes a big difference if one profile does drop packets, while the other profile does just log them.

However, you can just put both profiles into one single profile. That way you can define the behavior yourself. To write the profile in a clean manner you could use a separate functions for each subprofile.

I can now for the work I did for the chat rooms for more than one domain of rooms?
Check out section “Rules” on the “Basics” manual page. The Rule does execute Checks one by one from top down. We use an logical AND to connect all checks in the list. So in your case the packet would need to have ALL THREE domains in the “to” field. That’s impossible, the Rule would always execute the ELSE branch. However, take a look on the “A lessons in Logics” section on the “Advanced Concepts” page.

Notation:

  • M = “Message”
  • 1 = “Domain1”
  • 2 = “Domain2”
  • 3 = “Domain3”
  • & = and
  • | = or
  • ! = not

This is what you want:

M & ( 1 | 2 | 3 )

and we convert it be applying De Morgan’s law twice:

= M & !(!1 & !2 & !3)

= !(!M | (!1 & !2 & !3))

That does result in this code, note I’m using NMESSAGE and NDOMAIN:

<action:rule>
  <if>
    <check:packet packet="NMESSAGE" />
  </if>
  <then>
     <action:logic_or />
  </then>
</action:rule>
<action:rule>
  <if>
    <check:address fromtype="ANY" from="" totype="NDOMAIN" to="1.localhost"/>
    <check:address fromtype="ANY" from="" totype="NDOMAIN" to="2.localhost"/>
    <check:address fromtype="ANY" from="" totype="NDOMAIN" to="3.localhost"/>
  </if>
  <else>
     <!-- ...further code here... -->
  </else>
</action:rule>

Hello friends and thank you for helping me in this fight quite a lot, I know I’m being a little possessive about your work, but it can only help me this time only … I can not start that way told me …

help me just this last xml that makes the action for all 3 domains, your plugin is really very complex and delicate but recommended.

is my last request for help … I rape this … Thanks

My code lol

**<?xml version="1.0" encoding="UTF-8"?> **


**
**

** MUC-FloodDetection
**

** This example is a simple flood detection for MUC-rooms. If it detects a flood all packets from the user are droped for the next 3 seconds.
**

** 2
**

**
**

**
**

**
**

**action:rule
**

**
**

** <check:packet packet=“NMESSAGE” />
**

**
**

**
**

** <action:logic_or />
**

**
**

**</action:rule>
**

**action:rule
**

**
**

** <check:address fromtype=“ANY” from="" totype=“NDOMAIN” to=“1.localhost”/>
**

** <check:address fromtype=“ANY” from="" totype=“NDOMAIN” to=“2.localhost”/>
**

** <check:address fromtype=“ANY” from="" totype=“NDOMAIN” to=“3.localhost”/>
**

**
**

**
**

**
**

**
**

**</action:rule>
**

** <action:count counter=“TRAFFIC” count=“FROM”/>
**

** action:rule
**

**
**

** <check:set_count counter=“TRAFFIC” count=“FROM” compare=“GREATER” ref=“2” newvalue=“0”/>
**

**
**

**
**

** <action:set_count counter=“TIMER” count=“FROM” newvalue=“6”/>
**

** action:logFlood from user ‘\F’ with IP=\I. Dropping all packets from this user to conference server for 3 scds.</action:log>
**

** <action:message mode=“FROM”>AntiFlood</action:message>
**

** action:drop/
**

** action:drop/
**

**
**

** </action:rule>
**

**
**

** </action:rule>
**

** **


**
**

** **



You just needed to insert the Anti-Flood code at the “…further code here…” point I also changed the action:logic_or into action:accept which has in this case the same effect but might be easier to understand.

<?xml version="1.0" encoding="UTF-8"?>

<raptor xmlns:action="http://martin-weusten.de/raptor/action" xmlns:check="http://martin-weusten.de/raptor/check">
    <name>MUC-FloodDetection</name>
    <desc>This example is a simple flood detection for MUC-rooms. If it detects a flood all packets from the user are droped for the next 3 seconds.</desc>
    <version>2</version>
    <counter name="TIMER" interval="500" decrement="1"/>
    <counter name="TRAFFIC" interval="1000" decrement="1"/>
    <function name="MAIN">
        <action:rule>
            <if>
                <check:packet packet="NMESSAGE" />
            </if>
            <then>
                <action:accept />
            </then>
        </action:rule>
        <action:rule>
            <if>
                <check:address fromtype="ANY" from="" totype="NDOMAIN" to="1.localhost"/>
                <check:address fromtype="ANY" from="" totype="NDOMAIN" to="2.localhost"/>
                <check:address fromtype="ANY" from="" totype="NDOMAIN" to="3.localhost"/>
            </if>
            <else>
                <action:rule>
                    <if>
                        <check:count counter="TIMER" count="FROM" compare="GREATER" ref="0"/>
                    </if>
                    <then>
                        <action:drop/>
                    </then>
                </action:rule>
                <action:count counter="TRAFFIC" count="FROM"/>
                <action:rule>
                    <if>
                        <check:set_count counter="TRAFFIC" count="FROM" compare="GREATER" ref="2" newvalue="0"/>
                    </if>                   
                    <then>
                        <action:set_count counter="TIMER" count="FROM" newvalue="6"/>
                        <action:log>Flood from user '\F' with IP=\I. Dropping all packets from this user to conference server for 3 scds.</action:log>
                        <action:message mode="FROM">AntiFlood</action:message>
                        <action:drop/>
                    </then>
                </action:rule>
            </else>
        </action:rule>
  </function>
</raptor>

Thank you for your help, it will ask you to use programs to edit or create plugins could give me … like to examine further the plugins, you may learn to make my plugins … the time course, because java does not understand much. but is almost equal to other scripts …

hello coolcat and all staf, friends…

The issue is not about raptor … but I’m trying to create an application to my server and noticed that the date and time the database is coded example: Last Login: 001265359634722

Some friends here know how I can convert it into php code to the human eye?

Thank you very much

Openfire uses Java timestamps. Thats the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.

Skip the last three digits to convert it into an standard UNIX timestamp. UNIX uses seconds instead of milliseconds, because that way it does fit into an 32bit integer.

After that you can format it as a time string in you local timezone for example using the date function in PHP.

<? //----> convert $timestamp = "001265363218597"; echo "Data e hora da requisição: " . date('d/m/Y - H:i:s', $timestamp); ?>

java time 001265363218597

25/08/1917 - 02:57:57

thanks for helping me and being considerate.

why is it that the date is shown wrong?

why is it that the date is shown wrong?

Because you didn’t remove the last three digits.

However, this thread is about Raptor, not about PHP. Please ask PHP related questions in a PHP community.

Hi,

how active is this project? I’m trying to install it but I get several errors:

It would be a really great plugin Thanks for it!

2011.04.14 14:16:21 Error loading plugin: /usr/share/openfire/plugins/raptor
java.lang.NoSuchMethodError: java.util.Arrays.copyOf([Ljava/lang/Object;I)[Ljava/lang/Object;
at org.jivesoftware.openfire.plugin.raptor.util.PrebuildMessage.(PrebuildMes sage.java:157)
at org.jivesoftware.openfire.plugin.raptor.action.ActionLog.(ActionLog.java: 38)
at org.jivesoftware.openfire.plugin.raptor.action.ActionLog.importXML(ActionLog.ja va:49)
at org.jivesoftware.openfire.plugin.raptor.action.Action.importXML(Action.java:56)
at org.jivesoftware.openfire.plugin.raptor.action.ActionRule.importXML(ActionRule. java:146)
at org.jivesoftware.openfire.plugin.raptor.action.Action.importXML(Action.java:42)
at org.jivesoftware.openfire.plugin.raptor.util.Function.loadXML(Function.java:97)
at org.jivesoftware.openfire.plugin.raptor.Profile.(Profile.java:209)
at org.jivesoftware.openfire.plugin.raptor.ProfileManager.importXML(ProfileManager .java:266)
at org.jivesoftware.openfire.plugin.raptor.ProfileManager.init(ProfileManager.java :77)
at org.jivesoftware.openfire.plugin.raptor.Raptor.initializePlugin(Raptor.java:78)
at org.jivesoftware.openfire.container.PluginManager.loadPlugin(PluginManager.java :483)
at org.jivesoftware.openfire.container.PluginManager.access$300(PluginManager.java :80)
at org.jivesoftware.openfire.container.PluginManager$PluginMonitor.run(PluginManag er.java:1067)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:280)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:135)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101 (ScheduledThreadPoolExecutor.java:65)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodi c(ScheduledThreadPoolExecutor.java:146)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Schedu ledThreadPoolExecutor.java:170)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java: 651)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
at java.lang.Thread.run(Thread.java:595)

And:

2011.04.14 14:16:20 Corrupted pack file: magic/ver = CAFED00D/160.1 should be CAFED00D/150.7

            java.io.IOException: Corrupted pack file: magic/ver = CAFED00D/160.1 should be CAFED00D/150.7