首頁 資料庫 mysql教程 Shell分析access

Shell分析access

Jun 07, 2016 pm 03:50 PM
access shell tcp 分析 查看 連接埠 連接

#查看80端口的tcp连接 #netstat -tan | grep ESTABLISHED | grep :80 | wc -l 1 #当前WEB服务器中联接次数最多的ip地址: #netstat -ntu |awk '{print $5}' |sort | uniq -c| sort -n -r 231 ::ffff:127.0.0.1:8095 23 ::ffff:192.168.50.201:5432 2 ::ffff:1

#查看80端口的tcp连接

#netstat -tan | grep "ESTABLISHED" | grep ":80" | wc -l

1

#当前WEB服务器中联接次数最多的ip地址:

#netstat -ntu |awk '{print $5}' |sort | uniq -c| sort -n -r

231 ::ffff:127.0.0.1:8095

23 ::ffff:192.168.50.201:5432

2 ::ffff:192.168.50.203:80

1 servers)

1 ::ffff:192.168.50.56:43314

1 ::ffff:192.168.50.21:2996

1 ::ffff:192.168.50.21:2989

1 ::ffff:192.168.50.200:8060

1 ::ffff:192.168.50.12:1300

1 ::ffff:192.168.50.12:1299

1 ::ffff:192.168.50.12:1298

1 ::ffff:127.0.0.1:57933

1 Address

1 192.168.50.41:65310

1 192.168.50.41:64949

1 192.168.50.41:49653

#查看日志中访问次数最多的前10个IP

#cat access_log |cut -d ' ' -f 1 |sort |uniq -c | sort -nr | awk '{print $0 }' | head -n 10 |less

14085 121.207.252.122

13753 218.66.36.119

11069 220.162.237.6

1188 59.63.158.118

1025 ::1

728 220.231.141.28

655 114.80.126.139

397 117.25.55.100

374 222.76.112.211

348 120.6.214.70

#查看日志中出现100次以上的IP

#cat access_log |cut -d ' ' -f 1 |sort |uniq -c | awk '{if ($1 > 100) print $0}'|sort -nr |less

14085 121.207.252.122

13753 218.66.36.119

11069 220.162.237.6

1188 59.63.158.118

1025 ::1

728 220.231.141.28

655 114.80.126.139

397 117.25.55.100

374 222.76.112.211

348 120.6.214.70

252 58.211.82.150

252 159.226.126.21

206 121.204.57.94

192 59.61.111.58

186 218.85.73.40

145 221.231.139.30

134 121.14.148.220

123 222.246.128.220

122 61.147.123.46

119 121.204.105.58

107 116.9.75.237

105 118.123.5.173

#查看最近访问量最高的文件

#cat access_log |tail -10000|awk '{print $7}'|sort|uniq -c|sort -nr|less

8729 /server-status?auto

618 /

15 /favicon.ico

12 /manager/html

10 *

9 /top/icons.gif

8 /www.766.com/awstats.www.766.com.html

8 /awstatsicons/other/vv.png

8 /awstatsicons/other/vu.png

8 /awstatsicons/other/vp.png

8 /awstatsicons/other/vk.png

8 /awstatsicons/other/vh.png

8 /awstatsicons/other/hx.png

8 /awstatsicons/other/hp.png

8 /awstatsicons/other/hk.png

8 /awstatsicons/other/hh.png

8 /awstatsicons/other/he.png

8 /awstatsicons/other/awstats_logo6.png

8 /awstatsicons/os/win.png

8 /awstatsicons/os/unknown.png

8 /awstatsicons/os/unix.png

8 /awstatsicons/os/symbian.png

8 /awstatsicons/os/psp.png

#查看最近访问量最高的页面(.png)

#cat access_log |awk '{print $7}'|grep '.png'|sort|uniq -c|sort -nr |head -n 10

241 /awstatsicons/other/awstats_logo6.png

227 /awstatsicons/clock/hr12.png

226 /awstatsicons/other/vv.png

226 /awstatsicons/other/vu.png

226 /awstatsicons/other/vp.png

226 /awstatsicons/other/vk.png

226 /awstatsicons/other/vh.png

226 /awstatsicons/clock/hr9.png

226 /awstatsicons/clock/hr8.png

226 /awstatsicons/clock/hr7.png

#查看日志中访问超过100次的页面

#cat access_log | cut -d ' ' -f 7 | sort |uniq -c | awk '{if ($1 > 100) print $0}' | less

20107 /

1027 *

215 /awstatsicons/browser/chrome.png

215 /awstatsicons/browser/firefox.png

136 /awstatsicons/browser/mozilla.png

216 /awstatsicons/browser/msie.png

201 /awstatsicons/browser/netscape.png

123 /awstatsicons/browser/notavailable.png

214 /awstatsicons/browser/opera.png

215 /awstatsicons/browser/pdaphone.png

214 /awstatsicons/browser/safari.png

215 /awstatsicons/browser/unknown.png

226 /awstatsicons/clock/hr10.png

226 /awstatsicons/clock/hr11.png

227 /awstatsicons/clock/hr12.png

225 /awstatsicons/clock/hr1.png

226 /awstatsicons/clock/hr2.png

226 /awstatsicons/clock/hr3.png

226 /awstatsicons/clock/hr4.png

226 /awstatsicons/clock/hr5.png

226 /awstatsicons/clock/hr6.png

226 /awstatsicons/clock/hr7.png

226 /awstatsicons/clock/hr8.png

#access_log昨天一天的点击量(clicks);

cat access_log|grep '12/Nov/2009'|grep "******.jsp"|wc|awk '{print $1}'|uniq

0

#昨天访问网站的独立IP有多少;

cat access_log|grep '12/Aug/2009'|grep "******"|wc|awk '{print $1}'|uniq

194

#统计某url,一天的访问次数

#cat access_log|grep '12/Aug/2009'|grep '/images/index/e1.gif'|wc|awk '{print $1}'

2

#拉出前五天的访问次数最多的网页前20名清单;进行五天日志对比,找出排名靠前重复的网页,即可得出本周访问量最大的前几个网页;

#cat access_log|awk '{print $7}'|uniq -c |sort -n -r|head -20

10519 /

654 /manager/html

450 /manager/html

397 /

368 /manager/html

304 /

280 /manager/html

279 /

263 /manager/html

252 /manager/html

252 /manager/html

226 /

220 /

193 /

187 /

180 /

167 /

166 /

134 /

129 /

#从日志里查看该ip在干嘛:

#cat access_log | grep 218.66.36.119| awk '{print $1"/t"$7}' | sort | uniq -c | sort -nr | less

243 218.66.36.119 /

210 218.66.36.119 /awstatsicons/other/awstats_logo6.png

198 218.66.36.119 /awstatsicons/clock/hr12.png

197 218.66.36.119 /awstatsicons/other/vv.png

197 218.66.36.119 /awstatsicons/other/vu.png

197 218.66.36.119 /awstatsicons/other/vp.png

197 218.66.36.119 /awstatsicons/other/vk.png

197 218.66.36.119 /awstatsicons/other/vh.png

197 218.66.36.119 /awstatsicons/clock/hr9.png

197 218.66.36.119 /awstatsicons/clock/hr8.png

197 218.66.36.119 /awstatsicons/clock/hr7.png

197 218.66.36.119 /awstatsicons/clock/hr6.png

197 218.66.36.119 /awstatsicons/clock/hr5.png

197 218.66.36.119 /awstatsicons/clock/hr4.png

197 218.66.36.119 /awstatsicons/clock/hr3.png

197 218.66.36.119 /awstatsicons/clock/hr2.png

197 218.66.36.119 /awstatsicons/clock/hr1.png

197 218.66.36.119 /awstatsicons/clock/hr11.png

#列出传输时间超过 30 秒的文件

#cat access_log|awk ‘($NF > 30){print $7}’|sort -n|uniq -c|sort -nr|head -20

14058 /server-status?auto

8966 /

3955 /manager/html

1025 *

214 /www.766.com/awstats.www.766.com.html

211 /awstatsicons/other/awstats_logo6.png

199 /awstatsicons/clock/hr12.png

198 /awstatsicons/other/vv.png

198 /awstatsicons/other/vu.png

198 /awstatsicons/other/vp.png

198 /awstatsicons/other/vk.png

198 /awstatsicons/other/vh.png

198 /awstatsicons/clock/hr9.png

198 /awstatsicons/clock/hr8.png

198 /awstatsicons/clock/hr7.png

198 /awstatsicons/clock/hr6.png

198 /awstatsicons/clock/hr5.png

198 /awstatsicons/clock/hr4.png

198 /awstatsicons/clock/hr3.png

198 /awstatsicons/clock/hr2.png

#列出最最耗时的页面(超过60秒的)的以及对应页面发生次数

#cat access_log |awk ‘($NF > 60 && $7~//.php/){print $7}’|sort -n|uniq -c|sort -nr|head -100

本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

<🎜>:泡泡膠模擬器無窮大 - 如何獲取和使用皇家鑰匙
3 週前 By 尊渡假赌尊渡假赌尊渡假赌
北端:融合系統,解釋
3 週前 By 尊渡假赌尊渡假赌尊渡假赌
Mandragora:巫婆樹的耳語 - 如何解鎖抓鉤
3 週前 By 尊渡假赌尊渡假赌尊渡假赌

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

熱門話題

Java教學
1666
14
CakePHP 教程
1425
52
Laravel 教程
1324
25
PHP教程
1272
29
C# 教程
1251
24
sql if語句怎麼用 sql if語句怎麼用 Apr 09, 2025 pm 06:12 PM

SQL IF 語句用於有條件地執行 SQL 語句,語法為: IF (condition) THEN {語句} ELSE {語句} END IF;。條件可以是任何有效的 SQL 表達式,如果條件為真,執行 THEN 子句;如果條件為假,執行 ELSE 子句。 IF 語句可以嵌套,允許更複雜的條件檢查。

如何解決Vue Axios跨域導致的&quot;Network Error&quot; 如何解決Vue Axios跨域導致的&quot;Network Error&quot; Apr 07, 2025 pm 10:27 PM

解決 Vue Axios 跨域問題的方法包括:服務器端配置 CORS 頭使用 Axios 代理使用 JSONP使用 WebSocket使用 CORS 插件

apache怎麼配置zend apache怎麼配置zend Apr 13, 2025 pm 12:57 PM

如何在 Apache 中配置 Zend?在 Apache Web 服務器中配置 Zend Framework 的步驟如下:安裝 Zend Framework 並解壓到 Web 服務器目錄中。創建 .htaccess 文件。創建 Zend 應用程序目錄並添加 index.php 文件。配置 Zend 應用程序(application.ini)。重新啟動 Apache Web 服務器。

c#多線程的好處有哪些 c#多線程的好處有哪些 Apr 03, 2025 pm 02:51 PM

多線程的好處在於能提升性能和資源利用率,尤其適用於處理大量數據或執行耗時操作。它允許同時執行多個任務,提高效率。然而,線程過多會導致性能下降,因此需要根據 CPU 核心數和任務特性謹慎選擇線程數。另外,多線程編程涉及死鎖和競態條件等挑戰,需要使用同步機制解決,需要具備紮實的並發編程知識,權衡利弊並謹慎使用。

無法以 root 身份登錄 mysql 無法以 root 身份登錄 mysql Apr 08, 2025 pm 04:54 PM

無法以 root 身份登錄 MySQL 的原因主要在於權限問題、配置文件錯誤、密碼不符、socket 文件問題或防火牆攔截。解決方法包括:檢查配置文件中 bind-address 參數是否正確配置。查看 root 用戶權限是否被修改或刪除,並進行重置。驗證密碼是否準確無誤,包括大小寫和特殊字符。檢查 socket 文件權限設置和路徑。檢查防火牆是否阻止了 MySQL 服務器的連接。

如何在Debian上監控Nginx SSL性能 如何在Debian上監控Nginx SSL性能 Apr 12, 2025 pm 10:18 PM

本文介紹如何在Debian系統上有效監控Nginx服務器的SSL性能。我們將使用NginxExporter將Nginx狀態數據導出到Prometheus,再通過Grafana進行可視化展示。第一步:配置Nginx首先,我們需要在Nginx配置文件中啟用stub_status模塊來獲取Nginx的狀態信息。在你的Nginx配置文件(通常位於/etc/nginx/nginx.conf或其包含文件中)中添加以下代碼段:location/nginx_status{stub_status

phpmyadmin漏洞匯總 phpmyadmin漏洞匯總 Apr 10, 2025 pm 10:24 PM

PHPMyAdmin安全防禦策略的關鍵在於:1. 使用最新版PHPMyAdmin及定期更新PHP和MySQL;2. 嚴格控制訪問權限,使用.htaccess或Web服務器訪問控制;3. 啟用強密碼和雙因素認證;4. 定期備份數據庫;5. 仔細檢查配置文件,避免暴露敏感信息;6. 使用Web應用防火牆(WAF);7. 進行安全審計。 這些措施能夠有效降低PHPMyAdmin因配置不當、版本過舊或環境安全隱患導致的安全風險,保障數據庫安全。

Debian Apache日誌中如何識別惡意訪問 Debian Apache日誌中如何識別惡意訪問 Apr 13, 2025 am 07:30 AM

有效監控和防禦惡意網站訪問對於Debian系統的Apache服務器至關重要。 Apache訪問日誌是識別此類威脅的關鍵信息來源。本文將指導您如何分析日誌並採取防禦措施。識別惡意訪問行為Debian系統的Apache訪問日誌通常位於/var/log/apache2/access.log。您可以通過多種方法分析日誌:日誌文件位置確認:首先,請確認您的Apache訪問日誌的準確位置,它可能因係統配置而略有不同。命令行工具分析:使用grep命令搜索特定模式,例如grep"404"

See all articles