Quote:
Originally Posted by grail
Please show us what you have done to try and solve this? Also you do not indicate if it is in a script, on the command line or any particular language. Help us to help you.
|
Alrighty, yup', it's actually a script.
Someone is currently DoSing me and I'd like to have his ban automatic.
What I do is I send the output of tcpdump to a file, each line look like this:
19:20:45.620829 IP 62.106.118.118.49954 > xx.xx.xx.xx.xxxx: UDP, length 0
In this, I do only want to take '62.106.118.118' which is a variable, however, I did not manage to remove the extra '.49954'.
Here is what I've done so far to achieve this: echo "19:20:45.620829 IP 62.106.118.118.49954 > xx.xx.xx.xx.xxxx: UDP, length 0" | grep -o -P '(?<=IP ).*(?= >)' ; which outputs: 62.106.118.118.49954 .
Now, from this output, I'd like to get read of the four last characters (which might be variable).
Thank you very much for your help !