Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9c7fbd1

Browse files
committed
Minor refactoring
1 parent 3beb1ae commit 9c7fbd1

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

lib/core/enums.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ class PROXY_TYPE:
140140
SOCKS4 = "SOCKS4"
141141
SOCKS5 = "SOCKS5"
142142

143+
class REGISTRY_OPERATION:
144+
READ = "read"
145+
ADD = "add"
146+
DELETE = "delete"
147+
143148
class DUMP_FORMAT:
144149
CSV = "CSV"
145150
HTML = "HTML"

lib/takeover/registry.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from lib.core.common import randomStr
1111
from lib.core.data import conf
1212
from lib.core.data import logger
13+
from lib.core.enums import REGISTRY_OPERATION
1314

1415
class Registry:
1516
"""
@@ -49,11 +50,11 @@ def _initVars(self, regKey, regValue, regType=None, regData=None, parse=False):
4950
def _createLocalBatchFile(self):
5051
self._batPathFp = open(self._batPathLocal, "w")
5152

52-
if self._operation == "read":
53+
if self._operation == REGISTRY_OPERATION.READ:
5354
lines = self._batRead
54-
elif self._operation == "add":
55+
elif self._operation == REGISTRY_OPERATION.ADD:
5556
lines = self._batAdd
56-
elif self._operation == "delete":
57+
elif self._operation == REGISTRY_OPERATION.DELETE:
5758
lines = self._batDel
5859

5960
for line in lines:
@@ -70,7 +71,7 @@ def _createRemoteBatchFile(self):
7071
os.unlink(self._batPathLocal)
7172

7273
def readRegKey(self, regKey, regValue, parse=False):
73-
self._operation = "read"
74+
self._operation = REGISTRY_OPERATION.READ
7475

7576
Registry._initVars(self, regKey, regValue, parse=parse)
7677
self._createRemoteBatchFile()
@@ -90,7 +91,7 @@ def readRegKey(self, regKey, regValue, parse=False):
9091
return data
9192

9293
def addRegKey(self, regKey, regValue, regType, regData):
93-
self._operation = "add"
94+
self._operation = REGISTRY_OPERATION.ADD
9495

9596
Registry._initVars(self, regKey, regValue, regType, regData)
9697
self._createRemoteBatchFile()
@@ -103,7 +104,7 @@ def addRegKey(self, regKey, regValue, regType, regData):
103104
self.delRemoteFile(self._batPathRemote)
104105

105106
def delRegKey(self, regKey, regValue):
106-
self._operation = "delete"
107+
self._operation = REGISTRY_OPERATION.DELETE
107108

108109
Registry._initVars(self, regKey, regValue)
109110
self._createRemoteBatchFile()

0 commit comments

Comments
 (0)