漏洞挖掘之信息收集


對一個網站挖掘的深淺來說就得看你收集的如何,這說明信息收集在漏洞挖掘中是非常的重要的。

子域名收集

子域名收集是最簡單的收集手法之一,有很多在線的工具可以直接套用,這里分享幾個我經常用的。

開心的時候用用這個掃描器

為什么這么說,因為這是我寫的(你生氣用的話我怕我屏幕里突然冒出一個拖孩)

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

github上開源的子域名掃描器

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

在線網站收集

1,

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

 

 

然后不到30秒就出結果了
在這里插入圖片描述
2,

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

端口信息收集

掃描端口並且標記可以爆破的服務

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

精確判斷漏洞並掃描端口

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所示,掃描子域名
在這里插入圖片描述
提取出域名/ip

在這里插入圖片描述
然后把域名放到975.txt

2,批量掃描端口和漏洞檢測

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信息

自定義的端口

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

 

 

這里只是演示下他跑起來的美

目錄信息收集

目錄收集工具有很多,但是最看重的還是目錄字典,之前我拿了很多工具的字典去重集合起來超級超級大,只不過是在之前電腦那里還原的時候忘記了備份,(說這句話主要是想讓你們也可以這樣子做,方便自己,然后發我一份,方便你我)

這里推薦一個工具7kbstorm

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

像403,404這種頁面千萬不要關閉,放目錄里面掃就ok了

谷歌語法收集敏感文件

最常見的就是用搜索引擎〜

site:ooxx.com filetype:xls

首先試試百度
在這里插入圖片描述
試試必應
在這里插入圖片描述
這里主要是收集網站敏感文件(比如目標的某個系統手冊演示的截圖中截圖到了用戶名,然后我們可以根據用戶名來爆破密碼;甚至可以看看有沒有寫系統默認密碼,或者一些后台的目錄路徑,如果有目錄就可以嘗試對其訪問,說不定有未授權〜)

還能嘗試對后台進行查找

site:xxx.xxx admin
site:xxx.xxx login
site:xxx.xxx system
site:xxx.xxx 管理
site:xxx.xxx 登錄
site:xxx.xxx 內部
site:xxx.xxx 系統

還可以查找郵箱,然后進行釣魚

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

可以還查找qq群等,然后假裝員工驗證進去看群文件泄露了什么東東(這里有個技巧,去找客服聊天處,然后對整個過程抓包也就是看歷史請求,如果運氣好可能在請求的返回包中返回客服的姓名,如果只單純的泄露了姓如張xx,那么你加群的時候就說你是小張工作號,說這個工作號的原因是可能小張已經在群里了)

注意事項:如果你是挖騰訊的話就不要看這條啦

1 site:xxx.xxx qq
2 site:xxx.xxx 群
3 site:xxx.xxx 企鵝
4 site:xxx.xxx 騰訊

還可以對尋找一些公開的,危害大,普遍的漏洞的指紋,下面如搜索的jboss系統-

site:ooxx.com inurl:jmx-console

小技巧

比如下面一個站存在越權(但是越權的對象很難猜測)

http://xxx.xxx.xxx/userinfo/?uid=2018-WOIDJWOIDJ-5201314
那么我們可以嘗試用搜索引擎來找

site:xxx.xxx inurl=uid=20
利用雲網盤搜索工具搜集敏感文件

公司員工可能把一些內部資料放在了公網網盤,然后被在線雲網盤搜索的網站抓取了,我們就可以利用這個來對目標系統進行深入交流

我這邊主要用凌風雲搜索

https://www.lingfengyun.com/
在這里插入圖片描述
個人喜歡直接輸入廠商名字然后搜索(比較全),然后邊看電視(最好看鬼片,鬼出來的階段想着找找找)邊搜索

利用gayhub來收集信息

1,打開gayhub

在這里插入圖片描述
就是這里找gayhub全部開源項目內容中存在聯想這個關鍵字的項目,這樣子可以搜集到的方面更廣,如果單純只是對標題搜索,他們那么改成了lenovo你就搜不到了

然后說再多,也沒這個好用

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

針對網站性收集

1,把網站弄報錯,看是什么cms,或者看返回包回顯是什么中間件這些

2,的英文看linux還是window

目標如url的英文www.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文件,我將其打開后,里面的備注居然是配置信息…后台地址,管理員賬號和密碼等(我可是沒get到shell,所以你要知道這回事而不要記住這件事)

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 
 25 from exp10it import CLIOutput
 26 from exp10it import get_root_domain
 27 from exp10it import get_string_from_command
 28 from exp10it import get_http_or_https
 29 from exp10it import post_request
 30 from exp10it import get_request
 31 from exp10it import checkvpn
 32 import sys
 33 import re
 34 
 35 class Xcdn(object):
 36 
 37     def __init__(self,domain):
 38         #必須保證連上了vpn,要在可以ping通google的條件下使用本工具,否則有些domain由於被GFW攔截無法正常訪問會導致
 39         #本工具判斷錯誤,checkvpn在可以ping通google的條件下返回1
 40         while 1:
 41             if checkvpn()==1:
 42                 break
 43             else:
 44                 time.sleep(1)
 45                 print("vpn is off,connect vpn first")
 46         if domain[:4]=="http":
 47             print("domain format error,make sure domain has no http,like www.baidu.com but not \
 48 http://www.baidu.com")
 49             sys.exit(0)
 50         #首先保證hosts文件中沒有與domain相關的項,有則刪除相關
 51         domainPattern=domain.replace(".","\.")
 52         #下面的sed的正則中不能有\n,sed匹配\n比較特殊
 53         #http://stackoverflow.com/questions/1251999/how-can-i-replace-a-newline-n-using-sed
 54         command="sed -ri 's/.*\s+%s//' /etc/hosts" % domainPattern
 55         os.system(command)
 56 
 57         self.domain=domain
 58         self.http_or_https=get_http_or_https(self.domain)
 59         print('domain的http或https是:%s' % self.http_or_https)
 60         result=get_request(self.http_or_https+"://"+self.domain,'seleniumPhantomJS')
 61         self.domain_title=result['title']
 62         #下面調用相當於main函數的get_actual_ip_from_domain函數
 63         actual_ip = self.get_actual_ip_from_domain()
 64         if actual_ip != 0:
 65             print("恭喜,%s的真實ip是%s" % (self.domain, actual_ip))
 66         #下面用來存放關鍵返回值
 67         self.return_value=actual_ip
 68 
 69     def domain_has_cdn(self):
 70         # 檢測domain是否有cdn
 71         # 有cdn時,返回一個字典,如果cdn是cloudflare,返回{'has_cdn':1,'is_cloud_flare':1}
 72         # 否則返回{'has_cdn':1,'is_cloud_flare':0}或{'has_cdn':0,'is_cloud_flare':0}
 73         import re
 74         CLIOutput().good_print("現在檢測domain:%s是否有cdn" % self.domain)
 75         has_cdn = 0
 76         # ns記錄和mx記錄一樣,都要查頂級域名,eg.dig +short www.baidu.com ns VS dig +short baidu.com ns
 77         result = get_string_from_command("dig ns %s +short" % get_root_domain(self.domain))
 78         pattern = re.compile(
 79             r"(cloudflare)|(cdn)|(cloud)|(fast)|(incapsula)|(photon)|(cachefly)|(wppronto)|(softlayer)|(incapsula)|(jsdelivr)|(akamai)", re.I)
 80         cloudflare_pattern = re.compile(r"cloudflare", re.I)
 81         if re.search(pattern, result):
 82             if re.search(cloudflare_pattern, result):
 83                 print("has_cdn=1 from ns,and cdn is cloudflare")
 84                 return {'has_cdn': 1, 'is_cloud_flare': 1}
 85             else:
 86                 print("has_cdn=1 from ns")
 87                 return {'has_cdn': 1, 'is_cloud_flare': 0}
 88         else:
 89             # 下面通過a記錄個數來判斷,如果a記錄個數>1個,認為有cdn
 90             result = get_string_from_command("dig a %s +short" % self.domain)
 91             find_a_record_pattern = re.findall(r"((\d{1,3}\.){3}\d{1,3})", result)
 92             if find_a_record_pattern:
 93                 ip_count = 0
 94                 for each in find_a_record_pattern:
 95                     ip_count += 1
 96                 if ip_count > 1:
 97                     has_cdn = 1
 98                     return {'has_cdn': 1, 'is_cloud_flare': 0}
 99         return {'has_cdn': 0, 'is_cloud_flare': 0}
100 
101     def get_domain_actual_ip_from_phpinfo(self):
102         # 從phpinfo頁面嘗試獲得真實ip
103         CLIOutput().good_print("現在嘗試從domain:%s可能存在的phpinfo頁面獲取真實ip" % self.domain)
104         phpinfo_page_list = ["info.php", "phpinfo.php", "test.php", "l.php"]
105         for each in phpinfo_page_list:
106             url = self.http_or_https + "://" + self.domain + "/" + each
107             CLIOutput().good_print("現在訪問%s" % url)
108             visit = get_request(url,'seleniumPhantomJS')
109             code = visit['code']
110             content = visit['content']
111             pattern = re.compile(r"remote_addr", re.I)
112             if code == 200 and re.search(pattern, content):
113                 print(each)
114                 actual_ip = re.search(r"REMOTE_ADDR[^\.\d]+([\d\.]{7,15})[^\.\d]+", content).group(1)
115                 return actual_ip
116         # return 0代表沒有通過phpinfo頁面得到真實ip
117         return 0
118 
119     def flush_dns(self):
120         # 這個函數用來刷新本地dns cache
121         # 要刷新dns cache才能讓修改hosts文件有效
122         CLIOutput().good_print("現在刷新系統的dns cache")
123         command = "service network-manager restart && /etc/init.d/networking force-reload"
124         os.system(command)
125         import time
126         time.sleep(3)
127 
128     def modify_hosts_file_with_ip_and_domain(self,ip):
129         # 這個函數用來修改hosts文件
130         CLIOutput().good_print("現在修改hosts文件")
131         exists_domain_line = False
132         with open("/etc/hosts", "r+") as f:
133             file_content = f.read()
134         if re.search(r"%s" % self.domain.replace(".", "\."), file_content):
135             exists_domain_line = True
136         if exists_domain_line == True:
137             os.system("sed -ri 's/.*%s.*/%s    %s/' %s" % (self.domain.replace(".", "\."), ip, self.domain, "/etc/hosts"))
138         else:
139             os.system("echo %s %s >> /etc/hosts" % (ip, self.domain))
140 
141     def check_if_ip_is_actual_ip_of_domain(self,ip):
142         # 通過修改hosts文件檢測ip是否是domain對應的真實ip
143         # 如果是則返回True,否則返回False
144         #CLIOutput().good_print("現在通過修改hosts文件並刷新dns的方法檢測ip:%s是否是domain:%s的真實ip" % (ip,self.domain))
145         #python通過requests庫或mechanicalsoup庫或selenium_phantomjs來請求時不會被dns緩存影響,只會被hosts文件影響dns解析,人工用瀏覽器訪問域名則會受dns緩存影響
146         CLIOutput().good_print("現在通過修改hosts文件的方法檢測ip:%s是否是domain:%s的真實ip" % (ip,self.domain))
147         os.system("cp /etc/hosts /etc/hosts.bak")
148         self.modify_hosts_file_with_ip_and_domain(ip)
149         #python通過requests庫或mechanicalsoup庫或selenium_phantomjs來請求時不會被dns緩存影響,只會被hosts文件影響dns解析,人工用瀏覽器訪問域名則會受dns緩存影響
150         #self.flush_dns()
151         hosts_changed_domain_title= get_request(self.http_or_https + "://%s" % self.domain,'selenium_phantom_js')['title']
152         os.system("rm /etc/hosts && mv /etc/hosts.bak /etc/hosts")
153         #這里要用title判斷,html判斷不可以,title相同則認為相同
154         if self.domain_title == hosts_changed_domain_title:
155             CLIOutput().good_print("檢測到真實ip!!!!!!",'red')
156             return True
157         else:
158             CLIOutput().good_print("當前ip不是域名的真實ip",'yellow')
159             return False
160 
161     def get_c_80_or_443_list(self,ip):
162         # 得到ip的整個c段的開放80端口或443端口的ip列表
163         if "not found" in get_string_from_command("masscan"):
164             #這里不用nmap掃描,nmap掃描結果不准
165             os.system("apt-get install masscan")
166         if self.http_or_https=="http":
167             scanPort=80
168             CLIOutput().good_print("現在進行%s的c段開了80端口機器的掃描" % ip)
169         if self.http_or_https=="https":
170             scanPort=443
171             CLIOutput().good_print("現在進行%s的c段開了443端口機器的掃描" % ip)
172         masscan_command = "masscan -p%d %s/24 > /tmp/masscan.out" % (scanPort,ip)
173         os.system(masscan_command)
174         with open("/tmp/masscan.out", "r+") as f:
175             strings = f.read()
176         #os.system("rm /tmp/masscan.out")
177         import re
178         allIP=re.findall(r"((\d{1,3}\.){3}\d{1,3})",strings)
179         ipList=[]
180         for each in allIP:
181             ipList.append(each[0])
182         print(ipList)
183         return ipList
184 
185     def check_if_ip_c_machines_has_actual_ip_of_domain(self,ip):
186         # 檢測ip的c段有沒有domain的真實ip,如果有則返回真實ip,如果沒有則返回0
187         CLIOutput().good_print("現在檢測ip為%s的c段中有沒有%s的真實ip" % (ip,self.domain))
188         target_list=self.get_c_80_or_443_list(ip)
189         for each_ip in target_list:
190             if True == self.check_if_ip_is_actual_ip_of_domain(each_ip):
191                 return each_ip
192         return 0
193 
194     def get_ip_from_mx_record(self):
195         # 從mx記錄中得到ip列表,嘗試從mx記錄中的c段中找真實ip
196         print("嘗試從mx記錄中找和%s頂級域名相同的mx主機" % self.domain)
197         import socket
198         # domain.eg:www.baidu.com
199         from exp10it import get_root_domain
200         root_domain = get_root_domain(self.domain)
201         from exp10it import get_string_from_command
202         result = get_string_from_command("dig %s +short mx" % root_domain)
203         sub_domains_list = re.findall(r"\d{1,} (.*\.%s)\." % root_domain.replace(".", "\."), result)
204         ip_list = []
205         for each in sub_domains_list:
206             print(each)
207             ip = socket.gethostbyname_ex(each)[2]
208             if ip[0] not in ip_list:
209                 ip_list.append(ip[0])
210         return ip_list
211 
212     def check_if_mx_c_machines_has_actual_ip_of_domain(self):
213         # 檢測domain的mx記錄所在ip[或ip列表]的c段中有沒有domain的真實ip
214         # 有則返回真實ip,沒有則返回0
215         CLIOutput().good_print("嘗試從mx記錄的c段中查找是否存在%s的真實ip" % self.domain)
216         ip_list = self.get_ip_from_mx_record()
217         if ip_list != []:
218             for each_ip in ip_list:
219                 result = self.check_if_ip_c_machines_has_actual_ip_of_domain(each_ip)
220                 if result != 0:
221                     return result
222                 else:
223                     continue
224         return 0
225 
226     def get_ip_value_from_online_cloudflare_interface(self):
227         # 從在線的cloudflare查詢真實ip接口處查詢真實ip
228         # 如果查詢到真實ip則返回ip值,如果沒有查詢到則返回0
229         CLIOutput().good_print("現在從在線cloudflare類型cdn查詢真實ip接口嘗試獲取真實ip")
230         url = "http://www.crimeflare.com/cgi-bin/cfsearch.cgi"
231         post_data = 'cfS=%s' % self.domain
232         content = post_request(url, post_data)
233         findIp = re.search(r"((\d{1,3}\.){3}\d{1,3})", content)
234         if findIp:
235             return findIp.group(1)
236         return 0
237 
238     def get_actual_ip_from_domain(self):
239         # 嘗試獲得domain背后的真實ip,前提是domain有cdn
240         # 如果找到了則返回ip,如果沒有找到返回0
241         CLIOutput().good_print("進入獲取真實ip函數,認為每個domain都是有cdn的情況來處理")
242         import socket
243         has_cdn_value = self.domain_has_cdn()
244         if has_cdn_value['has_cdn'] == 1:
245             CLIOutput().good_print("檢測到domain:%s的A記錄不止一個,認為它有cdn" % self.domain)
246             pass
247         else:
248             CLIOutput().good_print("Attention...!!! Domain doesn't have cdn,I will return the only one ip")
249             true_ip = socket.gethostbyname_ex(self.domain)[2][0]
250             return true_ip
251         # 下面嘗試通過cloudflare在線查詢真實ip接口獲取真實ip
252         if has_cdn_value['is_cloud_flare'] == 1:
253             ip_value = self.get_ip_value_from_online_cloudflare_interface()
254             if ip_value != 0:
255                 return ip_value
256             else:
257                 pass
258         # 下面嘗試通過可能存在的phpinfo頁面獲得真實ip
259         ip_from_phpinfo = self.get_domain_actual_ip_from_phpinfo()
260         if ip_from_phpinfo == 0:
261             pass
262         else:
263             return ip_from_phpinfo
264         # 下面通過mx記錄來嘗試獲得真實ip
265         result = self.check_if_mx_c_machines_has_actual_ip_of_domain()
266         if result == 0:
267             pass
268         else:
269             return result
270         print("很遺憾,在下認為%s有cdn,但是目前在下的能力沒能獲取它的真實ip,當前函數將返回0" % self.domain)
271         return 0

if name == ‘main’:
import sys
domain=sys.argv[1]
Xcdn(domain)
如圖8所示,服務器的ssh配置信息

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

9,敏感文件爆破

svn代碼源泄露使用svn版本控制系統-時,操作錯誤將.svn文件存放,久那么可以看他SVN服務器賬號密碼等信息

1 http://xxx.xxx.xxx/.svn/entries
2 10,根據目標系統情況

根據目標系統情況是因為看他對應的系統是什么對應有什么漏洞,這個下面的英文tomcat的session泄露

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

在這里插入圖片描述
敏感目錄泄露

WEB-INF/web.xml泄露
WEB-INF的英文Java的WEB應用的安全目錄。如果想在頁面中直接訪問其中的文件,通過必須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

bzr泄露
通過它我們可以看項目歷史

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"

在這里插入圖片描述
我們可以將其收藏為文件夾,方便下次打開,然后記錄時間,看看有沒有新上線的(這里已經有監控的功能,師傅各位去可以看看米斯特大佬寫的shodan監控點文章,很有趣很實用)

shodan,fofa不多介紹了,有對應的手冊,見的肯定比我好

思路擴展

擴展思路就是在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師傅與我分享的,然后暫時只寫那么多吧(其實還有幾個,怕觸犯到權什么的就是他給你學了但不給我寫的那種,很麻煩所以就以后有機會再寫吧),如果遇到了更多我會補充

 

 

唉,我太難了,一個一個復制,好累哦。

文章轉載自https://blog.csdn.net/weixin_43639741/article/details/91360146


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM