Source code for pytw.exploit

import json
import copy

from . import constants as Constants

[docs]class Exploit(object): """ Exploit object Consists of {source, URL} fields """ def __init__(self, exploit_json): self.__exploit_json = exploit_json self.__source = self.__exploit_json[Constants.VULN_EXPLOIT_SOURCE] self.__url = self.__exploit_json[Constants.VULN_EXPLOIT_URL]
[docs] def get_source(self): """ :Returns the source of the exploit """ return self.__source
[docs] def get_url(self): """ :Returns the URL for the exploit """ return self.__url
[docs] def to_json(self): """ :Returns JSON representation of the object """ return copy.deepcopy(self.__exploit_json)
def __str__(self): return json.dumps(self.__exploit_json) def __repr__(self): return json.dumps(self.__exploit_json)
def json2exploits(exploits_json): exploits = [] for e in exploits_json: exploits.append(Exploit(e)) return exploits