2019-05-08 13:47:52 +03:00
|
|
|
#!/usr/bin/env python
|
2014-09-20 16:48:36 +04:00
|
|
|
|
|
|
|
"""
|
2024-01-04 01:11:52 +03:00
|
|
|
Copyright (c) 2006-2024 sqlmap developers (https://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
|
|
|
|
|
2019-03-28 18:04:38 +03:00
|
|
|
from lib.core.compat import xrange
|
2014-09-20 16:48:36 +04:00
|
|
|
from lib.core.enums import PRIORITY
|
2019-03-28 17:14:16 +03:00
|
|
|
|
2014-09-20 16:48:36 +04:00
|
|
|
__priority__ = PRIORITY.NORMAL
|
|
|
|
|
|
|
|
def dependencies():
|
|
|
|
pass
|
|
|
|
|
|
|
|
def randomIP():
|
2019-09-26 11:36:47 +03:00
|
|
|
octets = []
|
2018-10-02 15:07:14 +03:00
|
|
|
|
2019-09-26 11:36:47 +03:00
|
|
|
while not octets or octets[0] in (10, 172, 192):
|
|
|
|
octets = random.sample(xrange(1, 255), 4)
|
2018-10-02 15:07:14 +03:00
|
|
|
|
2019-09-26 11:36:47 +03:00
|
|
|
return '.'.join(str(_) for _ in octets)
|
2014-09-20 16:48:36 +04:00
|
|
|
|
|
|
|
def tamper(payload, **kwargs):
|
|
|
|
"""
|
2019-09-26 11:36:47 +03:00
|
|
|
Append a fake HTTP header 'X-Forwarded-For' (and alike)
|
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()
|
2019-09-26 11:36:47 +03:00
|
|
|
headers["CF-Connecting-IP"] = randomIP()
|
|
|
|
headers["True-Client-IP"] = randomIP()
|
|
|
|
|
|
|
|
# Reference: https://developer.chrome.com/multidevice/data-compression-for-isps#proxy-connection
|
|
|
|
headers["Via"] = "1.1 Chrome-Compression-Proxy"
|
|
|
|
|
|
|
|
# Reference: https://wordpress.org/support/topic/blocked-country-gaining-access-via-cloudflare/#post-9812007
|
|
|
|
headers["CF-IPCountry"] = random.sample(('GB', 'US', 'FR', 'AU', 'CA', 'NZ', 'BE', 'DK', 'FI', 'IE', 'AT', 'IT', 'LU', 'NL', 'NO', 'PT', 'SE', 'ES', 'CH'), 1)[0]
|
|
|
|
|
2014-09-20 16:48:36 +04:00
|
|
|
return payload
|