Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Python - SQLMAP - Tamper Script for Custom Caesar Cypher
#!/usr/bin/env python
from lib.core.data import kb
from lib.core.enums import PRIORITY
import string
__priority__ = PRIORITY.NORMAL
def dependencies():
pass
def tamper(payload, **kwargs):
orig = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
srvr = "QqnPvka03wMU6ZybjmK4BRSEWdVishgClpI1AouFNOJ9zrtL2Yef7Tc8GxDHX5"
return payload.translate(string.maketrans(orig,srvr))
@amir992710

This comment has been minimized.

Copy link

@amir992710 amir992710 commented Nov 10, 2019

import PRIORITY

ImportError: No module named PRIORITY

__priority__ = PRIORITY.NORMAL

NameError: name 'PRIORITY' is not defined

it has actually a lot of errors.

@amir992710

This comment has been minimized.

Copy link

@amir992710 amir992710 commented Nov 10, 2019

but good point of view ;)

@MarkBaggett

This comment has been minimized.

Copy link
Owner Author

@MarkBaggett MarkBaggett commented Nov 25, 2019

@mrgfy

This comment has been minimized.

Copy link

@mrgfy mrgfy commented May 31, 2020

got it working without errors.

#!/usr/bin/env python

from lib.core.data import kb
from lib.core.enums import PRIORITY
import string

__priority__ = PRIORITY.NORMAL

def dependencies():
    pass

def tamper(payload, **kwargs):
    orig = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
    srvr = "QqnPvka03wMU6ZybjmK4BRSEWdVishgClpI1AouFNOJ9zrtL2Yef7Tc8GxDHX5"
    return payload.translate(payload.maketrans(orig,srvr))
@mrgfy

This comment has been minimized.

Copy link

@mrgfy mrgfy commented May 31, 2020

remove:

  • (string.maketrans(orig,srvr))

replace with:

  • (payload.maketrans(orig,srvr))
@MarkBaggett

This comment has been minimized.

Copy link
Owner Author

@MarkBaggett MarkBaggett commented May 31, 2020

Thanks.
The original code was written when sqlmap was running in python 2.5 or 2.6. They changed the way the translate method works in python 2.7 and 3.

payload.maketrans should now be str.maketrans although using payload will work.

I’ll update the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.