Jump to content
Fi8sVrs

Redis Portscan Utility

Recommended Posts

  • Active Members

This python script port scans a host using a redis server.

#!/usr/bin/python

# Thu Feb 13 16:55:32 UTC 2014 <aramosf @ unsec.net>

#

# Scan a host using redis server.

# Using MIGRATE response:

# MIGRATE 127.0.0.1 21 a 1 1

#-IOERR error or timeout writing to target instance

#MIGRATE 127.0.0.1 22 a 1 1

#-IOERR error or timeout reading from target node

import socket

import sys

import string

if len(sys.argv) < 4:

print sys.argv[0] + " [redis IP] [redis PORT] [iP to scan]"

sys.exit()

try:

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

except socket.error:

print 'Failed'

sys.exit()

host = sys.argv[1];

port = int(sys.argv[2]);

toscan = sys.argv[3];

readbuffer=""

s.connect((host, port))

message = "set a1 1\r\n"

try :

s.sendall(message)

except socket.error:

print 'Failed'

sys.exit()

reply = s.recv(50)

for p in range(1, 65535):

message = "MIGRATE " + toscan + " " + str(p) + " a1 1 3000\r\n";

#print message

try :

s.sendall(message)

except socket.error:

print 'Failed'

sys.exit()

readbuffer=readbuffer+s.recv(1024)

temp=string.split(readbuffer, "\n")

readbuffer=temp.pop( )

for line in temp:

line=string.rstrip(line)

#print line

if not "writing" in line:

print str(p) + " open"

if "OK" in line:

message = "set a1 1\r\n"

#print message

s.sendall(message)

reply=s.recv(10)

s.close()

DEScrypt Ztex Bruteforcer ? Packet Storm

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...