Skip to content

Commit

Permalink
πŸ•Š
Browse files Browse the repository at this point in the history
πŸ•Š
  • Loading branch information
keyiflerolsun committed Aug 7, 2024
1 parent 0d318bc commit 34053b8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
12 changes: 11 additions & 1 deletion KeeneticPy/BGPTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,14 @@ def asn2cidr(asn:str|int) -> dict:
}

def domain2ip(domain:str) -> dict:
return Domain2IP(domain).bilgi
return Domain2IP(domain).bilgi

def ip2asname(ip:str) -> str:
oturum = Client()
istek = oturum.get(f"https://bgp.tools/search?q={ip}", follow_redirects=True)
if istek.status_code != 200:
return ""

secici = Selector(istek.text)

return secici.css("p#network-number strong")[-1].css("::text").get()
6 changes: 3 additions & 3 deletions KeeneticPy/Keenetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ def backup(self, maks_backup=5) -> str:
return zip_dosyasi

def get_static_routes(self) -> list[dict[str, str]]:
return self.__oturum.get(
return self.__oturum.post(
url = f"{self.__rci}",
json = {"show":{"ip":{"route":{}}}}
).json().get("ip", {}).get("route", [])
json = [{"show":{"rc":{"ip":{"route":{}}}}}]
).json()[0].get("show", {}).get("rc", {}).get("ip", {}).get("route", [])

def add_static_route(self, comment:str, host:str=None, network:str=None, mask:str=None, interface:str="Wireguard2") -> bool:
payload = None
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
setup(
# ? Genel Bilgiler
name = "KeeneticPy",
version = "1.4",
version = "1.5",
url = "https://github.com/keyiflerolsun/KeeneticPy",
description = "Python Lib for Keenetic Routers",
keywords = ["KeeneticPy", "KekikAkademi", "keyiflerolsun"],
Expand Down

0 comments on commit 34053b8

Please sign in to comment.