Compare commits
2 Commits
e18859e78f
...
ee0e36b40d
| Author | SHA1 | Date | |
|---|---|---|---|
|
ee0e36b40d
|
|||
|
790073aa95
|
@@ -14,6 +14,7 @@ go get git.kor-elf.net/kor-elf-shield/blocklist
|
|||||||
- [Пример получения списка IP адресов от Tor](/examples/tor.go)
|
- [Пример получения списка IP адресов от Tor](/examples/tor.go)
|
||||||
- [Пример получения списка IP адресов от CIARMY](/examples/ciarmy.go)
|
- [Пример получения списка IP адресов от CIARMY](/examples/ciarmy.go)
|
||||||
- [Пример получения списка IP адресов от Daniel Gerzo (BruteforceBlocker)](/examples/bruteforceblocker.go)
|
- [Пример получения списка IP адресов от Daniel Gerzo (BruteforceBlocker)](/examples/bruteforceblocker.go)
|
||||||
|
- [Пример получения списка IP адресов от Blocklist.de](/examples/blocklist.go)
|
||||||
|
|
||||||
## Лицензия
|
## Лицензия
|
||||||
|
|
||||||
|
|||||||
50
examples/blocklist.go
Normal file
50
examples/blocklist.go
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"git.kor-elf.net/kor-elf-shield/blocklist"
|
||||||
|
"git.kor-elf.net/kor-elf-shield/blocklist/parser"
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An example of how to get a list of IP addresses from a service https://www.blocklist.de/en/export.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// Getting a list of IP addresses that were entered in the last hour
|
||||||
|
// time=seconds
|
||||||
|
url := "https://api.blocklist.de/getlast.php?time=3600"
|
||||||
|
extract := parser.NewDefaultTextExtract(0, "\t")
|
||||||
|
pars, err := parser.NewText(extract)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
// limit 0 - no limit
|
||||||
|
limit := uint(0)
|
||||||
|
config := blocklist.NewConfig(limit)
|
||||||
|
ips, err := blocklist.Get(url, pars, config)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
fmt.Println(ips)
|
||||||
|
|
||||||
|
/*
|
||||||
|
// This second list retrieves all the IP addresses added in the last 48 hours and is usually a
|
||||||
|
// very large list (over 10000 entries), so be sure that you have the resources available to use it
|
||||||
|
url := "http://lists.blocklist.de/lists/all.txt"
|
||||||
|
extract := parser.NewDefaultTextExtract(0, "\t")
|
||||||
|
pars, err := parser.NewText(extract)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
// limit 0 - no limit
|
||||||
|
limit := uint(0)
|
||||||
|
config := blocklist.NewConfig(limit)
|
||||||
|
ips, err := blocklist.Get(url, pars, config)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
fmt.Println(ips)
|
||||||
|
*/
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user