Skip to content

Commit facc75d

Browse files
committed
chg: [valkey] get rid of Redis and moved to Valkey
1 parent 9cc2bef commit facc75d

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ be used against [cve-search](https://github.com/cve-search/cve-search) to do act
55

66
## Requirements
77

8-
- Redis
8+
- [Valkey](https://valkey.io/)
99
- Python
1010

1111
## Usage
1212

13-
To use CPE guesser, you have to initialise the Redis database with `import.py`.
13+
To use CPE guesser, you have to initialise the [Valkey](https://valkey.io/) database with `import.py`.
1414

1515
Then you can use the software with `lookup.py` to find the most probable CPE matching the keywords provided.
1616

@@ -28,7 +28,7 @@ If you don't want to install it locally, there is a public online version. Check
2828

2929
### Docker
3030

31-
#### Single image with existing Redis
31+
#### Single image with existing Valkey
3232

3333
```bash
3434
docker build . -t cpe-guesser:l.0
@@ -157,9 +157,9 @@ sharing common names or name is composed of multiple words.
157157

158158
Split vendor name and product name (such as `_`) into single word(s) and then canonize the word. Building an inverse index using
159159
the cpe vendor:product format as value and the canonized word as key. Then cpe guesser creates a ranked set with the most common
160-
cpe (vendor:product) per version to give a probability of the CPE appearance.
160+
cpe (vendor:product) per version to give a probability of the CPE appearance.
161161

162-
### Redis structure
162+
### Valkey structure
163163

164164
- `w:<word>` set
165165
- `s:<word>` sorted set with a score depending of the number of appearance
@@ -168,5 +168,5 @@ cpe (vendor:product) per version to give a probability of the CPE appearance.
168168

169169
Software is open source and released under a 2-Clause BSD License
170170

171-
Copyright (C) 2021-2024 Alexandre Dulaunoy
172-
Copyright (C) 2021-2024 Esa Jokinen
171+
Copyright (C) 2021-2024 Alexandre Dulaunoy
172+
Copyright (C) 2021-2024 Esa Jokinen

REQUIREMENTS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
redis
1+
valkey[libvalkey]
22
falcon
33
dynaconf

bin/import.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
import gzip
99
import shutil
1010
import xml.sax
11-
import redis
11+
import valkey
1212
import time
1313
from dynaconf import Dynaconf
1414

1515
# Configuration
1616
settings = Dynaconf(settings_files=["../config/settings.yaml"])
1717
cpe_path = settings.cpe.path
1818
cpe_source = settings.cpe.source
19-
rdb = redis.Redis(host=settings.redis.host, port=settings.redis.port, db=8)
19+
rdb = valkey.Valkey(host=settings.valkey.host, port=settings.valkey.port, db=8)
2020

2121

2222
class CPEHandler(xml.sax.ContentHandler):

config/settings.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
server:
22
port: 8000
3-
redis:
3+
valkey:
44
host: 127.0.0.1
55
port: 6379
66
cpe:
77
path: '../data/official-cpe-dictionary_v2.3.xml'
8-
source: 'https://nvd.nist.gov/feeds/xml/cpe/dictionary/official-cpe-dictionary_v2.3.xml.gz'
8+
source: 'https://nvd.nist.gov/feeds/xml/cpe/dictionary/official-cpe-dictionary_v2.3.xml.gz'

lib/cpeguesser.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

4-
import redis
4+
import valkey
55
from dynaconf import Dynaconf
66

77
# Configuration
@@ -10,9 +10,9 @@
1010

1111
class CPEGuesser:
1212
def __init__(self):
13-
self.rdb = redis.Redis(
14-
host=settings.redis.host,
15-
port=settings.redis.port,
13+
self.rdb = valkey.Valkey(
14+
host=settings.valkey.host,
15+
port=settings.valkey.port,
1616
db=8,
1717
decode_responses=True,
1818
)
@@ -35,4 +35,4 @@ def guessCpe(self, words):
3535
rank = self.rdb.zrank("rank:cpe", cpe)
3636
ranked.append((rank, cpe))
3737

38-
return sorted(ranked)
38+
return sorted(ranked, reverse=True)

0 commit comments

Comments
 (0)