@@ -16,7 +16,7 @@ pip install leakix
1616``` python
1717import decouple
1818from leakix import Client
19- from leakix.query import MustQuery, MustNotQuery
19+ from leakix.query import MustQuery, MustNotQuery, RawQuery
2020from leakix.field import PluginField, CountryField
2121from leakix.plugin import Plugin
2222
@@ -27,7 +27,7 @@ CLIENT = Client(api_key=API_KEY)
2727
2828def example_get_host_filter_plugin ():
2929 response = CLIENT .get_host(ipv4 = " 33.33.33.33" )
30- assert ( response.status_code() == 200 )
30+ assert response.status_code() == 200
3131
3232
3333def example_get_service_filter_plugin ():
@@ -37,7 +37,7 @@ def example_get_service_filter_plugin():
3737 """
3838 query_http_ntlm = MustQuery(field = PluginField(Plugin.HttpNTLM))
3939 response = CLIENT .get_service(queries = [query_http_ntlm])
40- assert ( response.status_code() == 200 )
40+ assert response.status_code() == 200
4141 # check we only get NTML related services
4242 assert all ((i.tags == [" ntlm" ] for i in response.json()))
4343
@@ -46,7 +46,7 @@ def example_get_leaks_filter_multiple_plugins():
4646 query_http_ntlm = MustQuery(field = PluginField(Plugin.HttpNTLM))
4747 query_country = MustQuery(field = CountryField(" France" ))
4848 response = CLIENT .get_leak(queries = [query_http_ntlm, query_country])
49- assert ( response.status_code() == 200 )
49+ assert response.status_code() == 200
5050 assert all (
5151 (
5252 i.geoip.country_name == " France" and i.tags == [" ntlm" ]
@@ -59,11 +59,32 @@ def example_get_leaks_multiple_filter_plugins_must_not():
5959 query_http_ntlm = MustQuery(field = PluginField(Plugin.HttpNTLM))
6060 query_country = MustNotQuery(field = CountryField(" France" ))
6161 response = CLIENT .get_leak(queries = [query_http_ntlm, query_country])
62- assert ( response.status_code() == 200 )
62+ assert response.status_code() == 200
6363 assert all (
6464 (
6565 i.geoip.country_name != " France" and i.tags == [" ntlm" ]
6666 for i in response.json()
6767 )
6868 )
69+
70+
71+ def example_get_leak_raw_query ():
72+ raw_query = ' +plugin:HttpNTLM +country:"France"'
73+ query = RawQuery(raw_query)
74+ response = CLIENT .get_leak(queries = [query])
75+ assert response.status_code() == 200
76+ assert all (
77+ (
78+ i.geoip.country_name == " France" and i.tags == [" ntlm" ]
79+ for i in response.json()
80+ )
81+ )
82+
83+
84+ if __name__ == " __main__" :
85+ example_get_host_filter_plugin()
86+ example_get_service_filter_plugin()
87+ example_get_leaks_filter_multiple_plugins()
88+ example_get_leaks_multiple_filter_plugins_must_not()
89+ example_get_leak_raw_query()
6990```
0 commit comments