|
77 | 77 | from lib.core.exception import sqlmapUnsupportedDBMSException |
78 | 78 | from lib.core.exception import sqlmapUserQuitException |
79 | 79 | from lib.core.optiondict import optDict |
| 80 | +from lib.request.dns import DNSServer |
80 | 81 | from lib.core.settings import CODECS_LIST_PAGE |
81 | 82 | from lib.core.settings import DEFAULT_GET_POST_DELIMITER |
82 | 83 | from lib.core.settings import DEFAULT_PAGE_ENCODING |
@@ -581,7 +582,7 @@ def __setMetasploit(): |
581 | 582 | if conf.osSmb: |
582 | 583 | isAdmin = runningAsAdmin() |
583 | 584 |
|
584 | | - if isAdmin is not True: |
| 585 | + if not isAdmin: |
585 | 586 | errMsg = "you need to run sqlmap as an administrator " |
586 | 587 | errMsg += "if you want to perform a SMB relay attack because " |
587 | 588 | errMsg += "it will need to listen on a user-specified SMB " |
@@ -1380,6 +1381,7 @@ def __setConfAttributes(): |
1380 | 1381 | conf.cj = None |
1381 | 1382 | conf.dbmsConnector = None |
1382 | 1383 | conf.dbmsHandler = None |
| 1384 | + conf.dnsServer = None |
1383 | 1385 | conf.dumpPath = None |
1384 | 1386 | conf.hashDB = None |
1385 | 1387 | conf.hashDBFile = None |
@@ -1711,6 +1713,25 @@ def __setTrafficOutputFP(): |
1711 | 1713 |
|
1712 | 1714 | conf.trafficFP = openFile(conf.trafficFile, "w+") |
1713 | 1715 |
|
| 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 | + |
1714 | 1735 | def __setTorProxySettings(): |
1715 | 1736 | if not conf.tor: |
1716 | 1737 | return |
@@ -1919,6 +1940,7 @@ def init(inputOptions=AttribDict(), overrideOptions=False): |
1919 | 1940 | __checkDependencies() |
1920 | 1941 | __basicOptionValidation() |
1921 | 1942 | __setTorProxySettings() |
| 1943 | + __setDNSServer() |
1922 | 1944 | __adjustLoggingFormatter() |
1923 | 1945 | __setMultipleTargets() |
1924 | 1946 | __setTamperingFunctions() |
|
0 commit comments