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

Skip to content

Commit f7a664b

Browse files
committed
enablind DNS server for DNS data exfiltration
1 parent 8be9cd4 commit f7a664b

3 files changed

Lines changed: 25 additions & 3 deletions

File tree

_sqlmap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,5 +126,5 @@ def main():
126126
dumper.flush()
127127

128128
# Reference: http://stackoverflow.com/questions/1635080/terminate-a-multi-thread-python-program
129-
if hasattr(conf, "threads") and conf.threads > 1:
129+
if conf.get("threads", 0) > 1 or conf.get("dnsServer", None):
130130
os._exit(0)

lib/core/option.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
from lib.core.exception import sqlmapUnsupportedDBMSException
7878
from lib.core.exception import sqlmapUserQuitException
7979
from lib.core.optiondict import optDict
80+
from lib.request.dns import DNSServer
8081
from lib.core.settings import CODECS_LIST_PAGE
8182
from lib.core.settings import DEFAULT_GET_POST_DELIMITER
8283
from lib.core.settings import DEFAULT_PAGE_ENCODING
@@ -581,7 +582,7 @@ def __setMetasploit():
581582
if conf.osSmb:
582583
isAdmin = runningAsAdmin()
583584

584-
if isAdmin is not True:
585+
if not isAdmin:
585586
errMsg = "you need to run sqlmap as an administrator "
586587
errMsg += "if you want to perform a SMB relay attack because "
587588
errMsg += "it will need to listen on a user-specified SMB "
@@ -1380,6 +1381,7 @@ def __setConfAttributes():
13801381
conf.cj = None
13811382
conf.dbmsConnector = None
13821383
conf.dbmsHandler = None
1384+
conf.dnsServer = None
13831385
conf.dumpPath = None
13841386
conf.hashDB = None
13851387
conf.hashDBFile = None
@@ -1711,6 +1713,25 @@ def __setTrafficOutputFP():
17111713

17121714
conf.trafficFP = openFile(conf.trafficFile, "w+")
17131715

1716+
def __setDNSServer():
1717+
if not conf.dnsDomain:
1718+
return
1719+
1720+
infoMsg = "making DNS server instance"
1721+
logger.info(infoMsg)
1722+
1723+
isAdmin = runningAsAdmin()
1724+
1725+
if isAdmin:
1726+
conf.dnsServer = DNSServer()
1727+
conf.dnsServer.run()
1728+
else:
1729+
errMsg = "you need to run sqlmap as an administrator "
1730+
errMsg += "if you want to perform a DNS data exfiltration attack "
1731+
errMsg += "as it will need to listen on privileged TCP port 53 "
1732+
errMsg += "for incoming address resolution attempts"
1733+
raise sqlmapMissingPrivileges, errMsg
1734+
17141735
def __setTorProxySettings():
17151736
if not conf.tor:
17161737
return
@@ -1919,6 +1940,7 @@ def init(inputOptions=AttribDict(), overrideOptions=False):
19191940
__checkDependencies()
19201941
__basicOptionValidation()
19211942
__setTorProxySettings()
1943+
__setDNSServer()
19221944
__adjustLoggingFormatter()
19231945
__setMultipleTargets()
19241946
__setTamperingFunctions()

plugins/generic/takeover.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def osPwn(self):
119119
if tunnel == 2:
120120
isAdmin = runningAsAdmin()
121121

122-
if isAdmin is not True:
122+
if not isAdmin:
123123
errMsg = "you need to run sqlmap as an administrator "
124124
errMsg += "if you want to establish an out-of-band ICMP "
125125
errMsg += "tunnel because icmpsh uses raw sockets to "

0 commit comments

Comments
 (0)