GithubHelp home page GithubHelp logo

shepherd's People

Contributors

ernket avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

sakazulu

shepherd's Issues

fofa模块bug

fofa.py:61 应该改成这样,去掉了导出fid的字段,这个字段需要企业会员
fofa_search_url = "https://fofa.info/api/v1/search/all?fields=ip,port,title,host,domain,country,province,city,country_name,header,server,protocol,banner,cert,isp,as_number,as_organization,latitude,longitude,icp,cname,type,jarm&page={}&email={}&key={}&qbase64={}&size=10".format(page_num,email,key,str_base64)

如果不改的话,返回结果为:{'error': True, 'errmsg': '[820001] 没有权限搜索fid字段'}

在这种情况下会报
[-]fofa模块存在问题:
local variable 'result' referenced before assignment

原因是异常处理没做好,在以下片段的代码里头,当errmsg存在于res.text时,result不会被创建,但紧接着又使用了result['results'],就会报变量在没定义前使用

    while True:
        fofa_search_url = "https://fofa.info/api/v1/search/all?fields=ip,port,title,host,domain,country,province,city,country_name,header,server,protocol,banner,cert,isp,as_number,as_organization,latitude,longitude,icp,cname,type,jarm&page={}&email={}&key={}&qbase64={}&size=10".format(page_num,email,key,str_base64)
        #print(fofa_search_url)
        res = requests.get(fofa_search_url, headers=header)
        if 'errmsg' not in res.text:
            result = json.loads(res.text)
        
        if len(result['results'])==0:           #如果当前页面返回的数据为0,说明已遍历完成,无需继续

可以改成

    while True:
        fofa_search_url = "https://fofa.info/api/v1/search/all?fields=ip,port,title,host,domain,country,province,city,country_name,header,server,protocol,banner,cert,isp,as_number,as_organization,latitude,longitude,icp,cname,type,jarm&page={}&email={}&key={}&qbase64={}&size=10".format(page_num,email,key,str_base64)
        #print(fofa_search_url)
        res = requests.get(fofa_search_url, headers=header)
        if 'errmsg' in res.text:
            print(res.text) #输出此时api返回结果
            continue #执行下次循环直到成功
        result = json.loads(res.text)
        
        if len(result['results'])==0:           #如果当前页面返回的数据为0,说明已遍历完成,无需继续

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.