Giter Site home page Giter Site logo

govanguard / pyexploitdb Goto Github PK

View Code? Open in Web Editor NEW
23.0 23.0 6.0 8.93 MB

An optimized Python3 library to fetch the most recent exploit-database, create searchable indexes for CVE->EDBID and EDBID -> CVE, and provide methods to perform searches.

License: GNU General Public License v3.0

Shell 1.23% Python 63.39% PowerShell 35.38%

pyexploitdb's People

Contributors

bensmart25 avatar dcallaway-govanguard avatar elboulangero avatar fabaff avatar jcavanguard avatar jchoy14 avatar kurtwuckertjr avatar sscottgvit avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pyexploitdb's Issues

Breaking changes on exploitdb end

Hi Guys, faced 2 issues when using this.

  1. Unable to clone and update the database
  2. ValueError: too many values to unpack (expected 8) faced for this line of code edb, fileName, description, date, author, platform, exploitType, port = tuple(row)

This is due to breaking changes on exploitdb end, where they shifted their github repo to gitlab and also renamed their files_exploits.csv headers

Shifting from github to gitlab

image

renaming of files_exploits.csv header

New Header

image

Old Header

image

I have came up with some temporary fix (below) so that this package can still be used, but a more permanent fix will require breaking changes in the codebase.

Temp Fix Method 1

The easiest method would be to download a working commit and save the files in pyExploitDB/exploit-database folder.

In this way, you would not face problem 2.

Temp Fix Method 2

In the __init__.py file, I have commented out the git clone and update function.

original code

    def openFile(self, exploitMap = "cveToEdbid.json", encoding="utf-8"):
        if not os.path.isdir(self.exploitDbPath):
            print("Cloning exploit-database repository")
            git.Repo.clone_from("https://github.com/offensive-security/exploit-database.git", self.exploitDbPath)
            print("Updating db...")
            self.updateDb()
        else:
            if self.autoUpdate == True:
                print("Pulling exploit-database updates...")
                git.Git(self.exploitDbPath).pull('origin', 'master')
                print("Updating db...")
                self.updateDb()
            print("Loading database...")
            with open(self.currentPath + "/" + exploitMap, encoding="utf-8") as fileData:
                cveToExploitMap = json.load(fileData)
                self.cveToExploitMap = cveToExploitMap
                if self.debug == True:
                    print(self.cveToExploitMap)

temp fix code

    def openFile(self, exploitMap = "cveToEdbid.json", encoding="utf-8"):
        if not os.path.isdir(self.exploitDbPath):
            print("Cloning exploit-database repository")
            git.Repo.clone_from("https://gitlab.com/exploit-database/exploitdb.git", self.exploitDbPath)
            #git.Repo.clone_from("https://github.com/offensive-security/exploit-database.git", self.exploitDbPath)
            print("Updating db...")
            self.updateDb()
        else:
            if self.autoUpdate == True:
                print("Pulling exploit-database updates...")
                #git.Git(self.exploitDbPath).pull('origin', 'master')
                print("Updating db...")
                #self.updateDb()
            print("Loading database...")
            with open(self.currentPath + "/" + exploitMap, encoding="utf-8") as fileData:
                cveToExploitMap = json.load(fileData)
                self.cveToExploitMap = cveToExploitMap
                if self.debug == True:
                    print(self.cveToExploitMap)

By doing the above changes, we will be faced with the second problem as the tuples in line 50 of init.py (see below) does not match the headers in the new files_exploits.csv.

Problematic Code

for row in reader:
            edb, fileName, description, date, author, platform, exploitType, port = tuple(row)
            if edb in self.cveToExploitMap[cveSearch]:
                found = True
                result['edbid'] = edb
                result['exploit'] = self.exploitDbPath + "/" + fileName
                result['date'] = date
                result['author'] = author
                result['platform'] = platform
                result['type'] = exploitType
                if self.debug == True:
                    print("Exploit DB Id: {0}".format(edb))
                    print("File: {0}".format(self.exploitDbPath + "/" + fileName))
                    print("Date: {0}".format(date))
                    print("Author: {0}".format(author))
                    print("Platform: {0}".format(platform))
                    print("Type: {0}".format(exploitType))
                if port != "0":
                    result['port'] = port
                    if self.debug == True:
                        print("Port: {0}".format(port))

As such, my suggestion for a quick fix would be to simply replace the new files_exploits.csv with an old one similar to how we just simply download the old database. It would be a tad too tedious to change the tuples.

Hope my suggestion helps!

image

To the maintainers, thanks for creating such an useful package! It is truly helpful! Looking forward to your updates!

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.