Skip to content Перейти до змісту


How to determine which IP addresses are hitting your web site the most Як визначити, який IP адрес б'ють ваш веб-сайт самої

Безпека

This is a brief one. Це короткий один. Thanks to Завдяки The How-To Geek How-To Geek for bringing this command into my troubleshooting repertoire. для чого ця команда в моєму репертуарі усунення несправностей.

A bit of background first. Трохи фону в першу чергу. This command is helpful to determine who is causing the most hits to your web site. Ця команда корисна, щоб визначити, хто є причиною найбільш показів на ваш веб-сайт. On my music blog, I post a fair number of (totally legal) MP3s. На моєму блозі музику, я пост чимало (абсолютно легальний) MP3. Some less than ethical people often use those MP3s to stream via their site, causing mine to be slower (and a larger bandwidth bill). Деякі менш етичних люди часто використовують ці MP3 файли на потік через свій сайт, в результаті чого моя повільніше (і більшою пропускною здатністю Bill). By figuring out the IP address of the site/person “stealing” my bandwidth I can then block their IP from accessing any of my content. З'ясувати IP адреса сайту / особи "крадіжки" на пропускну здатність Потім я можу заблокувати їх IP доступ до будь-якої з моїх книг.

Note: you'll need shell access to your web server log files Примітка: Вам знадобиться оболонка доступу до веб-сервера файли журналу

  1. SSH (or telnet) to your web host. SSH (або Telnet) до свого веб-хостингу. Switch to the directory that stores your web server log files. Перейдіть в каталог, який зберігає ваші веб-файлів журналу сервера.
  2. Run this command: Виконайте наступну команду:

    tail -100000 access.log | awk '{print $1}' | sort | uniq -c |sort -n Хвіст -100000 access.log | AWK '(PRINT $ 1)' | Сортувати | Uniq-C | Сортувати-N

    where 100000 is the number of lines (starting from the end of the log file) you want to search, and access.log is the name of your web server access log. 100000, де це кількість строк (починаючи з кінця файлу журналу) ви хочете виконати пошук, і access.log це ім'я вашого веб-журнал доступу до сервера.

  3. термінал з хвостом AWK Uniq результатів сортування

  4. The result will be a (probably) fairly long list of IPs, sorted by fewest hits to most. Результат буде (приблизно) досить довгий список IP-адрес, впорядковані за найменшим числом звернень до самих. The first value in each row is the number of times the IP address (the second number) accessed your site (in the number of lines of the log file you specified). Перше значення в кожному рядку кількість адрес IP (другий номер) на Вашому сайті (з-поміж рядків файлу журналу ви визначили).

    Use the host command to determine the fully qualified domain name of any IP address that shows up (you'll probably want to know who the ones that hit your site the most are). Використовуйте приймаючої команди визначити повне доменне ім'я будь-якого IP адреси, який показує вгору (можливо, вам захочеться дізнатися, хто ті, хіт вашого сайту більшість з них). In the screenshot example below, two of the IPs that hit simplehelp.net the most were Googlebot and the Yahoo Site Crawler. У прикладі, наведеному нижче скріншоті, два IP-адреси, що вразила simplehelp.net більшість з них були робота Google і Yahoo Site Crawler.

  5. термінал з хвостом AWK Uniq Сортування

  6. If there's an IP/domain that looks suspicious, you can check to see which files they were hitting by using the command: Якщо є IP / домен, який виглядає підозріло, ви можете перевірити, які файли вони били за допомогою команди:

    tail -1000 access.log | grep xx.xx.xx.xx Хвіст -1000 access.log | Grep XX.XX.XX.XX

    In that command, 1000 is the number of lines to check, access.log is the name of your web server access log, and xx.xx.xx.xx is the IP you want to sort by. У цій команді, 1000 ця кількість ліній, щоб перевірити, access.log це ім'я вашого веб-журнал доступу до сервера, і XX.XX.XX.XX є IP ви хочете виконати сортування. I'd suggest using a smaller number (1000 vs. 100000 as used in the first command) as you probably don't need/want to see every file they accessed. Я пропоную з використанням меншого числа (1000 проти 100000, використовувані в першу команду), як ви, мабуть, не потрібні / хочемо, щоб побачити всі файли, вони доступ. If you do, increase the 1000 number. Якщо так, то збільшення числа 1000. Or, if not very many results show up, that means that they were hitting your site “earlier”, and you'll want to increase 1000 to a higher number. Або, якщо не дуже багато результати показують, що означає, що вони били Вашого сайту "раніше", і ви хочете збільшити до 1000 вище числа.

Posted in Опубліковано в Security Безпека . .

Related Posts: Схожі повідомлення:

Why you get email that isn't addressed to you Чому Ви отримаєте лист, яка адресована не вам
How to use vMailias to generate unique email addresses for easy sorting and filtering Як використовувати vMailias для створення унікальних адрес електронної пошти для зручності сортування та фільтрації
How to secure your wireless home network Як убезпечити вашу домашню бездротову мережу
Some useful Linux bash tricks Деякі корисні Bash Linux трюки
How to determine the number of times your site has been bookmarked on del.icou.us Як визначити, скільки разів ваш сайт був закладкою на del.icou.us

3 Responses 3 Відповіді

Stay in touch with the conversation, subscribe to the Залишайтеся на зв'язку при розмові, підпишіться на RSS feed for comments on this post RSS-канал для коментарів на цю посаду . .

  1. Tony Тоні says говорить

    The problem is that if someone hotlinks your mp3s (or images, or any other media), then it's still the IPs of their users that will show up in your logs, not the offending webserver. Проблема в тому, що якщо хтось Hotlinks ваші MP3 файли (або зображення, або будь-якому іншому носії), то вона, як і раніше їх IP-адреси користувачів, які будуть з'являтися в журналах, а не образити сервер. That is to say, it will likely be a fairly even distribution of users and indistinguishable from that of your legitimate visitors (unless someone is just continuously refreshing your media content). Тобто, це, ймовірно, буде досить рівномірний розподіл користувачів і не відрізняється від ваших законних відвідувачів (якщо хтось просто постійне поповнюєте свій медіа контент).

    What you want to be doing is checking for the referrer information to your media files (naturally excluding your own domain from the list). Те, що ви хочете робити це перевірка реферера інформації мультимедійних файлів (природно, за винятком свого домену із списку).

  2. Ross Росс says говорить

    Tony - Тоні --

    Under normal circumstances yes, you're absolutely right. За нормальних обставин Так, ви абсолютно праві. In my specific case, the site was loading the files via a flash player that they hosted, and all the requests came from the sites flash player. У моєму конкретному випадку, сайт був завантаження файлів за допомогою Flash Player, що їх розміщення, а також усі запити прийшли з сайтів, Flash Player. Adding the IP to my .htaccess in turn stopped the flash player from loading the songs for anyone/everyone who tried to play them from the *explatives* site. Додавання до мого IP. Htaccess в свою чергу, зупинила Flash Player від завантаження пісень для будь-якого / кожного, хто намагався грати з ними explatives * * сайті.

  3. miiimooo says miiimooo говорить

    لم افهم شي لم افهم شي



Some HTML is OK Деякі HTML нормально

or, reply to this post via або відповісти на цей пост через trackback Архів . .