sqlmap/tamper/xforwardedfor.py

31 lines
720 B
Python
Raw Normal View History

2014-09-20 16:48:36 +04:00
#!/usr/bin/env python
"""
2018-01-02 02:48:10 +03:00
Copyright (c) 2006-2018 sqlmap developers (http://sqlmap.org/)
2017-10-11 15:50:46 +03:00
See the file 'LICENSE' for copying permission
2014-09-20 16:48:36 +04:00
"""
from lib.core.enums import PRIORITY
from random import sample
__priority__ = PRIORITY.NORMAL
def dependencies():
pass
def randomIP():
numbers = []
while not numbers or numbers[0] in (10, 172, 192):
numbers = sample(xrange(1, 255), 4)
return '.'.join(str(_) for _ in numbers)
def tamper(payload, **kwargs):
"""
2018-07-31 03:18:33 +03:00
Append a fake HTTP header 'X-Forwarded-For'
2014-09-20 16:48:36 +04:00
"""
headers = kwargs.get("headers", {})
headers["X-Forwarded-For"] = randomIP()
2018-09-13 11:50:58 +03:00
headers["X-Clinet-Ip"] = randomIP()
headers["X-Real-Ip"] = randomIP()
2014-09-20 16:48:36 +04:00
return payload