def __init__(self, channel, nickname, server, port, password=None, username=None, **kwargs): if not username: username = nickname irc.bot.SingleServerIRCBot.__init__(self, [(server, port)], nickname, username, **kwargs) self.channel = channel self.api = API()
setdefaultencoding('utf8') else: raw_input = input rankinglookup = True helpmessage = "last [<n>] - last n cve entries (default: 10) (output: JSON)\n" helpmessage += "get <cve-id> - get cve info (output: JSON)\n" helpmessage += "browse - list of vendors (output: JSON)\n" helpmessage += "browse <vendor> - list of products of vendor (output: JSON)\n" helpmessage += "search <vendor> <product> - list of cves for product (output: JSON)\n" helpmessage += "cvetweet <n> - summary of <n> last cve entries (output: Text)\n" helpmessage += "cvetweet <cve-id> - summary of cve <cve-id> (output: Text) \n\n" helpmessage += "For more info about cve-search: http://adulau.github.com/cve-search/" api = API() def cvesearch(query="last", option=None): def last(option): try: limit = int(option) if option else 10 except: return "Please specify the number of CVEs" if limit > opts.max or limit < 1: return "Request not in range 0-%d" % opts.max return api.api_last(limit) def cve(option): if option is None:
def __init__(self, api=None): self.apiurl = api if not api: self.api = API()