Skip to content

Commit

Permalink
modify code to be in adequation with pep8/pycodestyle.
Browse files Browse the repository at this point in the history
  • Loading branch information
sigalpes committed May 17, 2018
1 parent c987c97 commit 2f5924f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions analyzers/UnshortenLink/unshortenlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
import requests
from cortexutils.analyzer import Analyzer

class UnshortenlinkAnalyzer(Analyzer):

class UnshortenlinkAnalyzer(Analyzer):
def __init__(self):
Analyzer.__init__(self)
self.url = self.getParam('url', None)
self.proxies = self.getParam('config.proxy', None)

def artifacts(self, raw):
if raw['found'] == True:
if raw['found']:
return [{'type': 'url', 'value': raw['url']}]
else:
return []
Expand All @@ -29,8 +29,9 @@ def run(self):

result = {'found': False, 'url': None}
try:
response = requests.get(url, proxies=proxies, allow_redirects=False)

response = requests.get(url, proxies=proxies,
allow_redirects=False)

if (response.status_code == 301) or (response.status_code == 302):
result['url'] = response.headers['Location']
result['found'] = True
Expand All @@ -39,5 +40,6 @@ def run(self):

self.report(result)


if __name__ == '__main__':
UnshortenlinkAnalyzer().run()

0 comments on commit 2f5924f

Please sign in to comment.