#readwise
# Redeemer Write-up

## Metadata
- Author: [[Hack The Box]]
- Full Title: Redeemer Write-up
- URL: https://readwise.io/reader/document_raw_content/280026617
## Summary
Databases store organized information for easy access and management. Redis is an in-memory database that offers fast data retrieval by using the server's RAM. It is often used to cache frequently requested data, improving response times for websites. The lab discusses how to connect to a Redis server, retrieve information, and interact with its key-value database using command-line tools.
## Highlights
There are different types of databases and one among them is Redis, which is an 'in-memory' database. In- memory databases are the ones that rely essentially on the primary memory for data storage (meaning that the database is managed in the RAM of the system); in contrast to databases that store data on the disk or SSDs. As the primary memory is significantly faster than the secondary memory, the data retrieval time in the case of 'in-memory' databases is very small, thus offering very efficient & minimal response times.
In-memory databases like Redis are typically used to cache data that is frequently requested for quick retrieval. For example, if there is a website that returns some prices on the front page of the site. The website may be written to first check if the needed prices are in Redis, and if not, then check the traditional database (like MySQL or MongoDB). When the value is loaded from the database, it is then stored in Redis for some shorter period of time (seconds or minutes or hours), to handle any similar requests that arrive during that timeframe. For a site with lots of traffic, this configuration allows for much faster retrieval for the majority of requests, while still having stable long term storage in the main database. ([View Highlight](https://read.readwise.io/read/01jnxxtknre12r251y5tgzb0fj)) ^lcabsz
---
Redis (REmote DIctionary Server) is an open-source advanced NoSQL key-value data store used as a database, cache, and message broker. The data is stored in a dictionary format having key-value pairs. It is typically used for short term storage of data that needs fast retrieval. Redis does backup data to hard drives to provide consistency. ([View Highlight](https://read.readwise.io/read/01jnxzdgnztngd8v16gt5jkt90)) ^t0rso8
---
to be able to interact remotely with the Redis server, we need to download the redis-cli utility. It can be downloaded using the following command :
```sh
sudo apt install redis-tools
```
Alternatively, we can also connect to the Redis server using the `netcat` utility, but we will be using `redis-cli` in this write-up as it is more convenient to use. ([View Highlight](https://read.readwise.io/read/01jnxzfznfkgnw81xtc4q3jfrc))
---
One of the basic Redis enumeration commands is `info` which returns information and statistics about the Redis server. ... The keyspace section provides statistics on the main dictionary of each database. The statistics include the number of keys, and the number of keys with an expiration. ^fg9gci
---
Let us select this Redis logical database by using the `select` command followed by the index number of the database that needs to be selected: `select 0` ([View Highlight](https://read.readwise.io/read/01jnxzj26d71ast7946jff2zz0))
---
Furthermore, we can list all the keys present in the database using the command `keys *` ([View Highlight](https://read.readwise.io/read/01jnxzj542g0yvhdtxnjxqx2yt))
---
Finally, we can view the values stored for a corresponding key using the get command followed by the keynote: `get <key>` ([View Highlight](https://read.readwise.io/read/01jnxzjbtkesy7njxkexzff83g))
---