Commit graph

66 commits

Author SHA1 Message Date
Meitar M
bee1a38d05
Port original pyminifakedns, circa 2006, to Python 3.
This commit completes porting the internals of the MiniFakeDNS server
class to Python 3. This primarily means converting the Python 2 `str`
types to Python 3's `bytes` objects.

In the process, I've also translated the variable names from their
original Spanish into English, and added explanatory comments for how
the DNS header parsing is accomplished to enhance the educational
potential of SET.

Another small change is the addition of a new core helper function,
`detect_public_ip()`, which makes a couple parts of the codebase a
little more DRY by reducing code duplication across the `set.py` and
`setcore.py` files. This change also makes it possible to parameterize
the IP address that MiniFakeDNS server responds to requests with.
2020-03-14 02:18:18 -04:00
Meitar M
3a2ba0a500
Move the DNS server into its own module. Refactor how to call to it.
This is a relatively large commit because it refactors SET's interface
to the build-in DNS server it runs. Instead of a block of code inside of
the `setcore.py` file, a new module called `minifakedns` is added, which
houses all of the DNS-related code. Note that this commit *only*
refactors the DNS interface and its internals, it does not actually fix
the exception caused by receiving some DNS query, nor does it complete
the work required to set parameters for the DNS server, such as which IP
address it should respond with. It is just intended to make these
changes easier to introduce moving forward in upcoming chunks of work.

This replaces the `core.start_dns()` function with a new helper, whose
full path is `src.core.minifakedns.start_dns_server()`.

The previous implementation assumed the DNS server would be run from the
main thread, and thus have access to SIGINT, but this was never actually
possible because a `KeyboardInterrupt` was actually intercepted by SET
itself, before the DNS server code ever got to see it. This means that
the DNS server would never shut down cleanly.

This implementation changes that by using a simplistic sentinel value
(called `stop_flag`) that can be set as an instance attribute on the new
`MiniFakeDNS` object. When the sentinel value is `True`, the DNS server
thread will exit its listening loop.

Another change this introduces is the fact that, due to this new design,
the DNS server stops when `core.cleanup_routine()` is run. And, as a
note about that, this was running twice, once upon *startup* rather than
when SET shut down. This looked like a bug to me, and it was causing
problems for this DNS server design, so I removed that extra call and
performed some simplistic tests of various SET functionality to make
sure everything still works. (It seems fine, but might warrant a second
look.)

Finally, note that this commit breaks Python 2 compatibility due to the
use of a context manager handling the UDP socket. Given that the DNS
server was not really functional for some period of time before I
started looking at it more closely, the fact that Python 2 is officially
end-of-life'd (as of January 2020), the relative complexity of writing a
Python 2 and Python 3 implementation, and the fact that many comments
elsewhere in the SET codebase all seem to be nudging towards a Python 3
compatible upgrade, I am choosing to drop support for Python 2 in my own
patches, unless there is some considerable objection.
2020-03-12 19:25:28 -04:00
David Kennedy
55ba216a71 fix python3 raw input 2020-02-03 19:58:42 -05:00
TrustedSec
8777ff9f20 fix sudo check 2019-02-23 16:18:18 -05:00
TrustedSec
870b79b614 fix test code 2018-07-29 12:36:45 -04:00
TrustedSec
4e2af996b9 bump to 7.7.9 with fixes 2018-07-28 11:46:42 -04:00
Brigham Toskin
0672c2746b Fixes for path handling, especially user config dir. 2018-02-01 10:36:21 -08:00
TrustedSec
f20e770813 update derbycon stuff 2017-07-22 17:09:48 -04:00
TrustedSec
c275b58d85 turn off deploy binaries as a default option - move purely to powershell 2017-07-10 14:05:42 -04:00
TrustedSec
bc227508c9 update user agent string 2017-05-28 01:11:01 -04:00
TrustedSec
c489d9cc94 update setoolkit 2017-02-06 10:36:25 -05:00
TrustedSec
d296826a04 up the config and version numbers 2017-01-31 16:24:28 -05:00
TrustedSec
1eb57eeda7 turn apache server to off by default and use internal library 2017-01-31 15:58:35 -05:00
TrustedSec
abd935679f this fixes a psexec issue within SET 2016-08-02 18:28:39 -04:00
Ryan Jarvis
6315fbc1b7 Updated {} to {0} 2016-07-28 16:16:24 -07:00
Ryan Jarvis
7f1bba07b9 PEP8 and python3 changes for root files 2016-07-28 13:19:04 -07:00
TrustedSec
1319048ade fix setdir error with python3 conversion 2016-07-28 09:32:43 -04:00
trustedsec
7422fcf04f Merge pull request #250 from Cabalist/master
Code Review
2016-07-28 09:31:14 -04:00
Ryan Jarvis
1e4b95f102 PEP8 and python3 changes 2016-07-22 09:52:36 -07:00
TrustedSec
47905020a9 setup cleanup 2016-07-21 07:23:56 -04:00
TrustedSec
3571b2fecb some minor code cleanup 2016-07-21 05:35:25 -04:00
TrustedSec
bef8ce8eb0 fixes for autopep8 and python3 compatibility 2016-06-27 10:30:11 -04:00
TrustedSec
93ec005895 update config baseline option 2016-06-26 20:08:52 -04:00
TrustedSec
f2950bd43f add funny stuff cavs easter egg 2016-06-25 17:16:27 -04:00
TrustedSec
661919bd48 remove comment code on exception handling 2016-02-15 09:59:08 -05:00
TrustedSec
a8fcbcdfa9 fix issue where set.config was not properly created before launch 2016-02-15 09:58:38 -05:00
TrustedSec
fe7a258c39 uncomment section 2016-02-15 09:25:36 -05:00
TrustedSec
de3b9b35d8 fix menu system for import 2016-02-15 09:24:31 -05:00
TrustedSec
79c921edf2 fix module reload 2016-02-15 09:16:19 -05:00
TrustedSec
f619a78c77 remove bleeding edge check and fix python3 format issue 2016-02-12 17:04:57 -05:00
TrustedSec
3b34b956d4 Update release for SET v7.0 and bug fixes 2016-02-03 03:00:43 -05:00
TrustedSec
8896a7cb48 Merge branch 'master' of https://github.com/trustedsec/social-engineer-toolkit
Conflicts:
	src/html/Signed_Update.jar.orig
	src/html/unsigned/unsigned.jar
2016-01-24 20:24:43 -05:00
TrustedSec
e09fff9826 fix issues in web cloner 2016-01-24 20:23:04 -05:00
TrustedSec
c6d2440d10 Merge branch 'master' of https://github.com/trustedsec/social-engineer-toolkit
Conflicts:
	setoolkit
	src/fasttrack/mssql.py
	src/webattack/web_clone/cloner.py
2016-01-23 19:17:16 -05:00
TrustedSec
a73bea73dc additional fixes to alphanumeric shellcode generation 2016-01-23 18:37:45 -05:00
TrustedSec
a890faafa6 fix alphanumeric python3 generation 2016-01-23 17:30:49 -05:00
TrustedSec
d5740c9067 pep8 and python3 refactoring 2016-01-14 15:52:38 -05:00
TrustedSec
cc1e2a4295 pep8 and python3 refactoring 2016-01-14 15:50:06 -05:00
TrustedSec
3518f68179 pep8 and python3 compliance omfg 2016-01-13 18:17:55 -05:00
TrustedSec
d027a44998 Added python3 compliance to setoolkit 2016-01-12 22:29:04 -05:00
TrustedSec
283477cea8 Update config in etc config 2016-01-07 13:31:38 -05:00
root
4150862cf3 add detection for git 2015-12-08 11:16:50 -05:00
TrustedSec
f02eeda55f Update SET update for Kali warn instead of instsall 2015-10-15 08:04:02 -04:00
root
69176e6e8b Multiple bug fixes and added automatic checkout for Kali 2015-10-15 06:13:18 -04:00
TrustedSec
16fc348a10 updated to proper python path 2015-07-28 22:24:53 -04:00
TrustedSec
6a4d051703 Update to 6.4 2015-07-10 14:31:40 -04:00
TrustedSec
f59eb054bc SET 6.4 release 2015-07-10 14:30:10 -04:00
TrustedSec
f7aec00d87 SET v6.4 2015-07-10 14:29:08 -04:00
fnk0c
b83bb4ad8d identation error on setoolkit 2015-05-24 19:24:50 -03:00
fnk0c
4fdeb8974f setup.py support Arch Linux ; Python3 (most) and identation errors on setoolkit and setcore.py 2015-05-24 19:02:03 -03:00