Skip to content

Commit

Permalink
v1.2.32
Browse files Browse the repository at this point in the history
- Uploaded to PyPi
- Added some extra error handling for Redis connection errors
  • Loading branch information
battleoverflow committed Dec 19, 2022
1 parent 7f2889c commit 0c661f2
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 26 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@

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. 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.

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

NOTE: Some distributions may require you to give the binary executable permissions. You can do this by running the following command:
Once RediSea is installed, you can run it like any other executable:
```bash
chmod +x redisea-linux
redisea
```

## Installation (only required if installing from source)
After running RediSea, it'll boot up the application in an open prompt.

## Usage (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
```

## Usage (only required if installing from source)
```bash
python3 redisea/main.py
```
5 changes: 5 additions & 0 deletions redisea/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""
Owner: Hifumi1337 (https://github.com/hifumi1337)
Project: RediSea
License: MIT
"""
64 changes: 46 additions & 18 deletions redisea/main.py → redisea/redisea.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
# -*- coding: utf-8 -*-

"""
Owner: Hifumi1337 (https://github.com/hifumi1337)
Project: RediSea
License: MIT
"""

import redis, time, sys, os, platform, argparse

from subprocess import getoutput
from prettytable import PrettyTable

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

class RediSea:

Expand All @@ -22,7 +28,7 @@ def banner(self):
{0} | v{1}
Traverse a Redis database instance in a much simpler way by using our open prompt!
Traverse a Redis database instance in a much easier way by using our open prompt!
Start by typing "h" in the prompt below
Expand Down Expand Up @@ -97,12 +103,19 @@ def redis_comms(self):
sys.exit(0)
elif command == "v" or command == "version":
print("RediSea Version:", version)
print("Redis Version:", r.execute_command('INFO')['redis_version'])
try:
print("Redis Version:", r.execute_command('INFO')['redis_version'])
except redis.exceptions.ConnectionError:
print("Unable to connect to the Redis server")
elif command == "k" or command == "key":
key = input("Key: ")
key_output = r.mget(key)

try:
key_output = r.mget(key)
print(f"Key: {key} \nValue: {key_output}")
except redis.exceptions.ConnectionError:
print("Unable to connect to the Redis server")

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

Expand All @@ -111,21 +124,31 @@ def redis_comms(self):
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:
for key in r.scan_iter("*"):
f.write(str(key) + "\n")
print(key)
except redis.exceptions.ConnectionError:
print("Unable to connect to the Redis server")
elif command == "df" or command == "dumpf":
try:
with open('redis_dump.log', 'w') as f:
for key in r.scan_iter("*"):
f.write(str(key) + "\n")

print("Data successfully dumped!")
except redis.exceptions.ConnectionError:
print("Unable to connect to the Redis server")

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)
try:
redis_data = r.execute_command('CLIENT LIST')
redis_data_str = str(redis_data)
print(redis_data_str)
except redis.exceptions.ConnectionError:
print("Unable to connect to the Redis server")

print(redis_data_str)
elif command == "r" or command == "remote":
print("When remotely connecting to Redis, you will be removed from the RediSea shell!")

Expand All @@ -141,7 +164,10 @@ def redis_comms(self):
else:
print("Please choose y/n")
elif command == "rt" or command == "realtime":
RediSea().real_time_render()
try:
RediSea().real_time_render()
except redis.exceptions.ConnectionError:
print("Unable to connect to the Redis server")
else:
print("Unrecognized Command\n")
print("Available commands:")
Expand All @@ -164,8 +190,10 @@ def redis_comms(self):
time.sleep(0.2)
sys.exit(0)

def main():
rs = RediSea()
rs.banner()
rs.redis_comms()

if __name__ == '__main__':
rs = RediSea()
rs.banner()
rs.redis_comms()
RediSea.main()
38 changes: 38 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""
Owner: Hifumi1337 (https://github.com/hifumi1337)
Project: RediSea
License: MIT
"""

import setuptools

with open("README.md", "r", encoding = "utf-8") as fh:
long_description = fh.read()

setuptools.setup(
name = "redisea",
version = "1.2.32",
author = "Hifumi1337",
description = "RediSea is a Redis (in-memory database) communication framework used for dumping key/value information within the Redis server, real-time Redis database analysis, and much more.",
long_description = long_description,
long_description_content_type = "text/markdown",
url = "https://github.com/hifumi1337/RediSea",
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
packages = [
"redisea"
],
install_requires=[
"argparse",
"redis",
"prettytable"
],
scripts=["redisea/redisea.py"],
entry_points={
'console_scripts': ["redisea=redisea.redisea:RediSea.main"]
},
python_requires = ">=3.6"
)

0 comments on commit 0c661f2

Please sign in to comment.