2019-03-21 16:00:09 +03:00
|
|
|
#!/usr/bin/env python2
|
2014-09-20 16:48:36 +04:00
|
|
|
|
|
|
|
"""
|
2019-01-05 23:38:52 +03:00
|
|
|
Copyright (c) 2006-2019 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
|
|
|
"""
|
|
|
|
|
2019-03-28 17:14:16 +03:00
|
|
|
import random
|
|
|
|
|
2014-09-20 16:48:36 +04:00
|
|
|
from lib.core.enums import PRIORITY
|
2019-03-28 17:14:16 +03:00
|
|
|
from lib.utils.xrange import xrange
|
|
|
|
|
2014-09-20 16:48:36 +04:00
|
|
|
__priority__ = PRIORITY.NORMAL
|
|
|
|
|
|
|
|
def dependencies():
|
|
|
|
pass
|
|
|
|
|
|
|
|
def randomIP():
|
|
|
|
numbers = []
|
2018-10-02 15:07:14 +03:00
|
|
|
|
2014-09-20 16:48:36 +04:00
|
|
|
while not numbers or numbers[0] in (10, 172, 192):
|
2019-03-28 17:14:16 +03:00
|
|
|
numbers = random.sample(xrange(1, 255), 4)
|
2018-10-02 15:07:14 +03:00
|
|
|
|
2014-09-20 16:48:36 +04:00
|
|
|
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-15 22:36:21 +03:00
|
|
|
headers["X-Client-Ip"] = randomIP()
|
2018-09-13 11:50:58 +03:00
|
|
|
headers["X-Real-Ip"] = randomIP()
|
2014-09-20 16:48:36 +04:00
|
|
|
return payload
|