localhost에서 apache2를 실행 중이고 localhost에서 http 요청을 가로 채서 수정하려고합니다. 수정하여 헤더의 Accept-Encoding 속성을 'identity'로 변경하고 싶습니다. Burp-Suite를 사용하면 잘 작동합니다. 그러나, 내 scapy 스크립트를 사용하여 HTTP 응답이 여전히 인코딩되어 있기 때문에 패킷이 이미 보낸 것 같습니다.Python Scapy - 로컬 호스트에서 http 패킷을 가로 채고 수정합니다.
scapy 스크립트 :
from scapy.all import *
def intercept(pkt):
if pkt.haslayer(Raw):
http_content = pkt.getlayer(Raw).load
http_content = http_content.replace("Accept-Encoding: gzip, deflate", "Accept-Encoding: identity")
pkt[Raw].load = http_content
print pkt.show()
send(pkt)
def main():
sniff(iface='lo', filter='tcp port 80', prn=intercept)
if __name__ == '__main__':
main()
이것은 내가 응답으로 돌아갈 것입니다 : 인코딩
<skipped>
###[ Raw ]###
load = 'HTTP/1.1 200 OK\r\nDate: Thu, 11 Aug 2016 09:34:38 GMT\r\nServer: Apache/2.4.23 (Debian)\r\nLast-Modified: Thu, 11 Aug 2016 09:34:25 GMT\r\nETag: "7d-539c878b8f8fd-gzip"\r\nAccept-Ranges: bytes\r\nVary: Accept-Encoding\r\nContent-Encoding: gzip\r\nContent-Length: 103\r\nConnection: close\r\nContent-Type: text/html\r\n\r\n\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\x03\xb3\xc9(\xc9\xcd\xb1\xe3\xb2\xc9HML\xb1\xe3RPP\xb0)\xc9,\xc9I\xb5\xf3H\xcd\xc9\xc9W\x08\xcf/\xcaI\xb1\xd1\x87\x08q\xd9\xe8CT\xd9$\xe5\xa7TB\x14g\x18!\xabT\x04\xaa0\x82H\[email protected]\xc5\x13\xd3\x133\xf3\xf4\xf4\xf4l\xf4\[email protected]\[email protected]\x02\x95\x81m\x05\x00\x1c\x95F\x1d}\x00\x00\x00'
.
누군가 도움을 줄 수 있습니까?
Burp-Suite는 프록시이며, scapy는 아닙니다. localhost는 네트워크 지연이없는 매우 특별한 인터페이스입니다. 가로 채기 및 재생은 localhost에서 작동하지 않습니다 (대부분의 경우). – grochmal