GVKT站点域名/IP侦察器-结合云API

2016-10-06  本文已影响0人  吃鸡蛋的肉

GVKT站点域名/IP侦察器

GVKT是一个开源项目,作者倾旋。

该工具结合了Bing接口和本地DNS解析器、MySQL数据库等服务实现了对域名的子域名爆破、结果存储、分析。
此工具开发的初衷就是方便Linux下渗透测试,针对结果去分析目标网络架构。
可以从数据库调用之前扫描的结果
目前主要做了API这一块

一、运行环境

  • python3.x以上(Linux)
  • 后续将采用本地数据来存储网络扫描结果(MySQL 5.X)
  • 客户机必须联网

二、加载步骤

  1. 判断是否连接数据库
  2. 接收命令行参数
  3. 判断必须参数
  4. 获取必须参数值
  5. 判断参数且执行动作

三、具备功能

  • 获取站点IP
  • 获取子域名
  • 查询旁站
  • 条件保存 单独获取IP | 域名 存储数据库 | 文本
  • 查询IP段内网站

四、参数说明

help.png
  • [+] --update 从远程服务器下载最新字典到本地
  • [+] --domain|t|target=0nlis.com 调用本地字典爆破
  • [+] --domain=0nlis.com --dic=/usr/share/gvkt_scan/dic.txt 调用本地任意位置字典
  • [+] --add=new_dic --name=提交者名称

五、 爆破演示

爆破ALIYUN:


creak.png

更新字典:

update.png

-u --update都可以,单开关参数,很方便!!

提交新词:

submit.png

目前服务器已经有将近三千条词典:

number.png

六、 扩展API接口

七、 关于我

我将在后期着重开发此工具的插件,使其支持数据库保存,报告生产,目标探测,若有机会,将会结合其他开源扫描工具完成扫描任务。 感谢支持,我的邮箱 payloads#aliyun.com

八 、 开源一下

import socket
import urllib.request
import urllib.parse
import os
import sys
import getopt
import json

class Scaner:
    def __init__(self):
        pass
    def local_scan(self,target,dic_path=None):
        try:
            scan_log = []
            fp=open(dic_path,'r')
        except:
            print('[-]The dic cant read...')
            sys.exit(0)
        for start in fp.readlines():
                start = start.replace('\n','')
                domain = start+'.'+target
                print("[+]Try to %s\r"%domain,)
                result = self.sock_dns(domain)
                if not result == None:
                    scan_log.append(result)
                    print('[+]'+result)
        fp.close()
        path_index = dic_path.rfind('/')
        try:
            fp = open(dic_path[0:path_index]+'/'+target+'.log','w+')
        except:
            print('[-]Can not create scan log.')
            sys.exit(0)
        for x in scan_log:
            fp.write(x+"\n")
        print('[+]scan log save to : '+dic_path[0:path_index]+'/'+target+'.log')
        fp.close()
        sys.exit(0)
    def http_request(self,url,method,data):
        url = url+'?'+urllib.parse.urlencode(method)+'&'+urllib.parse.urlencode(data)
        req = urllib.request.urlopen(url)
        print("[+]"+url)
        if req.getcode()==200:
            print('[+]New Dictionary is '+data['domain'])
            print('[+]Dictionary submited success ! Thank You '+data['user'])
            sys.exit(0)
        else:
            print(req.info())
            print('[-]Dirctionary Submited error!!')
            sys.exit(0)
    def sock_dns(self,domain):
        try:
            host = socket.gethostbyname(domain)
        except:
            pass
            return None
        return domain+' => '+host
# dic_list 字典列表
config = {'url':'http://0nlis.com/api.php','local':'/usr/share/gvkt_scan/','save_name':'dic.txt'}
method = {'method':None}
target = {'target':None,'dic':None}
new_dic ={'user':None,'domain':None}
opts,args = getopt.getopt(sys.argv[1:],"hvut:d:",["help","version","update","target=","add=","name=","dic="])
for op1,op2 in opts:
    if op1 in ("-h","--help"):
       print("""
  '#'   -------------------------
#.   .#   \033[1;31;40m GVKT - SCAN DOMAIN \033[0;m
'#.   .#'  ===================
 /'#.  .#'   .#'\   \ %^ oO8
 _\\'#.   .#'//_  #'.  Oo o8O  Oo%
  (########'#'(___))) $ oO' #. oO
[+]--update | Connect to Could API get new dic.
[+]--domain 0nlis.com --dic /root/dic/domain.dic | Read local dic to blast domain
[+]--domain 0nlis.com       | Read local default dic to blast domain
[+]--add manager --name GVKT | Sumbit new dic to remote server
[+]--version | Show version
        """);sys.exit(0)
    if op1 in ("-v","--version"):
        print("""
  '#'   -------------------------
#.   .#   \033[1;31;40m GVKT - SCAN DOMAIN \033[0;m
'#.   .#'  ===================
 /'#.  .#'   .#'\   \ %^ oO8
 _\\'#.   .#'//_  #'.  Oo o8O  Oo%
  (########'#'(___))) $ oO' #. oO

Version : GVSCAN/0.1
""");sys.exit(0)
    if op1 in ("-u","--update"):
        print('[+]Update GVSCAN ....')
        method['method']='dic_list'
        try:
            req = urllib.request.urlopen(config['url']+'?'+urllib.parse.urlencode(method))
            print("[+]Content to "+req.geturl())
        except:
            print("\033[1;31;20m[-]The host can not connect ...\033[0m")
            sys.exit(0)
        print("\033[1;32;20m[+]Get dict success !!! Please waite make new dict...\033[0m")
        if(not os.path.exists(config['local'])):
            os.mkdir(config['local'])
        print('[+]DIR IS :'+config['local']+config['save_name'])
        fp = open(config['local']+config['save_name'],'w+')
        datas = req.readlines()
        for x in datas:
            fp.writelines(x.decode('utf8'))
        fp.close()
        print("[+]Update success !!!")
        sys.exit(0)
    if op1 in ("-t","--target"):
        target['target'] = op2
    if op1 in ("-d","--dic"):
        target['dic']  = op2
    if op1 in ("-a","--add"):
        new_dic['domain']  = op2
    if op1 in ("-n","--name"):
        new_dic['user'] = op2
scan = Scaner()
if not target['target'] == None:
    if not target['dic']==None:
        scan.local_scan(target['target'],target['dic'])
    else:
        scan.local_scan(target['target'],config['local']+config['save_name'])
if new_dic['domain']!= None and new_dic['user']!=None:
    method['method']='input'
    scan.http_request(config['url'],method,new_dic)
上一篇下一篇

猜你喜欢

热点阅读