diff --git a/pybotnet/package_info.py b/pybotnet/package_info.py index 9303293..0b9c89e 100644 --- a/pybotnet/package_info.py +++ b/pybotnet/package_info.py @@ -1,2 +1,2 @@ -__version__ = "2.2.4" +__version__ = "2.2.5" __github_link__ = "https://github.com/onionj/pybotnet" diff --git a/pybotnet/utils/utils.py b/pybotnet/utils/utils.py index c619648..6888d05 100644 --- a/pybotnet/utils/utils.py +++ b/pybotnet/utils/utils.py @@ -6,12 +6,24 @@ # Servers to get your public IP +def _get_my_ip_server_0(): + """return global ip V4 and contry code \n + server 1""" + takeip = requests.post("http://yourip.top/json", timeout=3).text + json_res = json.loads(takeip) + ip = str(json_res["ip"]) + country = str(json_res["country"]) + ipaddr = f"{ip}\ncountry_code: {country}" + return ipaddr + + def _get_my_ip_server_1(): """return global ip V4 and loaction \n server 1""" takeip = requests.post("https://api.myip.com", timeout=2).text - ip = str(json.loads(takeip)["ip"]) - country = str(json.loads(takeip)["country"]) + json_res = json.loads(takeip) + ip = str(json_res["ip"]) + country = str(json_res["country"]) ipaddr = f"{ip}\ncountry: {country}" return ipaddr @@ -29,12 +41,20 @@ def _get_my_ip_server_3(): def get_global_ip() -> str: - """return system ip (3 API server)""" - for server in [_get_my_ip_server_1, _get_my_ip_server_2, _get_my_ip_server_3]: + """return system ip (4 API server)""" + for server in [ + _get_my_ip_server_0, + _get_my_ip_server_1, + _get_my_ip_server_2, + _get_my_ip_server_3, + ]: try: return server() except: - return None + pass + + return None + def get_host_name_ip() -> dict: try: @@ -42,6 +62,7 @@ def get_host_name_ip() -> dict: s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.connect(("4.2.2.4", 80)) host_ip = s.getsockname()[0] + s.close() return {"host_ip": host_ip, "host_name": host_name} - except: + except Exception: return {"host_ip": None, "host_name": None} diff --git a/setup.py b/setup.py index a5b26ce..a8197f2 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,6 @@ KEYWORDS = [ "onionj pybotnet", "python remote control", - "python trojan", "python backdoor", "python botnet", "pybotnet",