Skip to content

Commit 402ef4d

Browse files
default client passwd to None
1 parent 200df96 commit 402ef4d

7 files changed

Lines changed: 19 additions & 18 deletions

File tree

src/ipr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -978,8 +978,8 @@ def populate_id_table(self) -> None:
978978
def get_target_data_from_type(self) -> Dict[str, str]:
979979
ip = self.result["ip"]
980980
type = self.result["type"]
981-
client_auth = ""
982-
custom_auth = ""
981+
client_auth = None
982+
custom_auth = None
983983
match type:
984984
case "antminer":
985985
client_auth = self.lineBitmainPasswd.text()

src/mod/api/client.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,65 +43,65 @@ def get_client(self):
4343
return self.client
4444

4545
def create_bitmain_client(
46-
self, ip_addr: str, passwd: str, vnish_passwd: str
46+
self, ip_addr: str, passwd: Optional[str] = None, vnish_passwd: Optional[str] = None
4747
) -> None:
4848
try:
4949
self.client = BitmainHTTPClient(ip_addr, passwd, vnish_passwd)
5050
except (FailedConnectionError, AuthenticationError) as err:
5151
logger.error(err)
5252

5353
def create_iceriver_client(
54-
self, ip_addr: str, passwd: Optional[str], pb_key: str
54+
self, ip_addr: str, passwd: Optional[str] = None, pb_key: Optional[str] = None
5555
) -> None:
5656
try:
5757
self.client = IceriverHTTPClient(ip_addr, passwd, pb_key)
5858
except FailedConnectionError as err:
5959
logger.error(err)
6060

61-
def create_whatsminer_client(self, ip_addr: str, passwd: str) -> None:
61+
def create_whatsminer_client(self, ip_addr: str, passwd: Optional[str] = None) -> None:
6262
try:
6363
self.client = WhatsminerRPCClient(ip_addr, passwd)
6464
except FailedConnectionError as err:
6565
logger.error(err)
6666

67-
def create_whatsminerv3_client(self, ip_addr: str, user: Optional[str], passwd: Optional[str]) -> None:
67+
def create_whatsminerv3_client(self, ip_addr: str, user: Optional[str] = None, passwd: Optional[str] = None) -> None:
6868
try:
6969
self.client = WhatsminerV3Client(ip_addr, user, passwd)
7070
except FailedConnectionError as err:
7171
logger.error(err)
7272

73-
def create_volcminer_client(self, ip_addr: str, passwd: str) -> None:
73+
def create_volcminer_client(self, ip_addr: str, passwd: Optional[str] = None) -> None:
7474
try:
7575
self.client = VolcminerHTTPClient(ip_addr, passwd)
7676
except (FailedConnectionError, AuthenticationError) as err:
7777
logger.error(err)
7878

79-
def create_goldshell_client(self, ip_addr: str, passwd: str) -> None:
79+
def create_goldshell_client(self, ip_addr: str, passwd: Optional[str] = None) -> None:
8080
try:
8181
self.client = GoldshellHTTPClient(ip_addr, passwd)
8282
except (FailedConnectionError, AuthenticationError) as err:
8383
logger.error(err)
8484

85-
def create_sealminer_client(self, ip_addr: str, passwd: str) -> None:
85+
def create_sealminer_client(self, ip_addr: str, passwd: Optional[str] = None) -> None:
8686
try:
8787
self.client = SealminerHTTPClient(ip_addr, passwd)
8888
except (FailedConnectionError, AuthenticationError) as err:
8989
logger.error(err)
9090

91-
def create_elphapex_client(self, ip_addr: str, passwd: Optional[str]) -> None:
91+
def create_elphapex_client(self, ip_addr: str, passwd: Optional[str] = None) -> None:
9292
try:
9393
self.client = ElphapexHTTPClient(ip_addr, passwd)
9494
except (FailedConnectionError, AuthenticationError) as err:
9595
logger.error(err)
9696

97-
def create_dragonball_client(self, ip_addr: str, passwd: Optional[str]) -> None:
97+
def create_dragonball_client(self, ip_addr: str, passwd: Optional[str] = None) -> None:
9898
try:
9999
self.client = DragonballHTTPClient(ip_addr, passwd)
100100
except (FailedConnectionError, AuthenticationError) as err:
101101
logger.error(err)
102102

103103
def create_client_from_type(
104-
self, miner_type: str, ip_addr: str, auth: str, custom_auth: str
104+
self, miner_type: str, ip_addr: str, auth: Optional[str] = None, custom_auth: Optional[str] = None
105105
) -> None:
106106
match miner_type:
107107
case "antminer":

src/mod/api/miners/bitmain/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
class BitmainHTTPClient(BaseHTTPClient):
1616
"""Bitmain/Antminer HTTP Client with support for vnish"""
1717

18-
def __init__(self, ip_addr: str, passwd: str, vnish_passwd: str):
18+
def __init__(self, ip_addr: str, passwd: Optional[str], vnish_passwd: Optional[str]):
1919
super().__init__(ip_addr)
2020
self.url = f"http://{self.ip}:{self.port}/"
2121
self.username = "root"

src/mod/api/miners/goldshell/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
class GoldshellHTTPClient(BaseHTTPClient):
1515
"""Goldshell HTTP Client"""
1616

17-
def __init__(self, ip_addr: str, passwd: str):
17+
def __init__(self, ip_addr: str, passwd: Optional[str]):
1818
super().__init__(ip_addr)
1919
self.url = f"http://{self.ip}:{self.port}/"
2020
self.username = "admin"
@@ -110,5 +110,5 @@ def encrypt_to_hex(plain: str) -> str:
110110
AES.MODE_CBC,
111111
iv=bytes([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
112112
)
113-
b = zero_pad(plain.encode("UTF-8"), 16)
113+
b = zero_pad(plain.encode(), 16)
114114
return cipher.encrypt(b).hex()

src/mod/api/miners/sealminer/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class SealminerHTTPClient(BaseHTTPClient):
1212
"""Bitdeer/Sealminer HTTP Client"""
1313

14-
def __init__(self, ip_addr: str, passwd: str):
14+
def __init__(self, ip_addr: str, passwd: Optional[str]):
1515
super().__init__(ip_addr)
1616
self.url = f"http://{self.ip}:{self.port}/"
1717
self.username = "seal"

src/mod/api/miners/volcminer/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
class VolcminerHTTPClient(BaseHTTPClient):
1313
"""Volcminer HTTP Client"""
1414

15-
def __init__(self, ip_addr: str, passwd: str):
15+
def __init__(self, ip_addr: str, passwd: Optional[str]):
1616
super().__init__(ip_addr)
1717
self.url = f"http://{self.ip}:{self.port}/"
1818
self.username = "root"

src/mod/api/miners/whatsminer/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from Crypto.Cipher import AES
1111
from passlib.hash import md5_crypt
12+
from scapy.arch.solaris import Optional
1213

1314
from mod.api import settings
1415
from mod.api.rpc import BaseRPCClient
@@ -67,7 +68,7 @@ def parse_privileged_data(token: Dict[str, Any], data: dict) -> dict:
6768
class WhatsminerRPCClient(BaseRPCClient):
6869
"""Whatsminer JSON-RPC API V2 client"""
6970

70-
def __init__(self, ip_addr: str, passwd: str):
71+
def __init__(self, ip_addr: str, passwd: Optional[str]):
7172
super().__init__(ip_addr)
7273
self.passwds: List[str] = [passwd, settings.get("default_whatsminer_passwd")]
7374
self.token = None

0 commit comments

Comments
 (0)