开发者

urllib2.HTTPError: HTTP Error 500: Internal Server Error

开发者 https://www.devze.com 2023-02-25 11:09 出处:网络
if data.find(\'!exploits\') != -1: nick = data.split(\'!\')[ 0 ].replace(\':\',\'\') results = api.exploitdb.search(arg)
  if data.find('!exploits') != -1:
     nick = data.split('!')[ 0 ].replace(':','')
     results = api.exploitdb.search(arg)
     sck.send('PRIVMSG ' + chan + " :" + ' Results found: %s' % results['total'] + '\r\n')
     for exploit in results['matches'][:5]:
              sck.send('PRIVMSG ' + chan + "" + '%s:' % (exploi开发者_开发技巧t['description'] + '\r\n')) 

This little script searches exploit-db for known exploits, but the script seems not to work when I try to use it within IRC, but its fine when I run it alone,

by alone I mean just this:

from shodan import WebAPI

SHODAN_API_KEY = "MY API KEY"
api = WebAPI(SHODAN_API_KEY)

results = api.exploitdb.search('PHP')

print 'Results found: %s' % results['total']
for exploit in results['matches'][:5]:
        print '%s:' % (exploit['description'])

that one works perfect, but I want to use it with IRC

but I get this error:

Traceback (most recent call last):
  File "C:\Users\Rabia\Documents\scripts\client.py", line 232, in <module>
    results = api.exploitdb.search(arg)
  File "C:\Python26\lib\site-packages\shodan\api.py", line 63, in search
    return self.parent._request('exploitdb/search', dict(q=query, **kwargs))
  File "C:\Python26\lib\site-packages\shodan\api.py", line 116, in _request
    data = urlopen(self.base_url + function + '?' + urlencode(params)).read()
  File "C:\Python26\lib\urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "C:\Python26\lib\urllib2.py", line 397, in open
    response = meth(req, response)
  File "C:\Python26\lib\urllib2.py", line 510, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Python26\lib\urllib2.py", line 435, in error
    return self._call_chain(*args)
  File "C:\Python26\lib\urllib2.py", line 369, in _call_chain
    result = func(*args)
  File "C:\Python26\lib\urllib2.py", line 518, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 500: Internal Server Error


Your code should be ok.

That's should be the server problem . Internal Error--the server could not fulfill the request because of an unexpected condition

You can check the return status of what its meaning.

0

精彩评论

暂无评论...
验证码 换一张
取 消