-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Windows Support and Installer for Examples #1907
base: master
Are you sure you want to change the base?
Conversation
…n to relay for redirection
…ter done + Print notification about redirecting ports
Update Npcap Module Update Npcap Module Update Update Update Sniff.py to prompt user to install npcap Update Update Setup & Installer Update Update Update sniff requirements Update installer for modules Update split.py Move imports in split.py
Patch Readline Patch Readline Patch Readline Patch Readline
Hey, grouping changes in this PR to discuss about them one by one... pyreadline3Yep, this is a needed workaround for these examples to run on Windows. At least until pydivertI see the need of the redirection when runnning smb relay server in windows, but I wouldn't include redirection functionality out of the box in Impacket. ps1 installer & npcapAs talked in #1871 I agree with @anadrianmanrique that the building examples infrastructure is a bit out of scope of Impacket. But, after merging pyreadline3 workaround, I guess the project will be in a status in which it will help running that infrastructure as a different project for everyone needing it. Thoughts? Comments? |
I can take a look at the pyreadline3 issue on a more global sense if you'd prefer. To my understanding, the property is accessed by the Cmd class that is wrapped by all the other shells, patching the Cmd class is not possible since it is not part of Impacket. You have to import pyreadline3 before Cmd does, and then add the missing property, Since the examples are separate you have to do this for each one. It would however be possible to deduplicate the code a bit by adding another intermediate shell class that wraps Cmd and which would be wrapped by all the other shells which simply patches the property and then does everything else normally. This would still have to be swapped out for each shell though, as far as I know there is no simple "set it once" approach possible here. Regarding pydivert, there's not a lot of viable options to have SMB redirection when running on windows. Even when it comes to 3rd party support options. Since port 445 is bound by the kernel, you either have to redirect the packets, or use a driver. There are environments where that might not be easy or possible at all. If you are willing to consider having support for windows across the Impacket examples (which I feel is advantageous to a lot of people out there) then I think this is a key component. The installer can be ignored, I'm happy to leave that as a script in my fork that can pull from this one, and I can see why you might not want to include Npcap as well, perhaps just a check and warning line stating that it's required for functionality on Windows would be a solution? The goal here is to allow a consultant the ability to do testing and research from a Windows device. Sometimes there are no alternatives on engagements. Having tested my builds in engagements recently, I can confirm they are working as intended. Merging as many of the changes as possible back upstream and maintaining some kind of build script separately would be the ideal outcome for me. |
Hi @p0rtL6, The issue with the pydivert addition we see (besides adding a new dependency to the lib, which could be minor), is that we are giving too much responsibility to Impacket in deciding how to handle this scenario. So in order to move forward with this one.. win-building script and npcap should be excluded as well as pydivert processing Does it make sense? |
I understand what you are saying about pydivert. If the issue is the lack of user control, it would be possible to add something like a If this is still not wanted, I can strip down the changes to just the pyreadline patch, and then open a new pull request. In addition, the |
Hey, yes, let's go that path... leave the pyreadline patches so we can move forward with this Related to Thanks! |
Ok, I have opened a pull request with just the patches for pyreadline3 so they can be merged separately. As for the Edit: I am unsure based on your last comment what you want to be done with the pydivert changes, are they confirmed to be closed out, or do you want me to make the changes I suggested to the functionality? If they are going to be closed out, I should just be able to close this entire PR after dealing with the readline and pcapy issues. |
This branch contains modifications to make Impacket examples work on Windows as well as adding a helpful installer to build examples into standalone binaries. This is a continuation of the previously closed in #1871.
A few changes to make the examples work on Windows:
It was previously indicated that the Powershell installer was not really wanted for this project, everything related to the installer should now be included in just the
impacket-installer.ps1
file. This can simply be removed.If merged, the README will need to be updated.