-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fc74f61
commit 04fc0fe
Showing
2 changed files
with
51 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,61 @@ | ||
import configparser | ||
import os | ||
|
||
class Configuration: | ||
config | ||
path | ||
config = None | ||
path = None | ||
|
||
dnsQueryTimeout = ("Discovery", "DnsQueryTimeout") | ||
similarResponses = ("Discovery", "SimilarResp") | ||
noOfHosts = ("Discovery", "NumberOfHosts") | ||
poisonType = ("Poisoning", "PoisonType") | ||
replaceIP = ("Poisoning", "ReplaceIP") | ||
|
||
def __init__(): | ||
path = os.path.dirname(__file__) + "../AdBleed.conf" | ||
config = configparser.ConfigParser() | ||
config.read(path) | ||
|
||
def set(section, variable, value): | ||
config.set(section, variable, value) | ||
with open(path, "wb") as file: | ||
config.write(file) | ||
|
||
def get(section, variable): | ||
return config.get(section, variable) | ||
def __init__(self): | ||
self.path = os.path.dirname(__file__) + "/../AdBleed.conf" | ||
self.config = configparser.ConfigParser() | ||
self.config.read(self.path) | ||
|
||
def setConf(self, section, variable, value): | ||
self.config.set(section, variable, value) | ||
with open(self.path, "wb") as file: | ||
self.config.write(file) | ||
|
||
def getConf(self, section, variable): | ||
return self.config.get(section, variable) | ||
|
||
# -------------------- | ||
# |------------------| | ||
# | Specific get/set | | ||
# -------------------- | ||
def setDNSQueryTimeout(value): | ||
set(dnsQueryTimeout[0], dnsQueryTimeout[1], value) | ||
|
||
def getDNSQueryTimeout(): | ||
return get(dnsQueryTimeout[0], dnsQueryTimeout[1]) | ||
# |------------------| | ||
def setDNSQueryTimeout(self, value): | ||
self.setConf(self.dnsQueryTimeout[0], self.dnsQueryTimeout[1], str.encode(value)) | ||
|
||
def setPoisonType(value): | ||
set(poisonType[0], poisonType[1], value) | ||
|
||
def getPoisonType(): | ||
return get(poisonType[0], poisonType[1]) | ||
def getDNSQueryTimeout(self): | ||
return int(self.getConf(self.dnsQueryTimeout[0], self.dnsQueryTimeout[1])) | ||
|
||
def setPoisonType(self, value): | ||
self.setConf(self.poisonType[0], self.poisonType[1], str.encode(value)) | ||
|
||
def getPoisonType(self): | ||
return self.getConf(self.poisonType[0], self.poisonType[1]) | ||
|
||
def setReplaceIP(self, value): | ||
sel.fsetConf(self.replaceIP[0], self.replaceIP[1], str.encode(value)) | ||
|
||
def getReplaceIP(self): | ||
return self.getConf(self.replaceIP[0], self.replaceIP[1]) | ||
|
||
def setReplaceIP(value): | ||
set(replaceIP[0], replaceIP[1], value) | ||
def setSimilarResponses(self, value): | ||
self.setConf(self.similarResponses[0], self.similarResponses[1], str.encode(value)) | ||
|
||
def getReplaceIP(): | ||
return get(replaceIP[0], replaceIP[1]) | ||
def getSimilarResponses(self): | ||
return int(self.getConf(self.similarResponses[0], self.similarResponses[1])) | ||
|
||
def setNumberOfHosts(self, value): | ||
self.setConf(self.noOfHosts[0], self.noOfHosts[1], str.encode(value)) | ||
|
||
def getNumberOfHosts(self): | ||
return int(self.getConf(self.noOfHosts[0], self.noOfHosts[1])) | ||
|
||
pass | ||
|