Skip to content

Commit

Permalink
Increase branch conditions and reduce memory usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Becivells committed Nov 22, 2019
1 parent c54e7b9 commit 3edc2df
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions pocsuite3/lib/core/option.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,21 @@ def _set_http_user_agent():
'''

conf.http_headers[HTTP_HEADER.USER_AGENT] = DEFAULT_USER_AGENT
uapath = os.path.join(paths.POCSUITE_DATA_PATH, 'user-agents.txt')

if os.path.exists(uapath):
with open(uapath) as f:
agents = f.read().split("\n")
if len(agents) == 1 and "" in agents:
logger.error("user-agents file is empty will use default")
else:
conf.agents = agents
else:
logger.error("user-agents file not fond will use default")
if conf.random_agent:
uapath = os.path.join(paths.POCSUITE_DATA_PATH, 'user-agents.txt')
if os.path.exists(uapath):
with open(uapath) as f:
agents = f.read().split("\n")
if len(agents) == 1 and "" in agents:
logger.error("user-agents file is empty will use default")
else:
conf.agents = agents
else:
logger.error("user-agents file not fond will use default")

if conf.agent:
conf.http_headers[HTTP_HEADER.USER_AGENT] = conf.agent
if conf.agent:
conf.http_headers[HTTP_HEADER.USER_AGENT] = conf.agent


def _set_http_referer():
Expand Down

0 comments on commit 3edc2df

Please sign in to comment.