来一发shell步伐猎取互联网公司web server 信息
如果您觉得本篇CentOSLinux教程讲得好,请记得点击右边漂浮的分享程序,把好文章分享给你的好朋友们!一.成绩来历想失掉以后互联网公司的webserver是哪一个范例的?(ApacheNginxLighttpd)以是编写此步伐。次要统计百度Googlealibabatencent(qq)taobaorenrensina京东凡客yahoo昌大网易搜狐畅游等公司的webserver。固然,也有大概失掉的是反向代办署理办事器。这得详细看公司的背景体系架构了。
二.步伐
1.源码
viab.sh
viewplaincopyhttp://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf
[*]#!/bin/bash
[*]#authorlongxibendi
[*]#bloghttp://blog.csdn.net/longxibendi
[*]#functiongetthewebserversinformationofcompanies
[*]if[-e/tmp/web_server.log];then
[*]rm-f/tmp/web_server.log
[*]fi
[*]if[-e/tmp/ab.log];then
[*]rm-f/tmp/ab.log
[*]fi
[*]forcompany_nameintaobao360buydangdangvanclmbaobaoalibaba谷歌百度yahoosinasohuren
[*]renchangyouwanmeisdo126163139
[*]do
[*]{
[*]ab-n1-c1http://www.${company_name}.com/index.html|tee/tmp/ab_${company_name}.log2>&1
[*]if[$?-eq0];then
[*]printf"%15s,%20s/n""${company_name}.com","`cat/tmp/ab_${company_name}.log|grep"Server
[*]Software"`">>/tmp/web_server.log
[*]fi
[*]sleep2
[*]}&
[*]done
[*]wait
[*]echo"ItisOK"
2.申明&实行步伐
经由过程ab网站主页,然后把失掉信息重定向到一个文件中,然后再从该文件中过滤信息,一致纪录到/tmp/web_server.log中
viewplaincopyhttp://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf
[*]#chmoda+xab.sh
[*]#./ab.sh>/dev/null
3.实行了局,经由过程检察/tmp/web_server.log失掉网站webserver信息(有多是反向代办署理办事器)
viewplaincopyhttp://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf
[*]#cat/tmp/web_server.log
[*]360buy.com,,ServerSoftware:jdws
[*]taobao.com,,ServerSoftware:nginx
[*]mbaobao.com,,ServerSoftware:
[*]百度.com,,ServerSoftware:BWS/1.0
[*]renren.com,,ServerSoftware:nginx/0.7.67
[*]谷歌.com,,ServerSoftware:gws
[*]changyou.com,,ServerSoftware:Apache
[*]sina.com,,ServerSoftware:Apache/2.0.63
[*]alibaba.com,,ServerSoftware:Apache/2.2.15
[*]126.com,,ServerSoftware:Apache
[*]vancl.com,,ServerSoftware:Microsoft-IIS/6.0
[*]wanmei.com,,ServerSoftware:nginx
[*]sdo.com,,ServerSoftware:SVS
[*]sohu.com,,ServerSoftware:SWS
[*]dangdang.com,,ServerSoftware:nginx/0.7.61
[*]yahoo.com,,ServerSoftware:YTS/1.20.0
[*]139.com,,ServerSoftware:Apache
[*]163.com,,ServerSoftware:nginx
4.复杂剖析了局
sohu.com用的webserver是SWS(这个有多是本人开辟的,有多是用的SWS)
谷歌.com用的webserver是gws
百度.com用的webserver是BWS
taobao.com用的webserver是nginx
另有良多,看3的了局
三.伪多线程与单历程剧本对照
1.先看单历程的步伐
vi1_ab.sh
viewplaincopyhttp://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf
[*]#!/bin/bash
[*]#authorlongxibendi
[*]#bloghttp://blog.csdn.net/longxibendi
[*]#functiongetthewebserversinformationofcompanies
[*]if[-e/tmp/web_server.log];then
[*]rm-f/tmp/web_server.log
[*]fi
[*]if[-e/tmp/ab.log];then
[*]rm-f/tmp/ab.log
[*]fi
[*]forcompany_nameintaobao360buydangdangvanclmbaobaoalibaba谷歌百度yahoosinasohurenrenchangyouwanmeisdo126163139
[*]do
[*]#{
[*]ab-n1-c1http://www.${company_name}.com/index.html|tee/tmp/ab.log2>&1
[*]if[$?-eq0];then
[*]printf"%10s,%20s/n""${company_name}.com","`cat/tmp/ab.log|grep"ServerSoftware"`">>/tmp/web_server.log
[*]fi
[*]#sleep3
[*]#}&
[*]done
[*]wait
[*]echo"ItisOK"
2.申明
下面的单历程步伐,只用一个历程完成,很复杂就不注释了。详细统计webserver完成与伪多线程步伐相似
3.两步伐实行效力对照
viewplaincopyhttp://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf
[*]#time-p./1_ab.sh>/dev/null
[*]real12.54
[*]user0.03
[*]sys1.74
[*]#time-p./ab.sh>/dev/null
[*]real11.20
[*]user0.07
[*]sys2.00
4.剖析
能够看到伪多线程步伐分明比单历程步伐快
实在,假如在实行ab.sh的时分能够ps-ef|grepab.sh一下,就会发明分歧了
<divclass="dp-highlighterbg_c-sharp"style="font-family:Consolas,CourierNew,Courier,mono,serif;background-color:rgb(231,229,220);width:700.9166870117188px;overflow:auto;padding-top:1px;margin:18px0px!important;">viewplaincopyhttp://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf
<olclass="dp-c"start="1"style="margin:0px0px1px45px!important;padding-right:0px;padding-left:0px;border:none;list-style-position:initial;list-style-image:initial;background-color:rgb(255,255,255);color:rgb(92,92,92);"><liclass="alt"style="margin:0px!important;padding:0px3px0px10px!important;border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;color:inherit;line-height:18px;">#ps-ef|grepab.sh<listyle="margin:0px!important;padding:0px3px0px10px!important;border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;background-color:rgb(248,248,248);line-height:18px;">root268465761102:15pts/100:00:00/bin/bash./ab.sh<liclass="alt"style="margin:0px!important;padding:0px3px0px10px!important;border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;color:inherit;line-height:18px;">root2685426846002:15pts/100:00:00/bin/bash./ab.sh<listyle="margin:0px!important;padding:0px3px0px10px!important;border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;background-color:rgb(248,248,248);line-height:18px;">root2685726846002:15pts/100:00:00/bin/bash./ab.sh<liclass="alt"style="margin:0px!important;padding:0px3px0px10px!important;border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;color:inherit;line-height:18px;">root2685926846002:15pts/100:00:00/bin/bash./ab.sh<listyle="margin:0px!important;padding:0px3px0px10px!important;border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;background-color:rgb(248,248,248);line-height:18px;">root2686526846002:15pts/100:00:00/bin/bash./ab.sh<liclass="alt"style="margin:0px!important;padding:0px3px0px10px!important;border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;color:inherit;line-height:18px;">root2687126846002:15pts/100:00:00/bin/bash./ab.sh<listyle="margin:0px!important;padding:0px3px0px10px!important;border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;background-color:rgb(248,248,248);line-height:18px;">root2687426846002:15pts/100:00:00/bin/bash./ab.sh<liclass="alt"style="margin:0px!important;padding:0px3px0px10px!important;border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;color:inherit;line-height:18px;">root2687526846002:15pts/100:00:00/bin/bash./ab.sh<listyle="margin:0px!important;padding:0px3px0px10px!important;border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;background-color:rgb(248,248,248);line-height:18px;">root2688626846002:15pts/100:00:00/bin/bash./ab.sh<liclass="alt"style="margin:0px!important;padding:0px3px0px10px!important;border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;color:inherit;line-height:18px;">root2688926846002:15pts/100:00:00/bin/bash./ab.sh<listyle="margin:0px!important;padding:0px3px0px10px!important;border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;background-color:rgb(248,248,248);line-height:18px;">root2689226846002:15pts/100:00:00/bin/bash./ab.sh
来一发shell步伐猎取互联网公司web server 信息
如果一定要用500以上的字来解释“晦涩”这个词,那么LZ是做到了的。 我感觉linux的学习,学习编程~!~!就去学习C语言编程!! 放手去搞。尽量不要提问,运用搜索找答案,或者看wiki,从原理上理解操作系统的本质,而不是满足于使用几个技巧。尽量看英文资料。 Linux?最大的优点在于其作为服务器的强大功能,同时支持多种应用程序及开发工具,所以Linux操作系统有着广泛的应用空间。 了解Linux的网络安全,系统的安全,用户的安全等。安全对于每位用户,管理员来说是非常重要的。 对Linux命令熟悉后,你可以开始搭建一个小的Linux网络,这是最好的实践方法。Linux是网络的代名词,Linux网络服务功能非常强大,不论是邮件服务器、Web服务器、DNS服务器等都非常完善。 说实话小时候没想过搞IT,也计算机了解也只是一些皮毛,至于什么UNIX,Linux,听过没见过,就更别说用过了。?
页:
[1]