Skip to content

Instantly share code, notes, and snippets.

@Ehsan-Nezami
Last active November 11, 2018 11:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ehsan-Nezami/0c2ba0bd3cece848e8fda7fd8131df32 to your computer and use it in GitHub Desktop.
Save Ehsan-Nezami/0c2ba0bd3cece848e8fda7fd8131df32 to your computer and use it in GitHub Desktop.
Random Session (Sqlmap Tamper)
#!/usr/bin/env python
"""
Copyright (c) 2006-2018 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
author: 3H34N(nezami.me)
"""
import string
import random
from lib.core.enums import PRIORITY
__priority__ = PRIORITY.NORMAL
def dependencies():
pass
def randomsession():
length = 32
chars = string.ascii_letters.lower() + string.digits
password = ''.join(random.choice(chars) for i in range(length))
return "PHPSESSID="+password
def tamper(payload, **kwargs):
"""
Append a random session HTTP header 'PHPSESSID' to bypass
WAF (usually application based) protection
"""
headers = kwargs.get("headers", {})
headers["Cookie"] = randomsession()
return payload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment