Skip to content

Commit 9cc2bef

Browse files
authored
Merge pull request #12 from oh2fih/docs
Enhance documentation
2 parents 6dbf87b + b034e0d commit 9cc2bef

File tree

2 files changed

+26
-22
lines changed

2 files changed

+26
-22
lines changed

LICENSE

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
Copyright 2021 Alexandre Dulaunoy
1+
Copyright 2021-2024 Alexandre Dulaunoy
2+
Copyright 2021-2024 Esa Jokinen
23

34
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
45

README.md

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ Or by calling the Web server (After running `server.py`), example: `curl -s -X P
1818

1919
### Installation
2020

21-
- `git clone https://github.com/cve-search/cpe-guesser.git`
22-
- `cd cpe-guesser/bin`
23-
- Download the CPE dictionary & populate the database with `python3 ./import.py`.
24-
- Take a cup of black or green tea ().
25-
- `python3 cpe-guesser/bin/server.py` to run the local HTTP server.
21+
1. `git clone https://github.com/cve-search/cpe-guesser.git`
22+
2. `cd cpe-guesser`
23+
3. Download the CPE dictionary & populate the database with `python3 ./bin/import.py`.
24+
4. Take a cup of black or green tea ().
25+
5. `python3 ./bin/server.py` to run the local HTTP server.
2626

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

2929
### Docker
3030

@@ -55,9 +55,11 @@ If you do not want to use the Web server, `lookup.py` can still be used. Example
5555
[cpe-guesser.cve-search.org](https://cpe-guesser.cve-search.org) is public online version of CPE guesser which can be used via
5656
a simple API. The endpoint is `/search` and the JSON is composed of a query list with the list of keyword(s) to search for.
5757

58-
59-
~~~~
58+
```bash
6059
curl -s -X POST https://cpe-guesser.cve-search.org/search -d "{\"query\": [\"outlook\", \"connector\"]}" | jq .
60+
```
61+
62+
```json
6163
[
6264
[
6365
18117,
@@ -72,11 +74,11 @@ curl -s -X POST https://cpe-guesser.cve-search.org/search -d "{\"query\": [\"out
7274
"cpe:2.3:a:oracle:corporate_time_outlook_connector"
7375
]
7476
]
75-
~~~~
77+
```
7678

7779
### Command line - `lookup.py`
7880

79-
~~~~
81+
```text
8082
usage: lookup.py [-h] WORD [WORD ...]
8183
8284
Find potential CPE names from a list of keyword(s) and return a JSON of the results
@@ -86,11 +88,13 @@ positional arguments:
8688
8789
optional arguments:
8890
-h, --help show this help message and exit
89-
~~~~
90-
91+
```
9192

92-
~~~~
93+
```bash
9394
python3 lookup.py microsoft sql server | jq .
95+
```
96+
97+
```json
9498
[
9599
[
96100
51325,
@@ -129,41 +133,40 @@ python3 lookup.py microsoft sql server | jq .
129133
"cpe:2.3:a:ibm:tivoli_storage_manager_for_databases_data_protection_for_microsoft_sql_server"
130134
]
131135
]
132-
~~~~
136+
```
133137

134138
## How does this work?
135139

136140
A CPE entry is composed of a human readable name with some references and the structured CPE name.
137141

138-
~~~
142+
```xml
139143
<cpe-item name="cpe:/a:10web:form_maker:1.7.17::~~~wordpress~~">
140144
<title xml:lang="en-US">10web Form Maker 1.7.17 for WordPress</title>
141145
<references>
142146
<reference href="https://wordpress.org/plugins/form-maker/#developers">Change Log</reference>
143147
</references>
144148
<cpe-23:cpe23-item name="cpe:2.3:a:10web:form_maker:1.7.17:*:*:*:*:wordpress:*:*"/>
145149
</cpe-item>
146-
~~~
150+
```
147151

148152
The CPE name is structured with a vendor name, a product name and some additional information.
149153
CPE name can be easily changed due to vendor name or product name changes, some vendor/product are
150154
sharing common names or name is composed of multiple words.
151155

152-
153156
### Data
154157

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

159162
### Redis structure
160163

161164
- `w:<word>` set
162165
- `s:<word>` sorted set with a score depending of the number of appearance
163166

164-
# License
167+
## License
165168

166169
Software is open source and released under a 2-Clause BSD License
167170

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

0 commit comments

Comments
 (0)