refactor: remove and fix some hardcoded passwords.
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
from typing import List, Optional
|
||||
|
||||
from pyasic import settings
|
||||
from pyasic.data import HashBoard
|
||||
from pyasic.miners.backends import BMMiner
|
||||
from pyasic.miners.base import DataFunction, DataLocations, DataOptions, RPCAPICommand
|
||||
@@ -64,7 +65,7 @@ HIVEON_DATA_LOC = DataLocations(
|
||||
class Hiveon(BMMiner):
|
||||
def __init__(self, ip: str, api_ver: str = "0.0.0") -> None:
|
||||
super().__init__(ip, api_ver)
|
||||
self.pwd = "admin"
|
||||
self.pwd = settings.get("default_hive_password", "admin")
|
||||
# static data
|
||||
self.api_type = "Hiveon"
|
||||
# data gathering locations
|
||||
|
||||
@@ -99,8 +99,6 @@ class BaseMiner(ABC):
|
||||
self.api = None
|
||||
self.web = None
|
||||
|
||||
self.ssh_pwd = "root"
|
||||
|
||||
# static data
|
||||
self.ip = ip
|
||||
self.api_type = None
|
||||
@@ -165,7 +163,6 @@ class BaseMiner(ABC):
|
||||
|
||||
@pwd.setter
|
||||
def pwd(self, val):
|
||||
self.ssh_pwd = val
|
||||
try:
|
||||
if self.web is not None:
|
||||
self.web.pwd = val
|
||||
@@ -202,7 +199,7 @@ class BaseMiner(ABC):
|
||||
str(self.ip),
|
||||
known_hosts=None,
|
||||
username="root",
|
||||
password=self.ssh_pwd,
|
||||
password=self.pwd,
|
||||
server_host_key_algs=["ssh-rsa"],
|
||||
)
|
||||
return conn
|
||||
|
||||
@@ -32,7 +32,7 @@ class BaseMinerRPCAPI:
|
||||
# ip address of the miner
|
||||
self.ip = ipaddress.ip_address(ip)
|
||||
|
||||
self.pwd = "admin"
|
||||
self.pwd = None
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
if cls is BaseMinerRPCAPI:
|
||||
|
||||
@@ -34,6 +34,7 @@ _settings = { # defaults
|
||||
"default_bosminer_password": "root",
|
||||
"default_vnish_password": "admin",
|
||||
"default_goldshell_password": "123456789",
|
||||
"default_hive_password": "admin",
|
||||
"socket_linger_time": 1000,
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class BaseWebAPI(ABC):
|
||||
# ip address of the miner
|
||||
self.ip = ip # ipaddress.ip_address(ip)
|
||||
self.username = "root"
|
||||
self.pwd = "root"
|
||||
self.pwd = None
|
||||
self.port = 80
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user