Skip to content

Commit

Permalink
v1.2.31
Browse files Browse the repository at this point in the history
- First release is now available for Linux!
- Added improved exceptions
- Updated timeouts & added an extra command for disconnecting
  • Loading branch information
Hifumi committed May 23, 2022
1 parent 2beaada commit feb883e
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 72 deletions.
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@

RediSea is a Redis (in-memory database) communication framework used for viewing Redis keys, dumping Redis keys, dumping key information about the Redis server, real-time Redis database analysis, and much more!

Please note, this framework does work even if a Redis instance is not present, but if running a command that requires direct communication with the database (ex: viewing a key), you will be removed from the prompt. There is also an option for remotely connecting to a Redis instance, if you prefer to not have the framework on the target system.
Please note, this framework does work even if a Redis instance is not present. There is also an option for remotely connecting to a Redis instance, if you prefer to not have the framework on the target system.

## Installation
There is now have a Linux binary available! You can use the provided executable by running the following command (after downloading from our releases):
```bash
./redisea
```

## Installation (only required if installing from source)
You can run this command to install all the required tools for this framework:
```bash
$ pip3 install -r requirements.txt
pip3 install -r requirements.txt
```

## Usage
## Usage (only required if installing from source)
```bash
$ cd redisea
$ python3 main.py
python3 redisea/main.py
```
154 changes: 88 additions & 66 deletions redisea/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from prettytable import PrettyTable

r = redis.Redis()
version = '0.2.30'
author = 'Hifumi1337'
version = '1.2.31'

class RediSea:

Expand Down Expand Up @@ -71,77 +71,99 @@ def redis_comms(self):
whoami = getoutput("whoami")

print("Connecting...")
time.sleep(1)
time.sleep(0.5)

while True:

command = input(f"{whoami}@RediSea:~$ ")

if command == "h" or command == "help":
print("q, quit Quit program")
print("h, help Displays help menu")
print("k, key Search for a specific Redis key")
print("v, version Check version of Redis & RediSea")
print("c, clear Clears all data in the terminal")
print("d, dump Dump entire Redis database (keys)")
print("df, dumpf Dump entire Redis database (keys) into a file")
print("b, banner Displays our cool banner!")
print("i, info Return general information about the Redis instance")
print("r, remote Remotely connect to a Redis instance")
print("rt, realtime View Redis data update in real-time")
elif command == "q" or command == "quit":
print("Disconnecting...")
time.sleep(0.5)
sys.exit(0)
elif command == "v" or command == "version":
print("RediSea Version:", version)
print("Redis Version:", r.execute_command('INFO')['redis_version'])
elif command == "k" or command == "key":
key = input("Key: ")
key_output = r.mget(key)

print(f"Key: {key} \n Value: {key_output}")
elif command == "c" or command == "clear":
system_info = platform.system()

if system_info == 'Windows':
os.system("cls")
else:
os.system("clear")
elif command == "dump" or command == "d":
for key in r.scan_iter("*"):
print(key)
elif command == "df" or command == "dumpf":
with open('redis_dump.log', 'w') as f:
try:

command = input(f"{whoami}@RediSea:~$ ")

if command == "h" or command == "help":
print("q, quit Quit program")
print("h, help Displays help menu")
print("k, key Search for a specific Redis key")
print("v, version Check version of Redis & RediSea")
print("c, clear Clears all data in the terminal")
print("d, dump Dump entire Redis database (keys)")
print("df, dumpf Dump entire Redis database (keys) into a file")
print("b, banner Displays our cool banner!")
print("i, info Return general information about the Redis instance")
print("r, remote Remotely connect to a Redis instance")
print("rt, realtime View Redis data update in real-time")
elif command == "q" or command == "quit" or command == "exit":
print("Disconnecting...")
time.sleep(0.2)
sys.exit(0)
elif command == "v" or command == "version":
print("RediSea Version:", version)
print("Redis Version:", r.execute_command('INFO')['redis_version'])
elif command == "k" or command == "key":
key = input("Key: ")
key_output = r.mget(key)

print(f"Key: {key} \n Value: {key_output}")
elif command == "c" or command == "clear":
system_info = platform.system()

if system_info == 'Windows':
os.system("cls")
else:
os.system("clear")
elif command == "dump" or command == "d":
for key in r.scan_iter("*"):
f.write(str(key) + "\n")

print("Data successfully dumped!")
elif command == "b" or command == "banner":
RediSea().banner()
elif command == "i" or command == "info":
redis_data = r.execute_command('CLIENT LIST')
redis_data_str = str(redis_data)

print(redis_data_str)
elif command == "r" or command == "remote":
print("When remotely connecting to Redis, you will be removed from the RediSea shell!")
print(key)
elif command == "df" or command == "dumpf":
with open('redis_dump.log', 'w') as f:
for key in r.scan_iter("*"):
f.write(str(key) + "\n")
print("Data successfully dumped!")
elif command == "b" or command == "banner":
RediSea().banner()
elif command == "i" or command == "info":
redis_data = r.execute_command('CLIENT LIST')
redis_data_str = str(redis_data)

ip_address = input("IP Address: ")
port = input("Port: ")

confirm_choice = input("Are you sure you would like to continue (y/n)? ")

if confirm_choice == "y":
os.system(f"redis-cli -h {ip_address} -p {port}")
elif confirm_choice == "n":
print("Exiting...")
print(redis_data_str)
elif command == "r" or command == "remote":
print("When remotely connecting to Redis, you will be removed from the RediSea shell!")

ip_address = input("IP Address: ")
port = input("Port: ")

confirm_choice = input("Are you sure you would like to continue (y/n)? ")

if confirm_choice == "y":
os.system(f"redis-cli -h {ip_address} -p {port}")
elif confirm_choice == "n":
print("Exiting...")
else:
print("Please choose y/n")
elif command == "rt" or command == "realtime":
RediSea().real_time_render()
else:
print("Please choose y/n")
elif command == "rt" or command == "realtime":
RediSea().real_time_render()
else:
print("? Unrecognized Command ?")
print("Unrecognized Command\n")
print("Available commands:")
print("q, quit Quit program")
print("h, help Displays help menu")
print("k, key Search for a specific Redis key")
print("v, version Check version of Redis & RediSea")
print("c, clear Clears all data in the terminal")
print("d, dump Dump entire Redis database (keys)")
print("df, dumpf Dump entire Redis database (keys) into a file")
print("b, banner Displays our cool banner!")
print("i, info Return general information about the Redis instance")
print("r, remote Remotely connect to a Redis instance")
print("rt, realtime View Redis data update in real-time\n")

except KeyboardInterrupt:
print("\n\nThank you for using RediSea!\n")
print(f"Author: {author} (https://github.com/Hifumi1337)")
print(f"Version: {version}")
time.sleep(0.2)
sys.exit(0)


if __name__ == '__main__':
rs = RediSea()
Expand Down

0 comments on commit feb883e

Please sign in to comment.