- A+
猪猪侠 (每次有人骂我是猪我都说自己是猪猪侠) | 2015-04-03 00:29
https://github.com/ring04h/weakfilescan
具体使用细节文档,帮助文档正在写
一句话,用来检测敏感信息泄露的,svn、git、配置文件的临时文件全包含了,相关流程图、设计图编辑中
利用一切可利用的动态信息来关联检测的,各种用心的逻辑判断过滤
# 安装 lxml & beautifulsoup4
yum install python-devel libxml2-devel libxslt-devel
pip install lxml beautifulsoup4
python wyspider.py wuyun.org
--------------------------------------------------
* scan http://wuyun.org start
--------------------------------------------------
[200] http://wuyun.org => http://wuyun.org/
[200] http://wuyun.org/wuyun.tar.gz => http://wuyun.org/wuyun.tar.gz
--------------------------------------------------
* scan complete...
--------------------------------------------------
{
"dirs": {
"http://wuyun.org": [
"http://wuyun.org"
]
},
"files": {
"http://wuyun.org": [
"http://wuyun.org/wuyun.tar.gz"
]
}
}
$("img").load(function(){ if($(this).attr("width")>640) $(this).attr("width",640); });
赞个
运行出现
Traceback (most recent call last):
File "wyspider.py", line 17, in <module>
print json.dumps(start_wyspider(sys.argv[1]), indent=2)
File "/root/weakfilescan/controller.py", line 78, in start_wyspider
possibility = checksite_possibility(httpurl)
File "/root/weakfilescan/common.py", line 65, in checksite_possibility
httpres = http_request_get(siteurl.rstrip('/')+tempurl)
File "/root/weakfilescan/common.py", line 39, in http_request_get
allow_redirects=allow_redirects)
File "/root/weakfilescan/libs/requests/sessions.py", line 473, in get
return self.request('GET', url, **kwargs)
File "/root/weakfilescan/libs/requests/sessions.py", line 461, in request
resp = self.send(prep, **send_kwargs)
File "/root/weakfilescan/libs/requests/sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "/root/weakfilescan/libs/requests/adapters.py", line 415, in send
raise ConnectionError(err, request=request)
libs.requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine("''",))
有些是探测两三个就这样,有些就直接这样。还有些是直接卡死- -是我没安装yum install python-devel libxml2-devel libxslt-devel 这个的原因么,kali运行提示没有yum这个命令- -百度无果- -我看可以运行就没管了,
加了点代码,就可以从txt读取然后挂着去喝咖啡了~~if __name__ == "__main__":
if len(sys.argv) == 2:
print '2'
print json.dumps(start_wyspider(sys.argv[1]), indent=2)
sys.exit(0)
elif len(sys.argv)==3:
for i in open(sys.argv[2]):
print i
print json.dumps(start_wyspider(str(i).strip()), indent=2)
sys.exit(0)
else:
print ("usage: %s http://wuyun.org" % sys.argv[0])
print ("usage: %s -u url.txt" % sys.argv[0])
sys.exit(-1)
赞~~
@猪猪侠 是不是有些问题啊?
[200] http://zone.wooyun.org/zone/wooyun.bz2 => http://zone.wooyun.org/login
[root@lax-01 weakfilescan]# curl -i http://zone.wooyun.org/zone/wooyun.bz2
HTTP/1.1 302 Moved Temporarily
Date: Fri, 03 Apr 2015 19:42:21 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: __cfduid=d4bb4dd27532c34ad259ff375546604b11428090140; expires=Sat, 02-Apr-16 19:42:20 GMT; path=/; domain=.wooyun.org; HttpOnly
Set-Cookie: PHPSESSID=hqsh2s54gc943b1949d35ptuc4; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Location: http://zone.wooyun.org/login
Server: yunjiasu-nginx
CF-RAY: 1d174193084f0af0-WAW
@猪猪侠 报错了Traceback (most recent call last):
File "wyspider.py", line 20, in <module>
print json.dumps(start_wyspider(sys.argv[1]),indent=2)
File "/root/Desktop/weakfilescan-master/controller.py", line 81, in start_wyspider
possibility = checksite_possibility(httpurl)
File "/root/Desktop/weakfilescan-master/common.py", line 76, in checksite_possibility
is_redirect = True if len(httpres.history) > 0 else False
AttributeError: 'NoneType' object has no attribute 'history'
@猪猪侠python wyspider.py http://www.youmi.net
--------------------------------------------------
* scan http://www.youmi.net start
--------------------------------------------------
Traceback (most recent call last):
File "wyspider.py", line 20, in <module>
print json.dumps(start_wyspider(sys.argv[1]),indent=2)
File "/root/weakfilescan/controller.py", line 41, in start_wyspider
link_datas = GetAllLink(siteurl).start()
File "/root/weakfilescan/libs/GetAllLink.py", line 47, in start
response_obj = LinksParser(http_request_get(self.siteurl))
File "/root/weakfilescan/common.py", line 157, in __init__
self.baseurl = get_baseurl(self.url)
File "/root/weakfilescan/common.py", line 31, in get_baseurl
netloc = urlparse.urlparse(link).netloc
File "/usr/lib/python2.7/urlparse.py", line 140, in urlparse
tuple = urlsplit(url, scheme, allow_fragments)
File "/usr/lib/python2.7/urlparse.py", line 179, in urlsplit
i = url.find(':')
@猪猪侠python wyspider.py http://www.youmi.net
--------------------------------------------------
* scan http://www.youmi.net start
--------------------------------------------------
/root/weakfilescan/libs/requests/packages/urllib3/connectionpool.py:734: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
/root/weakfilescan/libs/requests/packages/urllib3/connectionpool.py:734: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
/root/weakfilescan/libs/requests/packages/urllib3/connectionpool.py:734: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
/root/weakfilescan/libs/requests/packages/urllib3/connectionpool.py:734: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
/root/weakfilescan/libs/requests/packages/urllib3/connectionpool.py:734: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
/root/weakfilescan/libs/requests/packages/urllib3/connectionpool.py:734: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
/root/weakfilescan/libs/requests/packages/urllib3/connectionpool.py:734: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
@小博 pip
遇上安全狗会汪汪汪!没什么用 但是,我真心觉得很不错的一个工具! 谢谢分享!
asdf (import pdb;pdb.set_trace(); name="signature" type="text" maxlength="25") | 2015-04-14 08:47
@猪猪侠 不用修改官方的。在你主文件开头加上这个吧。 而且官方正在最新版本中计划加个参数可以ignore这个告警信息。import warnings
from requests.packages.urllib3.exceptions import InsecureRequestWarning
from requests.packages.urllib3.exceptions import InsecurePlatformWarning
warnings.filterwarnings(action="ignore", message="Unverified HTTPS request.*", category=InsecureRequestWarning)
warnings.filterwarnings(action="ignore", message="A true SSLContext object.*", category=InsecurePlatformWarning)
root@kali:~/weakfilescan# python wyspider.py http://www.xxxx.cn php
--------------------------------------------------
* scan http://www.qeeyou.cn start
--------------------------------------------------
Traceback (most recent call last):
File "wyspider.py", line 17, in <module>
print json.dumps(start_wyspider(sys.argv[1]), indent=2)
File "/root/weakfilescan/controller.py", line 41, in start_wyspider
link_datas = GetAllLink(siteurl).start()
File "/root/weakfilescan/libs/GetAllLink.py", line 47, in start
response_obj = LinksParser(http_request_get(self.siteurl))
File "/root/weakfilescan/common.py", line 171, in __init__
self.soup = BeautifulSoup(self.html_content.text, 'lxml')
File "/usr/lib/python2.7/dist-packages/bs4/__init__.py", line 172, in __init__
self._feed()
File "/usr/lib/python2.7/dist-packages/bs4/__init__.py", line 185, in _feed
self.builder.feed(self.markup)
File "/usr/lib/python2.7/dist-packages/bs4/builder/_lxml.py", line 175, in feed
self.parser.close()
File "parser.pxi", line 1186, in lxml.etree._FeedParser.close (src/lxml/lxml.etree.c:88907)
File "parsertarget.pxi", line 142, in lxml.etree._TargetParserContext._handleParseResult (src/lxml/lxml.etree.c:98223)
File "parsertarget.pxi", line 130, in lxml.etree._TargetParserContext._handleParseResult (src/lxml/lxml.etree.c:98047)
File "lxml.etree.pyx", line 294, in lxml.etree._ExceptionContext._raise_if_stored (src/lxml/lxml.etree.c:9077)
File "saxparser.pxi", line 289, in lxml.etree._handleSaxDoctype (src/lxml/lxml.etree.c:94611)
File "parsertarget.pxi", line 86, in lxml.etree._PythonSaxParserTarget._handleSaxDoctype (src/lxml/lxml.etree.c:97582)
File "/usr/lib/python2.7/dist-packages/bs4/builder/_lxml.py", line 150, in doctype
doctype = Doctype.for_name_and_ids(name, pubid, system)
File "/usr/lib/python2.7/dist-packages/bs4/element.py", line 720, in for_name_and_ids
return Doctype(value)
File "/usr/lib/python2.7/dist-packages/bs4/element.py", line 653, in __new__
return unicode.__new__(cls, value, DEFAULT_OUTPUT_ENCODING)
TypeError: coercing to Unicode: need string or buffer, NoneType found
加了点代码
扫描完成后会写入结果在当前目录,生成文件result.txt(代码很搓,有点冗余)
加了个用法:python wyspider.py -u url.txt (从当前目录url.txt循环取url然后开始扫描)
if __name__ == "__main__":
f = file("result.txt","a+")
result = "test"
if len(sys.argv) == 2:
result = json.dumps(start_wyspider(sys.argv[1]), indent=2)
f.write(result)
print result
sys.exit(0)
elif len(sys.argv)==3:
for i in open(sys.argv[2]):
result = json.dumps(start_wyspider(str(i).strip()), indent=2)
f.write(result)
print result
sys.exit(0)
else:
print ("usage: %s http://wuyun.org" % sys.argv[0])
print ("usage: %s -u url.txt" % sys.argv[0])
sys.exit(-1)
某些url会报这个错误Traceback (most recent call last):
File "wyspider.py", line 26, in <module>
result = json.dumps(start_wyspider(str(i).strip()), indent=2)
File "F:\Self\weakfilescan-master\controller.py", line 41, in start_wyspider
link_datas = GetAllLink(siteurl).start()
File "F:\Self\weakfilescan-master\libs\GetAllLink.py", line 47, in start
response_obj = LinksParser(http_request_get(self.siteurl))
File "F:\Self\weakfilescan-master\common.py", line 170, in __init__
self.baseurl = get_baseurl(self.url)
File "F:\Self\weakfilescan-master\common.py", line 31, in get_baseurl
netloc = urlparse.urlparse(link).netloc
File "C:\Python27\lib\urlparse.py", line 134, in urlparse
tuple = urlsplit(url, scheme, allow_fragments)
File "C:\Python27\lib\urlparse.py", line 173, in urlsplit
i = url.find(':')
AttributeError: 'NoneType' object has no attribute 'find'
然后http://www.onlylady.com报了这个错误* scan http://www.onlylady.com start
--------------------------------------------------
encoding error : input conversion failed due to input error, bytes 0xB5 0x00 0xDA 0x00
encoding error : input conversion failed due to input error, bytes 0xB5 0x00 0xDA 0x00
encoding error : input conversion failed due to input error, bytes 0xD3 0x00 0xD1 0x00
encoding error : input conversion failed due to input error, bytes 0xD3 0x00 0xD1 0x00
encoding error : input conversion failed due to input error, bytes 0xC5 0x00 0xD4 0x00
encoding error : input conversion failed due to input error, bytes 0xC5 0x00 0xD4 0x00
encoding error : input conversion failed due to input error, bytes 0xD5 0x00 0xE2 0x00
encoding error : input conversion failed due to input error, bytes 0xD5 0x00 0xE2 0x00
encoding error : input conversion failed due to input error, bytes 0xD1 0x00 0xEE 0x00
encoding error : input conversion failed due to input error, bytes 0xD1 0x00 0xEE 0x00
encoding error : input conversion failed due to input error, bytes 0xB4 0x00 0xA6 0x00
encoding error : input conversion failed due to input error, bytes 0xB4 0x00 0xA6 0x00
encoding error : input conversion failed due to input error, bytes 0xB1 0x00 0xEA 0x00
encoding error : input conversion failed due to input error, bytes 0xB1 0x00 0xEA 0x00
encoding error : input conversion failed due to input error, bytes 0xB1 0x00 0xEA 0x00
encoding error : input conversion failed due to input error, bytes 0xB1 0x00 0xEA 0x00
encoding error : input conversion failed due to input error, bytes 0xB7 0x00 0xA2 0x00
encoding error : input conversion failed due to input error, bytes 0xB7 0x00 0xA2 0x00
encoding error : input conversion failed due to input error, bytes 0xC6 0x00 0xD8 0x00
encoding error : input conversion failed due to input error, bytes 0xC6 0x00 0xD8 0x00
encoding error : input conversion failed due to input error, bytes 0xC7 0x00 0xA7 0x00
encoding error : input conversion failed due to input error, bytes 0xBF 0x00 0xC6 0x00
encoding error : input conversion failed due to input error, bytes 0xBB 0x00 0xBC 0x00
encoding error : input conversion failed due to input error, bytes 0xBC 0x00 0xAA 0x00
encoding error : input conversion failed due to input error, bytes 0xC8 0x00 0xC8 0x00
encoding error : input conversion failed due to input error, bytes 0xA1 0x00 0xBE 0x00
encoding error : input conversion failed due to input error, bytes 0xC7 0x00 0xEF 0x00
encoding error : input conversion failed due to input error, bytes 0xC8 0x00 0xC8 0x00
encoding error : input conversion failed due to input error, bytes 0xA1 0x00 0xBE 0x00
encoding error : input conversion failed due to input error, bytes 0xBB 0x00 0xBC 0x00
encoding error : input conversion failed due to input error, bytes 0xC8 0x00 0xC8 0x00
encoding error : input conversion failed due to input error, bytes 0xC7 0x00 0xA7 0x00
encoding error : input conversion failed due to input error, bytes 0xC7 0x00 0xEF 0x00
encoding error : input conversion failed due to input error, bytes 0xBF 0x00 0xC6 0x00
encoding error : input conversion failed due to input error, bytes 0xC8 0x00 0xC8 0x00
encoding error : input conversion failed due to input error, bytes 0xBC 0x00 0xAA 0x00
encoding error : input conversion failed due to input error, bytes 0xD3 0x00 0xA2 0x00
encoding error : input conversion failed due to input error, bytes 0xD3 0x00 0xA2 0x00
encoding error : input conversion failed due to input error, bytes 0xD2 0x00 0xBB 0x00
encoding error : input conversion failed due to input error, bytes 0xBB 0x00 0xD8 0x00
encoding error : input conversion failed due to input error, bytes 0xD2 0x00 0xBB 0x00
encoding error : input conversion failed due to input error, bytes 0xBB 0x00 0xD8 0x00
Traceback (most recent call last):
File "wyspider.py", line 20, in <module>
print json.dumps(start_wyspider(sys.argv[1]),indent=2)
File "/home/wwwroot/scan/weakfilescan-master/controller.py", line 58, in start_wyspider
fuzzfile_request_set.extend(urlgenerator_obj.generator())
File "/home/wwwroot/scan/weakfilescan-master/libs/FuzzUrlGenerator.py", line 46, in generator
urls_result.append(parser_obj.baseurl + webdir + depend)
MemoryError