Skip to content

Latest commit

 

History

History
132 lines (85 loc) · 3.13 KB

README.md

File metadata and controls

132 lines (85 loc) · 3.13 KB

DNS Amplification Script

This script creates and sends spoofed DNS queries to DNS servers, aiming to amplify requests to a target IP address. It is intended for educational purposes and network diagnostics.


📋 Features

  • Constructs a DNS query for a given domain.
  • Sends the DNS query to a specified DNS server.
  • Spoofs the source IP to amplify the DNS response to a target IP address.
  • Validates IP addresses.
  • Handles socket timeouts and errors.
  • Logs activities and errors to a log file.

📦 Prerequisites

  • Python 3.x

🚀 Usage

  1. Clone the repository or download the script:

    git clone https://github.com/thekogami/gilgamesh.git
    cd gilgamesh
  2. Ensure you have Python 3.x installed on your machine.

  3. Modify the variables in the script as needed:

    • target_ip: The target IP address.
    • dns_server: The DNS server address.
    • domain: The domain to query.
  4. Run the script with the following command:

    sudo python main.py

📝 Code Overview

create_dns_query(domain)

This function constructs a DNS query for a given domain.

Parameters:

  • domain (str): The domain name to query.

Returns:

  • bytes: The constructed DNS query.

is_valid_ip(ip)

This function checks if a given IP address is valid.

Parameters:

  • ip (str): The IP address to validate.

Returns:

  • bool: True if the IP address is valid, False otherwise.

send_amplified_request(target_ip, dns_server, domain)

This function sends a DNS query to a DNS server and spoofs the response to a target IP.

Parameters:

  • target_ip (str): The IP address of the target.
  • dns_server (str): The IP address of the DNS server.
  • domain (str): The domain name to query.

Exceptions:

  • Handles socket timeouts, general socket errors, and other exceptions.

🛠 Example

if __name__ == "__main__":
    import logging

    logging.basicConfig(
        level=logging.INFO,
        filename='dns.log',
        filemode='a',
        format='%(asctime)s - %(levelname)s - %(message)s'
    )

    target_ip = "192.0.2.1"  # IP address of the target
    dns_server = "8.8.8.8"  # Public DNS server (Google DNS)
    domain = "example.com"  # Domain to query

    send_amplified_request(target_ip, dns_server, domain)

⚠️ Important Notes

  • Ethical Use: Ensure the code is used for legitimate purposes, such as network diagnostics or educational purposes.
  • Security Concerns: Be aware that misuse of this script can lead to DNS amplification attacks, which are illegal and unethical.

📜 License

This project is licensed under the MIT License. See the LICENSE file for details.


🤝 Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.


📬 Contact

For any questions or concerns, please open an issue in the repository.


⚠️ Disclaimer

This script is intended for educational purposes only. The author is not responsible for any misuse of this script.