[关闭]
@1kbfree 2019-05-29T07:16:23.000000Z 字数 16643 阅读 3011

信息收集之我见

web安全


来源网络,回馈网络

对一个网站挖掘的深浅来说就得看你收集的如何,这说明信息收集在漏洞挖掘中是非常的重要的。

子域名收集

子域名收集是最简单的收集手法之一,有很多在线的工具可以直接套用,这里分享几个我经常用的。

开心的时候用用这个扫描器

为什么这么说,因为这是我写的(你生气用的话我怕我屏幕里突然冒出一个拖孩)

  1. import requests
  2. import threading
  3. from bs4 import BeautifulSoup
  4. import re
  5. import time
  6. url = input( 'url(如baidu.com): ' )
  7. head={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0'}
  8. ip = 'http://site.ip138.com/{}'.format( url )
  9. # domain_url = url.split('.')
  10. # domain_url = domain_url[1]+'.'+domain_url[2]
  11. domain_url = url
  12. domain = 'http://site.ip138.com/{}/domain.htm'.format( domain_url )
  13. t = time.strftime("%Y-%m-%d"+'_', time.localtime())
  14. html_file = open( url+'_'+t+'.html','w' )
  15. html_file.write( '''
  16. <head>
  17. <title>%s的扫描结果</title>
  18. <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
  19. <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
  20. <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
  21. <style>
  22. pre{
  23. margin: 0 0 0px;
  24. }
  25. </style>
  26. </head>
  27. <ul id="myTab" class="nav nav-tabs navbar-fixed-top navbar navbar-default">
  28. <li class="active">
  29. <a href="#ip" data-toggle="tab">
  30. IP历史解析
  31. </a>
  32. </li>
  33. <li><a href="#cms" data-toggle="tab">CMS识别</a></li>
  34. <li><a href="#domain" data-toggle="tab">子域名信息</a></li>
  35. </ul>
  36. <br>
  37. <br>
  38. <br>
  39. <br>
  40. <div id="myTabContent" class="tab-content">
  41. '''%url )
  42. class IP( threading.Thread ):
  43. def __init__(self, ip):
  44. threading.Thread.__init__(self)
  45. self.ip = ip
  46. def run(self):
  47. r = requests.get( self.ip,headers = head )
  48. html = r.text
  49. bs = BeautifulSoup(html, "html.parser")
  50. html_file.write('<div class="tab-pane fade in active" id="ip">')
  51. for i in bs.find_all('p'):
  52. ipc = i.get_text()
  53. ip_html = '<pre>{}</pre>'.format( ipc )
  54. html_file.write( ip_html )
  55. html_file.write('</div>')
  56. class CMS( threading.Thread ):
  57. def __init__(self, cms):
  58. threading.Thread.__init__(self)
  59. self.cms = cms
  60. def run(self):
  61. cms = requests.post('http://whatweb.bugscaner.com/what/', data={'url': self.cms}, headers = head)
  62. text = cms.text
  63. Web_Frameworks = re.search('"Web Frameworks": "(.*?)"]', text)
  64. Programming_Languages = re.search('"Programming Languages":(.*?)"]', text)
  65. JavaScript_Frameworks = re.search('"JavaScript Frameworks": (.*?)"]', text)
  66. CMS = re.search('"CMS": (.*?)"]', text)
  67. Web_Server = re.search('"Web Servers": (.*?)"]', text)
  68. if CMS:
  69. CMS = CMS.group(1)+'"]'
  70. if Programming_Languages:
  71. Programming_Languages = Programming_Languages.group(1)+'"]'
  72. if JavaScript_Frameworks:
  73. JavaScript_Frameworks = JavaScript_Frameworks.group(1)+'"]'
  74. if Web_Frameworks:
  75. Web_Frameworks = Web_Frameworks.group(1)+'"]'
  76. if Web_Server:
  77. Web_Server = Web_Server.group(1)+'"]'
  78. html = '''
  79. <div class="tab-pane fade" id="cms">
  80. <div class="table-responsive">
  81. <table class="table table-condensed">
  82. <tr>
  83. <th>web框架</th>
  84. <th>脚本版本</th>
  85. <th>JavaScript框架</th>
  86. <th>CMS框架</th>
  87. <th>web服务器</th>
  88. </tr>
  89. <tr>
  90. <td>{0}</td>
  91. <td>{1}</td>
  92. <td>{2}</td>
  93. <td>{3}</td>
  94. <td>{4}</td>
  95. </tr>
  96. </table>
  97. </div>
  98. </div>
  99. '''.format(Web_Frameworks,Programming_Languages,JavaScript_Frameworks,CMS,Web_Server)
  100. html_file.write( html )
  101. class DOMAIN( threading.Thread ):
  102. def __init__(self, domain):
  103. threading.Thread.__init__(self)
  104. self.domain = domain
  105. def run(self):
  106. r = requests.get( self.domain,headers = head )
  107. html = r.text
  108. bs = BeautifulSoup(html, "html.parser")
  109. html_file.write('<div class="tab-pane fade in active" id="domain"')
  110. num = 0
  111. for i in bs.find_all('p'):
  112. num += 1
  113. html_file.write( '<br>' )
  114. domainc = i.get_text()
  115. domain_html = '<pre>[{}]: {}</pre>'.format( num,domainc )
  116. html_file.write( domain_html )
  117. print( domain_html )
  118. html_file.write('</div>')
  119. ip_cls = IP(ip)
  120. ip_html = ip_cls.run()
  121. cms_cls = CMS(url)
  122. cms_html = cms_cls.run()
  123. domain_cls = DOMAIN( domain )
  124. domain_html = domain_cls.run()

github开源的子域名扫描器

https://github.com/lijiejie/subDomainsBrute
https://github.com/chuhades/dnsbrute

在线网站收集

1、

https://d.chinacycc.com/(非常推荐)

image_1dbuqgbbl2bh1v10nm68jh1j509.png-112kB

然后不到30秒就出结果了

image_1dbuqjj0a10o118r155p1q491k1lm.png-34.3kB

image_1dbuqkf3l1qdehf418221uslika13.png-175.7kB

2、

http://z.zcjun.com/
https://phpinfo.me/domain/

端口信息收集

扫描端口并且标记可以爆破的服务

  1. nmap 目标 --script=ftp-brute,imap-brute,smtp-brute,pop3-brute,mongodb-brute,redis-brute,ms-sql-brute,rlogin-brute,rsync-brute,mysql-brute,pgsql-brute,oracle-sid-brute,oracle-brute,rtsp-url-brute,snmp-brute,svn-brute,telnet-brute,vnc-brute,xmpp-brute

判断常见的漏洞并扫描端口

  1. nmap 目标 --script=auth,vuln

精确判断漏洞并扫描端口

  1. nmap 目标 --script=dns-zone-transfer,ftp-anon,ftp-proftpd-backdoor,ftp-vsftpd-backdoor,ftp-vuln-cve2010-4221,http-backup-finder,http-cisco-anyconnect,http-iis-short-name-brute,http-put,http-php-version,http-shellshock,http-robots.txt,http-svn-enum,http-webdav-scan,iis-buffer-overflow,iax2-version,memcached-info,mongodb-info,msrpc-enum,ms-sql-info,mysql-info,nrpe-enum,pptp-version,redis-info,rpcinfo,samba-vuln-cve-2012-1182,smb-vuln-ms08-067,smb-vuln-ms17-010,snmp-info,sshv1,xmpp-info,tftp-enum,teamspeak2-version

我喜欢这样做

1、扫描子域名

image_1dbutat2nhgqgid17iv68f2g42d.png-64.3kB

提取出域名/ip

image_1dbutad6a1965dff1d06kuoi2m20.png-172kB

然后把域名放到975.txt

2、批量扫描端口和漏洞检测

  1. nmap -iL 975.txt --script=auth,vuln,ftp-brute,imap-brute,smtp-brute,pop3-brute,mongodb-brute,redis-brute,ms-sql-brute,rlogin-brute,rsync-brute,mysql-brute,pgsql-brute,oracle-sid-brute,oracle-brute,rtsp-url-brute,snmp-brute,svn-brute,telnet-brute,vnc-brute,xmpp-brute > scan.txt

然后根据对应开放的端口进行针对性漏洞挖掘

c段信息收集

c段的话我一般都是使用iis put这款工具来扫描,可以自定义扫描1-255的端口并且还有返回服务器banner信息

自定义的端口

  1. 135,139,80,8080,15672,873,8983,7001,4848,6379,2381,8161,11211,5335,5336,7809,2181,9200,50070,50075,5984,2375,7809,16992,16993

image_1dbuu62uk1f3q1gfqbtk1r5l11qi3p.png-114.4kB

这里只是演示下他跑起来的美

目录信息收集

目录收集工具有很多,但是最看重的还是目录字典,之前我拿了很多工具的字典去重集合起来超级超级大,只不过是在之前电脑那里还原的时候忘记了备份、、、(说这句话主要是想让你们也可以这样子做,方便自己,然后发我一份,方便你我)

这里推荐一个工具7kbstorm

https://github.com/7kbstorm/7kbscan-WebPathBrute

403404这种页面千万不要关闭,放目录里面扫就ok

谷歌语法收集铭感文件

最常见的就是用搜索引擎~

  1. site:ooxx.com filetype:xls

首先试试百度

image_1dbv9cp101p0h1i1cid6g35190n46.png-48.2kB

$!@!~~WDwadawicnm

试试必应

image_1dbv9k8liv5n18n814fu18j25k53.png-120kB

这里主要是收集网站敏感文件(比如目标的某个系统手册演示的截图中截图到了用户名,然后我们可以根据用户名来爆破密码;甚至可以看看有没有写系统默认密码,或者一些后台的目录路径,如果有目录就可以尝试对其访问,说不定有未授权~)

还能尝试对后台进行查找

  1. site:xxx.xxx admin
  2. site:xxx.xxx login
  3. site:xxx.xxx system
  4. site:xxx.xxx 管理
  5. site:xxx.xxx 登录
  6. site:xxx.xxx 内部
  7. site:xxx.xxx 系统

还可以查找邮箱,然后进行钓鱼

  1. site:xxx.xxx 邮件
  2. site:xxx.xxx email

还可以查找qq群等,然后假装员工验证进去看群文件泄露了什么东东(这里有个技巧,去找客服聊天处,然后对整个过程抓包也就是看历史请求,如果运气好可能在请求的返回包中返回客服的姓名,如果只单纯的泄露了姓如张xx,那么你加群的时候就说你是小张工作号,说这个工作号的原因是可能小张已经在群里了)

  1. 注意事项:如果你是挖腾讯的话就不要看这条啦
  2. site:xxx.xxx qq
  3. site:xxx.xxx
  4. site:xxx.xxx 企鹅
  5. site:xxx.xxx 腾讯

还可以对寻找一些公开的、危害大、普遍的漏洞的指纹,如下面的搜索jboss系统

  1. site:ooxx.com inurl:jmx-console

小技巧

比如下面一个站存在越权(但是越权的对象很难猜测)

  1. http://xxx.xxx.xxx/userinfo/?uid=2018-WOIDJWOIDJ-5201314

那么我们可以尝试用搜索引擎来找

  1. site:xxx.xxx inurl=uid=20

利用云网盘搜索工具搜集敏感文件

公司员工可能把一些内部资料放在了公网网盘,然后被在线云网盘搜索的网站抓取了,我们就可以利用这个来对目标系统进行深入交流

我这边主要用凌风云搜索

https://www.lingfengyun.com/

image_1dbvbbve839lj94hs8d92cp.png-143.4kB

个人喜欢直接输入厂商名字然后搜索(比较全),然后边看电视(最好看鬼片,鬼出来的阶段想着找找找)边搜索

利用gayhub来收集信息

1、打开gayhub

image_1dbvble0op36hmi1ter16ck1vt816.png-151kB

这里就是找gayhub全部开源项目内容中存在联想这个关键字的项目,这样子可以搜集到的方面更广,如果单纯只是对标题搜索,那么他们改成了lenovo你就搜不到了

然后说再多,也没这个好用

https://sec.xiaomi.com/article/37

针对网站性收集

1、把网站弄报错,看是什么cms,或者看返回包回显是什么中间件这些
2、看是linux还是window

如目标urlwww.onlyfree.xxx/login,那么改成www.onlyfree.xxx/Login看看能不能访问,如果可以访问就可能是window,否则可能是linux

3、可以去云溪等在线识别指纹的网站看指纹信息

http://whatweb.bugscaner.com/look/
http://www.yunsee.cn/finger.html

4、对waf进行识别

这里有一款开源的识别工具,挺好用的
https://github.com/EnableSecurity/wafw00f

5、对网站whois查询看注册人、手机号、邮箱等(可以收集起来放到密码生成工具)
6、看html源代码,在一起项目测试的时候,我在找html源代码的时候发现一个注释的js文件,我将其打开后,里面的备注居然是配置信息。。。后台地址、管理员账号和密码等(可是我没getshell,所以你要知道这回事而不要记住这件事)
7、网站真实ip识别,下面是我用的一个工具,但是我忘记哪里下载的了,我原封不漏的粘贴出来
  1. #############################################################
  2. ###
  3. ### ▄▄▄▄ ▄▄▄ ▄▄▄▄ ▀ ▄
  4. ### ▀ ▀█ ▄ ▄ ▄▄▄▄ █ ▄▀ ▀▄ ▄▄▄ ▄▄█▄▄
  5. ### ▄▄▄▀ █▄█ █▀ ▀█ █ █ ▄ █ █ █
  6. ### ▀█ ▄█▄ █ █ █ █ █ █ █
  7. ### ▀▄▄▄█▀ ▄▀ ▀▄ ██▄█▀ ▄▄█▄▄ █▄▄█ ▄▄█▄▄ ▀▄▄
  8. ### █
  9. ### ▀
  10. ###
  11. ### name: xcdn.py
  12. ### function: try to get the actual ip behind cdn
  13. ### date: 2016-11-05
  14. ### author: quanyechavshuo
  15. ### blog: http://3xp10it.cc
  16. #############################################################
  17. # usage:python3 xcdn.py www.baidu.com
  18. import time
  19. import os
  20. os.system("pip3 install exp10it -U --no-cache-dir")
  21. from exp10it import figlet2file
  22. figlet2file("3xp10it",0,True)
  23. time.sleep(1)
  24. from exp10it import CLIOutput
  25. from exp10it import get_root_domain
  26. from exp10it import get_string_from_command
  27. from exp10it import get_http_or_https
  28. from exp10it import post_request
  29. from exp10it import get_request
  30. from exp10it import checkvpn
  31. import sys
  32. import re
  33. class Xcdn(object):
  34. def __init__(self,domain):
  35. #必须保证连上了vpn,要在可以ping通google的条件下使用本工具,否则有些domain由于被GFW拦截无法正常访问会导致
  36. #本工具判断错误,checkvpn在可以ping通google的条件下返回1
  37. while 1:
  38. if checkvpn()==1:
  39. break
  40. else:
  41. time.sleep(1)
  42. print("vpn is off,connect vpn first")
  43. if domain[:4]=="http":
  44. print("domain format error,make sure domain has no http,like www.baidu.com but not \
  45. http://www.baidu.com")
  46. sys.exit(0)
  47. #首先保证hosts文件中没有与domain相关的项,有则删除相关
  48. domainPattern=domain.replace(".","\.")
  49. #下面的sed的正则中不能有\n,sed匹配\n比较特殊
  50. #http://stackoverflow.com/questions/1251999/how-can-i-replace-a-newline-n-using-sed
  51. command="sed -ri 's/.*\s+%s//' /etc/hosts" % domainPattern
  52. os.system(command)
  53. self.domain=domain
  54. self.http_or_https=get_http_or_https(self.domain)
  55. print('domain的http或https是:%s' % self.http_or_https)
  56. result=get_request(self.http_or_https+"://"+self.domain,'seleniumPhantomJS')
  57. self.domain_title=result['title']
  58. #下面调用相当于main函数的get_actual_ip_from_domain函数
  59. actual_ip = self.get_actual_ip_from_domain()
  60. if actual_ip != 0:
  61. print("恭喜,%s的真实ip是%s" % (self.domain, actual_ip))
  62. #下面用来存放关键返回值
  63. self.return_value=actual_ip
  64. def domain_has_cdn(self):
  65. # 检测domain是否有cdn
  66. # 有cdn时,返回一个字典,如果cdn是cloudflare,返回{'has_cdn':1,'is_cloud_flare':1}
  67. # 否则返回{'has_cdn':1,'is_cloud_flare':0}或{'has_cdn':0,'is_cloud_flare':0}
  68. import re
  69. CLIOutput().good_print("现在检测domain:%s是否有cdn" % self.domain)
  70. has_cdn = 0
  71. # ns记录和mx记录一样,都要查顶级域名,eg.dig +short www.baidu.com ns VS dig +short baidu.com ns
  72. result = get_string_from_command("dig ns %s +short" % get_root_domain(self.domain))
  73. pattern = re.compile(
  74. r"(cloudflare)|(cdn)|(cloud)|(fast)|(incapsula)|(photon)|(cachefly)|(wppronto)|(softlayer)|(incapsula)|(jsdelivr)|(akamai)", re.I)
  75. cloudflare_pattern = re.compile(r"cloudflare", re.I)
  76. if re.search(pattern, result):
  77. if re.search(cloudflare_pattern, result):
  78. print("has_cdn=1 from ns,and cdn is cloudflare")
  79. return {'has_cdn': 1, 'is_cloud_flare': 1}
  80. else:
  81. print("has_cdn=1 from ns")
  82. return {'has_cdn': 1, 'is_cloud_flare': 0}
  83. else:
  84. # 下面通过a记录个数来判断,如果a记录个数>1个,认为有cdn
  85. result = get_string_from_command("dig a %s +short" % self.domain)
  86. find_a_record_pattern = re.findall(r"((\d{1,3}\.){3}\d{1,3})", result)
  87. if find_a_record_pattern:
  88. ip_count = 0
  89. for each in find_a_record_pattern:
  90. ip_count += 1
  91. if ip_count > 1:
  92. has_cdn = 1
  93. return {'has_cdn': 1, 'is_cloud_flare': 0}
  94. return {'has_cdn': 0, 'is_cloud_flare': 0}
  95. def get_domain_actual_ip_from_phpinfo(self):
  96. # 从phpinfo页面尝试获得真实ip
  97. CLIOutput().good_print("现在尝试从domain:%s可能存在的phpinfo页面获取真实ip" % self.domain)
  98. phpinfo_page_list = ["info.php", "phpinfo.php", "test.php", "l.php"]
  99. for each in phpinfo_page_list:
  100. url = self.http_or_https + "://" + self.domain + "/" + each
  101. CLIOutput().good_print("现在访问%s" % url)
  102. visit = get_request(url,'seleniumPhantomJS')
  103. code = visit['code']
  104. content = visit['content']
  105. pattern = re.compile(r"remote_addr", re.I)
  106. if code == 200 and re.search(pattern, content):
  107. print(each)
  108. actual_ip = re.search(r"REMOTE_ADDR[^\.\d]+([\d\.]{7,15})[^\.\d]+", content).group(1)
  109. return actual_ip
  110. # return 0代表没有通过phpinfo页面得到真实ip
  111. return 0
  112. def flush_dns(self):
  113. # 这个函数用来刷新本地dns cache
  114. # 要刷新dns cache才能让修改hosts文件有效
  115. CLIOutput().good_print("现在刷新系统的dns cache")
  116. command = "service network-manager restart && /etc/init.d/networking force-reload"
  117. os.system(command)
  118. import time
  119. time.sleep(3)
  120. def modify_hosts_file_with_ip_and_domain(self,ip):
  121. # 这个函数用来修改hosts文件
  122. CLIOutput().good_print("现在修改hosts文件")
  123. exists_domain_line = False
  124. with open("/etc/hosts", "r+") as f:
  125. file_content = f.read()
  126. if re.search(r"%s" % self.domain.replace(".", "\."), file_content):
  127. exists_domain_line = True
  128. if exists_domain_line == True:
  129. os.system("sed -ri 's/.*%s.*/%s %s/' %s" % (self.domain.replace(".", "\."), ip, self.domain, "/etc/hosts"))
  130. else:
  131. os.system("echo %s %s >> /etc/hosts" % (ip, self.domain))
  132. def check_if_ip_is_actual_ip_of_domain(self,ip):
  133. # 通过修改hosts文件检测ip是否是domain对应的真实ip
  134. # 如果是则返回True,否则返回False
  135. #CLIOutput().good_print("现在通过修改hosts文件并刷新dns的方法检测ip:%s是否是domain:%s的真实ip" % (ip,self.domain))
  136. #python通过requests库或mechanicalsoup库或selenium_phantomjs来请求时不会被dns缓存影响,只会被hosts文件影响dns解析,人工用浏览器访问域名则会受dns缓存影响
  137. CLIOutput().good_print("现在通过修改hosts文件的方法检测ip:%s是否是domain:%s的真实ip" % (ip,self.domain))
  138. os.system("cp /etc/hosts /etc/hosts.bak")
  139. self.modify_hosts_file_with_ip_and_domain(ip)
  140. #python通过requests库或mechanicalsoup库或selenium_phantomjs来请求时不会被dns缓存影响,只会被hosts文件影响dns解析,人工用浏览器访问域名则会受dns缓存影响
  141. #self.flush_dns()
  142. hosts_changed_domain_title= get_request(self.http_or_https + "://%s" % self.domain,'selenium_phantom_js')['title']
  143. os.system("rm /etc/hosts && mv /etc/hosts.bak /etc/hosts")
  144. #这里要用title判断,html判断不可以,title相同则认为相同
  145. if self.domain_title == hosts_changed_domain_title:
  146. CLIOutput().good_print("检测到真实ip!!!!!!",'red')
  147. return True
  148. else:
  149. CLIOutput().good_print("当前ip不是域名的真实ip",'yellow')
  150. return False
  151. def get_c_80_or_443_list(self,ip):
  152. # 得到ip的整个c段的开放80端口或443端口的ip列表
  153. if "not found" in get_string_from_command("masscan"):
  154. #这里不用nmap扫描,nmap扫描结果不准
  155. os.system("apt-get install masscan")
  156. if self.http_or_https=="http":
  157. scanPort=80
  158. CLIOutput().good_print("现在进行%s的c段开了80端口机器的扫描" % ip)
  159. if self.http_or_https=="https":
  160. scanPort=443
  161. CLIOutput().good_print("现在进行%s的c段开了443端口机器的扫描" % ip)
  162. masscan_command = "masscan -p%d %s/24 > /tmp/masscan.out" % (scanPort,ip)
  163. os.system(masscan_command)
  164. with open("/tmp/masscan.out", "r+") as f:
  165. strings = f.read()
  166. #os.system("rm /tmp/masscan.out")
  167. import re
  168. allIP=re.findall(r"((\d{1,3}\.){3}\d{1,3})",strings)
  169. ipList=[]
  170. for each in allIP:
  171. ipList.append(each[0])
  172. print(ipList)
  173. return ipList
  174. def check_if_ip_c_machines_has_actual_ip_of_domain(self,ip):
  175. # 检测ip的c段有没有domain的真实ip,如果有则返回真实ip,如果没有则返回0
  176. CLIOutput().good_print("现在检测ip为%s的c段中有没有%s的真实ip" % (ip,self.domain))
  177. target_list=self.get_c_80_or_443_list(ip)
  178. for each_ip in target_list:
  179. if True == self.check_if_ip_is_actual_ip_of_domain(each_ip):
  180. return each_ip
  181. return 0
  182. def get_ip_from_mx_record(self):
  183. # 从mx记录中得到ip列表,尝试从mx记录中的c段中找真实ip
  184. print("尝试从mx记录中找和%s顶级域名相同的mx主机" % self.domain)
  185. import socket
  186. # domain.eg:www.baidu.com
  187. from exp10it import get_root_domain
  188. root_domain = get_root_domain(self.domain)
  189. from exp10it import get_string_from_command
  190. result = get_string_from_command("dig %s +short mx" % root_domain)
  191. sub_domains_list = re.findall(r"\d{1,} (.*\.%s)\." % root_domain.replace(".", "\."), result)
  192. ip_list = []
  193. for each in sub_domains_list:
  194. print(each)
  195. ip = socket.gethostbyname_ex(each)[2]
  196. if ip[0] not in ip_list:
  197. ip_list.append(ip[0])
  198. return ip_list
  199. def check_if_mx_c_machines_has_actual_ip_of_domain(self):
  200. # 检测domain的mx记录所在ip[或ip列表]的c段中有没有domain的真实ip
  201. # 有则返回真实ip,没有则返回0
  202. CLIOutput().good_print("尝试从mx记录的c段中查找是否存在%s的真实ip" % self.domain)
  203. ip_list = self.get_ip_from_mx_record()
  204. if ip_list != []:
  205. for each_ip in ip_list:
  206. result = self.check_if_ip_c_machines_has_actual_ip_of_domain(each_ip)
  207. if result != 0:
  208. return result
  209. else:
  210. continue
  211. return 0
  212. def get_ip_value_from_online_cloudflare_interface(self):
  213. # 从在线的cloudflare查询真实ip接口处查询真实ip
  214. # 如果查询到真实ip则返回ip值,如果没有查询到则返回0
  215. CLIOutput().good_print("现在从在线cloudflare类型cdn查询真实ip接口尝试获取真实ip")
  216. url = "http://www.crimeflare.com/cgi-bin/cfsearch.cgi"
  217. post_data = 'cfS=%s' % self.domain
  218. content = post_request(url, post_data)
  219. findIp = re.search(r"((\d{1,3}\.){3}\d{1,3})", content)
  220. if findIp:
  221. return findIp.group(1)
  222. return 0
  223. def get_actual_ip_from_domain(self):
  224. # 尝试获得domain背后的真实ip,前提是domain有cdn
  225. # 如果找到了则返回ip,如果没有找到返回0
  226. CLIOutput().good_print("进入获取真实ip函数,认为每个domain都是有cdn的情况来处理")
  227. import socket
  228. has_cdn_value = self.domain_has_cdn()
  229. if has_cdn_value['has_cdn'] == 1:
  230. CLIOutput().good_print("检测到domain:%s的A记录不止一个,认为它有cdn" % self.domain)
  231. pass
  232. else:
  233. CLIOutput().good_print("Attention...!!! Domain doesn't have cdn,I will return the only one ip")
  234. true_ip = socket.gethostbyname_ex(self.domain)[2][0]
  235. return true_ip
  236. # 下面尝试通过cloudflare在线查询真实ip接口获取真实ip
  237. if has_cdn_value['is_cloud_flare'] == 1:
  238. ip_value = self.get_ip_value_from_online_cloudflare_interface()
  239. if ip_value != 0:
  240. return ip_value
  241. else:
  242. pass
  243. # 下面尝试通过可能存在的phpinfo页面获得真实ip
  244. ip_from_phpinfo = self.get_domain_actual_ip_from_phpinfo()
  245. if ip_from_phpinfo == 0:
  246. pass
  247. else:
  248. return ip_from_phpinfo
  249. # 下面通过mx记录来尝试获得真实ip
  250. result = self.check_if_mx_c_machines_has_actual_ip_of_domain()
  251. if result == 0:
  252. pass
  253. else:
  254. return result
  255. print("很遗憾,在下认为%s有cdn,但是目前在下的能力没能获取它的真实ip,当前函数将返回0" % self.domain)
  256. return 0
  257. if __name__ == '__main__':
  258. import sys
  259. domain=sys.argv[1]
  260. Xcdn(domain)
8、服务器ssh配置信息

丢工具:https://github.com/mozilla/ssh_scan

9、敏感文件爆破
  1. http://xxx.xxx.xxx/.svn/entries
10、根据目标系统情况

根据目标系统情况是因为看他对应的系统是什么对应有什么漏洞,下面这个是tomcatsession泄露

  1. /examples/servlets/servlet/SessionExample/examples/
  2. /examples/servlets/servlet/SessionExample
  3. /examples/

image_1dbvfielukp81f701hcd1qnq12e41j.png-57.6kB

敏感目录泄露

WEB-INFJavaWEB应用的安全目录。如果想在页面中直接访问其中的文件,必须通过web.xml文件对要访问的文件进行相应映射才能访问

  1. /WEB-INF/config/jdbc.properties
  2. /WEB-INF/web.xml
  3. /WEB-INF/classes/
  4. /WEB-INF/lib/
  5. /WEB-INF/src/
  6. /WEB-INF/database.properties

通过它我们可以看项目历史

  1. http://xxx.xxx.xxx/.bzr/

不多介绍,可能管理员觉得网站不安全,需要我们审计一下

  1. www.zip
  2. www.tar.gz
  3. www.rar
  4. web.zip
  5. web.rar
  6. ...

这些有很多,,不一一详细,后面我会将这些全部集合在一个字典里,然后我们可以放入目录遍历的工具里批量扫~

利用shodan、fofa等收集信息

查找标题是携程并且语言是国语的站点

  1. https://www.shodan.io/search?query=http.title:"携程" country:"CN"

image_1dbvfuq8rvjho6e3qd1etn1va420.png-338.8kB

我们可以将其收藏为文件夹,方便下次打开,然后记录时间,看看有没有新上线的(这里已经有监控的功能,各位师傅可以去看看米斯特大佬写的shodan监控文章,很有趣很实用)

shodanfofa不多介绍了,有对应的手册,见的肯定比我好

思路扩展

思路扩展就是在a功能点中找出b功能点,以此类推

比如一些后台登录是

  1. http://xxx.xxx.xxx/admin-login

我们是不是可以尝试吧login改成register来注册

再比如获取用户手机号的接口(这里不存在越权)

  1. http://xxx.xxx.xxx/user/GetPhone/?id=1

然后我们把GetPhone改成GetPasswd或者GetPwd或者GetPassword然后id就可能可以越权,或者这里可以json劫持或者origin劫持等,我们可以诱导用户点开来劫持账号密码

或者还是看源代码,然后搜索hidden(滑稽),我们可能可能会找到敏感操作的按钮,然后管理员也知道敏感,将其"隐藏"了,我们可以根据这个来搜索然后访问他,嘿嘿嘿(之前对一个小站点进行挖掘的时候我hidden找居然找到了不可描述的目录下面放着不可描述的电影,当时我的心情是非常拒绝的,经过几小时的思考我迅速的将那个目录关闭了,毕竟我是祖国的花朵)

这里有很多是adrian师傅与我分享的,然后暂时只写那么多吧(其实还有几个,怕触犯到权什么的就是他给你学了但不给我写的那种,很麻烦所以就以后有机会再写吧),如果遇到了更多我会补充

来源于网络,回馈于网络
作者qq:1900065568
经济条件的情况下表哥们可以来我小密圈支持,一起交流一起进步

xmq.jpg-47.5kB

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注