Created
May 7, 2024 19:16
-
-
Save lewiwiii/ec5a166c9ce2c5fb80ba63c98c880a4a to your computer and use it in GitHub Desktop.
[W.I.P.] Python script using scapy that will automatically run the PPPwn exploit every time the console sends PADI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scapy.all import sniff, PPPoED | |
import threading | |
import subprocess | |
def packet_listener(): | |
print("Starting packet listener on interface eth0...") | |
def handle_packet(packet): | |
print("Packet detected. Checking for PADI packets...") | |
# Check if it's a PADI packet (code 0x09 for PPPoE Discovery Initiation) | |
if PPPoED in packet and packet[PPPoED].code == 0x09: | |
print("PADI packet detected. Triggering script...") | |
trigger_script() | |
else: | |
print("Packet is not a PADI packet. Ignoring...") | |
# Listen for PPPoE Discovery traffic specifically on eth0 | |
sniff(iface="eth0", filter="ether proto 0x8863", prn=handle_packet) | |
def trigger_script(): | |
try: | |
print("Executing the second script...") | |
# Start the script and capture output | |
process = subprocess.Popen(["sudo", "python3", "pppwn.py", "--interface=eth0", "--fw=1100"], | |
stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) | |
# Monitor output line by line | |
while True: | |
output = process.stdout.readline() | |
if output == '': | |
if process.poll() is not None: | |
break | |
if output: | |
cleaned_output = output.strip() | |
print(f"Script output: {cleaned_output}") | |
# Check for specific outputs to terminate the script | |
if "[-] Scanning for corrupted object...failed. Please retry." in cleaned_output or \ | |
"[+] Done!" in cleaned_output: | |
print("Detected termination condition in script output.") | |
process.terminate() | |
print("Script terminated. Restarting...") | |
break | |
# Recursive call to restart the script | |
trigger_script() | |
except Exception as e: | |
print(f"An error occurred while running the script: {e}") | |
def main(): | |
listener_thread = threading.Thread(target=packet_listener) | |
listener_thread.start() | |
listener_thread.join() # This will wait for the thread to complete, which it won't under normal operation | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Still has a lot of room for improvement, suggestions are open.
Credits to RzareCTHa on the GoldHEN Discord server for helping me make this into a real thing.