Skip to content
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

[Uncategorized] Web(e.g. HTTPS) fail-over simulation #94

Open
gnh1201 opened this issue Nov 30, 2023 · 2 comments
Open

[Uncategorized] Web(e.g. HTTPS) fail-over simulation #94

gnh1201 opened this issue Nov 30, 2023 · 2 comments
Labels
commercial For customers with a willingness to pay investigating We're investigating this issue native Native environment with C++ or C# priority:low Don't worry topic:disaster_recovery A topic related to the disaster simulation and recovery

Comments

@gnh1201
Copy link
Owner

gnh1201 commented Nov 30, 2023

Summary

Recently, a request came in from a company with prior experience in adopting WelsonJS, expressing the desire to create a tool for web fail-over simulation (e.g., simulating HTTPS connection failures). They mentioned having used the Windivert library alongside WelsonJS before, suggesting that it should be possible to utilize these components to develop a fail-over simulator. I am currently looking into this issue.

Keywords: High Availablity, Disaster Recovery, Emergency Response Training

@gnh1201 gnh1201 added commercial For customers with a willingness to pay investigating We're investigating this issue labels Nov 30, 2023
@gnh1201
Copy link
Owner Author

gnh1201 commented Nov 30, 2023

I queried ChatGPT for details on this issue and was able to obtain the example code using pydivert as follows:

import pydivert

def is_port_443(packet):
    # Implement the logic to check if the destination port is 443
    # For example, check the TCP header in the packet
    return True

def modify_packet(packet):
    # Modify the packet to send a fake "Bad Request" response
    fake_response = "HTTP/1.1 400 Bad Request\r\nContent-Type: text/plain\r\n\r\nBad Request"

    response_bytes = bytes(fake_response, 'utf-8')

    # Replace the original payload with the fake response
    packet.payload = response_bytes

def main():
    with pydivert.WinDivert("tcp.DstPort == 443 or tcp.SrcPort == 443") as w:
        print("Intercepting traffic on port 443...")

        for packet in w:
            if is_port_443(packet):
                modify_packet(packet)
                w.send(packet)
                print("Sent fake 'Bad Request' response to port 443.")
            else:
                w.send(packet)

if __name__ == "__main__":
    main()

I will review this code snippet.

@gnh1201 gnh1201 added the priority:low Don't worry label Dec 11, 2023
@gnh1201 gnh1201 changed the title [Unknown] Web(e.g. HTTPS) fail-over simulation [Uncategorized] Web(e.g. HTTPS) fail-over simulation Dec 21, 2023
@gnh1201 gnh1201 added the native Native environment with C++ or C# label Dec 21, 2023
@gnh1201 gnh1201 added the topic:disaster_recovery A topic related to the disaster simulation and recovery label Jan 30, 2024
@gnh1201
Copy link
Owner Author

gnh1201 commented Oct 17, 2024

Recently, I came across an interesting implementation related to WFP (Windows Filtering Platform). I will try it out soon if I get the chance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
commercial For customers with a willingness to pay investigating We're investigating this issue native Native environment with C++ or C# priority:low Don't worry topic:disaster_recovery A topic related to the disaster simulation and recovery
Projects
None yet
Development

No branches or pull requests

1 participant